[go: up one dir, main page]

File: tonewconnectionui.cpp

package info (click to toggle)
tora 1.3.23-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 15,984 kB
  • ctags: 14,460
  • sloc: cpp: 123,554; sh: 16,181; makefile: 966; xml: 69
file content (208 lines) | stat: -rw-r--r-- 7,887 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/****************************************************************************
** Form implementation generated from reading ui file 'tonewconnectionui.ui'
**
** Created by: The User Interface Compiler ($Id: qt/main.cpp   3.3.6   edited Aug 31 2005 $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "tonewconnectionui.h"

#include <qvariant.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qcombobox.h>
#include <qspinbox.h>
#include <qbuttongroup.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include "toresultview.h"

/*
 *  Constructs a toNewConnectionUI as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
toNewConnectionUI::toNewConnectionUI( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "toNewConnectionUI" );
    toNewConnectionUILayout = new QGridLayout( this, 1, 1, 11, 6, "toNewConnectionUILayout"); 

    CancelButton = new QPushButton( this, "CancelButton" );
    CancelButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, CancelButton->sizePolicy().hasHeightForWidth() ) );

    toNewConnectionUILayout->addWidget( CancelButton, 13, 3 );

    OkButton = new QPushButton( this, "OkButton" );
    OkButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, OkButton->sizePolicy().hasHeightForWidth() ) );
    OkButton->setDefault( TRUE );

    toNewConnectionUILayout->addWidget( OkButton, 13, 2 );
    Spacer1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    toNewConnectionUILayout->addMultiCell( Spacer1, 13, 13, 0, 1 );

    Previous = new toListView( this, "Previous" );
    Previous->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, Previous->sizePolicy().hasHeightForWidth() ) );
    Previous->setFocusPolicy( toListView::StrongFocus );

    toNewConnectionUILayout->addMultiCellWidget( Previous, 1, 12, 0, 0 );

    TextLabel2 = new QLabel( this, "TextLabel2" );
    TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );

    toNewConnectionUILayout->addWidget( TextLabel2, 0, 0 );

    Password = new QLineEdit( this, "Password" );
    Password->setEchoMode( QLineEdit::Password );

    toNewConnectionUILayout->addMultiCellWidget( Password, 5, 5, 1, 3 );

    TextLabel1 = new QLabel( this, "TextLabel1" );
    TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );

    toNewConnectionUILayout->addMultiCellWidget( TextLabel1, 2, 2, 1, 3 );

    TextLabel1_2 = new QLabel( this, "TextLabel1_2" );
    TextLabel1_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)1, 0, 0, TextLabel1_2->sizePolicy().hasHeightForWidth() ) );

    toNewConnectionUILayout->addMultiCellWidget( TextLabel1_2, 4, 4, 1, 3 );

    Username = new QLineEdit( this, "Username" );

    toNewConnectionUILayout->addMultiCellWidget( Username, 3, 3, 1, 3 );

    ProviderLabel = new QLabel( this, "ProviderLabel" );

    toNewConnectionUILayout->addMultiCellWidget( ProviderLabel, 0, 0, 1, 3 );

    Provider = new QComboBox( FALSE, this, "Provider" );

    toNewConnectionUILayout->addMultiCellWidget( Provider, 1, 1, 1, 3 );

    Database = new QComboBox( FALSE, this, "Database" );
    Database->setEditable( TRUE );
    Database->setAutoCompletion( TRUE );
    Database->setDuplicatesEnabled( FALSE );

    toNewConnectionUILayout->addMultiCellWidget( Database, 10, 10, 1, 3 );

    TextLabel3 = new QLabel( this, "TextLabel3" );

    toNewConnectionUILayout->addMultiCellWidget( TextLabel3, 9, 9, 1, 3 );

    Host = new QComboBox( FALSE, this, "Host" );
    Host->setEditable( TRUE );
    Host->setAutoCompletion( TRUE );
    Host->setDuplicatesEnabled( FALSE );

    toNewConnectionUILayout->addMultiCellWidget( Host, 7, 7, 1, 3 );

    HostLabel = new QLabel( this, "HostLabel" );

    toNewConnectionUILayout->addMultiCellWidget( HostLabel, 6, 6, 1, 3 );

    PortLabel = new QLabel( this, "PortLabel" );

    toNewConnectionUILayout->addMultiCellWidget( PortLabel, 8, 8, 1, 2 );

    Port = new QSpinBox( this, "Port" );
    Port->setMaxValue( 65535 );

    toNewConnectionUILayout->addWidget( Port, 8, 3 );

    OptionGroup = new QButtonGroup( this, "OptionGroup" );
    OptionGroup->setFocusPolicy( QButtonGroup::StrongFocus );

    toNewConnectionUILayout->addMultiCellWidget( OptionGroup, 11, 11, 1, 3 );
    Spacer3 = new QSpacerItem( 20, 30, QSizePolicy::Minimum, QSizePolicy::Expanding );
    toNewConnectionUILayout->addItem( Spacer3, 12, 1 );
    languageChange();
    resize( QSize(654, 424).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( OkButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
    connect( CancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
    connect( Provider, SIGNAL( activated(int) ), this, SLOT( changeProvider() ) );
    connect( Host, SIGNAL( textChanged(const QString&) ), this, SLOT( changeHost() ) );

    // tab order
    setTabOrder( Provider, Username );
    setTabOrder( Username, Password );
    setTabOrder( Password, Host );
    setTabOrder( Host, Port );
    setTabOrder( Port, Database );
    setTabOrder( Database, OptionGroup );
    setTabOrder( OptionGroup, OkButton );
    setTabOrder( OkButton, CancelButton );
    setTabOrder( CancelButton, Previous );

    // buddies
    TextLabel2->setBuddy( Previous );
    TextLabel1->setBuddy( Username );
    TextLabel1_2->setBuddy( Password );
    ProviderLabel->setBuddy( Provider );
    TextLabel3->setBuddy( Database );
    HostLabel->setBuddy( Host );
    PortLabel->setBuddy( Host );
}

/*
 *  Destroys the object and frees any allocated resources
 */
