summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/settings/security/multiauthconfig.cpp50
-rw-r--r--core/settings/security/multiauthconfig.h1
2 files changed, 51 insertions, 0 deletions
diff --git a/core/settings/security/multiauthconfig.cpp b/core/settings/security/multiauthconfig.cpp
index ff11e49..3c73d7b 100644
--- a/core/settings/security/multiauthconfig.cpp
+++ b/core/settings/security/multiauthconfig.cpp
@@ -5,2 +5,3 @@
#include <qgroupbox.h>
+#include <qvgroupbox.h>
#include <qpe/resource.h>
@@ -150,2 +151,13 @@ MultiauthConfig::MultiauthConfig(QWidget* par, const char* w, WFlags f)
+ /* Checks (and memorizes) if any authentication plugins are
+ * installed on the system
+ */
+ QString path = QPEApplication::qpeDir() + "/plugins/security";
+ QDir dir( path, "lib*.so" );
+ QStringList list = dir.entryList();
+
+ m_pluginsInstalled = ! list.isEmpty();
+ if (m_pluginsInstalled == false)
+ owarn << "no authentication plugins installed! Talking about it in the last tab..." << oendl;
+
setCaption( tr( "Security configuration" ) );
@@ -154,2 +166,5 @@ MultiauthConfig::MultiauthConfig(QWidget* par, const char* w, WFlags f)
layout->addWidget(m_mainTW);
+
+ if (m_pluginsInstalled)
+ {
m_pluginListWidget = new QWidget(m_mainTW, "plugin list widget");
@@ -180,2 +195,3 @@ MultiauthConfig::MultiauthConfig(QWidget* par, const char* w, WFlags f)
+ }
// login settings page
@@ -191,2 +207,5 @@ MultiauthConfig::MultiauthConfig(QWidget* par, const char* w, WFlags f)
+
+ if (m_pluginsInstalled)
+ {
/* loads plugins configuration widgets in mainTW tabs and in pluginListView
@@ -225,2 +244,22 @@ MultiauthConfig::MultiauthConfig(QWidget* par, const char* w, WFlags f)
m_generalConfig->nbSuccessMin->setMaxValue( pluginList.count() );
+ }
+ else
+ {
+ /* we don't have any installed plugin there. Let's tell
+ * that to the user in a third tab, using the m_pluginListWidget widget
+ */
+ m_pluginListWidget = new QWidget(m_mainTW, "plugin list widget (no plugins warning)");
+ QVBoxLayout * pluginListLayout = new QVBoxLayout(m_pluginListWidget);
+ pluginListLayout->setSpacing(11);
+ pluginListLayout->setMargin(11);
+ pluginListLayout->setAlignment( Qt::AlignTop );
+ QVGroupBox *warningBox = new QVGroupBox(tr("Important notice"), m_pluginListWidget, "noPlugins warning box");
+ pluginListLayout->addWidget(warningBox);
+ QLabel * warningText = new QLabel( "<p>" + tr("To be able to protect your PDA with one or more authentication plugins (for example, a simple PIN authentication), you must install at least one <em>opie-multiauth-*</em> package! Once you have done that, you will be able to configure your PDA protection here.") + "</p>", warningBox );
+
+ m_mainTW->addTab(m_pluginListWidget, "security/Security", tr( "Locking") );
+
+ // set the first tab as default.
+ m_mainTW->setCurrentTab(m_loginWidget);
+ }
@@ -273,2 +312,5 @@ void MultiauthConfig::readConfig()
Config* pcfg = new Config("Security");
+
+ if (m_pluginsInstalled)
+ {
pcfg->setGroup( "Misc" );
@@ -284,2 +326,3 @@ void MultiauthConfig::readConfig()
m_allPlugins = pcfg->readListEntry( "AllPlugins", ',' );
+ }
@@ -353,2 +396,5 @@ void MultiauthConfig::writeConfig()
Config* pcfg = new Config("Security");
+
+ if (m_pluginsInstalled)
+ {
pcfg->setGroup( "Plugins" );
@@ -385,2 +431,3 @@ void MultiauthConfig::writeConfig()
pcfg->writeEntry( "allowBypass", m_generalConfig->allowBypass->isChecked() );
+ }
@@ -402,3 +449,6 @@ void MultiauthConfig::writeConfig()
target.sprintf("net%d", i);
+ if ( i < m_syncWidget->syncnet->count() )
pcfg->writeEntry(target,m_syncWidget->syncnet->text(i));
+ else // no more entry in the syncnet list -> we clear the line
+ pcfg->writeEntry(target, "");
}
diff --git a/core/settings/security/multiauthconfig.h b/core/settings/security/multiauthconfig.h
index 649815d..5287083 100644
--- a/core/settings/security/multiauthconfig.h
+++ b/core/settings/security/multiauthconfig.h
@@ -123,2 +123,3 @@ private:
bool m_plugins_changed;
+ bool m_pluginsInstalled;