~ubuntu-branches/ubuntu/vivid/kvpnc/vivid-proposed

« back to all changes in this revision

Viewing changes to src/newprofiledialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2009-04-23 09:18:50 UTC
  • mfrom: (1.1.10 upstream) (8.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20090423091850-hweeg0jo64t0jx52
Tags: 0.9.1-1
* New upstream release (KDE4 is here)
* Add Build-Depends cmake and pkg-kde-tools
* Remove obsolete debian/patches
* Refresh debian/patches:
  - 10_su-to-root_usage.diff
  - 13_add_kuser_issuperuser.diff
* Cleanup debian/rules - simple under KDE4
* Update debian/watch for KDE4 version
* Update debian/copyright - use versionned licenses
* Update Section field - move to utils
* Remove obsolete dependencies: kdebase-bin, gksu, sux and modutils
* Update debian/kvpnc.{manpages,1}

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include "newprofiledialog.h"
22
22
#include <kcombobox.h>
23
23
#include <klineedit.h>
24
 
#include <qcheckbox.h>
 
24
#include <QtGui/qcheckbox.h>
25
25
#include <kurlrequester.h>
26
26
#include <kmessagebox.h>
27
 
#include <qlistbox.h>
 
27
#include <Qt3Support/q3listbox.h>
28
28
#include <klineedit.h>
29
 
#include <klineeditdlg.h>
30
29
#include <klocale.h>
31
30
#include <knuminput.h>
32
 
#include <qobject.h>
 
31
#include <QtCore/qobject.h>
33
32
#include <ktextedit.h>
34
33
 
35
 
#include <qlabel.h>
 
34
#include <QtGui/qlabel.h>
36
35
#include "utils.h"
37
36
 
38
37
 
44
43
//END includes
45
44
 
46
45
NewProfileDialog::NewProfileDialog( QApplication *app,QWidget *parent, const QString& caption, KVpncConfig *GlobalConfig)
47
 
                : KDialogBase( parent, "New_profile", true, caption,
48
 
                               KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, true )
 
46
                : KDialog( parent )
49
47
{
 
48
        setupUi(this);
50
49
        this->GlobalConfig = GlobalConfig;
51
50
 
52
 
        main = new NewProfileDialogbase(this);
53
 
        setMainWidget(main);
54
 
        main->setMinimumSize(main->sizeHint());
55
 
 
56
 
        connect( main->ConnectionTypeComboBox, SIGNAL( activated( const QString& ) ), this, SLOT( connectiontypeChanged( const QString& ) ) );
57
 
        connect( main->AuthTypeComboBox , SIGNAL( activated( const QString& ) ), this, SLOT( authTypeChanged( const QString& ) ) );
58
 
        //      connect( main->buttonCancel , SIGNAL( clicked () ), this, SLOT( reject() ) );
59
 
        connect( main->ImportCertificatePushButton, SIGNAL( clicked () ), this, SLOT( importCertificate() ) );
60
 
        connect( main->AdvancedSettingsPushButton, SIGNAL( clicked () ), this, SLOT( advancedSettingsClicked() ) );
61
 
        connect( main->ImportPcfProfilePushButton , SIGNAL( clicked () ), this, SLOT( importPcfFileClicked() ) );
62
 
        connect( main->GroupPasswordEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( groupPasswordContentChanged() ) );
63
 
        connect( main->PasswordEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( passwordContentChanged() ) );
 
51
 
 
52
 
 
53
 
 
54
        
 
55
        connect( ConnectionTypeComboBox, SIGNAL( activated( const QString& ) ), this, SLOT( connectiontypeChanged( const QString& ) ) );
 
56
        connect( AuthTypeComboBox , SIGNAL( activated( const QString& ) ), this, SLOT( authTypeChanged( const QString& ) ) );
 
57
        //      connect( buttonCancel , SIGNAL( clicked () ), this, SLOT( reject() ) );
 
58
        connect( ImportCertificatePushButton, SIGNAL( clicked () ), this, SLOT( importCertificate() ) );
 
59
        connect( AdvancedSettingsPushButton, SIGNAL( clicked () ), this, SLOT( advancedSettingsClicked() ) );
 
60
        connect( ImportPcfProfilePushButton , SIGNAL( clicked () ), this, SLOT( importPcfFileClicked() ) );
 
61
        connect( GroupPasswordEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( groupPasswordContentChanged() ) );
 
62
        connect( PasswordEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( passwordContentChanged() ) );
64
63
        newProfileCreated = FALSE;
65
64
        Name = "";
66
65
 
128
127
 
129
128
        NetworkInterface iface(GlobalConfig,app);
130
129
        QStringList list = iface.getAllNetworkInterfaces();
131
 
        main->NetworkDeviceComboBox->insertItem( "default" );
 
130
        NetworkDeviceComboBox->insertItem( "default" );
132
131
        for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
133
132
        {
134
 
                main->NetworkDeviceComboBox->insertItem( QString( *it ) );
 
133
                NetworkDeviceComboBox->insertItem( QString( *it ) );
135
134
        }
136
 
        main->NetworkDeviceComboBox->setEnabled( TRUE );
137
 
        main->NetworkDeviceComboBox->setCurrentText( "default" );
138
 
 
139
 
        main->certpathURLRequester->setURL( "/etc/racoon/certs" );
140
 
        main->certpathURLRequester->setMode( 2 ); // directory
141
 
 
142
 
        main->ConnectionTypeComboBox->insertItem( i18n( "Cisco (vpnc)" ) );
143
 
        main->ConnectionTypeComboBox->insertItem( i18n( "IPSec (racoon)" ) );
144
 
        main->ConnectionTypeComboBox->insertItem( i18n( "IPSec (FreeS/WAN)" ) );
145
 
        main->ConnectionTypeComboBox->insertItem( i18n( "PPTP" ) );
146
 
        main->ConnectionTypeComboBox->insertItem( i18n( "OpenVPN" ) );
147
 
        main->AuthTypeComboBox->setCurrentItem(1); // cisco
148
 
 
149
 
        main->RemoteNetMaskComboBox->setCurrentText("24");
 
135
        NetworkDeviceComboBox->setEnabled( TRUE );
 
136
        NetworkDeviceComboBox->setCurrentText( "default" );
 
137
 
 
138
        certpathURLRequester->setUrl( QString("/etc/racoon/certs") );
 
139
        certpathURLRequester->setMode( KFile::Directory ); // directory
 
140
 
 
141
        ConnectionTypeComboBox->insertItem( i18n( "Cisco (vpnc)" ) );
 
142
        ConnectionTypeComboBox->insertItem( i18n( "IPSec (racoon)" ) );
 
143
        ConnectionTypeComboBox->insertItem( i18n( "IPSec (FreeS/WAN)" ) );
 
144
        ConnectionTypeComboBox->insertItem( i18n( "PPTP" ) );
 
145
        ConnectionTypeComboBox->insertItem( i18n( "OpenVPN" ) );
 
146
        AuthTypeComboBox->setCurrentItem(i18n( "Cisco (vpnc)")); // cisco
 
147
 
 
148
        RemoteNetMaskComboBox->setCurrentText("24");
150
149
 
151
150
        authTypeChanged( "" );
152
151
        connectiontypeChanged( "" );
158
157
void NewProfileDialog::accept()
159
158
{
160
159
        bool canSave = TRUE;
161
 
        if ( main->ConnectionTypeComboBox->currentItem() == 0 ) {
 
160
        if ( ConnectionTypeComboBox->currentItem() == 0 ) {
162
161
                profileData->setConnectionType( VpnAccountData::cisco );
163
162
                UdpPort=10000;
164
163
}
165
 
        else if ( main->ConnectionTypeComboBox->currentItem() == 1 )
 
164
        else if ( ConnectionTypeComboBox->currentItem() == 1 )
166
165
        {
167
166
                profileData->setConnectionType( VpnAccountData::racoon );
168
167
 
169
 
                if (main->AuthTypeComboBox->currentItem() == 0)
 
168
                if (AuthTypeComboBox->currentItem() == 0)
170
169
                        profileData->setAuthType( VpnAccountData::cert );
171
170
                else
172
171
                        profileData->setAuthType( VpnAccountData::psk );
173
172
 
174
 
                profileData->setX509Certificate( main->x509certURLRequester->url() );
175
 
                profileData->setCertPath( main->certpathURLRequester->url() );
 
173
                profileData->setX509Certificate( x509certURLRequester->url().prettyUrl() );
 
174
                profileData->setCertPath( certpathURLRequester->url().prettyUrl() );
176
175
 
177
176
                UdpPort=4500;
178
177
        }
179
 
        else if ( main->ConnectionTypeComboBox->currentItem() == 2 )
 
178
        else if ( ConnectionTypeComboBox->currentItem() == 2 )
180
179
        {
181
180
                profileData->setConnectionType( VpnAccountData::freeswan );
182
181
                UdpPort=4500;
183
182
        }
184
 
        else if ( main->ConnectionTypeComboBox->currentItem() == 3 )
 
183
        else if ( ConnectionTypeComboBox->currentItem() == 3 )
185
184
        {
186
185
                profileData->setConnectionType( VpnAccountData::pptp );
187
186
        }
188
 
        else if ( main->ConnectionTypeComboBox->currentItem() == 4 )
 
187
        else if ( ConnectionTypeComboBox->currentItem() == 4 )
189
188
        {
190
189
                profileData->setConnectionType( VpnAccountData::openvpn );
191
190
        }
196
195
 
197
196
        if ( profileData->getConnectionType() != VpnAccountData::cisco && profileData->getConnectionType() != VpnAccountData::openvpn )
198
197
        {
199
 
                if ( main->RemoteNetAddrLineEdit->text().contains( '.' ) != 3 )
 
198
                if ( RemoteNetAddrLineEdit->text().contains( '.' ) != 3 )
200
199
                {
201
200
                        KMessageBox::error ( this, i18n( "No IP address for remote network entered!" ), i18n( "No IP Address" ) );
202
201
                        GlobalConfig->appendLogEntry(  i18n( "No IP address for remote network entered!" ),GlobalConfig->error);
204
203
                }
205
204
                else
206
205
                {
207
 
                        if (!Utils(GlobalConfig).isValidIPv4Address(main->RemoteNetAddrLineEdit->text()))
 
206
                        if (!Utils(GlobalConfig).isValidIPv4Address(RemoteNetAddrLineEdit->text()))
208
207
                        {
209
208
 
210
209
                                KMessageBox::error ( this, i18n( "IP address of remote network is not valid!" ), i18n( "Invalid IP Address" ) );
214
213
                        }
215
214
                        if ( validAddr )
216
215
                        {
217
 
                                profileData->setRemoteNetAddr( main->RemoteNetAddrLineEdit->text());
218
 
                                profileData->setRemoteNetMask( main->RemoteNetMaskComboBox->currentText() );
 
216
                                profileData->setRemoteNetAddr( RemoteNetAddrLineEdit->text());
 
217
                                profileData->setRemoteNetMask( RemoteNetMaskComboBox->currentText() );
219
218
                        }
220
219
 
221
220
                }
222
221
        }
223
222
 
224
 
        //      profileData->setSavePsk( main->CheckGroupPass->isChecked() );
225
 
        //      profileData->setSaveUserPassword( main->CheckUserPass->isChecked () );
226
 
        profileData->setSavePsk( !main->PSKLineEdit->text().isEmpty() );
227
 
        profileData->setSaveUserPassword( !main->PasswordEdit->text().isEmpty() );
228
 
        profileData->setID( main->IDLineEdit->text() );
229
 
 
230
 
        profileData->setDescription( main->DescriptionLineEdit->text() );
231
 
 
232
 
        profileData->setUserName( main->UsernameLineEdit->text () );
233
 
 
234
 
        if ( main->CheckUserPass->isChecked ())
 
223
        //      profileData->setSavePsk( CheckGroupPass->isChecked() );
 
224
        //      profileData->setSaveUserPassword( CheckUserPass->isChecked () );
 
225
        profileData->setSavePsk( !PSKLineEdit->text().isEmpty() );
 
226
        profileData->setSaveUserPassword( !PasswordEdit->text().isEmpty() );
 
227
        profileData->setID( IDLineEdit->text() );
 
228
 
 
229
        profileData->setDescription( DescriptionLineEdit->text() );
 
230
 
 
231
        profileData->setUserName( UsernameLineEdit->text () );
 
232
 
 
233
        if ( CheckUserPass->isChecked ())
235
234
        {
236
 
                profileData->setUserPassword( main->PasswordEdit->text ( ) );
 
235
                profileData->setUserPassword( PasswordEdit->text ( ) );
237
236
                profileData->setSaveUserPassword(true);
238
237
        }
239
238
 
240
 
        profileData->setGateway( main->gatewayLineEdit->text() );
241
 
 
242
 
 
243
 
        if ( main->CheckGroupPass->isChecked())
 
239
        profileData->setGateway( gatewayLineEdit->text() );
 
240
 
 
241
 
 
242
        if ( CheckGroupPass->isChecked())
244
243
        {
245
244
                if (!profileData->getConnectionType() == VpnAccountData::cisco)
246
 
                        profileData->setPreSharedKey( main->PSKLineEdit->text() );
 
245
                        profileData->setPreSharedKey( PSKLineEdit->text() );
247
246
                else
248
 
                        profileData->setPreSharedKey( main->GroupPasswordEdit->text() );
 
247
                        profileData->setPreSharedKey( GroupPasswordEdit->text() );
249
248
                profileData->setSavePsk(true);
250
249
        }
251
250
 
252
 
        profileData->setX509Certificate( main->x509certURLRequester->url() );
253
 
        profileData->setCertPath( main->certpathURLRequester->url() );
254
 
        profileData->setNetworkDevice( main->NetworkDeviceComboBox->currentText() );
255
 
        if (main->AuthTypeComboBox->currentItem() == 0)
 
251
        profileData->setX509Certificate( x509certURLRequester->url().prettyUrl() );
 
252
        profileData->setCertPath( certpathURLRequester->url().prettyUrl() );
 
253
        profileData->setNetworkDevice( NetworkDeviceComboBox->currentText() );
 
254
        if (AuthTypeComboBox->currentItem() == 0)
256
255
                profileData->setAuthType( VpnAccountData::cert );
257
256
        else
258
257
                profileData->setAuthType( VpnAccountData::psk );
261
260
        {
262
261
 
263
262
                bool nameOk = TRUE;
264
 
                Name = main->ProfileLineEdit->text();
 
263
                Name = ProfileLineEdit->text();
265
264
 
266
265
                if (Name.contains(' '))
267
266
                {
318
317
 
319
318
        // First we should set a type
320
319
        //buttonOk->setEnabled( FALSE );
321
 
        main->AdvancedSettingsPushButton->setEnabled( FALSE );
 
320
        AdvancedSettingsPushButton->setEnabled( FALSE );
322
321
 
323
 
        int item = main->ConnectionTypeComboBox->currentItem();
 
322
        int item = ConnectionTypeComboBox->currentItem();
324
323
 
325
324
        if ( item == VpnAccountData::ConnectionType(VpnAccountData::cisco) )
326
325
        {
327
326
 
328
327
 
329
 
                GlobalConfig->appendLogEntry( i18n("New type: %1").arg("cisco"),GlobalConfig->debug );
 
328
                GlobalConfig->appendLogEntry( i18n( "New type: %1", QString("cisco")),GlobalConfig->debug );
330
329
 
331
330
                profileData->setConnectionType( VpnAccountData::cisco );
332
331
 
333
 
                main->CheckGroupPass->setEnabled( TRUE );
334
 
                main->CheckUserPass->setEnabled( TRUE );
335
 
 
336
 
                main->IDLineEdit->setEnabled( TRUE );
337
 
                main->LabelID->setEnabled( TRUE );
338
 
 
339
 
                main->UsernameLineEdit->setEnabled( TRUE );
340
 
                main->LabelUsername->setEnabled( TRUE );
341
 
 
342
 
                main->PasswordEdit->setEnabled( TRUE );
343
 
                main->LabelPassword->setEnabled( TRUE );
344
 
 
345
 
                main->AdvancedSettingsPushButton->setEnabled( TRUE );
346
 
 
347
 
                main->x509certURLRequester->setEnabled( FALSE );
348
 
                main->LabelCertificate->setEnabled( FALSE );
349
 
 
350
 
                main->certpathURLRequester->setEnabled( FALSE );
351
 
                main->LabelCertificatePath->setEnabled( FALSE );
352
 
 
353
 
                main->NetworkDeviceComboBox->setEnabled( FALSE );
354
 
                main->LabelNetworkDevice->setEnabled( FALSE );
355
 
                main->AuthTypeComboBox->setEnabled( FALSE );
356
 
                main->LabelAuthType->setEnabled( FALSE );
357
 
 
358
 
                main->PSKLineEdit->setEnabled( FALSE );
359
 
                main->LabelPsk->setEnabled( FALSE );
 
332
                CheckGroupPass->setEnabled( TRUE );
 
333
                CheckUserPass->setEnabled( TRUE );
 
334
 
 
335
                IDLineEdit->setEnabled( TRUE );
 
336
                LabelID->setEnabled( TRUE );
 
337
 
 
338
                UsernameLineEdit->setEnabled( TRUE );
 
339
                LabelUsername->setEnabled( TRUE );
 
340
 
 
341
                PasswordEdit->setEnabled( TRUE );
 
342
                LabelPassword->setEnabled( TRUE );
 
343
 
 
344
                AdvancedSettingsPushButton->setEnabled( TRUE );
 
345
 
 
346
                x509certURLRequester->setEnabled( FALSE );
 
347
                LabelCertificate->setEnabled( FALSE );
 
348
 
 
349
                certpathURLRequester->setEnabled( FALSE );
 
350
                LabelCertificatePath->setEnabled( FALSE );
 
351
 
 
352
                NetworkDeviceComboBox->setEnabled( FALSE );
 
353
                LabelNetworkDevice->setEnabled( FALSE );
 
354
                AuthTypeComboBox->setEnabled( FALSE );
 
355
                LabelAuthType->setEnabled( FALSE );
 
356
 
 
357
                PSKLineEdit->setEnabled( FALSE );
 
358
                LabelPsk->setEnabled( FALSE );
360
359
 
361
360
                //buttonCancel->setEnabled( TRUE );
362
361
                //buttonOk->setEnabled( TRUE );
363
362
 
364
 
                main->RemoteNetAddrLineEdit->setEnabled( FALSE );
365
 
                main->LabelRemoteNetwork->setEnabled( FALSE );
 
363
                RemoteNetAddrLineEdit->setEnabled( FALSE );
 
364
                LabelRemoteNetwork->setEnabled( FALSE );
366
365
 
367
 
                main->RemoteNetMaskComboBox->setEnabled( FALSE );
 
366
                RemoteNetMaskComboBox->setEnabled( FALSE );
368
367
 
369
368
        } // vpnc
370
369
 
372
371
        {
373
372
 
374
373
 
375
 
                GlobalConfig->appendLogEntry( i18n("New type: %1").arg("racoon"),GlobalConfig->debug );
376
 
                //     KURLRequester* main->x509certURLRequester;
377
 
                //     KComboBox* main->AuthTypeComboBox;
 
374
                GlobalConfig->appendLogEntry( i18n( "New type: %1", QString("racoon")),GlobalConfig->debug );
 
375
                //     KUrlRequester* x509certURLRequester;
 
376
                //     KComboBox* AuthTypeComboBox;
378
377
                //     KPushButton* ImportCertificatePushButton;
379
 
                //     KLineEdit* main->PSKLineEdit;
 
378
                //     KLineEdit* PSKLineEdit;
380
379
 
381
380
                profileData->setConnectionType( VpnAccountData::racoon );
382
381
 
383
 
                main->x509certURLRequester->setEnabled( TRUE );
384
 
                main->LabelCertificate->setEnabled( TRUE );
385
 
 
386
 
                main->certpathURLRequester->setEnabled( TRUE );
387
 
                main->LabelCertificatePath->setEnabled( TRUE );
388
 
 
389
 
                main->NetworkDeviceComboBox->setEnabled ( TRUE );
390
 
                main->LabelNetworkDevice->setEnabled( TRUE );
391
 
 
392
 
                main->AuthTypeComboBox->setEnabled( TRUE );
393
 
                main->LabelAuthType->setEnabled( TRUE );
394
 
 
395
 
                main->PSKLineEdit->setEnabled( TRUE );
396
 
                main->LabelPsk->setEnabled( TRUE );
397
 
 
398
 
                main->RemoteNetAddrLineEdit->setEnabled( TRUE );
399
 
                main->LabelRemoteNetwork->setEnabled( TRUE );
400
 
 
401
 
                main->RemoteNetMaskComboBox->setEnabled( TRUE );
402
 
 
403
 
                main->PasswordEdit->setEnabled( FALSE );
404
 
                main->LabelPassword->setEnabled( FALSE );
405
 
 
406
 
                main->CheckGroupPass->setEnabled( FALSE );
407
 
                main->CheckUserPass->setEnabled( FALSE );
408
 
 
409
 
                main->IDLineEdit->setEnabled( FALSE );
410
 
                main->LabelID->setEnabled( FALSE );
411
 
 
412
 
                main->UsernameLineEdit->setEnabled( FALSE );
413
 
                main->LabelUsername->setEnabled( FALSE );
414
 
 
415
 
                main->GroupPasswordEdit->setEnabled( FALSE );
416
 
                main->LabelGroupPassword->setEnabled( FALSE );
 
382
                x509certURLRequester->setEnabled( TRUE );
 
383
                LabelCertificate->setEnabled( TRUE );
 
384
 
 
385
                certpathURLRequester->setEnabled( TRUE );
 
386
                LabelCertificatePath->setEnabled( TRUE );
 
387
 
 
388
                NetworkDeviceComboBox->setEnabled ( TRUE );
 
389
                LabelNetworkDevice->setEnabled( TRUE );
 
390
 
 
391
                AuthTypeComboBox->setEnabled( TRUE );
 
392
                LabelAuthType->setEnabled( TRUE );
 
393
 
 
394
                PSKLineEdit->setEnabled( TRUE );
 
395
                LabelPsk->setEnabled( TRUE );
 
396
 
 
397
                RemoteNetAddrLineEdit->setEnabled( TRUE );
 
398
                LabelRemoteNetwork->setEnabled( TRUE );
 
399
 
 
400
                RemoteNetMaskComboBox->setEnabled( TRUE );
 
401
 
 
402
                PasswordEdit->setEnabled( FALSE );
 
403
                LabelPassword->setEnabled( FALSE );
 
404
 
 
405
                CheckGroupPass->setEnabled( FALSE );
 
406
                CheckUserPass->setEnabled( FALSE );
 
407
 
 
408
                IDLineEdit->setEnabled( FALSE );
 
409
                LabelID->setEnabled( FALSE );
 
410
 
 
411
                UsernameLineEdit->setEnabled( FALSE );
 
412
                LabelUsername->setEnabled( FALSE );
 
413
 
 
414
                GroupPasswordEdit->setEnabled( FALSE );
 
415
                LabelGroupPassword->setEnabled( FALSE );
417
416
 
418
417
                //buttonCancel->setEnabled( TRUE );
419
418
                //buttonOk->setEnabled( TRUE );
420
 
                main->AdvancedSettingsPushButton->setEnabled( TRUE );
 
419
                AdvancedSettingsPushButton->setEnabled( TRUE );
421
420
        } // racoon
422
421
 
423
422
        else if ( item == VpnAccountData::ConnectionType(VpnAccountData::freeswan) )
424
423
        {
425
424
 
426
425
 
427
 
                GlobalConfig->appendLogEntry( i18n("New type: %1").arg("freeswan"), GlobalConfig->debug );
428
 
                //     KURLRequester* main->x509certURLRequester;
429
 
                //     KComboBox* main->AuthTypeComboBox;
 
426
                GlobalConfig->appendLogEntry( i18n( "New type: %1", QString("freeswan")), GlobalConfig->debug );
 
427
                //     KUrlRequester* x509certURLRequester;
 
428
                //     KComboBox* AuthTypeComboBox;
430
429
                //     KPushButton* ImportCertificatePushButton;
431
 
                //     KLineEdit* main->PSKLineEdit;
 
430
                //     KLineEdit* PSKLineEdit;
432
431
 
433
432
                profileData->setConnectionType( VpnAccountData::freeswan );
434
433
 
435
 
                main->x509certURLRequester->setEnabled( TRUE );
436
 
                main->LabelCertificate->setEnabled( TRUE );
437
 
 
438
 
                main->certpathURLRequester->setEnabled( TRUE );
439
 
                main->LabelCertificatePath->setEnabled( TRUE );
440
 
 
441
 
                main->NetworkDeviceComboBox->setEnabled ( TRUE );
442
 
                main->LabelNetworkDevice->setEnabled( TRUE );
443
 
 
444
 
                main->AuthTypeComboBox->setEnabled( TRUE );
445
 
                main->LabelAuthType->setEnabled( TRUE );
446
 
 
447
 
                main->PSKLineEdit->setEnabled( TRUE );
448
 
                main->LabelPsk->setEnabled( TRUE );
449
 
 
450
 
                main->RemoteNetAddrLineEdit->setEnabled( TRUE );
451
 
                main->LabelRemoteNetwork->setEnabled( TRUE );
452
 
 
453
 
                main->RemoteNetMaskComboBox->setEnabled( TRUE );
454
 
 
455
 
                main->CheckGroupPass->setEnabled( FALSE );
456
 
                main->CheckUserPass->setEnabled( FALSE );
457
 
 
458
 
                main->IDLineEdit->setEnabled( FALSE );
459
 
                main->LabelID->setEnabled( FALSE );
460
 
 
461
 
                main->PasswordEdit->setEnabled( FALSE );
462
 
                main->LabelPassword->setEnabled( FALSE );
463
 
 
464
 
                main->UsernameLineEdit->setEnabled( FALSE );
465
 
                main->LabelUsername->setEnabled( FALSE );
466
 
 
467
 
                main->GroupPasswordEdit->setEnabled( FALSE );
468
 
                main->LabelGroupPassword->setEnabled( FALSE );
 
434
                x509certURLRequester->setEnabled( TRUE );
 
435
                LabelCertificate->setEnabled( TRUE );
 
436
 
 
437
                certpathURLRequester->setEnabled( TRUE );
 
438
                LabelCertificatePath->setEnabled( TRUE );
 
439
 
 
440
                NetworkDeviceComboBox->setEnabled ( TRUE );
 
441
                LabelNetworkDevice->setEnabled( TRUE );
 
442
 
 
443
                AuthTypeComboBox->setEnabled( TRUE );
 
444
                LabelAuthType->setEnabled( TRUE );
 
445
 
 
446
                PSKLineEdit->setEnabled( TRUE );
 
447
                LabelPsk->setEnabled( TRUE );
 
448
 
 
449
                RemoteNetAddrLineEdit->setEnabled( TRUE );
 
450
                LabelRemoteNetwork->setEnabled( TRUE );
 
451
 
 
452
                RemoteNetMaskComboBox->setEnabled( TRUE );
 
453
 
 
454
                CheckGroupPass->setEnabled( FALSE );
 
455
                CheckUserPass->setEnabled( FALSE );
 
456
 
 
457
                IDLineEdit->setEnabled( FALSE );
 
458
                LabelID->setEnabled( FALSE );
 
459
 
 
460
                PasswordEdit->setEnabled( FALSE );
 
461
                LabelPassword->setEnabled( FALSE );
 
462
 
 
463
                UsernameLineEdit->setEnabled( FALSE );
 
464
                LabelUsername->setEnabled( FALSE );
 
465
 
 
466
                GroupPasswordEdit->setEnabled( FALSE );
 
467
                LabelGroupPassword->setEnabled( FALSE );
469
468
 
470
469
                //              buttonCancel->setEnabled( TRUE );
471
470
                //              buttonOk->setEnabled( TRUE );
472
 
                main->AdvancedSettingsPushButton->setEnabled( TRUE );
 
471
                AdvancedSettingsPushButton->setEnabled( TRUE );
473
472
        } // freeswan
474
473
 
475
474
        else if ( item == VpnAccountData::ConnectionType(VpnAccountData::pptp) )
476
475
        {
477
476
 
478
477
 
479
 
                GlobalConfig->appendLogEntry( i18n("New type: %1").arg("pptp"),GlobalConfig->debug );
480
 
                //     KURLRequester* main->x509certURLRequester;
481
 
                //     KComboBox* main->AuthTypeComboBox;
 
478
                GlobalConfig->appendLogEntry( i18n( "New type: %1", QString("pptp")),GlobalConfig->debug );
 
479
                //     KUrlRequester* x509certURLRequester;
 
480
                //     KComboBox* AuthTypeComboBox;
482
481
                //     KPushButton* ImportCertificatePushButton;
483
 
                //     KLineEdit* main->PSKLineEdit;
 
482
                //     KLineEdit* PSKLineEdit;
484
483
 
485
484
                profileData->setConnectionType( VpnAccountData::pptp );
486
485
 
487
 
                main->x509certURLRequester->setEnabled( FALSE );
488
 
                main->LabelCertificate->setEnabled( FALSE );
489
 
 
490
 
                main->certpathURLRequester->setEnabled( FALSE );
491
 
                main->LabelCertificatePath->setEnabled( FALSE );
492
 
 
493
 
                main->NetworkDeviceComboBox->setEnabled ( FALSE );
494
 
                main->LabelNetworkDevice->setEnabled( FALSE );
495
 
 
496
 
                main->AuthTypeComboBox->setEnabled( FALSE );
497
 
                main->LabelAuthType->setEnabled( FALSE );
498
 
 
499
 
                main->PSKLineEdit->setEnabled( FALSE );
500
 
                main->LabelPsk->setEnabled( FALSE );
501
 
 
502
 
                main->RemoteNetAddrLineEdit->setEnabled( TRUE );
503
 
                main->LabelRemoteNetwork->setEnabled( TRUE );
504
 
 
505
 
                main->RemoteNetMaskComboBox->setEnabled( TRUE );
506
 
 
507
 
                main->CheckGroupPass->setEnabled( FALSE );
508
 
                main->CheckUserPass->setEnabled( TRUE );
509
 
 
510
 
                main->IDLineEdit->setEnabled( FALSE );
511
 
                main->LabelID->setEnabled( FALSE );
512
 
 
513
 
                main->PasswordEdit->setEnabled( TRUE );
514
 
                main->LabelPassword->setEnabled( TRUE );
515
 
 
516
 
                main->UsernameLineEdit->setEnabled( TRUE );
517
 
                main->LabelUsername->setEnabled( TRUE );
518
 
 
519
 
                main->GroupPasswordEdit->setEnabled( FALSE );
520
 
                main->LabelGroupPassword->setEnabled( FALSE );
 
486
                x509certURLRequester->setEnabled( FALSE );
 
487
                LabelCertificate->setEnabled( FALSE );
 
488
 
 
489
                certpathURLRequester->setEnabled( FALSE );
 
490
                LabelCertificatePath->setEnabled( FALSE );
 
491
 
 
492
                NetworkDeviceComboBox->setEnabled ( FALSE );
 
493
                LabelNetworkDevice->setEnabled( FALSE );
 
494
 
 
495
                AuthTypeComboBox->setEnabled( FALSE );
 
496
                LabelAuthType->setEnabled( FALSE );
 
497
 
 
498
                PSKLineEdit->setEnabled( FALSE );
 
499
                LabelPsk->setEnabled( FALSE );
 
500
 
 
501
                RemoteNetAddrLineEdit->setEnabled( TRUE );
 
502
                LabelRemoteNetwork->setEnabled( TRUE );
 
503
 
 
504
                RemoteNetMaskComboBox->setEnabled( TRUE );
 
505
 
 
506
                CheckGroupPass->setEnabled( FALSE );
 
507
                CheckUserPass->setEnabled( TRUE );
 
508
 
 
509
                IDLineEdit->setEnabled( FALSE );
 
510
                LabelID->setEnabled( FALSE );
 
511
 
 
512
                PasswordEdit->setEnabled( TRUE );
 
513
                LabelPassword->setEnabled( TRUE );
 
514
 
 
515
                UsernameLineEdit->setEnabled( TRUE );
 
516
                LabelUsername->setEnabled( TRUE );
 
517
 
 
518
                GroupPasswordEdit->setEnabled( FALSE );
 
519
                LabelGroupPassword->setEnabled( FALSE );
521
520
 
522
521
                //buttonCancel->setEnabled( TRUE );
523
522
                //buttonOk->setEnabled( TRUE );
524
 
                main->AdvancedSettingsPushButton->setEnabled( TRUE );
 
523
                AdvancedSettingsPushButton->setEnabled( TRUE );
525
524
        } // pptp
526
525
        else if ( item == VpnAccountData::ConnectionType(VpnAccountData::openvpn) )
527
526
        {
528
527
                if (GlobalConfig->KvpncDebugLevel > 0)
529
 
                        GlobalConfig->appendLogEntry( i18n("New type: %1").arg("openvpn"),GlobalConfig->debug );
530
 
                //     KURLRequester* main->x509certURLRequester;
531
 
                //     KComboBox* main->AuthTypeComboBox;
 
528
                        GlobalConfig->appendLogEntry( i18n( "New type: %1", QString("openvpn")),GlobalConfig->debug );
 
529
                //     KUrlRequester* x509certURLRequester;
 
530
                //     KComboBox* AuthTypeComboBox;
532
531
                //     KPushButton* ImportCertificatePushButton;
533
 
                //     KLineEdit* main->PSKLineEdit;
 
532
                //     KLineEdit* PSKLineEdit;
534
533
 
535
534
                profileData->setConnectionType( VpnAccountData::openvpn );
536
535
 
537
 
                main->x509certURLRequester->setEnabled( TRUE );
538
 
                main->LabelCertificate->setEnabled( TRUE );
539
 
 
540
 
                main->certpathURLRequester->setEnabled( TRUE );
541
 
                main->LabelCertificatePath->setEnabled( TRUE );
542
 
 
543
 
                main->NetworkDeviceComboBox->setEnabled ( TRUE );
544
 
                main->LabelNetworkDevice->setEnabled( TRUE );
545
 
 
546
 
                main->AuthTypeComboBox->setEnabled( TRUE );
547
 
                main->LabelAuthType->setEnabled( TRUE );
548
 
 
549
 
                main->PSKLineEdit->setEnabled( TRUE );
550
 
                main->LabelPsk->setEnabled( TRUE );
551
 
 
552
 
                main->RemoteNetAddrLineEdit->setEnabled( FALSE );
553
 
                main->LabelRemoteNetwork->setEnabled( FALSE );
554
 
 
555
 
                main->RemoteNetMaskComboBox->setEnabled( TRUE );
556
 
 
557
 
                main->PasswordEdit->setEnabled( FALSE );
558
 
                main->LabelPassword->setEnabled( FALSE );
559
 
 
560
 
                main->CheckGroupPass->setEnabled( FALSE );
561
 
                main->CheckUserPass->setEnabled( FALSE );
562
 
 
563
 
                main->IDLineEdit->setEnabled( FALSE );
564
 
                main->LabelID->setEnabled( FALSE );
565
 
 
566
 
 
567
 
                main->UsernameLineEdit->setEnabled( FALSE );
568
 
                main->LabelUsername->setEnabled( FALSE );
569
 
 
570
 
                main->GroupPasswordEdit->setEnabled( FALSE );
571
 
                main->LabelGroupPassword->setEnabled( FALSE );
 
536
                x509certURLRequester->setEnabled( TRUE );
 
537
                LabelCertificate->setEnabled( TRUE );
 
538
 
 
539
                certpathURLRequester->setEnabled( TRUE );
 
540
                LabelCertificatePath->setEnabled( TRUE );
 
541
 
 
542
                NetworkDeviceComboBox->setEnabled ( TRUE );
 
543
                LabelNetworkDevice->setEnabled( TRUE );
 
544
 
 
545
                AuthTypeComboBox->setEnabled( TRUE );
 
546
                LabelAuthType->setEnabled( TRUE );
 
547
 
 
548
                PSKLineEdit->setEnabled( TRUE );
 
549
                LabelPsk->setEnabled( TRUE );
 
550
 
 
551
                RemoteNetAddrLineEdit->setEnabled( FALSE );
 
552
                LabelRemoteNetwork->setEnabled( FALSE );
 
553
 
 
554
                RemoteNetMaskComboBox->setEnabled( TRUE );
 
555
 
 
556
                PasswordEdit->setEnabled( FALSE );
 
557
                LabelPassword->setEnabled( FALSE );
 
558
 
 
559
                CheckGroupPass->setEnabled( FALSE );
 
560
                CheckUserPass->setEnabled( FALSE );
 
561
 
 
562
                IDLineEdit->setEnabled( FALSE );
 
563
                LabelID->setEnabled( FALSE );
 
564
 
 
565
 
 
566
                UsernameLineEdit->setEnabled( FALSE );
 
567
                LabelUsername->setEnabled( FALSE );
 
568
 
 
569
                GroupPasswordEdit->setEnabled( FALSE );
 
570
                LabelGroupPassword->setEnabled( FALSE );
572
571
 
573
572
                //buttonCancel->setEnabled( TRUE );
574
573
                //buttonOk->setEnabled( TRUE );
575
 
                main->AdvancedSettingsPushButton->setEnabled( TRUE );
 
574
                AdvancedSettingsPushButton->setEnabled( TRUE );
576
575
        } // openvpn
577
576
 
578
577
        // other
581
580
 
582
581
                if (GlobalConfig->KvpncDebugLevel > 0)
583
582
                        GlobalConfig->appendLogEntry( "new type: other",GlobalConfig->debug );
584
 
                //              main->x509certURLRequester->setEnabled( FALSE );
585
 
                //              main->AuthTypeComboBox->setEnabled( FALSE );
586
 
                //              main->PSKLineEdit->setEnabled( FALSE );
 
583
                //              x509certURLRequester->setEnabled( FALSE );
 
584
                //              AuthTypeComboBox->setEnabled( FALSE );
 
585
                //              PSKLineEdit->setEnabled( FALSE );
587
586
                //
588
 
                //              main->CheckGroupPass->setEnabled( FALSE );
589
 
                //              main->CheckUserPass->setEnabled( FALSE );
590
 
                //              main->IDLineEdit->setEnabled( FALSE );
591
 
                //              main->UsernameLineEdit->setEnabled( FALSE );
592
 
                //              main->AdvancedSettingsPushButton->setEnabled( FALSE );
 
587
                //              CheckGroupPass->setEnabled( FALSE );
 
588
                //              CheckUserPass->setEnabled( FALSE );
 
589
                //              IDLineEdit->setEnabled( FALSE );
 
590
                //              UsernameLineEdit->setEnabled( FALSE );
 
591
                //              AdvancedSettingsPushButton->setEnabled( FALSE );
593
592
                //              buttonCancel->setEnabled( FALSE );
594
593
                //buttonOk->setEnabled( FALSE );
595
594
        }
597
596
 
598
597
void NewProfileDialog::authTypeChanged( const QString& )
599
598
{
600
 
        if ( main->AuthTypeComboBox->currentItem() == VpnAccountData::AuthenticationType(VpnAccountData::cert ))
 
599
        if ( AuthTypeComboBox->currentItem() == VpnAccountData::AuthenticationType(VpnAccountData::cert ))
601
600
        {
602
601
                // certificate
603
 
                main->PSKLineEdit->setEnabled( FALSE );
604
 
                main->LabelPsk->setEnabled( FALSE );
605
 
 
606
 
                main->x509certURLRequester->setEnabled( TRUE );
607
 
                main->LabelCertificate->setEnabled( TRUE );
608
 
 
609
 
                main->certpathURLRequester->setEnabled( TRUE );
610
 
                main->LabelCertificatePath->setEnabled( TRUE );
 
602
                PSKLineEdit->setEnabled( FALSE );
 
603
                LabelPsk->setEnabled( FALSE );
 
604
 
 
605
                x509certURLRequester->setEnabled( TRUE );
 
606
                LabelCertificate->setEnabled( TRUE );
 
607
 
 
608
                certpathURLRequester->setEnabled( TRUE );
 
609
                LabelCertificatePath->setEnabled( TRUE );
611
610
        }
612
 
        if ( main->AuthTypeComboBox->currentItem() == VpnAccountData::AuthenticationType(VpnAccountData::psk ))
 
611
        if ( AuthTypeComboBox->currentItem() == VpnAccountData::AuthenticationType(VpnAccountData::psk ))
613
612
        {
614
613
                // psk
615
 
                main->PSKLineEdit->setEnabled( TRUE );
616
 
                main->LabelPsk->setEnabled( TRUE );
617
 
 
618
 
                main->x509certURLRequester->setEnabled( FALSE );
619
 
                main->LabelCertificate->setEnabled( FALSE );
620
 
 
621
 
                main->certpathURLRequester->setEnabled( FALSE );
622
 
                main->LabelCertificatePath->setEnabled( FALSE );
 
614
                PSKLineEdit->setEnabled( TRUE );
 
615
                LabelPsk->setEnabled( TRUE );
 
616
 
 
617
                x509certURLRequester->setEnabled( FALSE );
 
618
                LabelCertificate->setEnabled( FALSE );
 
619
 
 
620
                certpathURLRequester->setEnabled( FALSE );
 
621
                LabelCertificatePath->setEnabled( FALSE );
623
622
        }
624
623
 
625
624
}
632
631
void NewProfileDialog::profileNameChanged( const QString& )
633
632
{
634
633
        //      LogOutput->append ( "text changed!" );
635
 
        //      if ( main->ProfileLineEdit->text().isEmpty() )
 
634
        //      if ( ProfileLineEdit->text().isEmpty() )
636
635
        //              buttonOk->setEnabled( FALSE );
637
636
        //      else
638
637
        //              buttonOk->setEnabled( TRUE );
652
651
 
653
652
void NewProfileDialog::groupPasswordContentChanged()
654
653
{
655
 
        if (!main->GroupPasswordEdit->text().isEmpty())
656
 
                main->CheckGroupPass->setChecked(true);
 
654
        if (!GroupPasswordEdit->text().isEmpty())
 
655
                CheckGroupPass->setChecked(true);
657
656
        else
658
 
                main->CheckGroupPass->setChecked(false);
 
657
                CheckGroupPass->setChecked(false);
659
658
}
660
659
 
661
660
 
662
661
void NewProfileDialog::passwordContentChanged()
663
662
{
664
 
        if (!main->PasswordEdit->text().isEmpty())
665
 
                main->CheckUserPass ->setChecked(true);
 
663
        if (!PasswordEdit->text().isEmpty())
 
664
                CheckUserPass ->setChecked(true);
666
665
        else
667
 
                main->CheckUserPass->setChecked(false);
 
666
                CheckUserPass->setChecked(false);
668
667
}
669
668
 
670
669