author | zecke <zecke> | 2004-12-20 22:02:47 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-12-20 22:02:47 (UTC) |
commit | 4a9d317adb576fed2164638a1d4d15c75eebfd6b (patch) (unidiff) | |
tree | c4634ae780964cb96edae64a3fd07a641c46e427 | |
parent | 086e832c16265a086e455ead0e5a64f61e2078e7 (diff) | |
download | opie-4a9d317adb576fed2164638a1d4d15c75eebfd6b.zip opie-4a9d317adb576fed2164638a1d4d15c75eebfd6b.tar.gz opie-4a9d317adb576fed2164638a1d4d15c75eebfd6b.tar.bz2 |
Keep only 'local' Config instances to avoid some older
instance reverting changes! (weakness of Config class)
-rw-r--r-- | core/settings/security/multiauthconfig.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/core/settings/security/multiauthconfig.cpp b/core/settings/security/multiauthconfig.cpp index 45d691b..7a5f7b9 100644 --- a/core/settings/security/multiauthconfig.cpp +++ b/core/settings/security/multiauthconfig.cpp | |||
@@ -148,25 +148,25 @@ static void test_and_start() { | |||
148 | m_nbSuccessReq(0), m_plugins_changed(false) | 148 | m_nbSuccessReq(0), m_plugins_changed(false) |
149 | { | 149 | { |
150 | /* Initializes the global configuration window | 150 | /* Initializes the global configuration window |
151 | */ | 151 | */ |
152 | test_and_start(); | 152 | test_and_start(); |
153 | 153 | ||
154 | /* Checks (and memorizes) if any authentication plugins are | 154 | /* Checks (and memorizes) if any authentication plugins are |
155 | * installed on the system | 155 | * installed on the system |
156 | */ | 156 | */ |
157 | QString path = QPEApplication::qpeDir() + "plugins/security"; | 157 | QString path = QPEApplication::qpeDir() + "plugins/security"; |
158 | QDir dir( path, "lib*.so" ); | 158 | QDir dir( path, "lib*.so" ); |
159 | QStringList list = dir.entryList(); | 159 | QStringList list = dir.entryList(); |
160 | 160 | ||
161 | m_pluginsInstalled = ! list.isEmpty(); | 161 | m_pluginsInstalled = ! list.isEmpty(); |
162 | if (m_pluginsInstalled == false) | 162 | if (m_pluginsInstalled == false) |
163 | owarn << "no authentication plugins installed! Talking about it in the last tab..." << oendl; | 163 | owarn << "no authentication plugins installed! Talking about it in the last tab..." << oendl; |
164 | 164 | ||
165 | setCaption( tr( "Security configuration" ) ); | 165 | setCaption( tr( "Security configuration" ) ); |
166 | QVBoxLayout *layout = new QVBoxLayout( this ); | 166 | QVBoxLayout *layout = new QVBoxLayout( this ); |
167 | m_mainTW = new Opie::Ui::OTabWidget( this, "main tab widget" ); | 167 | m_mainTW = new Opie::Ui::OTabWidget( this, "main tab widget" ); |
168 | layout->addWidget(m_mainTW); | 168 | layout->addWidget(m_mainTW); |
169 | 169 | ||
170 | if (m_pluginsInstalled) | 170 | if (m_pluginsInstalled) |
171 | { | 171 | { |
172 | m_pluginListWidget = new QWidget(m_mainTW, "plugin list widget"); | 172 | m_pluginListWidget = new QWidget(m_mainTW, "plugin list widget"); |
@@ -266,30 +266,30 @@ static void test_and_start() { | |||
266 | } | 266 | } |
267 | 267 | ||
268 | showMaximized(); | 268 | showMaximized(); |
269 | } | 269 | } |
270 | 270 | ||
271 | /// nothing to do | 271 | /// nothing to do |
272 | MultiauthConfig::~MultiauthConfig() | 272 | MultiauthConfig::~MultiauthConfig() |
273 | { | 273 | { |
274 | } | 274 | } |
275 | 275 | ||
276 | /// saves the general and plugin(s) configurations | 276 | /// saves the general and plugin(s) configurations |
277 | void MultiauthConfig::writeConfigs() { | 277 | void MultiauthConfig::writeConfigs() { |
278 | writeConfig(); | ||
279 | |||
280 | MultiauthConfigWidget* confWidget = 0; | 278 | MultiauthConfigWidget* confWidget = 0; |
281 | for ( confWidget = configWidgetList.first(); confWidget != 0; | 279 | for ( confWidget = configWidgetList.first(); confWidget != 0; |
282 | confWidget = configWidgetList.next() ) | 280 | confWidget = configWidgetList.next() ) |
283 | confWidget->writeConfig(); | 281 | confWidget->writeConfig(); |
282 | |||
283 | writeConfig(); | ||
284 | } | 284 | } |
285 | 285 | ||
286 | /// on QDialog::accept, we save all the configurations and exit the QDialog normally | 286 | /// on QDialog::accept, we save all the configurations and exit the QDialog normally |
287 | void MultiauthConfig::accept() { | 287 | void MultiauthConfig::accept() { |
288 | writeConfigs(); | 288 | writeConfigs(); |
289 | QDialog::accept(); | 289 | QDialog::accept(); |
290 | } | 290 | } |
291 | 291 | ||
292 | void MultiauthConfig::done( int r ) { | 292 | void MultiauthConfig::done( int r ) { |
293 | QDialog::done( r ); | 293 | QDialog::done( r ); |
294 | close(); | 294 | close(); |
295 | } | 295 | } |
@@ -390,113 +390,113 @@ void MultiauthConfig::readConfig() | |||
390 | connect(m_loginWidget->autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool))); | 390 | connect(m_loginWidget->autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool))); |
391 | connect(m_loginWidget->userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int))); | 391 | connect(m_loginWidget->userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int))); |
392 | connect(m_syncWidget->restoredefaults,SIGNAL(clicked()), this, SLOT(restoreDefaults())); | 392 | connect(m_syncWidget->restoredefaults,SIGNAL(clicked()), this, SLOT(restoreDefaults())); |
393 | connect(m_syncWidget->deleteentry,SIGNAL(clicked()), this, SLOT(deleteListEntry())); | 393 | connect(m_syncWidget->deleteentry,SIGNAL(clicked()), this, SLOT(deleteListEntry())); |
394 | 394 | ||
395 | loadUsers(); | 395 | loadUsers(); |
396 | updateGUI(); | 396 | updateGUI(); |
397 | 397 | ||
398 | } | 398 | } |
399 | 399 | ||
400 | void MultiauthConfig::writeConfig() | 400 | void MultiauthConfig::writeConfig() |
401 | { | 401 | { |
402 | Config* pcfg = new Config("Security"); | 402 | Config pcfg("Security"); |
403 | 403 | ||
404 | if (m_pluginsInstalled) | 404 | if (m_pluginsInstalled) |
405 | { | 405 | { |
406 | pcfg->setGroup( "Plugins" ); | 406 | pcfg.setGroup( "Plugins" ); |
407 | QStringList exclude; | 407 | QStringList exclude; |
408 | QStringList include; | 408 | QStringList include; |
409 | QStringList allPlugins; | 409 | QStringList allPlugins; |
410 | 410 | ||
411 | QListViewItemIterator list_it( m_pluginListView ); | 411 | QListViewItemIterator list_it( m_pluginListView ); |
412 | 412 | ||
413 | // this makes sure the names get saved in the order selected | 413 | // this makes sure the names get saved in the order selected |
414 | for ( ; list_it.current(); ++list_it ) { | 414 | for ( ; list_it.current(); ++list_it ) { |
415 | QMap <QString, QCheckListItem *>::Iterator it; | 415 | QMap <QString, QCheckListItem *>::Iterator it; |
416 | for ( it = m_plugins.begin(); it != m_plugins. end (); ++it ) { | 416 | for ( it = m_plugins.begin(); it != m_plugins. end (); ++it ) { |
417 | if ( list_it.current() == (*it) && !(*it)-> isOn () ) { | 417 | if ( list_it.current() == (*it) && !(*it)-> isOn () ) { |
418 | exclude << it.key(); | 418 | exclude << it.key(); |
419 | } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ | 419 | } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ |
420 | include << it.key(); | 420 | include << it.key(); |
421 | } | 421 | } |
422 | if ( list_it.current() == (*it) ) { | 422 | if ( list_it.current() == (*it) ) { |
423 | allPlugins << it.key(); | 423 | allPlugins << it.key(); |
424 | } | 424 | } |
425 | } | 425 | } |
426 | } | 426 | } |
427 | pcfg->writeEntry( "ExcludePlugins", exclude, ',' ); | 427 | pcfg.writeEntry( "ExcludePlugins", exclude, ',' ); |
428 | pcfg->writeEntry( "IncludePlugins", include, ',' ); | 428 | pcfg.writeEntry( "IncludePlugins", include, ',' ); |
429 | pcfg->writeEntry( "AllPlugins", allPlugins, ',' ); | 429 | pcfg.writeEntry( "AllPlugins", allPlugins, ',' ); |
430 | 430 | ||
431 | pcfg->setGroup( "Misc" ); | 431 | pcfg.setGroup( "Misc" ); |
432 | pcfg->writeEntry( "onStart", m_generalConfig->m_onStart->isChecked() ); | 432 | pcfg.writeEntry( "onStart", m_generalConfig->m_onStart->isChecked() ); |
433 | pcfg->writeEntry( "onResume", m_generalConfig->m_onResume->isChecked() ); | 433 | pcfg.writeEntry( "onResume", m_generalConfig->m_onResume->isChecked() ); |
434 | pcfg->writeEntry( "nbSuccessMin", m_generalConfig->m_nbSuccessMin->text() ); | 434 | pcfg.writeEntry( "nbSuccessMin", m_generalConfig->m_nbSuccessMin->text() ); |
435 | pcfg->writeEntry( "noProtectConfig", m_generalConfig->m_noProtectConfig->isChecked() ); | 435 | pcfg.writeEntry( "noProtectConfig", m_generalConfig->m_noProtectConfig->isChecked() ); |
436 | pcfg->writeEntry( "explanScreens", m_generalConfig->m_explanScreens->isChecked() ); | 436 | pcfg.writeEntry( "explanScreens", m_generalConfig->m_explanScreens->isChecked() ); |
437 | } | 437 | } |
438 | 438 | ||
439 | /* Login and Sync stuff */ | 439 | /* Login and Sync stuff */ |
440 | 440 | ||
441 | pcfg->setGroup("Sync"); | 441 | pcfg.setGroup("Sync"); |
442 | int auth_peer=0; | 442 | int auth_peer=0; |
443 | int auth_peer_bits; | 443 | int auth_peer_bits; |
444 | QString sn = m_syncWidget->syncnet->currentText(); | 444 | QString sn = m_syncWidget->syncnet->currentText(); |
445 | parseNet(sn,auth_peer,auth_peer_bits); | 445 | parseNet(sn,auth_peer,auth_peer_bits); |
446 | 446 | ||
447 | //this is the *selected* (active) net range | 447 | //this is the *selected* (active) net range |
448 | pcfg->writeEntry("auth_peer",auth_peer); | 448 | pcfg.writeEntry("auth_peer",auth_peer); |
449 | pcfg->writeEntry("auth_peer_bits",auth_peer_bits); | 449 | pcfg.writeEntry("auth_peer_bits",auth_peer_bits); |
450 | 450 | ||
451 | //write back all other net ranges in *cleartext* | 451 | //write back all other net ranges in *cleartext* |
452 | for (int i=0; i<10; i++) { | 452 | for (int i=0; i<10; i++) { |
453 | QString target; | 453 | QString target; |
454 | target.sprintf("net%d", i); | 454 | target.sprintf("net%d", i); |
455 | if ( i < m_syncWidget->syncnet->count() ) | 455 | if ( i < m_syncWidget->syncnet->count() ) |
456 | pcfg->writeEntry(target, m_syncWidget->syncnet->text(i)); | 456 | pcfg.writeEntry(target, m_syncWidget->syncnet->text(i)); |
457 | else // no more entry in the syncnet list -> we clear the line | 457 | else // no more entry in the syncnet list -> we clear the line |
458 | pcfg->writeEntry(target, ""); | 458 | pcfg.writeEntry(target, ""); |
459 | } | 459 | } |
460 | 460 | ||
461 | #ifdef ODP | 461 | #ifdef ODP |
462 | #error "Use 0,1,2 and use Launcher" | 462 | #error "Use 0,1,2 and use Launcher" |
463 | #endif | 463 | #endif |
464 | /* keep the old code so we don't use currentItem directly */ | 464 | /* keep the old code so we don't use currentItem directly */ |
465 | int value = 0x02; | 465 | int value = 0x02; |
466 | switch( m_syncWidget->syncModeCombo->currentItem() ) { | 466 | switch( m_syncWidget->syncModeCombo->currentItem() ) { |
467 | case 0: | 467 | case 0: |
468 | value = 0x01; | 468 | value = 0x01; |
469 | break; | 469 | break; |
470 | case 1: | 470 | case 1: |
471 | value = 0x02; | 471 | value = 0x02; |
472 | break; | 472 | break; |
473 | case 2: | 473 | case 2: |
474 | value = 0x04; | 474 | value = 0x04; |
475 | break; | 475 | break; |
476 | } | 476 | } |
477 | pcfg->setGroup("SyncMode"); | 477 | pcfg.setGroup("SyncMode"); |
478 | pcfg->writeEntry( "Mode", value ); | 478 | pcfg.writeEntry( "Mode", value ); |
479 | 479 | ||
480 | /* | 480 | /* |
481 | pcfg->setGroup("Remote"); | 481 | pcfg.setGroup("Remote"); |
482 | if ( telnetAvailable() ) | 482 | if ( telnetAvailable() ) |
483 | pcfg->writeEntry("allow_telnet",telnet->isChecked()); | 483 | pcfg.writeEntry("allow_telnet",telnet->isChecked()); |
484 | if ( sshAvailable() ) | 484 | if ( sshAvailable() ) |
485 | pcfg->writeEntry("allow_ssh",ssh->isChecked()); | 485 | pcfg.writeEntry("allow_ssh",ssh->isChecked()); |
486 | // ### write ssh/telnet sys config files | 486 | // ### write ssh/telnet sys config files |
487 | */ | 487 | */ |
488 | 488 | ||
489 | //release the Config handler | 489 | //release the Config handler |
490 | delete pcfg; | 490 | pcfg.write(); |
491 | 491 | ||
492 | QString configFile = QPEApplication::qpeDir() + "etc/opie-login.conf"; | 492 | QString configFile = QPEApplication::qpeDir() + "etc/opie-login.conf"; |
493 | Config loginCfg(configFile,Config::File); | 493 | Config loginCfg(configFile,Config::File); |
494 | loginCfg.setGroup("General"); | 494 | loginCfg.setGroup("General"); |
495 | 495 | ||
496 | if (autoLogin) { | 496 | if (autoLogin) { |
497 | loginCfg.writeEntry("AutoLogin",autoLoginName); | 497 | loginCfg.writeEntry("AutoLogin",autoLoginName); |
498 | } else { | 498 | } else { |
499 | loginCfg.removeEntry("AutoLogin"); | 499 | loginCfg.removeEntry("AutoLogin"); |
500 | } | 500 | } |
501 | 501 | ||
502 | } | 502 | } |