toNewConnectionUI::~toNewConnectionUI()
{
    // no need to delete child widgets, Qt does it all for us
}

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void toNewConnectionUI::languageChange()
{
    setCaption( tr( "New connection" ) );
    CancelButton->setText( tr( "Cancel" ) );
    OkButton->setText( tr( "&Ok" ) );
    TextLabel2->setText( tr( "&Previous connections" ) );
    QToolTip::add( TextLabel2, tr( "A list of previous connections. Select to bring over to the right." ) );
    TextLabel1->setText( tr( "&Username" ) );
    QToolTip::add( TextLabel1, tr( "Username to connect with" ) );
    TextLabel1_2->setText( tr( "&Password" ) );
    QToolTip::add( TextLabel1_2, tr( "Password to connect with." ) );
    ProviderLabel->setText( tr( "Connection provider" ) );
    TextLabel3->setText( tr( "&Database" ) );
    QToolTip::add( TextLabel3, tr( "Select the database ID to connect to." ) );
    HostLabel->setText( tr( "&Host" ) );
    QToolTip::add( HostLabel, tr( "Select the database ID to connect to." ) );
    PortLabel->setText( tr( "&Port" ) );
    QToolTip::add( PortLabel, tr( "Select the database ID to connect to." ) );
    OptionGroup->setTitle( tr( "Options" ) );
}

void toNewConnectionUI::changeHost()
{
    qWarning( "toNewConnectionUI::changeHost(): Not implemented yet" );
}

void toNewConnectionUI::changeProvider()
{
    qWarning( "toNewConnectionUI::changeProvider(): Not implemented yet" );
}

void toNewConnectionUI::historySelection()
{
    qWarning( "toNewConnectionUI::historySelection(): Not implemented yet" );
}

void toNewConnectionUI::historyConnect()
{
    qWarning( "toNewConnectionUI::historyConnect(): Not implemented yet" );
}