-rw-r--r-- | noncore/securityplugins/pin/pin.cpp | 17 | ||||
-rw-r--r-- | noncore/securityplugins/pin/pin.h | 4 | ||||
-rw-r--r-- | noncore/securityplugins/pin/pinConfigWidget.cpp | 6 | ||||
-rw-r--r-- | noncore/securityplugins/pin/pinConfigWidget.h | 16 | ||||
-rw-r--r-- | noncore/securityplugins/pin/pinpluginimpl.cpp | 3 | ||||
-rw-r--r-- | noncore/securityplugins/pin/pinpluginimpl.h | 5 |
6 files changed, 29 insertions, 22 deletions
diff --git a/noncore/securityplugins/pin/pin.cpp b/noncore/securityplugins/pin/pin.cpp index 37dc5be..c21ffcd 100644 --- a/noncore/securityplugins/pin/pin.cpp +++ b/noncore/securityplugins/pin/pin.cpp | |||
@@ -38,14 +38,17 @@ | |||
38 | #include <unistd.h> | 38 | #include <unistd.h> |
39 | #include <stdlib.h> | 39 | #include <stdlib.h> |
40 | #include <time.h> | 40 | #include <time.h> |
41 | 41 | ||
42 | extern "C" char *crypt(const char *key, const char *salt); | 42 | extern "C" char *crypt(const char *key, const char *salt); |
43 | 43 | ||
44 | using Opie::Security::MultiauthConfigWidget; | ||
45 | using Opie::Security::MultiauthPluginObject; | ||
46 | |||
44 | /// set to TRUE when we press the 'Skip' button | 47 | /// set to TRUE when we press the 'Skip' button |
45 | bool isSkip = FALSE; | 48 | static bool isSkip = FALSE; |
46 | 49 | ||
47 | /// PIN input graphical widget. | 50 | /// PIN input graphical widget. |
48 | /** | 51 | /** |
49 | * Inherits the PinDialogBase class defined originally in pinDialogBase.ui interface file. | 52 | * Inherits the PinDialogBase class defined originally in pinDialogBase.ui interface file. |
50 | * \sa PinDlg and PinDialog (the class generated from the .ui file) | 53 | * \sa PinDlg and PinDialog (the class generated from the .ui file) |
51 | * It comes from the original PIN locking code in Opie : | 54 | * It comes from the original PIN locking code in Opie : |
@@ -229,16 +232,16 @@ bool PinPlugin::verify(const QString& pin, const QString& hash) | |||
229 | * dialog). | 232 | * dialog). |
230 | */ | 233 | */ |
231 | QString PinPlugin::getPIN( const QString& prompt ) | 234 | QString PinPlugin::getPIN( const QString& prompt ) |
232 | { | 235 | { |
233 | PinDlg pd(0,0,TRUE); | 236 | PinDlg pd(0,0,TRUE); |
234 | pd.pinD->setPrompt( prompt ); | 237 | pd.pinD->setPrompt( prompt ); |
235 | 238 | ||
236 | pd.showMaximized(); | 239 | pd.showMaximized(); |
237 | int r = pd.exec(); | 240 | int r = pd.exec(); |
238 | 241 | ||
239 | if ( r == QDialog::Accepted ) { | 242 | if ( r == QDialog::Accepted ) { |
240 | if (pd.pinD->text.isEmpty()) | 243 | if (pd.pinD->text.isEmpty()) |
241 | return ""; | 244 | return ""; |
242 | else | 245 | else |
243 | return pd.pinD->text; | 246 | return pd.pinD->text; |
244 | } | 247 | } |
@@ -299,19 +302,19 @@ int PinPlugin::authenticate() | |||
299 | if (!hashedPin.isEmpty()) | 302 | if (!hashedPin.isEmpty()) |
300 | { | 303 | { |
301 | // prompt for the PIN in a fullscreen modal dialog | 304 | // prompt for the PIN in a fullscreen modal dialog |
302 | PinDlg pd(0,0,TRUE,TRUE); | 305 | PinDlg pd(0,0,TRUE,TRUE); |
303 | pd.reset(); | 306 | pd.reset(); |
304 | pd.exec(); | 307 | pd.exec(); |
305 | 308 | ||
306 | // analyse the result | 309 | // analyse the result |
307 | if (isSkip == TRUE) | 310 | if (isSkip == TRUE) |
308 | return MultiauthPluginObject::Skip; | 311 | return MultiauthPluginObject::Skip; |
309 | else if (verify(pd.pinD->text, hashedPin)) | 312 | else if (verify(pd.pinD->text, hashedPin)) |
310 | return MultiauthPluginObject::Success; | 313 | return MultiauthPluginObject::Success; |
311 | else | 314 | else |
312 | return MultiauthPluginObject::Failure; | 315 | return MultiauthPluginObject::Failure; |
313 | } | 316 | } |
314 | owarn << "No PIN has been defined! We consider it as a successful authentication though." << oendl; | 317 | owarn << "No PIN has been defined! We consider it as a successful authentication though." << oendl; |
315 | return MultiauthPluginObject::Success; | 318 | return MultiauthPluginObject::Success; |
316 | } | 319 | } |
317 | 320 | ||
@@ -328,15 +331,15 @@ QString PinPlugin::pixmapNameConfig() const { | |||
328 | return "security/pinplugin"; | 331 | return "security/pinplugin"; |
329 | } | 332 | } |
330 | 333 | ||
331 | /// returns a PinConfigWidget | 334 | /// returns a PinConfigWidget |
332 | MultiauthConfigWidget * PinPlugin::configWidget(QWidget * parent) { | 335 | MultiauthConfigWidget * PinPlugin::configWidget(QWidget * parent) { |
333 | PinConfigWidget * pinw = new PinConfigWidget(parent, "PIN configuration widget"); | 336 | PinConfigWidget * pinw = new PinConfigWidget(parent, "PIN configuration widget"); |
334 | 337 | ||
335 | connect(pinw->changePIN, SIGNAL( clicked() ), this, SLOT( changePIN() )); | 338 | connect(pinw->changePIN, SIGNAL( clicked() ), this, SLOT( changePIN() )); |
336 | connect(pinw->clearPIN, SIGNAL( clicked() ), this, SLOT( clearPIN() )); | 339 | connect(pinw->clearPIN, SIGNAL( clicked() ), this, SLOT( clearPIN() )); |
337 | 340 | ||
338 | return pinw; | 341 | return pinw; |
339 | } | 342 | } |
340 | 343 | ||
341 | #include "pin.moc" | 344 | #include "pin.moc" |
342 | 345 | ||
diff --git a/noncore/securityplugins/pin/pin.h b/noncore/securityplugins/pin/pin.h index 6cd328a..1832210 100644 --- a/noncore/securityplugins/pin/pin.h +++ b/noncore/securityplugins/pin/pin.h | |||
@@ -40,19 +40,19 @@ | |||
40 | #include "pinConfigWidget.h" | 40 | #include "pinConfigWidget.h" |
41 | 41 | ||
42 | /// Multi-authentication plugin, implementing a PIN verification. | 42 | /// Multi-authentication plugin, implementing a PIN verification. |
43 | /** | 43 | /** |
44 | * The plugin itself, implementing the main authenticate() function. | 44 | * The plugin itself, implementing the main authenticate() function. |
45 | */ | 45 | */ |
46 | class PinPlugin : public QObject, public MultiauthPluginObject { | 46 | class PinPlugin : public QObject, public Opie::Security::MultiauthPluginObject { |
47 | 47 | ||
48 | Q_OBJECT | 48 | Q_OBJECT |
49 | 49 | ||
50 | public: | 50 | public: |
51 | int authenticate(); | 51 | int authenticate(); |
52 | MultiauthConfigWidget * configWidget(QWidget * parent); | 52 | Opie::Security::MultiauthConfigWidget * configWidget(QWidget * parent); |
53 | QString pixmapNameConfig() const; | 53 | QString pixmapNameConfig() const; |
54 | QString pixmapNameWidget() const; | 54 | QString pixmapNameWidget() const; |
55 | QString pluginName() const; | 55 | QString pluginName() const; |
56 | 56 | ||
57 | private slots: | 57 | private slots: |
58 | QString getPIN( const QString& prompt ); | 58 | QString getPIN( const QString& prompt ); |
diff --git a/noncore/securityplugins/pin/pinConfigWidget.cpp b/noncore/securityplugins/pin/pinConfigWidget.cpp index 53e1a20..b34db8b 100644 --- a/noncore/securityplugins/pin/pinConfigWidget.cpp +++ b/noncore/securityplugins/pin/pinConfigWidget.cpp | |||
@@ -2,20 +2,22 @@ | |||
2 | #include <qlayout.h> | 2 | #include <qlayout.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qgroupbox.h> | 4 | #include <qgroupbox.h> |
5 | 5 | ||
6 | #include "pinConfigWidget.h" | 6 | #include "pinConfigWidget.h" |
7 | 7 | ||
8 | using Opie::Security::MultiauthConfigWidget; | ||
9 | |||
8 | PinConfigWidget::PinConfigWidget(QWidget* parent = 0, const char* name = "PIN configuration widget") | 10 | PinConfigWidget::PinConfigWidget(QWidget* parent = 0, const char* name = "PIN configuration widget") |
9 | : MultiauthConfigWidget(parent, name) | 11 | : MultiauthConfigWidget(parent, name) |
10 | { | 12 | { |
11 | QVBoxLayout * baseLayout = new QVBoxLayout( this); | 13 | QVBoxLayout * baseLayout = new QVBoxLayout( this); |
12 | baseLayout->setSpacing(11); | 14 | baseLayout->setSpacing(11); |
13 | baseLayout->setMargin(11); | 15 | baseLayout->setMargin(11); |
14 | baseLayout->setAlignment( Qt::AlignTop ); | 16 | baseLayout->setAlignment( Qt::AlignTop ); |
15 | 17 | ||
16 | QGroupBox * configBox = new QGroupBox(0, Qt::Vertical, tr("Configure your PIN here"), this); | 18 | QGroupBox * configBox = new QGroupBox(0, Qt::Vertical, tr("Configure your PIN here"), this); |
17 | baseLayout->addWidget(configBox); | 19 | baseLayout->addWidget(configBox); |
18 | QVBoxLayout *boxLayout = new QVBoxLayout( configBox->layout() ); | 20 | QVBoxLayout *boxLayout = new QVBoxLayout( configBox->layout() ); |
19 | 21 | ||
20 | QLabel * description = new QLabel("<p>" + tr("PIN protection provides a minimal level of protection from casual access to this device.") + "</p>", configBox); | 22 | QLabel * description = new QLabel("<p>" + tr("PIN protection provides a minimal level of protection from casual access to this device.") + "</p>", configBox); |
21 | boxLayout->addWidget(description); | 23 | boxLayout->addWidget(description); |
@@ -24,13 +26,13 @@ PinConfigWidget::PinConfigWidget(QWidget* parent = 0, const char* name = "PIN co | |||
24 | buttonLayout->setSpacing(6); | 26 | buttonLayout->setSpacing(6); |
25 | changePIN = new QPushButton( tr("Change PIN"), configBox, "changePIN" ); | 27 | changePIN = new QPushButton( tr("Change PIN"), configBox, "changePIN" ); |
26 | clearPIN = new QPushButton( tr("Clear PIN"), configBox, "clearPIN" ); | 28 | clearPIN = new QPushButton( tr("Clear PIN"), configBox, "clearPIN" ); |
27 | buttonLayout->addWidget(changePIN); | 29 | buttonLayout->addWidget(changePIN); |
28 | buttonLayout->addWidget(clearPIN); | 30 | buttonLayout->addWidget(clearPIN); |
29 | boxLayout->addLayout(buttonLayout); | 31 | boxLayout->addLayout(buttonLayout); |
30 | 32 | ||
31 | } | 33 | } |
32 | 34 | ||
33 | /// nothing to do | 35 | /// nothing to do |
34 | PinConfigWidget::~PinConfigWidget() | 36 | PinConfigWidget::~PinConfigWidget() |
35 | {} | 37 | {} |
36 | 38 | ||
diff --git a/noncore/securityplugins/pin/pinConfigWidget.h b/noncore/securityplugins/pin/pinConfigWidget.h index 3242ad0..6d5edff 100644 --- a/noncore/securityplugins/pin/pinConfigWidget.h +++ b/noncore/securityplugins/pin/pinConfigWidget.h | |||
@@ -4,48 +4,48 @@ | |||
4 | * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr) | 4 | * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr) |
5 | */ | 5 | */ |
6 | /* | 6 | /* |
7 | =. This file is part of the Opie Project | 7 | =. This file is part of the Opie Project |
8 | .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org> | 8 | .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org> |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This library is free software; you can | 10 | _;:, .> :=|. This library is free software; you can |
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 PINCONFIGWIDGET_H | 34 | #ifndef PINCONFIGWIDGET_H |
35 | #define PINCONFIGWIDGET_H | 35 | #define PINCONFIGWIDGET_H |
36 | #include <qpushbutton.h> | 36 | #include <qpushbutton.h> |
37 | 37 | ||
38 | #include <opie2/multiauthconfigwidget.h> | 38 | #include <opie2/multiauthconfigwidget.h> |
39 | 39 | ||
40 | class PinConfigWidget : public MultiauthConfigWidget { | 40 | class PinConfigWidget : public Opie::Security::MultiauthConfigWidget { |
41 | public: | 41 | public: |
42 | PinConfigWidget(QWidget* parent, const char* name); | 42 | PinConfigWidget(QWidget* parent, const char* name); |
43 | virtual ~PinConfigWidget(); | 43 | virtual ~PinConfigWidget(); |
44 | virtual void writeConfig(); | 44 | virtual void writeConfig(); |
45 | ///\todo to protect? | 45 | ///\todo to protect? |
46 | QPushButton *changePIN; | 46 | QPushButton *changePIN; |
47 | QPushButton *clearPIN; | 47 | QPushButton *clearPIN; |
48 | 48 | ||
49 | }; | 49 | }; |
50 | 50 | ||
51 | #endif // PINCONFIGWIDGET_H | 51 | #endif // PINCONFIGWIDGET_H |
diff --git a/noncore/securityplugins/pin/pinpluginimpl.cpp b/noncore/securityplugins/pin/pinpluginimpl.cpp index 1c32f81..6cd2467 100644 --- a/noncore/securityplugins/pin/pinpluginimpl.cpp +++ b/noncore/securityplugins/pin/pinpluginimpl.cpp | |||
@@ -1,8 +1,11 @@ | |||
1 | #include "pinpluginimpl.h" | 1 | #include "pinpluginimpl.h" |
2 | 2 | ||
3 | using Opie::Security::MultiauthPluginObject; | ||
4 | using Opie::Security::MultiauthPluginInterface; | ||
5 | |||
3 | PinPluginImpl::PinPluginImpl() { | 6 | PinPluginImpl::PinPluginImpl() { |
4 | pinPlugin = new PinPlugin(); | 7 | pinPlugin = new PinPlugin(); |
5 | } | 8 | } |
6 | 9 | ||
7 | PinPluginImpl::~PinPluginImpl() { | 10 | PinPluginImpl::~PinPluginImpl() { |
8 | delete pinPlugin; | 11 | delete pinPlugin; |
diff --git a/noncore/securityplugins/pin/pinpluginimpl.h b/noncore/securityplugins/pin/pinpluginimpl.h index e604b64..cbb9ef0 100644 --- a/noncore/securityplugins/pin/pinpluginimpl.h +++ b/noncore/securityplugins/pin/pinpluginimpl.h | |||
@@ -34,25 +34,24 @@ | |||
34 | #ifndef PIN_PLUGIN_IMPL_H | 34 | #ifndef PIN_PLUGIN_IMPL_H |
35 | #define PIN_PLUGIN_IMPL_H | 35 | #define PIN_PLUGIN_IMPL_H |
36 | 36 | ||
37 | #include "pin.h" | 37 | #include "pin.h" |
38 | 38 | ||
39 | /// Standard multiauth plugin class | 39 | /// Standard multiauth plugin class |
40 | class PinPluginImpl : public MultiauthPluginInterface{ | 40 | class PinPluginImpl : public Opie::Security::MultiauthPluginInterface{ |
41 | 41 | ||
42 | public: | 42 | public: |
43 | PinPluginImpl(); | 43 | PinPluginImpl(); |
44 | virtual ~PinPluginImpl(); | 44 | virtual ~PinPluginImpl(); |
45 | 45 | ||
46 | QRESULT queryInterface( const QUuid &, QUnknownInterface** ); | 46 | QRESULT queryInterface( const QUuid &, QUnknownInterface** ); |
47 | // defines standard addRef() and release() functions | 47 | // defines standard addRef() and release() functions |
48 | Q_REFCOUNT; | 48 | Q_REFCOUNT; |
49 | 49 | ||
50 | virtual MultiauthPluginObject *plugin(); | 50 | virtual Opie::Security::MultiauthPluginObject *plugin(); |
51 | 51 | ||
52 | private: | 52 | private: |
53 | /// the plugin itself | 53 | /// the plugin itself |
54 | PinPlugin *pinPlugin; | 54 | PinPlugin *pinPlugin; |
55 | ulong ref; | ||
56 | }; | 55 | }; |
57 | 56 | ||
58 | #endif | 57 | #endif |