-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 @@ #include "multiauthconfig.h" #include <opie2/oapplication.h> #include <opie2/odebug.h> int main(int argc, char **argv) { Opie::Core::OApplication app(argc, argv, "MultiAuthentication Config"); // protect this dialog if option set Config* pcfg = new Config("Security"); pcfg->setGroup( "Misc" ); bool protectConfigDialog = ! pcfg->readBoolEntry("noProtectConfig", true); delete pcfg; bool show = true; if ( protectConfigDialog ) { if (Opie::Security::Internal::runPlugins() != 0) { // authentication failed show = false; } } - if ( show == true ) - { - printf("building dialog\n"); + if ( show == true ){ MultiauthConfig dialog; app.setMainWidget(&dialog); if ( dialog.exec() == QDialog::Accepted ) { // write the general, login and sync config dialog.writeConfig(); // call writeConfig() on each plugin config widget Opie::Security::MultiauthConfigWidget *confWidget; for ( confWidget = dialog.configWidgetList.first(); confWidget != 0; confWidget = dialog.configWidgetList.next() ) { confWidget->writeConfig(); } } dialog.close(); app.quit(); return 0; } else { owarn << "authentication failed, not showing opie-security" << oendl; return 1; } } 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 @@ -367,144 +367,138 @@ void MultiauthConfig::writeConfig() /* keep the old code so we don't use currentItem directly */ int value = 0x02; switch( m_syncWidget->syncModeCombo->currentItem() ) { case 0: value = 0x01; break; case 1: value = 0x02; break; case 2: value = 0x04; break; } pcfg->setGroup("SyncMode"); pcfg->writeEntry( "Mode", value ); /* pcfg->setGroup("Remote"); if ( telnetAvailable() ) pcfg->writeEntry("allow_telnet",telnet->isChecked()); if ( sshAvailable() ) pcfg->writeEntry("allow_ssh",ssh->isChecked()); // ### write ssh/telnet sys config files */ //release the Config handler delete pcfg; QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; Config loginCfg(configFile,Config::File); loginCfg.setGroup("General"); if (autoLogin) { loginCfg.writeEntry("AutoLogin",autoLoginName); } else { loginCfg.removeEntry("AutoLogin"); } } /// slot used to record the fact plugins order has been modified void MultiauthConfig::pluginsChanged() { m_plugins_changed = true; } /// loads each multiauth plugin void MultiauthConfig::loadPlugins() { - odebug << "loading plugins..." << oendl; QString path = QPEApplication::qpeDir() + "/plugins/security"; QDir dir( path, "lib*.so" ); QStringList list = dir.entryList(); QStringList::Iterator it; // temporary list used to sort plugins QMap<QString, MultiauthPlugin> sortList; for ( it = list.begin(); it != list.end(); ++it ) { QInterfacePtr<MultiauthPluginInterface> iface; QLibrary *lib = new QLibrary( path + "/" + *it ); QString libPath(path + "/" + *it); - odebug << "library path: " << libPath << oendl; - odebug << "querying: " << QString( path + "/" + *it ) << oendl; if ( lib->queryInterface( IID_MultiauthPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { - odebug << "accepted: " << QString( path + "/" + *it ) << oendl; - MultiauthPlugin plugin; plugin.library = lib; plugin.iface = iface; plugin.name = QString(*it); // find out if plugins should be launched if ( m_excludePlugins.grep( *it ).isEmpty() ) { plugin.active = true; } else { plugin.active = false; } plugin.pluginObject = plugin.iface->plugin(); // "prebuffer" it in one more list, to get the sorting done sortList.insert( plugin.name, plugin ); // on first start the list is off course empty if ( m_allPlugins.isEmpty() ) { pluginList.append( plugin ); } // if plugin is not yet in the list, add it to the layout too else if ( !m_allPlugins.contains( plugin.name ) ) { pluginList.append( plugin ); } } else { - odebug << "could not recognize " << QString( path + "/" + *it ) << oendl; delete lib; } } // end for // put m_allPlugins tempPlugin objects into pluginList if ( !m_allPlugins.isEmpty() ) { MultiauthPlugin tempPlugin; QStringList::Iterator stringit; for( stringit = m_allPlugins.begin(); stringit != m_allPlugins.end(); ++stringit ) { tempPlugin = ( sortList.find( *stringit ) ).data(); if ( !( (tempPlugin.name).isEmpty() ) ) { pluginList.append( tempPlugin ); } } } } void MultiauthConfig::deleteListEntry() { m_syncWidget->syncnet->removeItem(m_syncWidget->syncnet->currentItem()); } void MultiauthConfig::restoreDefaults() { QMessageBox unrecbox( tr("Attention"), tr( "<p>All user-defined net ranges will be lost."), QMessageBox::Warning, QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, 0, QString::null, TRUE, WStyle_StaysOnTop); unrecbox.setButtonText(QMessageBox::Cancel, tr("Cancel")); unrecbox.setButtonText(QMessageBox::Yes, tr("Ok")); if ( unrecbox.exec() == QMessageBox::Yes) { m_syncWidget->syncnet->clear(); insertDefaultRanges(); } m_syncWidget->syncModeCombo->setCurrentItem( 2 ); } void MultiauthConfig::insertDefaultRanges() { m_syncWidget->syncnet->insertItem( tr( "192.168.129.0/24" ) ); m_syncWidget->syncnet->insertItem( tr( "192.168.1.0/24" ) ); m_syncWidget->syncnet->insertItem( tr( "192.168.0.0/16" ) ); 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,78 +1,77 @@ #include "bluepingplugin.h" #include <opie2/oapplication.h> #include <opie2/odebug.h> #include <opie2/odevice.h> #include <qdialog.h> #include <qlayout.h> #include <qhbox.h> #include <qlabel.h> #include <qpushbutton.h> #include <qtimer.h> using namespace Opie::Core; using Opie::Security::MultiauthPluginObject; using Opie::Security::MultiauthConfigWidget; /// creates and initializes the m_config Config object BluepingPlugin::BluepingPlugin() : MultiauthPluginObject(), m_ping(0) { m_config = new Config("Security"); m_config->setGroup("BluepingPlugin"); bluetoothAlreadyRestarted = false; } /// deletes the m_config Config object and noticeW if necessary BluepingPlugin::~BluepingPlugin() { delete m_config; - if (m_ping != 0) - delete m_ping; + delete m_ping; } /// Simply return its name (Blueping plugin) QString BluepingPlugin::pluginName() const { return "Blueping plugin"; } /// no configuration widget for the moment MultiauthConfigWidget * BluepingPlugin::configWidget(QWidget * parent) { return 0l; } QString BluepingPlugin::pixmapNameWidget() const { return "security/bluepingplugin"; } QString BluepingPlugin::pixmapNameConfig() const { return 0l; } /// Emit the MultiauthPluginObject::Success emitCode void BluepingPlugin::success() { emit emitCode(MultiauthPluginObject::Success); } /// Emit the MultiauthPluginObject::Failure emitCode void BluepingPlugin::failure() { emit emitCode(MultiauthPluginObject::Failure); } /// Emit the MultiauthPluginObject::Skip emitCode void BluepingPlugin::skip() { emit emitCode(MultiauthPluginObject::Skip); } /// do the actual ping void BluepingPlugin::ping() { m_ping = new OProcess(); odebug << "pinging device: " << macToPing << oendl; *m_ping << "l2ping" << "-c 1" << macToPing; // starting to ping in the background /// \todo as soon as ping is launched, check RSSI (signal strength) and check /// it's high enough, meaning the device is close enough? /// \todo make it optionally pollable, so don't finish the ping and call /// Opie suspend if l2ping timeouts? if ( !m_ping->start() ) { oerr << "could not start l2ping" << oendl; this->skip(); } 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 @@ -12,72 +12,72 @@ using Opie::Security::MultiauthConfigWidget; /// constructs the widget, filling the noticeMLE QMultiLineEdit with the "noticeText" entry NoticeConfigWidget::NoticeConfigWidget(QWidget* parent = 0, const char* name = "Notice configuration widget") : MultiauthConfigWidget(parent, name) { QVBoxLayout *baseLayout = new QVBoxLayout( this); baseLayout->setSpacing(11); baseLayout->setMargin(6); baseLayout->setAlignment( Qt::AlignTop ); QGroupBox *configBox = new QGroupBox(0, Qt::Vertical, tr("Set the message the user must accept"), this); baseLayout->addWidget(configBox); QVBoxLayout *boxLayout = new QVBoxLayout( configBox->layout() ); QLabel * comment1 = new QLabel("<p><em>" + tr("You may want to consult your legal department for proper wording here.") + "</em></p>", configBox); boxLayout->addWidget(comment1); // Set the multilineedit box text to getNoticeText() noticeMLE = new QMultiLineEdit(configBox, "notice text"); noticeMLE->setWordWrap(QMultiLineEdit::WidgetWidth); noticeMLE->setFocus(); noticeMLE->setText(getNoticeText()); boxLayout->addWidget(noticeMLE); resetNoticeButton = new QPushButton( tr("Reset notice to default"), configBox, "reset Notice Button" ); connect(resetNoticeButton, SIGNAL( clicked() ), this, SLOT( resetNotice() )); boxLayout->addWidget(resetNoticeButton, 0, Qt::AlignHCenter); 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); boxLayout->addWidget(comment2); } /// nothing to do NoticeConfigWidget::~NoticeConfigWidget() {} /// write the notice text in the multiauth.conf Config file void NoticeConfigWidget::writeConfig() { if ( noticeMLE->edited() ) { odebug << "writing new notice text in Security.conf" << oendl; setNoticeText(noticeMLE->text()); } } /// reset the notice text to the hard-coded example defaultNoticeText void NoticeConfigWidget::resetNotice() { - noticeMLE->setText(defaultNoticeText); + noticeMLE->setText(QObject::tr(defaultNoticeText)); } /// get the notice text from the config file (with true new lines) /** * if no text has been defined yet returns defaultNoticeText */ QString NoticeConfigWidget::getNoticeText() { m_config = new Config("Security"); m_config->setGroup("NoticePlugin"); // Note: C++ processes '\' character, so we have to type \\\\ to mean \\ to QRegExp - QString noticeText = m_config->readEntry("noticeText", defaultNoticeText).replace( QRegExp("\\\\n"), "\n" ); + QString noticeText = m_config->readEntry("noticeText", QObject::tr(defaultNoticeText) ).replace( QRegExp("\\\\n"), "\n" ); delete m_config; return noticeText; } /// set the notice text in our m_config config file (escaping new lines) void NoticeConfigWidget::setNoticeText(QString noticeText) { m_config = new Config("Security"); m_config->setGroup("NoticePlugin"); // since Config files do not allow true newlines, we replace them with litteral "\n" m_config->writeEntry("noticeText", noticeText.replace( QRegExp("\n"), "\\n" )); delete m_config; } 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 @@ -1,72 +1,72 @@ /** * \file noticeConfigWidget.h * \brief Notice plugin configuration widget * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr) */ /* =. This file is part of the Opie Project .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org> .>+-= _;:, .> :=|. This library is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This library is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef NOTICECONFIGWIDGET_H #define NOTICECONFIGWIDGET_H #include <qpushbutton.h> #include <qmultilineedit.h> #include <qpe/config.h> #include <opie2/multiauthconfigwidget.h> -static char defaultNoticeText [] = "<h2>NOTICE TO USERS</h2>\n" +static char defaultNoticeText [] = QT_TRANSLATE_NOOP( "QObject", "<h2>NOTICE TO USERS</h2>\n" "<p>This is a private computer system and is the property of " "the company XXX / Mr or Ms X. It is for authorized " "use only. Users have no expectation of privacy.</p>\n" "<p><strong>Unauthorized or improper use of this system may result in " "disciplinary action and civil and criminal penalties. <em>By continuing to use " "this system you indicate your awareness of and consent to these " - "terms. LOG OFF IMMEDIATELY if you do not agree to them.</em></strong></p>"; + "terms. LOG OFF IMMEDIATELY if you do not agree to them.</em></strong></p>"); class NoticeConfigWidget : public Opie::Security::MultiauthConfigWidget { Q_OBJECT public: NoticeConfigWidget(QWidget* parent, const char* name); virtual ~NoticeConfigWidget(); virtual void writeConfig(); private: QMultiLineEdit * noticeMLE; QPushButton * resetNoticeButton; private slots: void resetNotice(); private: Config * m_config; QString getNoticeText(); void setNoticeText(QString noticeText); }; #endif // NOTICECONFIGWIDGET_H 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 @@ -36,51 +36,51 @@ MultiauthConfigWidget * NoticePlugin::configWidget(QWidget * parent) { return noticeW; } /// return the path of the small tab icon QString NoticePlugin::pixmapNameConfig() const { return "security/noticeplugin_small"; } /// return the path of the big icon for the active/order checklist QString NoticePlugin::pixmapNameWidget() const { return "security/noticeplugin"; } /// Displays the configured message and an 'Accept' button /** * \return the outcome code of this authentication (can be only success) */ int NoticePlugin::authenticate() { QMessageBox noticeDialog("Notice plugin", getNoticeText(), QMessageBox::Warning, QMessageBox::Yes, 0, 0, 0, "notice plugin dialog", true, Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop); noticeDialog.setButtonText(QMessageBox::Yes, tr("I accept")); QRect desk = oApp->desktop()->geometry(); noticeDialog.setGeometry( 0, 0, desk.width(), desk.height() ); switch (noticeDialog.exec()) { case QMessageBox::Yes: return MultiauthPluginObject::Success; } return 255; //should not be returned anyway } /// get the notice text from our m_config config file (with true new lines) /** * if no text has been defined yet returns defaultNoticeText */ QString NoticePlugin::getNoticeText() { // Note: C++ processes '\' character, so we have to type \\\\ to mean \\ to QRegExp - return m_config->readEntry("noticeText", defaultNoticeText).replace( QRegExp("\\\\n"), "\n" ); + return m_config->readEntry("noticeText", QObject::tr(defaultNoticeText)).replace( QRegExp("\\\\n"), "\n" ); } |