-rw-r--r-- | core/settings/security/multiauthconfig.cpp | 7 | ||||
-rw-r--r-- | core/settings/security/opie-security.control | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/core/settings/security/multiauthconfig.cpp b/core/settings/security/multiauthconfig.cpp index da99804..43b453f 100644 --- a/core/settings/security/multiauthconfig.cpp +++ b/core/settings/security/multiauthconfig.cpp | |||
@@ -1,327 +1,328 @@ | |||
1 | #include <opie2/odebug.h> | 1 | #include <opie2/odebug.h> |
2 | #include <opie2/oresource.h> | ||
2 | #include <opie2/multiauthpassword.h> | 3 | #include <opie2/multiauthpassword.h> |
3 | 4 | ||
4 | #include <qgroupbox.h> | 5 | #include <qgroupbox.h> |
5 | #include <qvgroupbox.h> | 6 | #include <qvgroupbox.h> |
6 | #include <qpe/resource.h> | ||
7 | #include <qlayout.h> | 7 | #include <qlayout.h> |
8 | #include <qlabel.h> | 8 | #include <qlabel.h> |
9 | #include <qhbox.h> | 9 | #include <qhbox.h> |
10 | #include <qheader.h> | 10 | #include <qheader.h> |
11 | #include <qvbox.h> | 11 | #include <qvbox.h> |
12 | #include <qwhatsthis.h> | 12 | #include <qwhatsthis.h> |
13 | #include <qtoolbutton.h> | 13 | #include <qtoolbutton.h> |
14 | #include <qstringlist.h> | 14 | #include <qstringlist.h> |
15 | #include <qdir.h> | 15 | #include <qdir.h> |
16 | #include <qpe/qlibrary.h> | 16 | #include <qpe/qlibrary.h> |
17 | #include <qpe/qpeapplication.h> | 17 | #include <qpe/qpeapplication.h> |
18 | 18 | ||
19 | #include "multiauthconfig.h" | 19 | #include "multiauthconfig.h" |
20 | 20 | ||
21 | 21 | ||
22 | using Opie::Security::MultiauthPluginInterface; | 22 | using Opie::Security::MultiauthPluginInterface; |
23 | using Opie::Security::MultiauthPluginObject; | 23 | using Opie::Security::MultiauthPluginObject; |
24 | using Opie::Security::MultiauthConfigWidget; | 24 | using Opie::Security::MultiauthConfigWidget; |
25 | /// keeps information about MultiauthPluginObject plugins | 25 | /// keeps information about MultiauthPluginObject plugins |
26 | struct MultiauthPlugin { | 26 | struct MultiauthPlugin { |
27 | MultiauthPlugin() : library( 0 ), iface( 0 ), pluginObject( 0 ) {} | 27 | MultiauthPlugin() : library( 0 ), iface( 0 ), pluginObject( 0 ) {} |
28 | /// plugin file | 28 | /// plugin file |
29 | QLibrary *library; | 29 | QLibrary *library; |
30 | /// the plugin object interface | 30 | /// the plugin object interface |
31 | QInterfacePtr<MultiauthPluginInterface> iface; | 31 | QInterfacePtr<MultiauthPluginInterface> iface; |
32 | /// the plugin object itself | 32 | /// the plugin object itself |
33 | MultiauthPluginObject *pluginObject; | 33 | MultiauthPluginObject *pluginObject; |
34 | /// name of the plugin file | 34 | /// name of the plugin file |
35 | QString name; | 35 | QString name; |
36 | /// should the plugin be launched during authentication or not | 36 | /// should the plugin be launched during authentication or not |
37 | bool active; | 37 | bool active; |
38 | /// order of the plugin, in the pluginListWidget and during authentication | 38 | /// order of the plugin, in the pluginListWidget and during authentication |
39 | int pos; | 39 | int pos; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | /// list of available MultiauthPlugin objects | 42 | /// list of available MultiauthPlugin objects |
43 | static QValueList<MultiauthPlugin> pluginList; | 43 | static QValueList<MultiauthPlugin> pluginList; |
44 | 44 | ||
45 | 45 | ||
46 | /// extension of QToolButton that adds signals, icons and stuff (taken from todayconfig.cpp) | 46 | /// extension of QToolButton that adds signals, icons and stuff (taken from todayconfig.cpp) |
47 | class ToolButton : public QToolButton { | 47 | class ToolButton : public QToolButton { |
48 | 48 | ||
49 | public: | 49 | public: |
50 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 50 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
51 | : QToolButton( parent, name ) { | 51 | : QToolButton( parent, name ) { |
52 | setPixmap( Resource::loadPixmap( icon ) ); | 52 | setPixmap( Opie::Core::OResource::loadPixmap( icon, Opie::Core::OResource::SmallIcon ) ); |
53 | setAutoRaise( TRUE ); | 53 | setAutoRaise( TRUE ); |
54 | setFocusPolicy( QWidget::NoFocus ); | 54 | setFocusPolicy( QWidget::NoFocus ); |
55 | setToggleButton( t ); | 55 | setToggleButton( t ); |
56 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 56 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
57 | } | 57 | } |
58 | }; | 58 | }; |
59 | 59 | ||
60 | MultiauthGeneralConfig::MultiauthGeneralConfig(MultiauthConfig * parentConfig, QWidget * parent, const char * name = "general Opie-multiauthentication config widget") | 60 | MultiauthGeneralConfig::MultiauthGeneralConfig(MultiauthConfig * parentConfig, QWidget * parent, const char * name = "general Opie-multiauthentication config widget") |
61 | : QWidget(parent, name), m_onStart(0), m_onResume(0), m_noProtectConfig(0), m_explanScreens(0), m_nbSuccessMin(0), m_tryButton(0) | 61 | : QWidget(parent, name), m_onStart(0), m_onResume(0), m_noProtectConfig(0), m_explanScreens(0), m_nbSuccessMin(0), m_tryButton(0) |
62 | { | 62 | { |
63 | // keep track of the MultiauthConfig parent in one of our attributes | 63 | // keep track of the MultiauthConfig parent in one of our attributes |
64 | m_parentConfig = parentConfig; | 64 | m_parentConfig = parentConfig; |
65 | QVBoxLayout *vb = new QVBoxLayout(this); | 65 | QVBoxLayout *vb = new QVBoxLayout(this); |
66 | vb->setSpacing(11); | 66 | vb->setSpacing(11); |
67 | vb->setMargin(11); | 67 | vb->setMargin(11); |
68 | vb->setAlignment( Qt::AlignTop ); | 68 | vb->setAlignment( Qt::AlignTop ); |
69 | 69 | ||
70 | QGroupBox *lockBox = new QGroupBox(0, Qt::Vertical, tr("When to lock Opie"), this, "lock box"); | 70 | QGroupBox *lockBox = new QGroupBox(0, Qt::Vertical, tr("When to lock Opie"), this, "lock box"); |
71 | vb->addWidget(lockBox); | 71 | vb->addWidget(lockBox); |
72 | QGridLayout *boxLayout = new QGridLayout( lockBox->layout() ); | 72 | QGridLayout *boxLayout = new QGridLayout( lockBox->layout() ); |
73 | m_onStart = new QCheckBox( tr( "on Opie start" ), lockBox, "lock on opie start"); | 73 | m_onStart = new QCheckBox( tr( "on Opie start" ), lockBox, "lock on opie start"); |
74 | m_onResume = new QCheckBox( tr( "on Opie resume" ), lockBox, "lock on opie resume"); | 74 | m_onResume = new QCheckBox( tr( "on Opie resume" ), lockBox, "lock on opie resume"); |
75 | boxLayout->addWidget(m_onStart, 0, 0); | 75 | boxLayout->addWidget(m_onStart, 0, 0); |
76 | boxLayout->addWidget(m_onResume, 0, 1); | 76 | boxLayout->addWidget(m_onResume, 0, 1); |
77 | 77 | ||
78 | QGroupBox *nbBox = new QGroupBox(0, Qt::Vertical, tr("Multiple plugins authentication"), this, "nb box"); | 78 | QGroupBox *nbBox = new QGroupBox(0, Qt::Vertical, tr("Multiple plugins authentication"), this, "nb box"); |
79 | vb->addWidget(nbBox); | 79 | vb->addWidget(nbBox); |
80 | QGridLayout *nbBoxLayout = new QGridLayout( nbBox->layout() ); | 80 | QGridLayout *nbBoxLayout = new QGridLayout( nbBox->layout() ); |
81 | m_nbSuccessMin = new QSpinBox(nbBox); | 81 | m_nbSuccessMin = new QSpinBox(nbBox); |
82 | QLabel *lNbSuccessMin = new QLabel( tr( "Required successes" ), nbBox); | 82 | QLabel *lNbSuccessMin = new QLabel( tr( "Required successes" ), nbBox); |
83 | nbBoxLayout->addWidget(m_nbSuccessMin, 0, 0); | 83 | nbBoxLayout->addWidget(m_nbSuccessMin, 0, 0); |
84 | nbBoxLayout->addWidget(lNbSuccessMin, 0, 1); | 84 | nbBoxLayout->addWidget(lNbSuccessMin, 0, 1); |
85 | m_nbSuccessMin->setMinValue(1); // the max value is defined in MultiauthConfig constructor | 85 | m_nbSuccessMin->setMinValue(1); // the max value is defined in MultiauthConfig constructor |
86 | 86 | ||
87 | QGroupBox *devBox = new QGroupBox(0, Qt::Vertical, tr("Options"), this, "dev box"); | 87 | QGroupBox *devBox = new QGroupBox(0, Qt::Vertical, tr("Options"), this, "dev box"); |
88 | vb->addWidget(devBox); | 88 | vb->addWidget(devBox); |
89 | QGridLayout *devBoxLayout = new QGridLayout( devBox->layout() ); | 89 | QGridLayout *devBoxLayout = new QGridLayout( devBox->layout() ); |
90 | m_noProtectConfig = new QCheckBox( tr("Don't protect this config screen"), devBox, "don't protect config"); | 90 | m_noProtectConfig = new QCheckBox( tr("Don't protect this config screen"), devBox, "don't protect config"); |
91 | m_explanScreens = new QCheckBox( tr("Show explanatory screens"), devBox, "Show explan. screens"); | 91 | m_explanScreens = new QCheckBox( tr("Show explanatory screens"), devBox, "Show explan. screens"); |
92 | devBoxLayout->addWidget(m_noProtectConfig, 0, 0); | 92 | devBoxLayout->addWidget(m_noProtectConfig, 0, 0); |
93 | devBoxLayout->addWidget(m_explanScreens, 1, 0); | 93 | devBoxLayout->addWidget(m_explanScreens, 1, 0); |
94 | 94 | ||
95 | QVGroupBox *tryBox = new QVGroupBox(tr("Testing"), this, "try box"); | 95 | QVGroupBox *tryBox = new QVGroupBox(tr("Testing"), this, "try box"); |
96 | vb->addWidget(tryBox); | 96 | vb->addWidget(tryBox); |
97 | m_tryButton = new QPushButton( tr("Test the authentication now"), tryBox, "try button"); | 97 | m_tryButton = new QPushButton( tr("Test the authentication now"), tryBox, "try button"); |
98 | connect( m_tryButton, SIGNAL(clicked()), this, SLOT(tryAuth()) ); | 98 | connect( m_tryButton, SIGNAL(clicked()), this, SLOT(tryAuth()) ); |
99 | 99 | ||
100 | } | 100 | } |
101 | 101 | ||
102 | /// nothing to do | 102 | /// nothing to do |
103 | MultiauthGeneralConfig::~MultiauthGeneralConfig() | 103 | MultiauthGeneralConfig::~MultiauthGeneralConfig() |
104 | {} | 104 | {} |
105 | 105 | ||
106 | /// launches the authentication process, as configured, with the option to bypass it | 106 | /// launches the authentication process, as configured, with the option to bypass it |
107 | void MultiauthGeneralConfig::tryAuth() | 107 | void MultiauthGeneralConfig::tryAuth() |
108 | { | 108 | { |
109 | QMessageBox confirmSave( | 109 | QMessageBox confirmSave( |
110 | tr("Attention"), | 110 | tr("Attention"), |
111 | "<p>" + tr("You must save your current settings before trying to authenticate. Press OK to accept and launch a simulated authentication process.") + "</p><p><em>" + | 111 | "<p>" + tr("You must save your current settings before trying to authenticate. Press OK to accept and launch a simulated authentication process.") + "</p><p><em>" + |
112 | tr("If you don't like the result of this test, don't forget to change your settings before you exit the configuration application!") + "</em></p>", | 112 | tr("If you don't like the result of this test, don't forget to change your settings before you exit the configuration application!") + "</em></p>", |
113 | QMessageBox::Warning, | 113 | QMessageBox::Warning, |
114 | QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, | 114 | QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, |
115 | 0, QString::null, TRUE, WStyle_StaysOnTop); | 115 | 0, QString::null, TRUE, WStyle_StaysOnTop); |
116 | confirmSave.setButtonText(QMessageBox::Cancel, tr("Cancel")); | 116 | confirmSave.setButtonText(QMessageBox::Cancel, tr("Cancel")); |
117 | confirmSave.setButtonText(QMessageBox::Yes, tr("OK")); | 117 | confirmSave.setButtonText(QMessageBox::Yes, tr("OK")); |
118 | 118 | ||
119 | if ( confirmSave.exec() == QMessageBox::Yes) | 119 | if ( confirmSave.exec() == QMessageBox::Yes) |
120 | { | 120 | { |
121 | owarn << "writing config as user accepted" << oendl; | 121 | owarn << "writing config as user accepted" << oendl; |
122 | m_parentConfig->writeConfigs(); | 122 | m_parentConfig->writeConfigs(); |
123 | owarn << "testing authentication" << oendl; | 123 | owarn << "testing authentication" << oendl; |
124 | // launch the authentication in testing mode | 124 | // launch the authentication in testing mode |
125 | Opie::Security::MultiauthPassword::authenticate(Opie::Security::TestNow); | 125 | Opie::Security::MultiauthPassword::authenticate(Opie::Security::TestNow); |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | 129 | ||
130 | /// Builds and displays the Opie multi-authentication configuration dialog | 130 | /// Builds and displays the Opie multi-authentication configuration dialog |
131 | static void test_and_start() { | 131 | static void test_and_start() { |
132 | Config pcfg("Security"); | 132 | Config pcfg("Security"); |
133 | pcfg.setGroup( "Misc" ); | 133 | pcfg.setGroup( "Misc" ); |
134 | bool protectConfigDialog = ! pcfg.readBoolEntry("noProtectConfig", true); | 134 | bool protectConfigDialog = ! pcfg.readBoolEntry("noProtectConfig", true); |
135 | 135 | ||
136 | if (protectConfigDialog && Opie::Security::Internal::runPlugins() != 0) { | 136 | if (protectConfigDialog && Opie::Security::Internal::runPlugins() != 0) { |
137 | owarn << "authentication failed, not showing opie-security" << oendl; | 137 | owarn << "authentication failed, not showing opie-security" << oendl; |
138 | exit( -1 ); | 138 | exit( -1 ); |
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | 142 | ||
143 | 143 | ||
144 | MultiauthConfig::MultiauthConfig(QWidget* par, const char* w = "MultiauthConfig dialog", WFlags f = 0) | 144 | MultiauthConfig::MultiauthConfig(QWidget* par, const char* w = "MultiauthConfig dialog", WFlags f = 0) |
145 | : QDialog(par, w, TRUE, f), | 145 | : QDialog(par, w, TRUE, f), |
146 | m_mainTW(0), m_pluginListView(0), m_pluginListWidget(0), | 146 | m_mainTW(0), m_pluginListView(0), m_pluginListWidget(0), |
147 | m_generalConfig(0), m_loginWidget(0), m_syncWidget(0), | 147 | m_generalConfig(0), m_loginWidget(0), m_syncWidget(0), |
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"); |
173 | QVBoxLayout * pluginListLayout = new QVBoxLayout(m_pluginListWidget); | 173 | QVBoxLayout * pluginListLayout = new QVBoxLayout(m_pluginListWidget); |
174 | pluginListLayout->setSpacing(6); | 174 | pluginListLayout->setSpacing(6); |
175 | pluginListLayout->setMargin(11); | 175 | pluginListLayout->setMargin(11); |
176 | QLabel * pluginListTitle = new QLabel( tr( "Load which plugins in what order:" ), m_pluginListWidget ); | 176 | QLabel * pluginListTitle = new QLabel( tr( "Load which plugins in what order:" ), m_pluginListWidget ); |
177 | pluginListLayout->addWidget(pluginListTitle); | 177 | pluginListLayout->addWidget(pluginListTitle); |
178 | QHBox * pluginListHB = new QHBox(m_pluginListWidget); | 178 | QHBox * pluginListHB = new QHBox(m_pluginListWidget); |
179 | pluginListLayout->addWidget(pluginListHB); | 179 | pluginListLayout->addWidget(pluginListHB); |
180 | 180 | ||
181 | m_pluginListView = new QListView(pluginListHB); | 181 | m_pluginListView = new QListView(pluginListHB); |
182 | m_pluginListView->addColumn("PluginList"); | 182 | m_pluginListView->addColumn("PluginList"); |
183 | m_pluginListView->header()->hide(); | 183 | m_pluginListView->header()->hide(); |
184 | m_pluginListView->setSorting(-1); | 184 | m_pluginListView->setSorting(-1); |
185 | QWhatsThis::add(m_pluginListView, tr( "Check a checkbox to activate/deactivate a plugin or use the arrow buttons on the right to change the order they will appear in" )); | 185 | QWhatsThis::add(m_pluginListView, tr( "Check a checkbox to activate/deactivate a plugin or use the arrow buttons on the right to change the order they will appear in" )); |
186 | 186 | ||
187 | QVBox * pluginListVB = new QVBox(pluginListHB); | 187 | QVBox * pluginListVB = new QVBox(pluginListHB); |
188 | new ToolButton( pluginListVB, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) ); | 188 | new ToolButton( pluginListVB, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) ); |
189 | new ToolButton( pluginListVB, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); | 189 | new ToolButton( pluginListVB, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); |
190 | m_mainTW->addTab( m_pluginListWidget, "pass", tr( "plugins" ) ); | 190 | m_mainTW->addTab( m_pluginListWidget, "pass", tr( "plugins" ) ); |
191 | 191 | ||
192 | connect ( m_pluginListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( pluginsChanged ( ) ) ); | 192 | connect ( m_pluginListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( pluginsChanged ( ) ) ); |
193 | 193 | ||
194 | // general Opie multi-authentication configuration tab | 194 | // general Opie multi-authentication configuration tab |
195 | m_generalConfig = new MultiauthGeneralConfig(this, m_mainTW); | 195 | m_generalConfig = new MultiauthGeneralConfig(this, m_mainTW); |
196 | m_mainTW->addTab(m_generalConfig, "SettingsIcon", tr( "Authentication") ); | 196 | m_mainTW->addTab(m_generalConfig, "SettingsIcon", tr( "Authentication") ); |
197 | 197 | ||
198 | } | 198 | } |
199 | // login settings page | 199 | // login settings page |
200 | m_loginWidget = new LoginBase(m_mainTW, "login config widget"); | 200 | m_loginWidget = new LoginBase(m_mainTW, "login config widget"); |
201 | m_mainTW->addTab(m_loginWidget, "security/users", tr( "Login") ); | 201 | m_mainTW->addTab(m_loginWidget, "security/users", tr( "Login") ); |
202 | 202 | ||
203 | // sync settings page | 203 | // sync settings page |
204 | m_syncWidget = new SyncBase( m_mainTW, "sync config widget" ); | 204 | m_syncWidget = new SyncBase( m_mainTW, "sync config widget" ); |
205 | m_mainTW->addTab(m_syncWidget, "security/sync", tr( "Sync") ); | 205 | m_mainTW->addTab(m_syncWidget, "security/sync", tr( "Sync") ); |
206 | 206 | ||
207 | // read the "Security" Config file and update our UI | 207 | // read the "Security" Config file and update our UI |
208 | readConfig(); | 208 | readConfig(); |
209 | 209 | ||
210 | 210 | ||
211 | if (m_pluginsInstalled) | 211 | if (m_pluginsInstalled) |
212 | { | 212 | { |
213 | /* loads plugins configuration widgets in mainTW tabs and in pluginListView | 213 | /* loads plugins configuration widgets in mainTW tabs and in pluginListView |
214 | */ | 214 | */ |
215 | 215 | ||
216 | loadPlugins(); | 216 | loadPlugins(); |
217 | 217 | ||
218 | for ( int i = pluginList.count() - 1; i >= 0; i-- ) { | 218 | for ( int i = pluginList.count() - 1; i >= 0; i-- ) { |
219 | MultiauthPlugin plugin = pluginList[i]; | 219 | MultiauthPlugin plugin = pluginList[i]; |
220 | 220 | ||
221 | // load the config widgets in the tabs | 221 | // load the config widgets in the tabs |
222 | // (configWidget will return 0l if there is no configuration GUI) | 222 | // (configWidget will return 0l if there is no configuration GUI) |
223 | MultiauthConfigWidget* widget = plugin.pluginObject->configWidget(m_mainTW); | 223 | MultiauthConfigWidget* widget = plugin.pluginObject->configWidget(m_mainTW); |
224 | if ( widget != 0l ) { | 224 | if ( widget != 0l ) { |
225 | odebug << "plugin " << plugin.name << " has a configuration widget" << oendl; | 225 | odebug << "plugin " << plugin.name << " has a configuration widget" << oendl; |
226 | configWidgetList.append(widget); | 226 | configWidgetList.append(widget); |
227 | m_mainTW->addTab( widget, plugin.pluginObject->pixmapNameConfig(), | 227 | m_mainTW->addTab( widget, plugin.pluginObject->pixmapNameConfig(), |
228 | plugin.pluginObject->pluginName() ); | 228 | plugin.pluginObject->pluginName() ); |
229 | } | 229 | } |
230 | // set the order/activate tab | 230 | // set the order/activate tab |
231 | QPixmap icon = Resource::loadPixmap( plugin.pluginObject->pixmapNameWidget() ); | 231 | QPixmap icon = Opie::Core::OResource::loadPixmap( plugin.pluginObject->pixmapNameWidget(), |
232 | Opie::Core::OResource::SmallIcon ); | ||
232 | QCheckListItem * item = new QCheckListItem(m_pluginListView, plugin.pluginObject->pluginName(), QCheckListItem::CheckBox ); | 233 | QCheckListItem * item = new QCheckListItem(m_pluginListView, plugin.pluginObject->pluginName(), QCheckListItem::CheckBox ); |
233 | if ( !icon.isNull() ) { | 234 | if ( !icon.isNull() ) { |
234 | item->setPixmap( 0, icon ); | 235 | item->setPixmap( 0, icon ); |
235 | } | 236 | } |
236 | if ( m_excludePlugins.find( plugin.name ) == m_excludePlugins.end() ) { | 237 | if ( m_excludePlugins.find( plugin.name ) == m_excludePlugins.end() ) { |
237 | item->setOn( TRUE ); | 238 | item->setOn( TRUE ); |
238 | } | 239 | } |
239 | m_plugins[plugin.name] = item; | 240 | m_plugins[plugin.name] = item; |
240 | } | 241 | } |
241 | 242 | ||
242 | // set the first tab as default. | 243 | // set the first tab as default. |
243 | m_mainTW->setCurrentTab(m_pluginListWidget); | 244 | m_mainTW->setCurrentTab(m_pluginListWidget); |
244 | 245 | ||
245 | // put the number of plugins as the max number of req. auth. | 246 | // put the number of plugins as the max number of req. auth. |
246 | m_generalConfig->m_nbSuccessMin->setMaxValue( pluginList.count() ); | 247 | m_generalConfig->m_nbSuccessMin->setMaxValue( pluginList.count() ); |
247 | } | 248 | } |
248 | else | 249 | else |
249 | { | 250 | { |
250 | /* we don't have any installed plugin there. Let's tell | 251 | /* we don't have any installed plugin there. Let's tell |
251 | * that to the user in a third tab, using the m_pluginListWidget widget | 252 | * that to the user in a third tab, using the m_pluginListWidget widget |
252 | */ | 253 | */ |
253 | m_pluginListWidget = new QWidget(m_mainTW, "plugin list widget (no plugins warning)"); | 254 | m_pluginListWidget = new QWidget(m_mainTW, "plugin list widget (no plugins warning)"); |
254 | QVBoxLayout * pluginListLayout = new QVBoxLayout(m_pluginListWidget); | 255 | QVBoxLayout * pluginListLayout = new QVBoxLayout(m_pluginListWidget); |
255 | pluginListLayout->setSpacing(11); | 256 | pluginListLayout->setSpacing(11); |
256 | pluginListLayout->setMargin(11); | 257 | pluginListLayout->setMargin(11); |
257 | pluginListLayout->setAlignment( Qt::AlignTop ); | 258 | pluginListLayout->setAlignment( Qt::AlignTop ); |
258 | QVGroupBox *warningBox = new QVGroupBox(tr("Important notice"), m_pluginListWidget, "noPlugins warning box"); | 259 | QVGroupBox *warningBox = new QVGroupBox(tr("Important notice"), m_pluginListWidget, "noPlugins warning box"); |
259 | pluginListLayout->addWidget(warningBox); | 260 | pluginListLayout->addWidget(warningBox); |
260 | 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-securityplugin-*</em> package! Once you have done that, you will be able to configure your PDA protection here.") + "</p>", warningBox ); | 261 | 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-securityplugin-*</em> package! Once you have done that, you will be able to configure your PDA protection here.") + "</p>", warningBox ); |
261 | 262 | ||
262 | m_mainTW->addTab(m_pluginListWidget, "security/Security", tr( "Locking") ); | 263 | m_mainTW->addTab(m_pluginListWidget, "security/Security", tr( "Locking") ); |
263 | 264 | ||
264 | // set the first tab as default. | 265 | // set the first tab as default. |
265 | m_mainTW->setCurrentTab(m_loginWidget); | 266 | m_mainTW->setCurrentTab(m_loginWidget); |
266 | } | 267 | } |
267 | 268 | ||
268 | showMaximized(); | 269 | showMaximized(); |
269 | } | 270 | } |
270 | 271 | ||
271 | /// nothing to do | 272 | /// nothing to do |
272 | MultiauthConfig::~MultiauthConfig() | 273 | MultiauthConfig::~MultiauthConfig() |
273 | { | 274 | { |
274 | } | 275 | } |
275 | 276 | ||
276 | /// saves the general and plugin(s) configurations | 277 | /// saves the general and plugin(s) configurations |
277 | void MultiauthConfig::writeConfigs() { | 278 | void MultiauthConfig::writeConfigs() { |
278 | MultiauthConfigWidget* confWidget = 0; | 279 | MultiauthConfigWidget* confWidget = 0; |
279 | for ( confWidget = configWidgetList.first(); confWidget != 0; | 280 | for ( confWidget = configWidgetList.first(); confWidget != 0; |
280 | confWidget = configWidgetList.next() ) | 281 | confWidget = configWidgetList.next() ) |
281 | confWidget->writeConfig(); | 282 | confWidget->writeConfig(); |
282 | 283 | ||
283 | writeConfig(); | 284 | writeConfig(); |
284 | } | 285 | } |
285 | 286 | ||
286 | /// on QDialog::accept, we save all the configurations and exit the QDialog normally | 287 | /// on QDialog::accept, we save all the configurations and exit the QDialog normally |
287 | void MultiauthConfig::accept() { | 288 | void MultiauthConfig::accept() { |
288 | writeConfigs(); | 289 | writeConfigs(); |
289 | QDialog::accept(); | 290 | QDialog::accept(); |
290 | } | 291 | } |
291 | 292 | ||
292 | void MultiauthConfig::done( int r ) { | 293 | void MultiauthConfig::done( int r ) { |
293 | QDialog::done( r ); | 294 | QDialog::done( r ); |
294 | close(); | 295 | close(); |
295 | } | 296 | } |
296 | 297 | ||
297 | /// moves up the selected plugin | 298 | /// moves up the selected plugin |
298 | void MultiauthConfig::moveSelectedUp() | 299 | void MultiauthConfig::moveSelectedUp() |
299 | { | 300 | { |
300 | QListViewItem *item = m_pluginListView->selectedItem(); | 301 | QListViewItem *item = m_pluginListView->selectedItem(); |
301 | if ( item && item->itemAbove() ) { | 302 | if ( item && item->itemAbove() ) { |
302 | item->itemAbove()->moveItem( item ); | 303 | item->itemAbove()->moveItem( item ); |
303 | } | 304 | } |
304 | } | 305 | } |
305 | 306 | ||
306 | /// moves down the selected plugin | 307 | /// moves down the selected plugin |
307 | void MultiauthConfig::moveSelectedDown() | 308 | void MultiauthConfig::moveSelectedDown() |
308 | { | 309 | { |
309 | QListViewItem *item = m_pluginListView->selectedItem(); | 310 | QListViewItem *item = m_pluginListView->selectedItem(); |
310 | if ( item && item->itemBelow() ) { | 311 | if ( item && item->itemBelow() ) { |
311 | item->moveItem( item->itemBelow() ); | 312 | item->moveItem( item->itemBelow() ); |
312 | } | 313 | } |
313 | } | 314 | } |
314 | 315 | ||
315 | /// reads the <code>Security.conf</code> Config file, and updates parts of the user interface | 316 | /// reads the <code>Security.conf</code> Config file, and updates parts of the user interface |
316 | void MultiauthConfig::readConfig() | 317 | void MultiauthConfig::readConfig() |
317 | { | 318 | { |
318 | // pointer, so we release this Config when we want | 319 | // pointer, so we release this Config when we want |
319 | Config* pcfg = new Config("Security"); | 320 | Config* pcfg = new Config("Security"); |
320 | 321 | ||
321 | if (m_pluginsInstalled) | 322 | if (m_pluginsInstalled) |
322 | { | 323 | { |
323 | pcfg->setGroup( "Misc" ); | 324 | pcfg->setGroup( "Misc" ); |
324 | m_generalConfig->m_onStart->setChecked( pcfg->readBoolEntry( "onStart", false ) ); | 325 | m_generalConfig->m_onStart->setChecked( pcfg->readBoolEntry( "onStart", false ) ); |
325 | m_generalConfig->m_onResume->setChecked( pcfg->readBoolEntry( "onResume", false ) ); | 326 | m_generalConfig->m_onResume->setChecked( pcfg->readBoolEntry( "onResume", false ) ); |
326 | m_generalConfig->m_nbSuccessMin->setValue( pcfg->readNumEntry( "nbSuccessMin", 1 ) ); | 327 | m_generalConfig->m_nbSuccessMin->setValue( pcfg->readNumEntry( "nbSuccessMin", 1 ) ); |
327 | m_generalConfig->m_noProtectConfig->setChecked( pcfg->readBoolEntry( "noProtectConfig", true) ); | 328 | m_generalConfig->m_noProtectConfig->setChecked( pcfg->readBoolEntry( "noProtectConfig", true) ); |
diff --git a/core/settings/security/opie-security.control b/core/settings/security/opie-security.control index ab08c05..7d393a8 100644 --- a/core/settings/security/opie-security.control +++ b/core/settings/security/opie-security.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-security | 1 | Package: opie-security |
2 | Files: plugins/application/libsecurity.so* bin/security apps/Settings/security.desktop pics/security/sync.png pics/security/users.png pics/security/Security.png | 2 | Files: plugins/application/libsecurity.so* bin/security apps/Settings/security.desktop pics/security/sync.png pics/security/users.png pics/security/Security.png |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Opie Team <opie@handhelds.org> | 5 | Maintainer: Opie Team <opie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal, libopiecore2, libopieui2, libopiesecurity2 |
8 | Recommends: opie-lockapplet, opie-multiauth | 8 | Recommends: opie-lockapplet, opie-multiauth |
9 | Description: Security settings dialog for the Opie environment. | 9 | Description: Security settings dialog for the Opie environment. |
10 | Version: $QPE_VERSION$EXTRAVERSION | 10 | Version: $QPE_VERSION$EXTRAVERSION |