author | zecke <zecke> | 2004-07-17 20:29:06 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-17 20:29:06 (UTC) |
commit | 872d24ff104d9ea9a7ea8ef68c8b3f98531ed677 (patch) (unidiff) | |
tree | c889395e77601bdebe3ba21b5230640501c7e083 | |
parent | d68baedc489a7ab4ab1419144608d28d5336a884 (diff) | |
download | opie-872d24ff104d9ea9a7ea8ef68c8b3f98531ed677.zip opie-872d24ff104d9ea9a7ea8ef68c8b3f98531ed677.tar.gz opie-872d24ff104d9ea9a7ea8ef68c8b3f98531ed677.tar.bz2 |
Be less verbose
clean ups
-rw-r--r-- | core/settings/security/main.cpp | 4 | ||||
-rw-r--r-- | core/settings/security/multiauthconfig.cpp | 6 | ||||
-rw-r--r-- | noncore/securityplugins/blueping/bluepingplugin.cpp | 3 | ||||
-rw-r--r-- | noncore/securityplugins/notice/noticeConfigWidget.cpp | 4 | ||||
-rw-r--r-- | noncore/securityplugins/notice/noticeConfigWidget.h | 4 | ||||
-rw-r--r-- | noncore/securityplugins/notice/noticeplugin.cpp | 2 |
6 files changed, 7 insertions, 16 deletions
diff --git a/core/settings/security/main.cpp b/core/settings/security/main.cpp index f161109..7f24490 100644 --- a/core/settings/security/main.cpp +++ b/core/settings/security/main.cpp | |||
@@ -1,46 +1,44 @@ | |||
1 | #include "multiauthconfig.h" | 1 | #include "multiauthconfig.h" |
2 | #include <opie2/oapplication.h> | 2 | #include <opie2/oapplication.h> |
3 | #include <opie2/odebug.h> | 3 | #include <opie2/odebug.h> |
4 | 4 | ||
5 | 5 | ||
6 | 6 | ||
7 | int main(int argc, char **argv) { | 7 | int main(int argc, char **argv) { |
8 | Opie::Core::OApplication app(argc, argv, "MultiAuthentication Config"); | 8 | Opie::Core::OApplication app(argc, argv, "MultiAuthentication Config"); |
9 | // protect this dialog if option set | 9 | // protect this dialog if option set |
10 | Config* pcfg = new Config("Security"); | 10 | Config* pcfg = new Config("Security"); |
11 | pcfg->setGroup( "Misc" ); | 11 | pcfg->setGroup( "Misc" ); |
12 | bool protectConfigDialog = ! pcfg->readBoolEntry("noProtectConfig", true); | 12 | bool protectConfigDialog = ! pcfg->readBoolEntry("noProtectConfig", true); |
13 | delete pcfg; | 13 | delete pcfg; |
14 | bool show = true; | 14 | bool show = true; |
15 | if ( protectConfigDialog ) | 15 | if ( protectConfigDialog ) |
16 | { | 16 | { |
17 | if (Opie::Security::Internal::runPlugins() != 0) | 17 | if (Opie::Security::Internal::runPlugins() != 0) |
18 | { | 18 | { |
19 | // authentication failed | 19 | // authentication failed |
20 | show = false; | 20 | show = false; |
21 | } | 21 | } |
22 | } | 22 | } |
23 | if ( show == true ) | 23 | if ( show == true ){ |
24 | { | ||
25 | printf("building dialog\n"); | ||
26 | MultiauthConfig dialog; | 24 | MultiauthConfig dialog; |
27 | app.setMainWidget(&dialog); | 25 | app.setMainWidget(&dialog); |
28 | 26 | ||
29 | if ( dialog.exec() == QDialog::Accepted ) { | 27 | if ( dialog.exec() == QDialog::Accepted ) { |
30 | // write the general, login and sync config | 28 | // write the general, login and sync config |
31 | dialog.writeConfig(); | 29 | dialog.writeConfig(); |
32 | // call writeConfig() on each plugin config widget | 30 | // call writeConfig() on each plugin config widget |
33 | Opie::Security::MultiauthConfigWidget *confWidget; | 31 | Opie::Security::MultiauthConfigWidget *confWidget; |
34 | for ( confWidget = dialog.configWidgetList.first(); confWidget != 0; | 32 | for ( confWidget = dialog.configWidgetList.first(); confWidget != 0; |
35 | confWidget = dialog.configWidgetList.next() ) { | 33 | confWidget = dialog.configWidgetList.next() ) { |
36 | confWidget->writeConfig(); | 34 | confWidget->writeConfig(); |
37 | } | 35 | } |
38 | } | 36 | } |
39 | dialog.close(); | 37 | dialog.close(); |
40 | app.quit(); | 38 | app.quit(); |
41 | return 0; | 39 | return 0; |
42 | } else { | 40 | } else { |
43 | owarn << "authentication failed, not showing opie-security" << oendl; | 41 | owarn << "authentication failed, not showing opie-security" << oendl; |
44 | return 1; | 42 | return 1; |
45 | } | 43 | } |
46 | } | 44 | } |
diff --git a/core/settings/security/multiauthconfig.cpp b/core/settings/security/multiauthconfig.cpp index 0ce4542..93e73c3 100644 --- a/core/settings/security/multiauthconfig.cpp +++ b/core/settings/security/multiauthconfig.cpp | |||
@@ -383,112 +383,106 @@ void MultiauthConfig::writeConfig() | |||
383 | /* | 383 | /* |
384 | pcfg->setGroup("Remote"); | 384 | pcfg->setGroup("Remote"); |
385 | if ( telnetAvailable() ) | 385 | if ( telnetAvailable() ) |
386 | pcfg->writeEntry("allow_telnet",telnet->isChecked()); | 386 | pcfg->writeEntry("allow_telnet",telnet->isChecked()); |
387 | if ( sshAvailable() ) | 387 | if ( sshAvailable() ) |
388 | pcfg->writeEntry("allow_ssh",ssh->isChecked()); | 388 | pcfg->writeEntry("allow_ssh",ssh->isChecked()); |
389 | // ### write ssh/telnet sys config files | 389 | // ### write ssh/telnet sys config files |
390 | */ | 390 | */ |
391 | 391 | ||
392 | //release the Config handler | 392 | //release the Config handler |
393 | delete pcfg; | 393 | delete pcfg; |
394 | 394 | ||
395 | QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; | 395 | QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; |
396 | Config loginCfg(configFile,Config::File); | 396 | Config loginCfg(configFile,Config::File); |
397 | loginCfg.setGroup("General"); | 397 | loginCfg.setGroup("General"); |
398 | 398 | ||
399 | if (autoLogin) { | 399 | if (autoLogin) { |
400 | loginCfg.writeEntry("AutoLogin",autoLoginName); | 400 | loginCfg.writeEntry("AutoLogin",autoLoginName); |
401 | } else { | 401 | } else { |
402 | loginCfg.removeEntry("AutoLogin"); | 402 | loginCfg.removeEntry("AutoLogin"); |
403 | } | 403 | } |
404 | 404 | ||
405 | } | 405 | } |
406 | 406 | ||
407 | /// slot used to record the fact plugins order has been modified | 407 | /// slot used to record the fact plugins order has been modified |
408 | void MultiauthConfig::pluginsChanged() { | 408 | void MultiauthConfig::pluginsChanged() { |
409 | m_plugins_changed = true; | 409 | m_plugins_changed = true; |
410 | } | 410 | } |
411 | 411 | ||
412 | /// loads each multiauth plugin | 412 | /// loads each multiauth plugin |
413 | void MultiauthConfig::loadPlugins() { | 413 | void MultiauthConfig::loadPlugins() { |
414 | 414 | ||
415 | odebug << "loading plugins..." << oendl; | ||
416 | QString path = QPEApplication::qpeDir() + "/plugins/security"; | 415 | QString path = QPEApplication::qpeDir() + "/plugins/security"; |
417 | QDir dir( path, "lib*.so" ); | 416 | QDir dir( path, "lib*.so" ); |
418 | 417 | ||
419 | QStringList list = dir.entryList(); | 418 | QStringList list = dir.entryList(); |
420 | QStringList::Iterator it; | 419 | QStringList::Iterator it; |
421 | 420 | ||
422 | // temporary list used to sort plugins | 421 | // temporary list used to sort plugins |
423 | QMap<QString, MultiauthPlugin> sortList; | 422 | QMap<QString, MultiauthPlugin> sortList; |
424 | 423 | ||
425 | for ( it = list.begin(); it != list.end(); ++it ) { | 424 | for ( it = list.begin(); it != list.end(); ++it ) { |
426 | QInterfacePtr<MultiauthPluginInterface> iface; | 425 | QInterfacePtr<MultiauthPluginInterface> iface; |
427 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 426 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
428 | QString libPath(path + "/" + *it); | 427 | QString libPath(path + "/" + *it); |
429 | odebug << "library path: " << libPath << oendl; | ||
430 | 428 | ||
431 | odebug << "querying: " << QString( path + "/" + *it ) << oendl; | ||
432 | if ( lib->queryInterface( IID_MultiauthPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { | 429 | if ( lib->queryInterface( IID_MultiauthPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { |
433 | odebug << "accepted: " << QString( path + "/" + *it ) << oendl; | ||
434 | |||
435 | MultiauthPlugin plugin; | 430 | MultiauthPlugin plugin; |
436 | plugin.library = lib; | 431 | plugin.library = lib; |
437 | plugin.iface = iface; | 432 | plugin.iface = iface; |
438 | plugin.name = QString(*it); | 433 | plugin.name = QString(*it); |
439 | 434 | ||
440 | // find out if plugins should be launched | 435 | // find out if plugins should be launched |
441 | if ( m_excludePlugins.grep( *it ).isEmpty() ) { | 436 | if ( m_excludePlugins.grep( *it ).isEmpty() ) { |
442 | plugin.active = true; | 437 | plugin.active = true; |
443 | } else { | 438 | } else { |
444 | plugin.active = false; | 439 | plugin.active = false; |
445 | } | 440 | } |
446 | 441 | ||
447 | plugin.pluginObject = plugin.iface->plugin(); | 442 | plugin.pluginObject = plugin.iface->plugin(); |
448 | 443 | ||
449 | // "prebuffer" it in one more list, to get the sorting done | 444 | // "prebuffer" it in one more list, to get the sorting done |
450 | sortList.insert( plugin.name, plugin ); | 445 | sortList.insert( plugin.name, plugin ); |
451 | 446 | ||
452 | // on first start the list is off course empty | 447 | // on first start the list is off course empty |
453 | if ( m_allPlugins.isEmpty() ) { | 448 | if ( m_allPlugins.isEmpty() ) { |
454 | pluginList.append( plugin ); | 449 | pluginList.append( plugin ); |
455 | } | 450 | } |
456 | // if plugin is not yet in the list, add it to the layout too | 451 | // if plugin is not yet in the list, add it to the layout too |
457 | else if ( !m_allPlugins.contains( plugin.name ) ) { | 452 | else if ( !m_allPlugins.contains( plugin.name ) ) { |
458 | pluginList.append( plugin ); | 453 | pluginList.append( plugin ); |
459 | } | 454 | } |
460 | 455 | ||
461 | } else { | 456 | } else { |
462 | odebug << "could not recognize " << QString( path + "/" + *it ) << oendl; | ||
463 | delete lib; | 457 | delete lib; |
464 | } | 458 | } |
465 | 459 | ||
466 | } // end for | 460 | } // end for |
467 | 461 | ||
468 | // put m_allPlugins tempPlugin objects into pluginList | 462 | // put m_allPlugins tempPlugin objects into pluginList |
469 | if ( !m_allPlugins.isEmpty() ) { | 463 | if ( !m_allPlugins.isEmpty() ) { |
470 | MultiauthPlugin tempPlugin; | 464 | MultiauthPlugin tempPlugin; |
471 | QStringList::Iterator stringit; | 465 | QStringList::Iterator stringit; |
472 | for( stringit = m_allPlugins.begin(); stringit != m_allPlugins.end(); ++stringit ) { | 466 | for( stringit = m_allPlugins.begin(); stringit != m_allPlugins.end(); ++stringit ) { |
473 | tempPlugin = ( sortList.find( *stringit ) ).data(); | 467 | tempPlugin = ( sortList.find( *stringit ) ).data(); |
474 | if ( !( (tempPlugin.name).isEmpty() ) ) { | 468 | if ( !( (tempPlugin.name).isEmpty() ) ) { |
475 | pluginList.append( tempPlugin ); | 469 | pluginList.append( tempPlugin ); |
476 | } | 470 | } |
477 | } | 471 | } |
478 | } | 472 | } |
479 | 473 | ||
480 | } | 474 | } |
481 | 475 | ||
482 | void MultiauthConfig::deleteListEntry() | 476 | void MultiauthConfig::deleteListEntry() |
483 | { | 477 | { |
484 | m_syncWidget->syncnet->removeItem(m_syncWidget->syncnet->currentItem()); | 478 | m_syncWidget->syncnet->removeItem(m_syncWidget->syncnet->currentItem()); |
485 | } | 479 | } |
486 | 480 | ||
487 | void MultiauthConfig::restoreDefaults() | 481 | void MultiauthConfig::restoreDefaults() |
488 | { | 482 | { |
489 | QMessageBox unrecbox( | 483 | QMessageBox unrecbox( |
490 | tr("Attention"), | 484 | tr("Attention"), |
491 | tr( "<p>All user-defined net ranges will be lost."), | 485 | tr( "<p>All user-defined net ranges will be lost."), |
492 | QMessageBox::Warning, | 486 | QMessageBox::Warning, |
493 | QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, | 487 | QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, |
494 | 0, QString::null, TRUE, WStyle_StaysOnTop); | 488 | 0, QString::null, TRUE, WStyle_StaysOnTop); |
diff --git a/noncore/securityplugins/blueping/bluepingplugin.cpp b/noncore/securityplugins/blueping/bluepingplugin.cpp index f4c5e95..05fd3c2 100644 --- a/noncore/securityplugins/blueping/bluepingplugin.cpp +++ b/noncore/securityplugins/blueping/bluepingplugin.cpp | |||
@@ -1,62 +1,61 @@ | |||
1 | #include "bluepingplugin.h" | 1 | #include "bluepingplugin.h" |
2 | 2 | ||
3 | #include <opie2/oapplication.h> | 3 | #include <opie2/oapplication.h> |
4 | #include <opie2/odebug.h> | 4 | #include <opie2/odebug.h> |
5 | #include <opie2/odevice.h> | 5 | #include <opie2/odevice.h> |
6 | 6 | ||
7 | #include <qdialog.h> | 7 | #include <qdialog.h> |
8 | #include <qlayout.h> | 8 | #include <qlayout.h> |
9 | #include <qhbox.h> | 9 | #include <qhbox.h> |
10 | #include <qlabel.h> | 10 | #include <qlabel.h> |
11 | #include <qpushbutton.h> | 11 | #include <qpushbutton.h> |
12 | #include <qtimer.h> | 12 | #include <qtimer.h> |
13 | 13 | ||
14 | using namespace Opie::Core; | 14 | using namespace Opie::Core; |
15 | using Opie::Security::MultiauthPluginObject; | 15 | using Opie::Security::MultiauthPluginObject; |
16 | using Opie::Security::MultiauthConfigWidget; | 16 | using Opie::Security::MultiauthConfigWidget; |
17 | 17 | ||
18 | 18 | ||
19 | /// creates and initializes the m_config Config object | 19 | /// creates and initializes the m_config Config object |
20 | BluepingPlugin::BluepingPlugin() : MultiauthPluginObject(), m_ping(0) { | 20 | BluepingPlugin::BluepingPlugin() : MultiauthPluginObject(), m_ping(0) { |
21 | m_config = new Config("Security"); | 21 | m_config = new Config("Security"); |
22 | m_config->setGroup("BluepingPlugin"); | 22 | m_config->setGroup("BluepingPlugin"); |
23 | bluetoothAlreadyRestarted = false; | 23 | bluetoothAlreadyRestarted = false; |
24 | } | 24 | } |
25 | 25 | ||
26 | /// deletes the m_config Config object and noticeW if necessary | 26 | /// deletes the m_config Config object and noticeW if necessary |
27 | BluepingPlugin::~BluepingPlugin() { | 27 | BluepingPlugin::~BluepingPlugin() { |
28 | delete m_config; | 28 | delete m_config; |
29 | if (m_ping != 0) | 29 | delete m_ping; |
30 | delete m_ping; | ||
31 | } | 30 | } |
32 | 31 | ||
33 | /// Simply return its name (Blueping plugin) | 32 | /// Simply return its name (Blueping plugin) |
34 | QString BluepingPlugin::pluginName() const { | 33 | QString BluepingPlugin::pluginName() const { |
35 | return "Blueping plugin"; | 34 | return "Blueping plugin"; |
36 | } | 35 | } |
37 | 36 | ||
38 | /// no configuration widget for the moment | 37 | /// no configuration widget for the moment |
39 | MultiauthConfigWidget * BluepingPlugin::configWidget(QWidget * parent) { | 38 | MultiauthConfigWidget * BluepingPlugin::configWidget(QWidget * parent) { |
40 | return 0l; | 39 | return 0l; |
41 | } | 40 | } |
42 | QString BluepingPlugin::pixmapNameWidget() const { | 41 | QString BluepingPlugin::pixmapNameWidget() const { |
43 | return "security/bluepingplugin"; | 42 | return "security/bluepingplugin"; |
44 | } | 43 | } |
45 | QString BluepingPlugin::pixmapNameConfig() const { | 44 | QString BluepingPlugin::pixmapNameConfig() const { |
46 | return 0l; | 45 | return 0l; |
47 | } | 46 | } |
48 | 47 | ||
49 | /// Emit the MultiauthPluginObject::Success emitCode | 48 | /// Emit the MultiauthPluginObject::Success emitCode |
50 | void BluepingPlugin::success() { | 49 | void BluepingPlugin::success() { |
51 | emit emitCode(MultiauthPluginObject::Success); | 50 | emit emitCode(MultiauthPluginObject::Success); |
52 | } | 51 | } |
53 | 52 | ||
54 | /// Emit the MultiauthPluginObject::Failure emitCode | 53 | /// Emit the MultiauthPluginObject::Failure emitCode |
55 | void BluepingPlugin::failure() { | 54 | void BluepingPlugin::failure() { |
56 | emit emitCode(MultiauthPluginObject::Failure); | 55 | emit emitCode(MultiauthPluginObject::Failure); |
57 | } | 56 | } |
58 | 57 | ||
59 | /// Emit the MultiauthPluginObject::Skip emitCode | 58 | /// Emit the MultiauthPluginObject::Skip emitCode |
60 | void BluepingPlugin::skip() { | 59 | void BluepingPlugin::skip() { |
61 | emit emitCode(MultiauthPluginObject::Skip); | 60 | emit emitCode(MultiauthPluginObject::Skip); |
62 | } | 61 | } |
diff --git a/noncore/securityplugins/notice/noticeConfigWidget.cpp b/noncore/securityplugins/notice/noticeConfigWidget.cpp index e532232..e0468a7 100644 --- a/noncore/securityplugins/notice/noticeConfigWidget.cpp +++ b/noncore/securityplugins/notice/noticeConfigWidget.cpp | |||
@@ -28,56 +28,56 @@ NoticeConfigWidget::NoticeConfigWidget(QWidget* parent = 0, const char* name = " | |||
28 | // Set the multilineedit box text to getNoticeText() | 28 | // Set the multilineedit box text to getNoticeText() |
29 | noticeMLE = new QMultiLineEdit(configBox, "notice text"); | 29 | noticeMLE = new QMultiLineEdit(configBox, "notice text"); |
30 | noticeMLE->setWordWrap(QMultiLineEdit::WidgetWidth); | 30 | noticeMLE->setWordWrap(QMultiLineEdit::WidgetWidth); |
31 | noticeMLE->setFocus(); | 31 | noticeMLE->setFocus(); |
32 | noticeMLE->setText(getNoticeText()); | 32 | noticeMLE->setText(getNoticeText()); |
33 | boxLayout->addWidget(noticeMLE); | 33 | boxLayout->addWidget(noticeMLE); |
34 | 34 | ||
35 | resetNoticeButton = new QPushButton( tr("Reset notice to default"), configBox, "reset Notice Button" ); | 35 | resetNoticeButton = new QPushButton( tr("Reset notice to default"), configBox, "reset Notice Button" ); |
36 | connect(resetNoticeButton, SIGNAL( clicked() ), this, SLOT( resetNotice() )); | 36 | connect(resetNoticeButton, SIGNAL( clicked() ), this, SLOT( resetNotice() )); |
37 | boxLayout->addWidget(resetNoticeButton, 0, Qt::AlignHCenter); | 37 | boxLayout->addWidget(resetNoticeButton, 0, Qt::AlignHCenter); |
38 | 38 | ||
39 | QLabel * comment2 = new QLabel("<p>" + tr("Note: you can use HTML tags to improve its layout (example: text between <em> and </em> will be <em>emphasized</em>)") + "</p>", configBox); | 39 | QLabel * comment2 = new QLabel("<p>" + tr("Note: you can use HTML tags to improve its layout (example: text between <em> and </em> will be <em>emphasized</em>)") + "</p>", configBox); |
40 | boxLayout->addWidget(comment2); | 40 | boxLayout->addWidget(comment2); |
41 | 41 | ||
42 | } | 42 | } |
43 | 43 | ||
44 | /// nothing to do | 44 | /// nothing to do |
45 | NoticeConfigWidget::~NoticeConfigWidget() | 45 | NoticeConfigWidget::~NoticeConfigWidget() |
46 | {} | 46 | {} |
47 | 47 | ||
48 | /// write the notice text in the multiauth.conf Config file | 48 | /// write the notice text in the multiauth.conf Config file |
49 | void NoticeConfigWidget::writeConfig() | 49 | void NoticeConfigWidget::writeConfig() |
50 | { | 50 | { |
51 | if ( noticeMLE->edited() ) { | 51 | if ( noticeMLE->edited() ) { |
52 | odebug << "writing new notice text in Security.conf" << oendl; | 52 | odebug << "writing new notice text in Security.conf" << oendl; |
53 | setNoticeText(noticeMLE->text()); | 53 | setNoticeText(noticeMLE->text()); |
54 | } | 54 | } |
55 | } | 55 | } |
56 | 56 | ||
57 | /// reset the notice text to the hard-coded example defaultNoticeText | 57 | /// reset the notice text to the hard-coded example defaultNoticeText |
58 | void NoticeConfigWidget::resetNotice() | 58 | void NoticeConfigWidget::resetNotice() |
59 | { | 59 | { |
60 | noticeMLE->setText(defaultNoticeText); | 60 | noticeMLE->setText(QObject::tr(defaultNoticeText)); |
61 | } | 61 | } |
62 | 62 | ||
63 | /// get the notice text from the config file (with true new lines) | 63 | /// get the notice text from the config file (with true new lines) |
64 | /** | 64 | /** |
65 | * if no text has been defined yet returns defaultNoticeText | 65 | * if no text has been defined yet returns defaultNoticeText |
66 | */ | 66 | */ |
67 | QString NoticeConfigWidget::getNoticeText() { | 67 | QString NoticeConfigWidget::getNoticeText() { |
68 | m_config = new Config("Security"); | 68 | m_config = new Config("Security"); |
69 | m_config->setGroup("NoticePlugin"); | 69 | m_config->setGroup("NoticePlugin"); |
70 | // Note: C++ processes '\' character, so we have to type \\\\ to mean \\ to QRegExp | 70 | // Note: C++ processes '\' character, so we have to type \\\\ to mean \\ to QRegExp |
71 | QString noticeText = m_config->readEntry("noticeText", defaultNoticeText).replace( QRegExp("\\\\n"), "\n" ); | 71 | QString noticeText = m_config->readEntry("noticeText", QObject::tr(defaultNoticeText) ).replace( QRegExp("\\\\n"), "\n" ); |
72 | delete m_config; | 72 | delete m_config; |
73 | return noticeText; | 73 | return noticeText; |
74 | } | 74 | } |
75 | 75 | ||
76 | /// set the notice text in our m_config config file (escaping new lines) | 76 | /// set the notice text in our m_config config file (escaping new lines) |
77 | void NoticeConfigWidget::setNoticeText(QString noticeText) { | 77 | void NoticeConfigWidget::setNoticeText(QString noticeText) { |
78 | m_config = new Config("Security"); | 78 | m_config = new Config("Security"); |
79 | m_config->setGroup("NoticePlugin"); | 79 | m_config->setGroup("NoticePlugin"); |
80 | // since Config files do not allow true newlines, we replace them with litteral "\n" | 80 | // since Config files do not allow true newlines, we replace them with litteral "\n" |
81 | m_config->writeEntry("noticeText", noticeText.replace( QRegExp("\n"), "\\n" )); | 81 | m_config->writeEntry("noticeText", noticeText.replace( QRegExp("\n"), "\\n" )); |
82 | delete m_config; | 82 | delete m_config; |
83 | } | 83 | } |
diff --git a/noncore/securityplugins/notice/noticeConfigWidget.h b/noncore/securityplugins/notice/noticeConfigWidget.h index c90484c..f8847e4 100644 --- a/noncore/securityplugins/notice/noticeConfigWidget.h +++ b/noncore/securityplugins/notice/noticeConfigWidget.h | |||
@@ -11,62 +11,62 @@ | |||
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This library is distributed in the hope that | 17 | .i_,=:_. -<s. This library is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef NOTICECONFIGWIDGET_H | 34 | #ifndef NOTICECONFIGWIDGET_H |
35 | #define NOTICECONFIGWIDGET_H | 35 | #define NOTICECONFIGWIDGET_H |
36 | 36 | ||
37 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
38 | #include <qmultilineedit.h> | 38 | #include <qmultilineedit.h> |
39 | #include <qpe/config.h> | 39 | #include <qpe/config.h> |
40 | 40 | ||
41 | #include <opie2/multiauthconfigwidget.h> | 41 | #include <opie2/multiauthconfigwidget.h> |
42 | 42 | ||
43 | static char defaultNoticeText [] = "<h2>NOTICE TO USERS</h2>\n" | 43 | static char defaultNoticeText [] = QT_TRANSLATE_NOOP( "QObject", "<h2>NOTICE TO USERS</h2>\n" |
44 | "<p>This is a private computer system and is the property of " | 44 | "<p>This is a private computer system and is the property of " |
45 | "the company XXX / Mr or Ms X. It is for authorized " | 45 | "the company XXX / Mr or Ms X. It is for authorized " |
46 | "use only. Users have no expectation of privacy.</p>\n" | 46 | "use only. Users have no expectation of privacy.</p>\n" |
47 | "<p><strong>Unauthorized or improper use of this system may result in " | 47 | "<p><strong>Unauthorized or improper use of this system may result in " |
48 | "disciplinary action and civil and criminal penalties. <em>By continuing to use " | 48 | "disciplinary action and civil and criminal penalties. <em>By continuing to use " |
49 | "this system you indicate your awareness of and consent to these " | 49 | "this system you indicate your awareness of and consent to these " |
50 | "terms. LOG OFF IMMEDIATELY if you do not agree to them.</em></strong></p>"; | 50 | "terms. LOG OFF IMMEDIATELY if you do not agree to them.</em></strong></p>"); |
51 | 51 | ||
52 | class NoticeConfigWidget : public Opie::Security::MultiauthConfigWidget { | 52 | class NoticeConfigWidget : public Opie::Security::MultiauthConfigWidget { |
53 | 53 | ||
54 | Q_OBJECT | 54 | Q_OBJECT |
55 | 55 | ||
56 | public: | 56 | public: |
57 | NoticeConfigWidget(QWidget* parent, const char* name); | 57 | NoticeConfigWidget(QWidget* parent, const char* name); |
58 | virtual ~NoticeConfigWidget(); | 58 | virtual ~NoticeConfigWidget(); |
59 | virtual void writeConfig(); | 59 | virtual void writeConfig(); |
60 | private: | 60 | private: |
61 | QMultiLineEdit * noticeMLE; | 61 | QMultiLineEdit * noticeMLE; |
62 | QPushButton * resetNoticeButton; | 62 | QPushButton * resetNoticeButton; |
63 | private slots: | 63 | private slots: |
64 | void resetNotice(); | 64 | void resetNotice(); |
65 | private: | 65 | private: |
66 | Config * m_config; | 66 | Config * m_config; |
67 | QString getNoticeText(); | 67 | QString getNoticeText(); |
68 | void setNoticeText(QString noticeText); | 68 | void setNoticeText(QString noticeText); |
69 | }; | 69 | }; |
70 | 70 | ||
71 | #endif // NOTICECONFIGWIDGET_H | 71 | #endif // NOTICECONFIGWIDGET_H |
72 | 72 | ||
diff --git a/noncore/securityplugins/notice/noticeplugin.cpp b/noncore/securityplugins/notice/noticeplugin.cpp index 25a452a..1da260a 100644 --- a/noncore/securityplugins/notice/noticeplugin.cpp +++ b/noncore/securityplugins/notice/noticeplugin.cpp | |||
@@ -52,35 +52,35 @@ QString NoticePlugin::pixmapNameWidget() const { | |||
52 | */ | 52 | */ |
53 | int NoticePlugin::authenticate() { | 53 | int NoticePlugin::authenticate() { |
54 | QMessageBox noticeDialog("Notice plugin", | 54 | QMessageBox noticeDialog("Notice plugin", |
55 | getNoticeText(), | 55 | getNoticeText(), |
56 | QMessageBox::Warning, | 56 | QMessageBox::Warning, |
57 | QMessageBox::Yes, | 57 | QMessageBox::Yes, |
58 | 0, | 58 | 0, |
59 | 0, | 59 | 0, |
60 | 0, | 60 | 0, |
61 | "notice plugin dialog", | 61 | "notice plugin dialog", |
62 | true, | 62 | true, |
63 | Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop); | 63 | Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop); |
64 | 64 | ||
65 | noticeDialog.setButtonText(QMessageBox::Yes, tr("I accept")); | 65 | noticeDialog.setButtonText(QMessageBox::Yes, tr("I accept")); |
66 | 66 | ||
67 | QRect desk = oApp->desktop()->geometry(); | 67 | QRect desk = oApp->desktop()->geometry(); |
68 | noticeDialog.setGeometry( 0, 0, desk.width(), desk.height() ); | 68 | noticeDialog.setGeometry( 0, 0, desk.width(), desk.height() ); |
69 | 69 | ||
70 | switch (noticeDialog.exec()) | 70 | switch (noticeDialog.exec()) |
71 | { | 71 | { |
72 | case QMessageBox::Yes: | 72 | case QMessageBox::Yes: |
73 | return MultiauthPluginObject::Success; | 73 | return MultiauthPluginObject::Success; |
74 | } | 74 | } |
75 | return 255; //should not be returned anyway | 75 | return 255; //should not be returned anyway |
76 | } | 76 | } |
77 | 77 | ||
78 | /// get the notice text from our m_config config file (with true new lines) | 78 | /// get the notice text from our m_config config file (with true new lines) |
79 | /** | 79 | /** |
80 | * if no text has been defined yet returns defaultNoticeText | 80 | * if no text has been defined yet returns defaultNoticeText |
81 | */ | 81 | */ |
82 | QString NoticePlugin::getNoticeText() { | 82 | QString NoticePlugin::getNoticeText() { |
83 | // Note: C++ processes '\' character, so we have to type \\\\ to mean \\ to QRegExp | 83 | // Note: C++ processes '\' character, so we have to type \\\\ to mean \\ to QRegExp |
84 | return m_config->readEntry("noticeText", defaultNoticeText).replace( QRegExp("\\\\n"), "\n" ); | 84 | return m_config->readEntry("noticeText", QObject::tr(defaultNoticeText)).replace( QRegExp("\\\\n"), "\n" ); |
85 | } | 85 | } |
86 | 86 | ||