File: kbsproxydialog.cpp

package info (click to toggle)
kboincspy 0.9.1-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 12,880 kB
  • ctags: 3,964
  • sloc: cpp: 29,018; sh: 9,736; perl: 2,793; makefile: 472; xml: 119
file content (254 lines) | stat: -rw-r--r-- 11,591 bytes parent folder | download | duplicates (2)
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
#include <kdialog.h>
#include <klocale.h>
/****************************************************************************
** Form implementation generated from reading ui file './kbsproxydialog.ui'
**
** Created: Mon Feb 6 18:28:49 2006
**      by: The User Interface Compiler ($Id: qt/main.cpp   3.3.4   edited Nov 24 2003 $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "kbsproxydialog.h"

#include <qvariant.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qtabwidget.h>
#include <qwidget.h>
#include <qcheckbox.h>
#include <qframe.h>
#include <klineedit.h>
#include <qgroupbox.h>
#include <kpassdlg.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>

/*
 *  Constructs a KBSProxyDialog 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.
 */
KBSProxyDialog::KBSProxyDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "KBSProxyDialog" );
    setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, sizePolicy().hasHeightForWidth() ) );
    setMaximumSize( QSize( 32767, 32767 ) );
    KBSProxyDialogLayout = new QVBoxLayout( this, 11, 6, "KBSProxyDialogLayout"); 

    help = new QLabel( this, "help" );
    help->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) );
    KBSProxyDialogLayout->addWidget( help );
    spacer_middle = new QSpacerItem( 16, 16, QSizePolicy::Minimum, QSizePolicy::Fixed );
    KBSProxyDialogLayout->addItem( spacer_middle );

    tab_proxy = new QTabWidget( this, "tab_proxy" );
    tab_proxy->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, tab_proxy->sizePolicy().hasHeightForWidth() ) );

    tab = new QWidget( tab_proxy, "tab" );
    tabLayout = new QVBoxLayout( tab, 11, 6, "tabLayout"); 

    socks = new QCheckBox( tab, "socks" );
    socks->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, socks->sizePolicy().hasHeightForWidth() ) );
    socks->setChecked( TRUE );
    tabLayout->addWidget( socks );

    frame_socks_server = new QFrame( tab, "frame_socks_server" );
    frame_socks_server->setFrameShape( QFrame::NoFrame );
    frame_socks_server->setFrameShadow( QFrame::Plain );
    frame_socks_serverLayout = new QHBoxLayout( frame_socks_server, 11, 6, "frame_socks_serverLayout"); 

    label_socks_server = new QLabel( frame_socks_server, "label_socks_server" );
    label_socks_server->setEnabled( TRUE );
    frame_socks_serverLayout->addWidget( label_socks_server );

    socks_server = new KLineEdit( frame_socks_server, "socks_server" );
    socks_server->setEnabled( TRUE );
    socks_server->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 3, 0, socks_server->sizePolicy().hasHeightForWidth() ) );
    frame_socks_serverLayout->addWidget( socks_server );

    label_socks_port = new QLabel( frame_socks_server, "label_socks_port" );
    label_socks_port->setEnabled( TRUE );
    frame_socks_serverLayout->addWidget( label_socks_port );

    socks_port = new KLineEdit( frame_socks_server, "socks_port" );
    socks_port->setEnabled( TRUE );
    socks_port->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 1, 0, socks_port->sizePolicy().hasHeightForWidth() ) );
    frame_socks_serverLayout->addWidget( socks_port );
    tabLayout->addWidget( frame_socks_server );

    socks_auth = new QGroupBox( tab, "socks_auth" );
    socks_auth->setEnabled( TRUE );
    socks_auth->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 1, socks_auth->sizePolicy().hasHeightForWidth() ) );
    socks_auth->setCheckable( TRUE );
    socks_auth->setColumnLayout(0, Qt::Vertical );
    socks_auth->layout()->setSpacing( 6 );
    socks_auth->layout()->setMargin( 11 );
    socks_authLayout = new QVBoxLayout( socks_auth->layout() );
    socks_authLayout->setAlignment( Qt::AlignTop );

    frame_socks_auth = new QFrame( socks_auth, "frame_socks_auth" );
    frame_socks_auth->setFrameShape( QFrame::NoFrame );
    frame_socks_auth->setFrameShadow( QFrame::Plain );
    frame_socks_authLayout = new QHBoxLayout( frame_socks_auth, 11, 6, "frame_socks_authLayout"); 

    label_socks_user = new QLabel( frame_socks_auth, "label_socks_user" );
    label_socks_user->setEnabled( TRUE );
    frame_socks_authLayout->addWidget( label_socks_user );

    socks_user = new KLineEdit( frame_socks_auth, "socks_user" );
    socks_user->setEnabled( TRUE );
    frame_socks_authLayout->addWidget( socks_user );

    label_socks_password = new QLabel( frame_socks_auth, "label_socks_password" );
    label_socks_password->setEnabled( TRUE );
    frame_socks_authLayout->addWidget( label_socks_password );

    socks_password = new KPasswordEdit( frame_socks_auth, "socks_password" );
    socks_password->setEnabled( TRUE );
    frame_socks_authLayout->addWidget( socks_password );
    socks_authLayout->addWidget( frame_socks_auth );
    tabLayout->addWidget( socks_auth );
    tab_proxy->insertTab( tab, QString::fromLatin1("") );

    tab_2 = new QWidget( tab_proxy, "tab_2" );
    tabLayout_2 = new QVBoxLayout( tab_2, 11, 6, "tabLayout_2"); 

    http = new QCheckBox( tab_2, "http" );
    http->setChecked( TRUE );
    tabLayout_2->addWidget( http );

    frame_http_server = new QFrame( tab_2, "frame_http_server" );
    frame_http_server->setFrameShape( QFrame::NoFrame );
    frame_http_server->setFrameShadow( QFrame::Plain );
    frame_http_serverLayout = new QHBoxLayout( frame_http_server, 11, 6, "frame_http_serverLayout"); 

    label_http_server = new QLabel( frame_http_server, "label_http_server" );
    label_http_server->setEnabled( TRUE );
    frame_http_serverLayout->addWidget( label_http_server );

    http_server = new KLineEdit( frame_http_server, "http_server" );
    http_server->setEnabled( TRUE );
    http_server->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 3, 0, http_server->sizePolicy().hasHeightForWidth() ) );
    frame_http_serverLayout->addWidget( http_server );

    label_http_port = new QLabel( frame_http_server, "label_http_port" );
    label_http_port->setEnabled( TRUE );
    frame_http_serverLayout->addWidget( label_http_port );

    http_port = new KLineEdit( frame_http_server, "http_port" );
    http_port->setEnabled( TRUE );
    http_port->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 1, 0, http_port->sizePolicy().hasHeightForWidth() ) );
    http_port->setMaxLength( 5 );
    frame_http_serverLayout->addWidget( http_port );
    tabLayout_2->addWidget( frame_http_server );

    http_auth = new QGroupBox( tab_2, "http_auth" );
    http_auth->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 1, http_auth->sizePolicy().hasHeightForWidth() ) );
    http_auth->setCheckable( TRUE );
    http_auth->setColumnLayout(0, Qt::Vertical );
    http_auth->layout()->setSpacing( 6 );
    http_auth->layout()->setMargin( 11 );
    http_authLayout = new QVBoxLayout( http_auth->layout() );
    http_authLayout->setAlignment( Qt::AlignTop );

    frame_http_auth = new QFrame( http_auth, "frame_http_auth" );
    frame_http_auth->setFrameShape( QFrame::NoFrame );
    frame_http_auth->setFrameShadow( QFrame::Plain );
    frame_http_authLayout = new QHBoxLayout( frame_http_auth, 11, 6, "frame_http_authLayout"); 

    label_http_user = new QLabel( frame_http_auth, "label_http_user" );
    label_http_user->setEnabled( TRUE );
    frame_http_authLayout->addWidget( label_http_user );

    http_user = new KLineEdit( frame_http_auth, "http_user" );
    http_user->setEnabled( TRUE );
    frame_http_authLayout->addWidget( http_user );

    label_http_password = new QLabel( frame_http_auth, "label_http_password" );
    label_http_password->setEnabled( TRUE );
    frame_http_authLayout->addWidget( label_http_password );

    http_password = new KPasswordEdit( frame_http_auth, "http_password" );
    http_password->setEnabled( TRUE );
    frame_http_authLayout->addWidget( http_password );
    http_authLayout->addWidget( frame_http_auth );
    tabLayout_2->addWidget( http_auth );
    tab_proxy->insertTab( tab_2, QString::fromLatin1("") );
    KBSProxyDialogLayout->addWidget( tab_proxy );

    button_layout = new QHBoxLayout( 0, 0, 6, "button_layout"); 
    spacer_button = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    button_layout->addItem( spacer_button );

    button_ok = new QPushButton( this, "button_ok" );
    button_ok->setAutoDefault( TRUE );
    button_ok->setDefault( TRUE );
    button_layout->addWidget( button_ok );

    button_cancel = new QPushButton( this, "button_cancel" );
    button_cancel->setAutoDefault( TRUE );
    button_layout->addWidget( button_cancel );
    KBSProxyDialogLayout->addLayout( button_layout );
    languageChange();
    resize( QSize(403, 366).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( button_ok, SIGNAL( clicked() ), this, SLOT( accept() ) );
    connect( button_cancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
    connect( socks, SIGNAL( toggled(bool) ), frame_socks_server, SLOT( setEnabled(bool) ) );
    connect( socks, SIGNAL( toggled(bool) ), socks_auth, SLOT( setEnabled(bool) ) );
    connect( http, SIGNAL( toggled(bool) ), frame_http_server, SLOT( setEnabled(bool) ) );
    connect( http, SIGNAL( toggled(bool) ), http_auth, SLOT( setEnabled(bool) ) );
    init();
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void KBSProxyDialog::languageChange()
{
    setCaption( tr2i18n( "Proxy Settings" ) );
    help->setText( tr2i18n( "Some organizations use an \"HTTP proxy\" or a \"SOCKS proxy\" (or both) for increased security. If you need to use a proxy, fill in the information below. If you need help, ask your System Administrator or Internet Service Provider." ) );
    socks->setText( tr2i18n( "&Connect via a SOCKS proxy server" ) );
    socks->setAccel( QKeySequence( tr2i18n( "Alt+C" ) ) );
    label_socks_server->setText( tr2i18n( "Server:" ) );
    label_socks_port->setText( tr2i18n( "Port:" ) );
    socks_auth->setTitle( tr2i18n( "Authentication" ) );
    label_socks_user->setText( tr2i18n( "User:" ) );
    label_socks_password->setText( tr2i18n( "Password:" ) );
    tab_proxy->changeTab( tab, tr2i18n( "&SOCKS Proxy" ) );
    http->setText( tr2i18n( "&Connect via an HTTP proxy server" ) );
    http->setAccel( QKeySequence( tr2i18n( "Alt+C" ) ) );
    label_http_server->setText( tr2i18n( "http://" ) );
    label_http_port->setText( tr2i18n( "Port:" ) );
    http_auth->setTitle( tr2i18n( "Authentication" ) );
    label_http_user->setText( tr2i18n( "User:" ) );
    label_http_password->setText( tr2i18n( "Password:" ) );
    tab_proxy->changeTab( tab_2, tr2i18n( "&HTTP Proxy" ) );
    button_ok->setText( tr2i18n( "&OK" ) );
    button_ok->setAccel( QKeySequence( QString::null ) );
    button_cancel->setText( tr2i18n( "&Cancel" ) );
    button_cancel->setAccel( QKeySequence( QString::null ) );
}

void KBSProxyDialog::init()
{
}

#include "kbsproxydialog.moc"