Diffstat (limited to 'core/settings/security/security.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/settings/security/security.cpp | 106 |
1 files changed, 54 insertions, 52 deletions
diff --git a/core/settings/security/security.cpp b/core/settings/security/security.cpp index 34f7e50..4eddb55 100644 --- a/core/settings/security/security.cpp +++ b/core/settings/security/security.cpp | |||
@@ -44,19 +44,12 @@ | |||
44 | int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24 | 44 | int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24 |
45 | int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24); | 45 | int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24); |
46 | selectNet(auth_peer,auth_peer_bits,TRUE); | 46 | selectNet(auth_peer,auth_peer_bits,TRUE); |
47 | 47 | ||
48 | connect(syncnet, SIGNAL(textChanged(const QString&)), | 48 | connect(syncnet, SIGNAL(textChanged(const QString&)), |
49 | this, SLOT(setSyncNet(const QString&))); | 49 | this, SLOT(setSyncNet(const QString&))); |
50 | 50 | ||
51 | cfg.setGroup("Sync"); | ||
52 | QString sa = cfg.readEntry("syncapp","Qtopia"); | ||
53 | 51 | ||
54 | for (int i=0; i<syncapp->count(); i++) { | 52 | |
55 | if ( syncapp->text(i) == sa ) { | ||
56 | syncapp->setCurrentItem(i); | ||
57 | } | ||
58 | } | ||
59 | |||
60 | /* | 53 | /* |
61 | cfg.setGroup("Remote"); | 54 | cfg.setGroup("Remote"); |
62 | if ( telnetAvailable() ) | 55 | if ( telnetAvailable() ) |
@@ -72,7 +65,7 @@ | |||
72 | 65 | ||
73 | QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; | 66 | QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; |
74 | Config loginCfg(configFile,Config::File); | 67 | Config loginCfg(configFile,Config::File); |
75 | 68 | ||
76 | loginCfg.setGroup("General"); | 69 | loginCfg.setGroup("General"); |
77 | autoLoginName=loginCfg.readEntry("AutoLogin",""); | 70 | autoLoginName=loginCfg.readEntry("AutoLogin",""); |
78 | 71 | ||
@@ -84,20 +77,27 @@ | |||
84 | 77 | ||
85 | cfg.setGroup("SyncMode"); | 78 | cfg.setGroup("SyncMode"); |
86 | int mode = cfg.readNumEntry("Mode",2); // Default to Sharp | 79 | int mode = cfg.readNumEntry("Mode",2); // Default to Sharp |
87 | syncModeCombo->setCurrentItem( mode - 1 ); | 80 | switch( mode ) { |
88 | 81 | case 0x01: | |
89 | //since nobody knows what this is and it doesn't do anything, i'll hide it # CoreDump | 82 | syncModeCombo->setCurrentItem( 0 ); |
90 | // is this work-in-progress or can it be removed? | 83 | break; |
91 | syncModeCombo->hide(); | 84 | case 0x02: |
85 | default: | ||
86 | syncModeCombo->setCurrentItem( 1 ); | ||
87 | break; | ||
88 | case 0x04: | ||
89 | syncModeCombo->setCurrentItem( 2 ); | ||
90 | break; | ||
91 | } | ||
92 | |||
92 | 93 | ||
93 | connect(autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool))); | 94 | connect(autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool))); |
94 | connect(userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int))); | 95 | connect(userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int))); |
95 | connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode())); | 96 | connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode())); |
96 | connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode())); | 97 | connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode())); |
97 | connect(syncapp,SIGNAL(activated(int)), this, SLOT(changeSyncApp())); | 98 | connect(restoredefaults,SIGNAL(clicked()), this, SLOT(restoreDefaults())); |
98 | connect(restoredefaults,SIGNAL(clicked()), this, SLOT(restoreDefaults())); | ||
99 | connect(deleteentry,SIGNAL(clicked()), this, SLOT(deleteListEntry())); | 99 | connect(deleteentry,SIGNAL(clicked()), this, SLOT(deleteListEntry())); |
100 | 100 | ||
101 | loadUsers(); | 101 | loadUsers(); |
102 | updateGUI(); | 102 | updateGUI(); |
103 | 103 | ||
@@ -109,13 +109,13 @@ Security::~Security() | |||
109 | { | 109 | { |
110 | } | 110 | } |
111 | 111 | ||
112 | void Security::deleteListEntry() | 112 | void Security::deleteListEntry() |
113 | { | 113 | { |
114 | syncnet->removeItem(syncnet->currentItem()); | 114 | syncnet->removeItem(syncnet->currentItem()); |
115 | } | 115 | } |
116 | 116 | ||
117 | void Security::restoreDefaults() | 117 | void Security::restoreDefaults() |
118 | { | 118 | { |
119 | QMessageBox unrecbox( | 119 | QMessageBox unrecbox( |
120 | tr("Attention"), | 120 | tr("Attention"), |
121 | tr("<p>All user-defined net ranges will be lost."), | 121 | tr("<p>All user-defined net ranges will be lost."), |
@@ -125,15 +125,16 @@ void Security::restoreDefaults() | |||
125 | unrecbox.setButtonText(QMessageBox::Cancel, tr("Cancel")); | 125 | unrecbox.setButtonText(QMessageBox::Cancel, tr("Cancel")); |
126 | unrecbox.setButtonText(QMessageBox::Yes, tr("Ok")); | 126 | unrecbox.setButtonText(QMessageBox::Yes, tr("Ok")); |
127 | 127 | ||
128 | if ( unrecbox.exec() == QMessageBox::Yes) | 128 | if ( unrecbox.exec() == QMessageBox::Yes) |
129 | { | 129 | { |
130 | syncnet->clear(); | 130 | syncnet->clear(); |
131 | insertDefaultRanges(); | 131 | insertDefaultRanges(); |
132 | } | 132 | } |
133 | syncModeCombo->setCurrentItem( 2 ); | ||
133 | } | 134 | } |
134 | 135 | ||
135 | void Security::insertDefaultRanges() | 136 | void Security::insertDefaultRanges() |
136 | { | 137 | { |
137 | syncnet->insertItem( tr( "192.168.129.0/24" ) ); | 138 | syncnet->insertItem( tr( "192.168.129.0/24" ) ); |
138 | syncnet->insertItem( tr( "192.168.1.0/24" ) ); | 139 | syncnet->insertItem( tr( "192.168.1.0/24" ) ); |
139 | syncnet->insertItem( tr( "192.168.0.0/16" ) ); | 140 | syncnet->insertItem( tr( "192.168.0.0/16" ) ); |
@@ -154,7 +155,7 @@ void Security::updateGUI() | |||
154 | clearpasscode->setEnabled( !empty ); | 155 | clearpasscode->setEnabled( !empty ); |
155 | 156 | ||
156 | autologinToggle->setChecked(autoLogin); | 157 | autologinToggle->setChecked(autoLogin); |
157 | userlist->setEnabled(autoLogin); | 158 | userlist->setEnabled(autoLogin); |
158 | } | 159 | } |
159 | 160 | ||
160 | 161 | ||
@@ -237,19 +238,19 @@ void Security::selectNet(int auth_peer,int auth_peer_bits, bool update) | |||
237 | //make sure we have no "twin" entries | 238 | //make sure we have no "twin" entries |
238 | for (int i=0; i<syncnet->count(); i++) { | 239 | for (int i=0; i<syncnet->count(); i++) { |
239 | if ( syncnet->text(i) == netrange ) { | 240 | if ( syncnet->text(i) == netrange ) { |
240 | already_there=TRUE; | 241 | already_there=TRUE; |
241 | } | 242 | } |
242 | } | 243 | } |
243 | if (! already_there) { | 244 | if (! already_there) { |
244 | syncnet->insertItem( tr( netrange ) ); | 245 | syncnet->insertItem( tr( netrange ) ); |
245 | } else { | 246 | } else { |
246 | already_there=FALSE; | 247 | already_there=FALSE; |
247 | } | 248 | } |
248 | } | 249 | } |
249 | } | 250 | } |
250 | } | 251 | } |
251 | } | 252 | } |
252 | 253 | ||
253 | for (int i=0; i<syncnet->count(); i++) { | 254 | for (int i=0; i<syncnet->count(); i++) { |
254 | if ( syncnet->text(i).left(sn.length()) == sn ) { | 255 | if ( syncnet->text(i).left(sn.length()) == sn ) { |
255 | syncnet->setCurrentItem(i); | 256 | syncnet->setCurrentItem(i); |
@@ -334,20 +335,37 @@ void Security::applySecurity() | |||
334 | int auth_peer_bits; | 335 | int auth_peer_bits; |
335 | QString sn = syncnet->currentText(); | 336 | QString sn = syncnet->currentText(); |
336 | parseNet(sn,auth_peer,auth_peer_bits); | 337 | parseNet(sn,auth_peer,auth_peer_bits); |
337 | 338 | ||
338 | //this is the *selected* (active) net range | 339 | //this is the *selected* (active) net range |
339 | cfg.writeEntry("auth_peer",auth_peer); | 340 | cfg.writeEntry("auth_peer",auth_peer); |
340 | cfg.writeEntry("auth_peer_bits",auth_peer_bits); | 341 | cfg.writeEntry("auth_peer_bits",auth_peer_bits); |
341 | 342 | ||
342 | //write back all other net ranges in *cleartext* | 343 | //write back all other net ranges in *cleartext* |
343 | for (int i=0; i<10; i++) { | 344 | for (int i=0; i<10; i++) { |
344 | QString target; | 345 | QString target; |
345 | target.sprintf("net%d", i); | 346 | target.sprintf("net%d", i); |
346 | cfg.writeEntry(target,syncnet->text(i)); | 347 | cfg.writeEntry(target,syncnet->text(i)); |
347 | } | 348 | } |
348 | 349 | ||
349 | cfg.writeEntry("syncapp",syncapp->currentText()); | 350 | #ifdef ODP |
350 | 351 | #error "Use 0,1,2 and use Launcher" | |
352 | #endif | ||
353 | /* keep the old code so we don't use currentItem directly */ | ||
354 | int value = 0x02; | ||
355 | switch( syncModeCombo->currentItem() ) { | ||
356 | case 0: | ||
357 | value = 0x01; | ||
358 | break; | ||
359 | case 1: | ||
360 | value = 0x02; | ||
361 | break; | ||
362 | case 2: | ||
363 | value = 0x04; | ||
364 | break; | ||
365 | } | ||
366 | cfg.setGroup("SyncMode"); | ||
367 | cfg.writeEntry( "Mode", value ); | ||
368 | |||
351 | /* | 369 | /* |
352 | cfg.setGroup("Remote"); | 370 | cfg.setGroup("Remote"); |
353 | if ( telnetAvailable() ) | 371 | if ( telnetAvailable() ) |
@@ -369,23 +387,7 @@ void Security::applySecurity() | |||
369 | 387 | ||
370 | } | 388 | } |
371 | } | 389 | } |
372 | void Security::changeSyncApp() | 390 | |
373 | { | ||
374 | // Don't say i didn't tell ya | ||
375 | if (syncapp->currentText() == "IntelliSync") { | ||
376 | QMessageBox attn( | ||
377 | tr("WARNING"), | ||
378 | tr("<p>Selecting IntelliSync here will disable the FTP password." | ||
379 | "<p>Every machine in your netrange will be able to sync with " | ||
380 | "your Zaurus!"), | ||
381 | QMessageBox::Warning, | ||
382 | QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, | ||
383 | 0, QString::null, TRUE, WStyle_StaysOnTop); | ||
384 | attn.setButtonText(QMessageBox::Cancel, tr("Ok")); | ||
385 | attn.exec(); | ||
386 | } | ||
387 | updateGUI(); | ||
388 | } | ||
389 | 391 | ||
390 | 392 | ||
391 | 393 | ||