summaryrefslogtreecommitdiff
authorzecke <zecke>2004-07-17 16:46:58 (UTC)
committer zecke <zecke>2004-07-17 16:46:58 (UTC)
commite917f3763a0beb6d540adbfa5f59e478d3baec64 (patch) (unidiff)
treec2cf3f13559d9693a4f66cd3f65e419b571377bd
parentd6a4bf47ef7dfaabd08fb8d514cde1832a055816 (diff)
downloadopie-e917f3763a0beb6d540adbfa5f59e478d3baec64.zip
opie-e917f3763a0beb6d540adbfa5f59e478d3baec64.tar.gz
opie-e917f3763a0beb6d540adbfa5f59e478d3baec64.tar.bz2
Addjust to the namespace changes of OMAF
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/securityplugins/blueping/bluepingplugin.cpp3
-rw-r--r--noncore/securityplugins/blueping/bluepingplugin.h4
-rw-r--r--noncore/securityplugins/blueping/bluepingpluginimpl.cpp3
-rw-r--r--noncore/securityplugins/blueping/bluepingpluginimpl.h5
-rw-r--r--noncore/securityplugins/dummy/dummyplugin.cpp11
-rw-r--r--noncore/securityplugins/dummy/dummyplugin.h4
-rw-r--r--noncore/securityplugins/dummy/dummypluginimpl.cpp3
-rw-r--r--noncore/securityplugins/dummy/dummypluginimpl.h5
-rw-r--r--noncore/securityplugins/notice/noticeConfigWidget.cpp4
-rw-r--r--noncore/securityplugins/notice/noticeConfigWidget.h15
-rw-r--r--noncore/securityplugins/notice/noticeplugin.cpp6
-rw-r--r--noncore/securityplugins/notice/noticeplugin.h4
-rw-r--r--noncore/securityplugins/notice/noticepluginimpl.cpp3
-rw-r--r--noncore/securityplugins/notice/noticepluginimpl.h5
-rw-r--r--noncore/securityplugins/pin/pin.cpp17
-rw-r--r--noncore/securityplugins/pin/pin.h4
-rw-r--r--noncore/securityplugins/pin/pinConfigWidget.cpp6
-rw-r--r--noncore/securityplugins/pin/pinConfigWidget.h16
-rw-r--r--noncore/securityplugins/pin/pinpluginimpl.cpp3
-rw-r--r--noncore/securityplugins/pin/pinpluginimpl.h5
20 files changed, 75 insertions, 51 deletions
diff --git a/noncore/securityplugins/blueping/bluepingplugin.cpp b/noncore/securityplugins/blueping/bluepingplugin.cpp
index af0448b..f4c5e95 100644
--- a/noncore/securityplugins/blueping/bluepingplugin.cpp
+++ b/noncore/securityplugins/blueping/bluepingplugin.cpp
@@ -1,46 +1,49 @@
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
14using namespace Opie::Core; 14using namespace Opie::Core;
15using Opie::Security::MultiauthPluginObject;
16using Opie::Security::MultiauthConfigWidget;
17
15 18
16/// creates and initializes the m_config Config object 19/// creates and initializes the m_config Config object
17BluepingPlugin::BluepingPlugin() : MultiauthPluginObject(), m_ping(0) { 20BluepingPlugin::BluepingPlugin() : MultiauthPluginObject(), m_ping(0) {
18 m_config = new Config("Security"); 21 m_config = new Config("Security");
19 m_config->setGroup("BluepingPlugin"); 22 m_config->setGroup("BluepingPlugin");
20 bluetoothAlreadyRestarted = false; 23 bluetoothAlreadyRestarted = false;
21} 24}
22 25
23/// deletes the m_config Config object and noticeW if necessary 26/// deletes the m_config Config object and noticeW if necessary
24BluepingPlugin::~BluepingPlugin() { 27BluepingPlugin::~BluepingPlugin() {
25 delete m_config; 28 delete m_config;
26 if (m_ping != 0) 29 if (m_ping != 0)
27 delete m_ping; 30 delete m_ping;
28} 31}
29 32
30/// Simply return its name (Blueping plugin) 33/// Simply return its name (Blueping plugin)
31QString BluepingPlugin::pluginName() const { 34QString BluepingPlugin::pluginName() const {
32 return "Blueping plugin"; 35 return "Blueping plugin";
33} 36}
34 37
35/// no configuration widget for the moment 38/// no configuration widget for the moment
36MultiauthConfigWidget * BluepingPlugin::configWidget(QWidget * parent) { 39MultiauthConfigWidget * BluepingPlugin::configWidget(QWidget * parent) {
37 return 0l; 40 return 0l;
38} 41}
39QString BluepingPlugin::pixmapNameWidget() const { 42QString BluepingPlugin::pixmapNameWidget() const {
40 return "security/bluepingplugin"; 43 return "security/bluepingplugin";
41} 44}
42QString BluepingPlugin::pixmapNameConfig() const { 45QString BluepingPlugin::pixmapNameConfig() const {
43 return 0l; 46 return 0l;
44} 47}
45 48
46/// Emit the MultiauthPluginObject::Success emitCode 49/// Emit the MultiauthPluginObject::Success emitCode
diff --git a/noncore/securityplugins/blueping/bluepingplugin.h b/noncore/securityplugins/blueping/bluepingplugin.h
index c122471..0df3f78 100644
--- a/noncore/securityplugins/blueping/bluepingplugin.h
+++ b/noncore/securityplugins/blueping/bluepingplugin.h
@@ -17,65 +17,65 @@
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 BLUEPING_PLUGIN_H 34#ifndef BLUEPING_PLUGIN_H
35#define BLUEPING_PLUGIN_H 35#define BLUEPING_PLUGIN_H
36 36
37#include <opie2/multiauthplugininterface.h> 37#include <opie2/multiauthplugininterface.h>
38 38
39#include <opie2/oprocess.h> 39#include <opie2/oprocess.h>
40 40
41#include <qobject.h> 41#include <qobject.h>
42#include <qstring.h> 42#include <qstring.h>
43#include <qpe/config.h> 43#include <qpe/config.h>
44 44
45/// Multi-authentication bluetooth plugin, which tries to ping a specific MAC address. 45/// Multi-authentication bluetooth plugin, which tries to ping a specific MAC address.
46/** 46/**
47 * The plugin itself, implementing the main authenticate() function. 47 * The plugin itself, implementing the main authenticate() function.
48 */ 48 */
49class BluepingPlugin : public QObject, public MultiauthPluginObject { 49class BluepingPlugin : public QObject, public Opie::Security::MultiauthPluginObject {
50 50
51 Q_OBJECT 51 Q_OBJECT
52 52
53 public: 53 public:
54 BluepingPlugin(); 54 BluepingPlugin();
55 virtual ~BluepingPlugin(); 55 virtual ~BluepingPlugin();
56 int authenticate(); 56 int authenticate();
57 MultiauthConfigWidget * configWidget(QWidget * parent); 57 Opie::Security::MultiauthConfigWidget * configWidget(QWidget * parent);
58 QString pixmapNameConfig() const; 58 QString pixmapNameConfig() const;
59 QString pixmapNameWidget() const; 59 QString pixmapNameWidget() const;
60 QString pluginName() const; 60 QString pluginName() const;
61 61
62 signals: 62 signals:
63 /// Signal carrying the result code of this plugin 63 /// Signal carrying the result code of this plugin
64 void emitCode(int resultCode); 64 void emitCode(int resultCode);
65 65
66 private slots: 66 private slots:
67 void success(); 67 void success();
68 void failure(); 68 void failure();
69 void skip(); 69 void skip();
70 void ping(); 70 void ping();
71 void pingFinished(Opie::Core::OProcess * ping); 71 void pingFinished(Opie::Core::OProcess * ping);
72 72
73 private: 73 private:
74 Opie::Core::OProcess *m_ping; 74 Opie::Core::OProcess *m_ping;
75 Config * m_config; 75 Config * m_config;
76 bool bluetoothAlreadyRestarted; 76 bool bluetoothAlreadyRestarted;
77 QString macToPing; 77 QString macToPing;
78 78
79}; 79};
80 80
81#endif 81#endif
diff --git a/noncore/securityplugins/blueping/bluepingpluginimpl.cpp b/noncore/securityplugins/blueping/bluepingpluginimpl.cpp
index f7b1bfc..dbca91f 100644
--- a/noncore/securityplugins/blueping/bluepingpluginimpl.cpp
+++ b/noncore/securityplugins/blueping/bluepingpluginimpl.cpp
@@ -1,28 +1,31 @@
1#include "bluepingpluginimpl.h" 1#include "bluepingpluginimpl.h"
2 2
3using Opie::Security::MultiauthPluginInterface;
4using Opie::Security::MultiauthPluginObject;
5
3BluepingPluginImpl::BluepingPluginImpl() { 6BluepingPluginImpl::BluepingPluginImpl() {
4 bluepingPlugin = new BluepingPlugin(); 7 bluepingPlugin = new BluepingPlugin();
5} 8}
6 9
7BluepingPluginImpl::~BluepingPluginImpl() { 10BluepingPluginImpl::~BluepingPluginImpl() {
8 delete bluepingPlugin; 11 delete bluepingPlugin;
9} 12}
10 13
11MultiauthPluginObject* BluepingPluginImpl::plugin() { 14MultiauthPluginObject* BluepingPluginImpl::plugin() {
12 return bluepingPlugin; 15 return bluepingPlugin;
13} 16}
14 17
15Q_EXPORT_INTERFACE() { 18Q_EXPORT_INTERFACE() {
16 Q_CREATE_INSTANCE( BluepingPluginImpl ) 19 Q_CREATE_INSTANCE( BluepingPluginImpl )
17} 20}
18 21
19QRESULT BluepingPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) { 22QRESULT BluepingPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) {
20 *iface = 0; 23 *iface = 0;
21 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MultiauthPluginInterface ) ) { 24 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MultiauthPluginInterface ) ) {
22 *iface = this, (*iface)->addRef(); 25 *iface = this, (*iface)->addRef();
23 } else { 26 } else {
24 return QE_NOINTERFACE; 27 return QE_NOINTERFACE;
25 } 28 }
26 return QS_OK; 29 return QS_OK;
27 30
28} 31}
diff --git a/noncore/securityplugins/blueping/bluepingpluginimpl.h b/noncore/securityplugins/blueping/bluepingpluginimpl.h
index 2fd023a..4663602 100644
--- a/noncore/securityplugins/blueping/bluepingpluginimpl.h
+++ b/noncore/securityplugins/blueping/bluepingpluginimpl.h
@@ -8,51 +8,50 @@
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 BLUEPING_PLUGIN_IMPL_H 34#ifndef BLUEPING_PLUGIN_IMPL_H
35#define BLUEPING_PLUGIN_IMPL_H 35#define BLUEPING_PLUGIN_IMPL_H
36 36
37#include "bluepingplugin.h" 37#include "bluepingplugin.h"
38 38
39/// Standard multiauth plugin class 39/// Standard multiauth plugin class
40class BluepingPluginImpl : public MultiauthPluginInterface{ 40class BluepingPluginImpl : public Opie::Security::MultiauthPluginInterface{
41 41
42 public: 42 public:
43 BluepingPluginImpl(); 43 BluepingPluginImpl();
44 virtual ~BluepingPluginImpl(); 44 virtual ~BluepingPluginImpl();
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 BluepingPlugin *bluepingPlugin; 54 BluepingPlugin *bluepingPlugin;
55 ulong ref;
56}; 55};
57 56
58#endif 57#endif
diff --git a/noncore/securityplugins/dummy/dummyplugin.cpp b/noncore/securityplugins/dummy/dummyplugin.cpp
index 0d19e43..594825e 100644
--- a/noncore/securityplugins/dummy/dummyplugin.cpp
+++ b/noncore/securityplugins/dummy/dummyplugin.cpp
@@ -1,92 +1,95 @@
1#include "dummyplugin.h" 1#include "dummyplugin.h"
2 2
3#include <opie2/oapplication.h> 3#include <opie2/oapplication.h>
4 4
5#include <qdialog.h> 5#include <qdialog.h>
6#include <qlayout.h> 6#include <qlayout.h>
7#include <qlabel.h> 7#include <qlabel.h>
8#include <qpushbutton.h> 8#include <qpushbutton.h>
9 9
10using Opie::Security::MultiauthConfigWidget;
11using Opie::Security::MultiauthPluginObject;
12
10/// Simply return its name (Dummy plugin) 13/// Simply return its name (Dummy plugin)
11QString DummyPlugin::pluginName() const { 14QString DummyPlugin::pluginName() const {
12 return "Dummy plugin"; 15 return "Dummy plugin";
13} 16}
14 17
15/// no configuration widget for the moment 18/// no configuration widget for the moment
16MultiauthConfigWidget * DummyPlugin::configWidget(QWidget * parent) { 19MultiauthConfigWidget * DummyPlugin::configWidget(QWidget * parent) {
17 return 0l; 20 return 0l;
18} 21}
19QString DummyPlugin::pixmapNameWidget() const { 22QString DummyPlugin::pixmapNameWidget() const {
20 return "security/dummyplugin"; 23 return "security/dummyplugin";
21} 24}
22QString DummyPlugin::pixmapNameConfig() const { 25QString DummyPlugin::pixmapNameConfig() const {
23 return 0l; 26 return 0l;
24} 27}
25 28
26/// Emit the MultiauthPluginObject::Success emitCode 29/// Emit the MultiauthPluginObject::Success emitCode
27void DummyPlugin::success() { 30void DummyPlugin::success() {
28 emit emitCode(MultiauthPluginObject::Success); 31 emit emitCode(MultiauthPluginObject::Success);
29} 32}
30 33
31/// Emit the MultiauthPluginObject::Failure emitCode 34/// Emit the MultiauthPluginObject::Failure emitCode
32void DummyPlugin::failure() { 35void DummyPlugin::failure() {
33 emit emitCode(MultiauthPluginObject::Failure); 36 emit emitCode(MultiauthPluginObject::Failure);
34} 37}
35 38
36/// Emit the MultiauthPluginObject::Skip emitCode 39/// Emit the MultiauthPluginObject::Skip emitCode
37void DummyPlugin::skip() { 40void DummyPlugin::skip() {
38 emit emitCode(MultiauthPluginObject::Skip); 41 emit emitCode(MultiauthPluginObject::Skip);
39} 42}
40 43
41/// Make one authentication attempt with this plugin 44/// Make one authentication attempt with this plugin
42/** 45/**
43 * (very simple "success" / "failure" buttons in a dialog) 46 * (very simple "success" / "failure" buttons in a dialog)
44 * \return The outcome code of this authentication 47 * \return The outcome code of this authentication
45 */ 48 */
46int DummyPlugin::authenticate() { 49int DummyPlugin::authenticate() {
47 50
48 /* Standard, inescapable authentication dialog 51 /* Standard, inescapable authentication dialog
49 */ 52 */
50 QDialog dummyDialog(0, 53 QDialog dummyDialog(0,
51 "Dummy dialog", 54 "Dummy dialog",
52 TRUE, 55 TRUE,
53 Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop); 56 Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop);
54 57
55 QRect desk = oApp->desktop()->geometry(); 58 QRect desk = oApp->desktop()->geometry();
56 dummyDialog.setGeometry( 0, 0, desk.width(), desk.height() ); 59 dummyDialog.setGeometry( 0, 0, desk.width(), desk.height() );
57 60
58 /* Creation of the particular widgets of our Dummy user interface 61 /* Creation of the particular widgets of our Dummy user interface
59 * Note: we have to resize the VBox to the QDialog size, since it's not 62 * Note: we have to resize the VBox to the QDialog size, since it's not
60 * done automatically. 63 * done automatically.
61 */ 64 */
62 QVBoxLayout layout(&dummyDialog); 65 QVBoxLayout layout(&dummyDialog);
63 layout.setSpacing(11); 66 layout.setSpacing(11);
64 layout.setMargin(11); 67 layout.setMargin(11);
65 layout.setAlignment( Qt::AlignTop ); 68 layout.setAlignment( Qt::AlignTop );
66 69
67 QLabel title("<center><h1>" + tr("\"Dummy\" <br />demonstration plugin") + "</h1></center>", &dummyDialog); 70 QLabel title("<center><h1>" + tr("\"Dummy\" <br />demonstration plugin") + "</h1></center>", &dummyDialog);
68 QLabel subTitle("<center><h2>" +tr("You can simulate the following outcomes:") + "</h2></center>", &dummyDialog); 71 QLabel subTitle("<center><h2>" +tr("You can simulate the following outcomes:") + "</h2></center>", &dummyDialog);
69 layout.addWidget(&title); 72 layout.addWidget(&title);
70 layout.addWidget(&subTitle); 73 layout.addWidget(&subTitle);
71 74
72 QHBoxLayout hl(&layout); 75 QHBoxLayout hl(&layout);
73 QPushButton pbSuccess("Success", &dummyDialog); 76 QPushButton pbSuccess("Success", &dummyDialog);
74 QPushButton pbSkip("Skip", &dummyDialog); 77 QPushButton pbSkip("Skip", &dummyDialog);
75 QPushButton pbFailure("Failure", &dummyDialog); 78 QPushButton pbFailure("Failure", &dummyDialog);
76 hl.addWidget(&pbSuccess, 0, Qt::AlignHCenter); 79 hl.addWidget(&pbSuccess, 0, Qt::AlignHCenter);
77 hl.addWidget(&pbSkip, 0, Qt::AlignHCenter); 80 hl.addWidget(&pbSkip, 0, Qt::AlignHCenter);
78 hl.addWidget(&pbFailure, 0, Qt::AlignHCenter); 81 hl.addWidget(&pbFailure, 0, Qt::AlignHCenter);
79 82
80 /* Linking our pushbuttons to exit functions 83 /* Linking our pushbuttons to exit functions
81 * (each result button here has a corresponding slot) 84 * (each result button here has a corresponding slot)
82 */ 85 */
83 QObject::connect(&pbSuccess, SIGNAL(clicked()), this, SLOT(success())); 86 QObject::connect(&pbSuccess, SIGNAL(clicked()), this, SLOT(success()));
84 QObject::connect(&pbFailure, SIGNAL(clicked()), this, SLOT(failure())); 87 QObject::connect(&pbFailure, SIGNAL(clicked()), this, SLOT(failure()));
85 QObject::connect(&pbSkip, SIGNAL(clicked()), this, SLOT(skip())); 88 QObject::connect(&pbSkip, SIGNAL(clicked()), this, SLOT(skip()));
86 89
87 /* The value of the signal these three slots will emit corresponds to 90 /* The value of the signal these three slots will emit corresponds to
88 * the different values we want to return 91 * the different values we want to return
89 */ 92 */
90 QObject::connect(this, SIGNAL(emitCode(int)), &dummyDialog, SLOT(done(int))); 93 QObject::connect(this, SIGNAL(emitCode(int)), &dummyDialog, SLOT(done(int)));
91 return dummyDialog.exec(); 94 return dummyDialog.exec();
92} 95}
diff --git a/noncore/securityplugins/dummy/dummyplugin.h b/noncore/securityplugins/dummy/dummyplugin.h
index 9680dff..3bfca98 100644
--- a/noncore/securityplugins/dummy/dummyplugin.h
+++ b/noncore/securityplugins/dummy/dummyplugin.h
@@ -13,54 +13,54 @@
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 DUMMY_PLUGIN_H 34#ifndef DUMMY_PLUGIN_H
35#define DUMMY_PLUGIN_H 35#define DUMMY_PLUGIN_H
36 36
37#include <qobject.h> 37#include <qobject.h>
38#include <qstring.h> 38#include <qstring.h>
39#include <opie2/multiauthplugininterface.h> 39#include <opie2/multiauthplugininterface.h>
40 40
41/// Multi-authentication example plugin, implementing a trivial 'yes/no' verification. 41/// Multi-authentication example plugin, implementing a trivial 'yes/no' verification.
42/** 42/**
43 * The plugin itself, implementing the main authenticate() function. 43 * The plugin itself, implementing the main authenticate() function.
44 */ 44 */
45class DummyPlugin : public QObject, public MultiauthPluginObject { 45class DummyPlugin : public QObject, public Opie::Security::MultiauthPluginObject {
46 46
47 Q_OBJECT 47 Q_OBJECT
48 48
49 public: 49 public:
50 int authenticate(); 50 int authenticate();
51 MultiauthConfigWidget * configWidget(QWidget * parent); 51 Opie::Security::MultiauthConfigWidget * configWidget(QWidget * parent);
52 QString pixmapNameConfig() const; 52 QString pixmapNameConfig() const;
53 QString pixmapNameWidget() const; 53 QString pixmapNameWidget() const;
54 QString pluginName() const; 54 QString pluginName() const;
55 55
56 signals: 56 signals:
57 /// Signal carrying the result code of this plugin 57 /// Signal carrying the result code of this plugin
58 void emitCode(int resultCode); 58 void emitCode(int resultCode);
59 59
60 private slots: 60 private slots:
61 void success(); 61 void success();
62 void failure(); 62 void failure();
63 void skip(); 63 void skip();
64}; 64};
65 65
66#endif 66#endif
diff --git a/noncore/securityplugins/dummy/dummypluginimpl.cpp b/noncore/securityplugins/dummy/dummypluginimpl.cpp
index 518996c..54dbdd1 100644
--- a/noncore/securityplugins/dummy/dummypluginimpl.cpp
+++ b/noncore/securityplugins/dummy/dummypluginimpl.cpp
@@ -1,28 +1,31 @@
1#include "dummypluginimpl.h" 1#include "dummypluginimpl.h"
2 2
3using Opie::Security::MultiauthPluginInterface;
4using Opie::Security::MultiauthPluginObject;
5
3DummyPluginImpl::DummyPluginImpl() { 6DummyPluginImpl::DummyPluginImpl() {
4 dummyPlugin = new DummyPlugin(); 7 dummyPlugin = new DummyPlugin();
5} 8}
6 9
7DummyPluginImpl::~DummyPluginImpl() { 10DummyPluginImpl::~DummyPluginImpl() {
8 delete dummyPlugin; 11 delete dummyPlugin;
9} 12}
10 13
11MultiauthPluginObject* DummyPluginImpl::plugin() { 14MultiauthPluginObject* DummyPluginImpl::plugin() {
12 return dummyPlugin; 15 return dummyPlugin;
13} 16}
14 17
15Q_EXPORT_INTERFACE() { 18Q_EXPORT_INTERFACE() {
16 Q_CREATE_INSTANCE( DummyPluginImpl ) 19 Q_CREATE_INSTANCE( DummyPluginImpl )
17} 20}
18 21
19QRESULT DummyPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) { 22QRESULT DummyPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) {
20 *iface = 0; 23 *iface = 0;
21 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MultiauthPluginInterface ) ) { 24 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MultiauthPluginInterface ) ) {
22 *iface = this, (*iface)->addRef(); 25 *iface = this, (*iface)->addRef();
23 } else { 26 } else {
24 return QE_NOINTERFACE; 27 return QE_NOINTERFACE;
25 } 28 }
26 return QS_OK; 29 return QS_OK;
27 30
28} 31}
diff --git a/noncore/securityplugins/dummy/dummypluginimpl.h b/noncore/securityplugins/dummy/dummypluginimpl.h
index 49a18cd..ce8620d 100644
--- a/noncore/securityplugins/dummy/dummypluginimpl.h
+++ b/noncore/securityplugins/dummy/dummypluginimpl.h
@@ -8,51 +8,50 @@
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 DUMMY_PLUGIN_IMPL_H 34#ifndef DUMMY_PLUGIN_IMPL_H
35#define DUMMY_PLUGIN_IMPL_H 35#define DUMMY_PLUGIN_IMPL_H
36 36
37#include "dummyplugin.h" 37#include "dummyplugin.h"
38 38
39/// Standard multiauth plugin class 39/// Standard multiauth plugin class
40class DummyPluginImpl : public MultiauthPluginInterface{ 40class DummyPluginImpl : public Opie::Security::MultiauthPluginInterface{
41 41
42 public: 42 public:
43 DummyPluginImpl(); 43 DummyPluginImpl();
44 virtual ~DummyPluginImpl(); 44 virtual ~DummyPluginImpl();
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 DummyPlugin *dummyPlugin; 54 DummyPlugin *dummyPlugin;
55 ulong ref;
56}; 55};
57 56
58#endif 57#endif
diff --git a/noncore/securityplugins/notice/noticeConfigWidget.cpp b/noncore/securityplugins/notice/noticeConfigWidget.cpp
index e2c2d83..e532232 100644
--- a/noncore/securityplugins/notice/noticeConfigWidget.cpp
+++ b/noncore/securityplugins/notice/noticeConfigWidget.cpp
@@ -1,81 +1,83 @@
1#include "noticeConfigWidget.h" 1#include "noticeConfigWidget.h"
2 2
3#include <opie2/odebug.h> 3#include <opie2/odebug.h>
4 4
5#include <qwidget.h> 5#include <qwidget.h>
6#include <qlayout.h> 6#include <qlayout.h>
7#include <qlabel.h> 7#include <qlabel.h>
8#include <qregexp.h> 8#include <qregexp.h>
9#include <qgroupbox.h> 9#include <qgroupbox.h>
10 10
11using Opie::Security::MultiauthConfigWidget;
12
11/// constructs the widget, filling the noticeMLE QMultiLineEdit with the "noticeText" entry 13/// constructs the widget, filling the noticeMLE QMultiLineEdit with the "noticeText" entry
12NoticeConfigWidget::NoticeConfigWidget(QWidget* parent = 0, const char* name = "Notice configuration widget") : MultiauthConfigWidget(parent, name) 14NoticeConfigWidget::NoticeConfigWidget(QWidget* parent = 0, const char* name = "Notice configuration widget") : MultiauthConfigWidget(parent, name)
13{ 15{
14 QVBoxLayout *baseLayout = new QVBoxLayout( this); 16 QVBoxLayout *baseLayout = new QVBoxLayout( this);
15 baseLayout->setSpacing(11); 17 baseLayout->setSpacing(11);
16 baseLayout->setMargin(6); 18 baseLayout->setMargin(6);
17 baseLayout->setAlignment( Qt::AlignTop ); 19 baseLayout->setAlignment( Qt::AlignTop );
18 20
19 QGroupBox *configBox = new QGroupBox(0, Qt::Vertical, tr("Set the message the user must accept"), this); 21 QGroupBox *configBox = new QGroupBox(0, Qt::Vertical, tr("Set the message the user must accept"), this);
20 baseLayout->addWidget(configBox); 22 baseLayout->addWidget(configBox);
21 QVBoxLayout *boxLayout = new QVBoxLayout( configBox->layout() ); 23 QVBoxLayout *boxLayout = new QVBoxLayout( configBox->layout() );
22 24
23 QLabel * comment1 = new QLabel("<p><em>" + tr("You may want to consult your legal department for proper wording here.") + "</em></p>", configBox); 25 QLabel * comment1 = new QLabel("<p><em>" + tr("You may want to consult your legal department for proper wording here.") + "</em></p>", configBox);
24 boxLayout->addWidget(comment1); 26 boxLayout->addWidget(comment1);
25 27
26 // Set the multilineedit box text to getNoticeText() 28 // Set the multilineedit box text to getNoticeText()
27 noticeMLE = new QMultiLineEdit(configBox, "notice text"); 29 noticeMLE = new QMultiLineEdit(configBox, "notice text");
28 noticeMLE->setWordWrap(QMultiLineEdit::WidgetWidth); 30 noticeMLE->setWordWrap(QMultiLineEdit::WidgetWidth);
29 noticeMLE->setFocus(); 31 noticeMLE->setFocus();
30 noticeMLE->setText(getNoticeText()); 32 noticeMLE->setText(getNoticeText());
31 boxLayout->addWidget(noticeMLE); 33 boxLayout->addWidget(noticeMLE);
32 34
33 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" );
34 connect(resetNoticeButton, SIGNAL( clicked() ), this, SLOT( resetNotice() )); 36 connect(resetNoticeButton, SIGNAL( clicked() ), this, SLOT( resetNotice() ));
35 boxLayout->addWidget(resetNoticeButton, 0, Qt::AlignHCenter); 37 boxLayout->addWidget(resetNoticeButton, 0, Qt::AlignHCenter);
36 38
37 QLabel * comment2 = new QLabel("<p>" + tr("Note: you can use HTML tags to improve its layout (example: text between &lt;em&gt; and &lt;/em&gt; 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 &lt;em&gt; and &lt;/em&gt; will be <em>emphasized</em>)") + "</p>", configBox);
38 boxLayout->addWidget(comment2); 40 boxLayout->addWidget(comment2);
39 41
40} 42}
41 43
42/// nothing to do 44/// nothing to do
43NoticeConfigWidget::~NoticeConfigWidget() 45NoticeConfigWidget::~NoticeConfigWidget()
44{} 46{}
45 47
46/// write the notice text in the multiauth.conf Config file 48/// write the notice text in the multiauth.conf Config file
47void NoticeConfigWidget::writeConfig() 49void NoticeConfigWidget::writeConfig()
48{ 50{
49 if ( noticeMLE->edited() ) { 51 if ( noticeMLE->edited() ) {
50 odebug << "writing new notice text in Security.conf" << oendl; 52 odebug << "writing new notice text in Security.conf" << oendl;
51 setNoticeText(noticeMLE->text()); 53 setNoticeText(noticeMLE->text());
52 } 54 }
53} 55}
54 56
55/// reset the notice text to the hard-coded example defaultNoticeText 57/// reset the notice text to the hard-coded example defaultNoticeText
56void NoticeConfigWidget::resetNotice() 58void NoticeConfigWidget::resetNotice()
57{ 59{
58 noticeMLE->setText(defaultNoticeText); 60 noticeMLE->setText(defaultNoticeText);
59} 61}
60 62
61/// 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)
62/** 64/**
63 * if no text has been defined yet returns defaultNoticeText 65 * if no text has been defined yet returns defaultNoticeText
64 */ 66 */
65QString NoticeConfigWidget::getNoticeText() { 67QString NoticeConfigWidget::getNoticeText() {
66 m_config = new Config("Security"); 68 m_config = new Config("Security");
67 m_config->setGroup("NoticePlugin"); 69 m_config->setGroup("NoticePlugin");
68 // 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
69 QString noticeText = m_config->readEntry("noticeText", defaultNoticeText).replace( QRegExp("\\\\n"), "\n" ); 71 QString noticeText = m_config->readEntry("noticeText", defaultNoticeText).replace( QRegExp("\\\\n"), "\n" );
70 delete m_config; 72 delete m_config;
71 return noticeText; 73 return noticeText;
72} 74}
73 75
74/// 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)
75void NoticeConfigWidget::setNoticeText(QString noticeText) { 77void NoticeConfigWidget::setNoticeText(QString noticeText) {
76 m_config = new Config("Security"); 78 m_config = new Config("Security");
77 m_config->setGroup("NoticePlugin"); 79 m_config->setGroup("NoticePlugin");
78 // 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"
79 m_config->writeEntry("noticeText", noticeText.replace( QRegExp("\n"), "\\n" )); 81 m_config->writeEntry("noticeText", noticeText.replace( QRegExp("\n"), "\\n" ));
80 delete m_config; 82 delete m_config;
81} 83}
diff --git a/noncore/securityplugins/notice/noticeConfigWidget.h b/noncore/securityplugins/notice/noticeConfigWidget.h
index 69f15bf..c90484c 100644
--- a/noncore/securityplugins/notice/noticeConfigWidget.h
+++ b/noncore/securityplugins/notice/noticeConfigWidget.h
@@ -1,71 +1,72 @@
1/** 1/**
2 * \file noticeConfigWidget.h 2 * \file noticeConfigWidget.h
3 * \brief Notice plugin configuration widget 3 * \brief Notice plugin configuration widget
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 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
43static char defaultNoticeText [] = "<h2>NOTICE TO USERS</h2>\n" 43static char defaultNoticeText [] = "<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
52class NoticeConfigWidget : public MultiauthConfigWidget { 52class NoticeConfigWidget : public Opie::Security::MultiauthConfigWidget {
53 53
54 Q_OBJECT 54 Q_OBJECT
55 55
56public: 56public:
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();
60private: 60private:
61 QMultiLineEdit * noticeMLE; 61 QMultiLineEdit * noticeMLE;
62 QPushButton * resetNoticeButton; 62 QPushButton * resetNoticeButton;
63private slots: 63private slots:
64 void resetNotice(); 64 void resetNotice();
65private: 65private:
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
diff --git a/noncore/securityplugins/notice/noticeplugin.cpp b/noncore/securityplugins/notice/noticeplugin.cpp
index bacc439..25a452a 100644
--- a/noncore/securityplugins/notice/noticeplugin.cpp
+++ b/noncore/securityplugins/notice/noticeplugin.cpp
@@ -1,84 +1,86 @@
1#include "noticeplugin.h" 1#include "noticeplugin.h"
2 2
3#include <opie2/oapplication.h> 3#include <opie2/oapplication.h>
4 4
5#include <qmessagebox.h> 5#include <qmessagebox.h>
6#include <qregexp.h> 6#include <qregexp.h>
7 7
8using Opie::Security::MultiauthPluginObject;
9using Opie::Security::MultiauthConfigWidget;
8 10
9/// creates and initializes the m_config Config object 11/// creates and initializes the m_config Config object
10NoticePlugin::NoticePlugin() : MultiauthPluginObject(), noticeW(0) { 12NoticePlugin::NoticePlugin() : MultiauthPluginObject(), noticeW(0) {
11 m_config = new Config("Security"); 13 m_config = new Config("Security");
12 m_config->setGroup("NoticePlugin"); 14 m_config->setGroup("NoticePlugin");
13} 15}
14 16
15/// deletes the m_config Config object and noticeW if necessary 17/// deletes the m_config Config object and noticeW if necessary
16NoticePlugin::~NoticePlugin() { 18NoticePlugin::~NoticePlugin() {
17 delete m_config; 19 delete m_config;
18 if (noticeW != 0) 20 if (noticeW != 0)
19 delete noticeW; 21 delete noticeW;
20} 22}
21 23
22/// Simply return its name (Notice plugin) 24/// Simply return its name (Notice plugin)
23QString NoticePlugin::pluginName() const { 25QString NoticePlugin::pluginName() const {
24 return "Notice plugin"; 26 return "Notice plugin";
25} 27}
26 28
27/// return the Notice widget configuration widget 29/// return the Notice widget configuration widget
28/** 30/**
29 * \return noticeW, the NoticeConfigWidget 31 * \return noticeW, the NoticeConfigWidget
30 */ 32 */
31MultiauthConfigWidget * NoticePlugin::configWidget(QWidget * parent) { 33MultiauthConfigWidget * NoticePlugin::configWidget(QWidget * parent) {
32 if (noticeW == 0) 34 if (noticeW == 0)
33 noticeW = new NoticeConfigWidget(parent, "Notice configuration widget"); 35 noticeW = new NoticeConfigWidget(parent, "Notice configuration widget");
34 return noticeW; 36 return noticeW;
35} 37}
36 38
37/// return the path of the small tab icon 39/// return the path of the small tab icon
38QString NoticePlugin::pixmapNameConfig() const { 40QString NoticePlugin::pixmapNameConfig() const {
39 return "security/noticeplugin_small"; 41 return "security/noticeplugin_small";
40} 42}
41 43
42/// return the path of the big icon for the active/order checklist 44/// return the path of the big icon for the active/order checklist
43QString NoticePlugin::pixmapNameWidget() const { 45QString NoticePlugin::pixmapNameWidget() const {
44 return "security/noticeplugin"; 46 return "security/noticeplugin";
45} 47}
46 48
47/// Displays the configured message and an 'Accept' button 49/// Displays the configured message and an 'Accept' button
48/** 50/**
49 * \return the outcome code of this authentication (can be only success) 51 * \return the outcome code of this authentication (can be only success)
50 */ 52 */
51int NoticePlugin::authenticate() { 53int NoticePlugin::authenticate() {
52 QMessageBox noticeDialog("Notice plugin", 54 QMessageBox noticeDialog("Notice plugin",
53 getNoticeText(), 55 getNoticeText(),
54 QMessageBox::Warning, 56 QMessageBox::Warning,
55 QMessageBox::Yes, 57 QMessageBox::Yes,
56 0, 58 0,
57 0, 59 0,
58 0, 60 0,
59 "notice plugin dialog", 61 "notice plugin dialog",
60 true, 62 true,
61 Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop); 63 Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop);
62 64
63 noticeDialog.setButtonText(QMessageBox::Yes, tr("I accept")); 65 noticeDialog.setButtonText(QMessageBox::Yes, tr("I accept"));
64 66
65 QRect desk = oApp->desktop()->geometry(); 67 QRect desk = oApp->desktop()->geometry();
66 noticeDialog.setGeometry( 0, 0, desk.width(), desk.height() ); 68 noticeDialog.setGeometry( 0, 0, desk.width(), desk.height() );
67 69
68 switch (noticeDialog.exec()) 70 switch (noticeDialog.exec())
69 { 71 {
70 case QMessageBox::Yes: 72 case QMessageBox::Yes:
71 return MultiauthPluginObject::Success; 73 return MultiauthPluginObject::Success;
72 } 74 }
73 return 255; //should not be returned anyway 75 return 255; //should not be returned anyway
74} 76}
75 77
76/// 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)
77/** 79/**
78 * if no text has been defined yet returns defaultNoticeText 80 * if no text has been defined yet returns defaultNoticeText
79 */ 81 */
80QString NoticePlugin::getNoticeText() { 82QString NoticePlugin::getNoticeText() {
81 // 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
82 return m_config->readEntry("noticeText", defaultNoticeText).replace( QRegExp("\\\\n"), "\n" ); 84 return m_config->readEntry("noticeText", defaultNoticeText).replace( QRegExp("\\\\n"), "\n" );
83} 85}
84 86
diff --git a/noncore/securityplugins/notice/noticeplugin.h b/noncore/securityplugins/notice/noticeplugin.h
index 842d47b..4aa6f02 100644
--- a/noncore/securityplugins/notice/noticeplugin.h
+++ b/noncore/securityplugins/notice/noticeplugin.h
@@ -14,51 +14,51 @@
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 NOTICE_PLUGIN_H 34#ifndef NOTICE_PLUGIN_H
35#define NOTICE_PLUGIN_H 35#define NOTICE_PLUGIN_H
36 36
37#include <qstring.h> 37#include <qstring.h>
38#include <qpe/config.h> 38#include <qpe/config.h>
39#include <opie2/multiauthplugininterface.h> 39#include <opie2/multiauthplugininterface.h>
40#include "noticeConfigWidget.h" 40#include "noticeConfigWidget.h"
41 41
42/// Multi-authentication plugin, having the user accept a (legal, etc.) notice text. 42/// Multi-authentication plugin, having the user accept a (legal, etc.) notice text.
43/** 43/**
44 * The plugin itself, implementing the main authenticate() function. 44 * The plugin itself, implementing the main authenticate() function.
45 */ 45 */
46class NoticePlugin : public QObject, public MultiauthPluginObject { 46class NoticePlugin : public QObject, public Opie::Security::MultiauthPluginObject {
47 47
48 Q_OBJECT; 48 Q_OBJECT;
49 49
50public: 50public:
51 NoticePlugin(); 51 NoticePlugin();
52 virtual ~NoticePlugin(); 52 virtual ~NoticePlugin();
53 int authenticate(); 53 int authenticate();
54 MultiauthConfigWidget * configWidget(QWidget * parent); 54 Opie::Security::MultiauthConfigWidget * configWidget(QWidget * parent);
55 QString pixmapNameConfig() const; 55 QString pixmapNameConfig() const;
56 QString pixmapNameWidget() const; 56 QString pixmapNameWidget() const;
57 QString pluginName() const; 57 QString pluginName() const;
58private: 58private:
59 NoticeConfigWidget * noticeW; 59 NoticeConfigWidget * noticeW;
60 Config * m_config; 60 Config * m_config;
61 QString getNoticeText(); 61 QString getNoticeText();
62}; 62};
63 63
64#endif 64#endif
diff --git a/noncore/securityplugins/notice/noticepluginimpl.cpp b/noncore/securityplugins/notice/noticepluginimpl.cpp
index 34e3cfc..7524512 100644
--- a/noncore/securityplugins/notice/noticepluginimpl.cpp
+++ b/noncore/securityplugins/notice/noticepluginimpl.cpp
@@ -1,28 +1,31 @@
1#include "noticepluginimpl.h" 1#include "noticepluginimpl.h"
2 2
3using Opie::Security::MultiauthPluginObject;
4using Opie::Security::MultiauthPluginInterface;
5
3NoticePluginImpl::NoticePluginImpl() { 6NoticePluginImpl::NoticePluginImpl() {
4 noticePlugin = new NoticePlugin(); 7 noticePlugin = new NoticePlugin();
5} 8}
6 9
7NoticePluginImpl::~NoticePluginImpl() { 10NoticePluginImpl::~NoticePluginImpl() {
8 delete noticePlugin; 11 delete noticePlugin;
9} 12}
10 13
11MultiauthPluginObject* NoticePluginImpl::plugin() { 14MultiauthPluginObject* NoticePluginImpl::plugin() {
12 return noticePlugin; 15 return noticePlugin;
13} 16}
14 17
15 Q_EXPORT_INTERFACE() { 18 Q_EXPORT_INTERFACE() {
16 Q_CREATE_INSTANCE( NoticePluginImpl ) 19 Q_CREATE_INSTANCE( NoticePluginImpl )
17 } 20 }
18 21
19QRESULT NoticePluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) { 22QRESULT NoticePluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) {
20 *iface = 0; 23 *iface = 0;
21 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MultiauthPluginInterface ) ) { 24 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MultiauthPluginInterface ) ) {
22 *iface = this, (*iface)->addRef(); 25 *iface = this, (*iface)->addRef();
23 } else { 26 } else {
24 return QE_NOINTERFACE; 27 return QE_NOINTERFACE;
25 } 28 }
26 return QS_OK; 29 return QS_OK;
27 30
28} 31}
diff --git a/noncore/securityplugins/notice/noticepluginimpl.h b/noncore/securityplugins/notice/noticepluginimpl.h
index b2a1140..1b1e22f 100644
--- a/noncore/securityplugins/notice/noticepluginimpl.h
+++ b/noncore/securityplugins/notice/noticepluginimpl.h
@@ -10,52 +10,51 @@
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 NOTICE_PLUGIN_IMPL 34#ifndef NOTICE_PLUGIN_IMPL
35#define NOTICE_PLUGIN_IMPL 35#define NOTICE_PLUGIN_IMPL
36 36
37#include "noticeplugin.h" 37#include "noticeplugin.h"
38 38
39/** 39/**
40 * \brief Standard multiauth plugin class 40 * \brief Standard multiauth plugin class
41 */ 41 */
42class NoticePluginImpl : public MultiauthPluginInterface{ 42class NoticePluginImpl : public Opie::Security::MultiauthPluginInterface{
43 43
44 public: 44 public:
45 NoticePluginImpl(); 45 NoticePluginImpl();
46 virtual ~NoticePluginImpl(); 46 virtual ~NoticePluginImpl();
47 47
48 QRESULT queryInterface( const QUuid &, QUnknownInterface** ); 48 QRESULT queryInterface( const QUuid &, QUnknownInterface** );
49 /// defines standard addRef() and release() functions 49 /// defines standard addRef() and release() functions
50 Q_REFCOUNT; 50 Q_REFCOUNT;
51 51
52 virtual MultiauthPluginObject *plugin(); 52 virtual Opie::Security::MultiauthPluginObject *plugin();
53 53
54 private: 54 private:
55 /// the plugin itself 55 /// the plugin itself
56 NoticePlugin *noticePlugin; 56 NoticePlugin *noticePlugin;
57 ulong ref;
58}; 57};
59 58
60#endif 59#endif
61 60
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
@@ -12,66 +12,69 @@
12 ** packaging of this file. 12 ** packaging of this file.
13 ** 13 **
14 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 14 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
15 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 15 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16 ** 16 **
17 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 17 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
18 ** 18 **
19 ** Contact info@trolltech.com if any conditions of this licensing are 19 ** Contact info@trolltech.com if any conditions of this licensing are
20 ** not clear to you. 20 ** not clear to you.
21 ** 21 **
22 **********************************************************************/ 22 **********************************************************************/
23 23
24#include "pin.h" 24#include "pin.h"
25#include "pinDialogBase.h" 25#include "pinDialogBase.h"
26#include "pinConfigWidget.h" 26#include "pinConfigWidget.h"
27/* OPIE */ 27/* OPIE */
28#include <opie2/odebug.h> 28#include <opie2/odebug.h>
29#include <opie2/oapplication.h> 29#include <opie2/oapplication.h>
30/* QT */ 30/* QT */
31#include <qpe/config.h> 31#include <qpe/config.h>
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qlineedit.h> 33#include <qlineedit.h>
34#include <qtextview.h> 34#include <qtextview.h>
35#include <qstring.h> 35#include <qstring.h>
36#include <qdialog.h> 36#include <qdialog.h>
37/* UNIX */ 37/* UNIX */
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
42extern "C" char *crypt(const char *key, const char *salt); 42extern "C" char *crypt(const char *key, const char *salt);
43 43
44using Opie::Security::MultiauthConfigWidget;
45using Opie::Security::MultiauthPluginObject;
46
44/// set to TRUE when we press the 'Skip' button 47/// set to TRUE when we press the 'Skip' button
45bool isSkip = FALSE; 48static 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 :
52 * \sa http://dudu.dyn.2-h.org/opiedoxydoc/library_2password_8cpp-source.html 55 * \sa http://dudu.dyn.2-h.org/opiedoxydoc/library_2password_8cpp-source.html
53 */ 56 */
54class PinDialog : public PinDialogBase 57class PinDialog : public PinDialogBase
55{ 58{
56 Q_OBJECT 59 Q_OBJECT
57 60
58 public: 61 public:
59 PinDialog( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 62 PinDialog( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
60 ~PinDialog(); 63 ~PinDialog();
61 64
62 void clear(); 65 void clear();
63 void setPrompt( const QString& ); 66 void setPrompt( const QString& );
64 67
65signals: 68signals:
66 /// emitted when we press the Enter button 69 /// emitted when we press the Enter button
67 void passwordEntered( const QString& ); 70 void passwordEntered( const QString& );
68 /// emitted when we press the Skip button 71 /// emitted when we press the Skip button
69 void skip(); 72 void skip();
70 73
71 protected: 74 protected:
72 bool eventFilter( QObject*, QEvent* ); 75 bool eventFilter( QObject*, QEvent* );
73 76
74 private: 77 private:
75 void input( QString ); 78 void input( QString );
76 friend class PinPlugin; 79 friend class PinPlugin;
77 QString text; 80 QString text;
@@ -203,68 +206,68 @@ QString PinPlugin::encrypt(const QString& pin)
203 const char *const seedchars = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; 206 const char *const seedchars = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
204 // initialize the random generator 207 // initialize the random generator
205 srandom(time(0)); 208 srandom(time(0));
206 int i; 209 int i;
207 for(i = 0; i < 8; i++) 210 for(i = 0; i < 8; i++)
208 { 211 {
209 // initialize the salt with random() 212 // initialize the salt with random()
210 salt[i+3] = seedchars[random() % 64]; 213 salt[i+3] = seedchars[random() % 64];
211 } 214 }
212 return QString::fromLatin1(crypt(pin.latin1(),salt)); 215 return QString::fromLatin1(crypt(pin.latin1(),salt));
213} 216}
214 217
215/// verify a PIN against its crypt() hash 218/// verify a PIN against its crypt() hash
216/** 219/**
217 * \return true if the \a pin matches its \a hash 220 * \return true if the \a pin matches its \a hash
218 */ 221 */
219bool PinPlugin::verify(const QString& pin, const QString& hash) 222bool PinPlugin::verify(const QString& pin, const QString& hash)
220{ 223{
221 // the hash, which contains the salt (8 chars after "$1$"), can be given as the salt 224 // the hash, which contains the salt (8 chars after "$1$"), can be given as the salt
222 return hash.compare( QString::fromLatin1(crypt( pin.latin1(), hash.latin1() )) ) == 0 ? true : false; 225 return hash.compare( QString::fromLatin1(crypt( pin.latin1(), hash.latin1() )) ) == 0 ? true : false;
223} 226}
224 227
225/// Displays a PinDialog and returns the typed in PIN 228/// Displays a PinDialog and returns the typed in PIN
226/** 229/**
227 * The returned value is QString::null if the user cancels the operation, 230 * The returned value is QString::null if the user cancels the operation,
228 * or the empty string if the user enters no password (but confirms the 231 * or the empty string if the user enters no password (but confirms the
229 * dialog). 232 * dialog).
230 */ 233 */
231QString PinPlugin::getPIN( const QString& prompt ) 234QString 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 }
245 else 248 else
246 return QString::null; 249 return QString::null;
247} 250}
248 251
249/// Displays the PIN dialog and returns a hash of the typed in PIN 252/// Displays the PIN dialog and returns a hash of the typed in PIN
250/** 253/**
251 * \return the hashed ( =one-way encrypted) PIN typed in by the user 254 * \return the hashed ( =one-way encrypted) PIN typed in by the user
252 * \param prompt the prompt to display in the PinDialog 255 * \param prompt the prompt to display in the PinDialog
253 */ 256 */
254QString PinPlugin::getCryptedPIN( const QString& prompt ) 257QString PinPlugin::getCryptedPIN( const QString& prompt )
255{ 258{
256 return encrypt(getPIN(prompt)); 259 return encrypt(getPIN(prompt));
257} 260}
258 261
259/// Displays the PIN dialog, asks 2 times for a new PIN, saves it if entered two times 262/// Displays the PIN dialog, asks 2 times for a new PIN, saves it if entered two times
260/** 263/**
261 * writes nothing if we enter nothing the first time 264 * writes nothing if we enter nothing the first time
262 */ 265 */
263void PinPlugin::changePIN() 266void PinPlugin::changePIN()
264{ 267{
265 QString new1, new2; 268 QString new1, new2;
266 do { 269 do {
267 new1 = getPIN(QObject::tr("Enter new PIN")); 270 new1 = getPIN(QObject::tr("Enter new PIN"));
268 if ( new1.isNull() ) 271 if ( new1.isNull() )
269 return; 272 return;
270 new2 = getPIN(QObject::tr("Re-enter new PIN")); 273 new2 = getPIN(QObject::tr("Re-enter new PIN"));
@@ -273,70 +276,70 @@ void PinPlugin::changePIN()
273 odebug << "writing new PIN hash in Security.conf" << oendl; 276 odebug << "writing new PIN hash in Security.conf" << oendl;
274 Config cfg("Security"); 277 Config cfg("Security");
275 cfg.setGroup("PinPlugin"); 278 cfg.setGroup("PinPlugin");
276 cfg.writeEntry("hashedPIN", encrypt(new1)); 279 cfg.writeEntry("hashedPIN", encrypt(new1));
277} 280}
278 281
279/// Removes the PIN hashed value in the config file 282/// Removes the PIN hashed value in the config file
280void PinPlugin::clearPIN() 283void PinPlugin::clearPIN()
281{ 284{
282 Config cfg("Security"); 285 Config cfg("Security");
283 cfg.setGroup("PinPlugin"); 286 cfg.setGroup("PinPlugin");
284 cfg.removeEntry("hashedPIN"); 287 cfg.removeEntry("hashedPIN");
285} 288}
286 289
287/// Prompt, fullscreen, for the user's PIN and compare it to the stored one. 290/// Prompt, fullscreen, for the user's PIN and compare it to the stored one.
288/** 291/**
289 * \return the result code, as a MultiauthPluginObject::authResult object 292 * \return the result code, as a MultiauthPluginObject::authResult object
290 */ 293 */
291int PinPlugin::authenticate() 294int PinPlugin::authenticate()
292{ 295{
293 // reset skip (if we ran Pin two times in a row, skipping the first time, it must be put to 0 again) 296 // reset skip (if we ran Pin two times in a row, skipping the first time, it must be put to 0 again)
294 isSkip = FALSE; 297 isSkip = FALSE;
295 // fetch value in config 298 // fetch value in config
296 Config cfg("Security"); 299 Config cfg("Security");
297 cfg.setGroup("PinPlugin"); 300 cfg.setGroup("PinPlugin");
298 QString hashedPin = cfg.readEntry("hashedPIN"); 301 QString hashedPin = cfg.readEntry("hashedPIN");
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
318/// Simply returns the plugin name (PIN plugin) 321/// Simply returns the plugin name (PIN plugin)
319QString PinPlugin::pluginName() const { 322QString PinPlugin::pluginName() const {
320 return "PIN Plugin"; 323 return "PIN Plugin";
321} 324}
322 325
323QString PinPlugin::pixmapNameWidget() const { 326QString PinPlugin::pixmapNameWidget() const {
324 return "security/pinplugin"; 327 return "security/pinplugin";
325} 328}
326 329
327QString PinPlugin::pixmapNameConfig() const { 330QString PinPlugin::pixmapNameConfig() const {
328 return "security/pinplugin"; 331 return "security/pinplugin";
329} 332}
330 333
331/// returns a PinConfigWidget 334/// returns a PinConfigWidget
332MultiauthConfigWidget * PinPlugin::configWidget(QWidget * parent) { 335MultiauthConfigWidget * 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
@@ -14,55 +14,55 @@
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 PIN_H 34#ifndef PIN_H
35#define PIN_H 35#define PIN_H
36 36
37#include <qobject.h> 37#include <qobject.h>
38#include <qstring.h> 38#include <qstring.h>
39#include <opie2/multiauthplugininterface.h> 39#include <opie2/multiauthplugininterface.h>
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 */
46class PinPlugin : public QObject, public MultiauthPluginObject { 46class PinPlugin : public QObject, public Opie::Security::MultiauthPluginObject {
47 47
48 Q_OBJECT 48 Q_OBJECT
49 49
50public: 50public:
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
57private slots: 57private slots:
58 QString getPIN( const QString& prompt ); 58 QString getPIN( const QString& prompt );
59 QString getCryptedPIN( const QString& prompt ); 59 QString getCryptedPIN( const QString& prompt );
60 void changePIN(); 60 void changePIN();
61 void clearPIN(); 61 void clearPIN();
62 62
63private: 63private:
64 QString encrypt(const QString& pin); 64 QString encrypt(const QString& pin);
65 bool verify(const QString& pin, const QString& hash); 65 bool verify(const QString& pin, const QString& hash);
66}; 66};
67 67
68#endif // PIN_H 68#endif // PIN_H
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
@@ -1,39 +1,41 @@
1#include <qwidget.h> 1#include <qwidget.h>
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
8using Opie::Security::MultiauthConfigWidget;
9
8PinConfigWidget::PinConfigWidget(QWidget* parent = 0, const char* name = "PIN configuration widget") 10PinConfigWidget::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);
22 24
23 QHBoxLayout * buttonLayout = new QHBoxLayout(); 25 QHBoxLayout * buttonLayout = new QHBoxLayout();
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
34PinConfigWidget::~PinConfigWidget() 36PinConfigWidget::~PinConfigWidget()
35{} 37{}
36 38
37/// does nothing since the config file update is already done in changePIN or clearPIN 39/// does nothing since the config file update is already done in changePIN or clearPIN
38void PinConfigWidget::writeConfig() 40void PinConfigWidget::writeConfig()
39{} 41{}
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
@@ -1,51 +1,51 @@
1/** 1/**
2 * \file pinConfigWidget.h 2 * \file pinConfigWidget.h
3 * \brief PIN plugin configuration widget 3 * \brief PIN plugin configuration widget
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
40class PinConfigWidget : public MultiauthConfigWidget { 40class PinConfigWidget : public Opie::Security::MultiauthConfigWidget {
41public: 41public:
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,28 +1,31 @@
1#include "pinpluginimpl.h" 1#include "pinpluginimpl.h"
2 2
3using Opie::Security::MultiauthPluginObject;
4using Opie::Security::MultiauthPluginInterface;
5
3PinPluginImpl::PinPluginImpl() { 6PinPluginImpl::PinPluginImpl() {
4 pinPlugin = new PinPlugin(); 7 pinPlugin = new PinPlugin();
5} 8}
6 9
7PinPluginImpl::~PinPluginImpl() { 10PinPluginImpl::~PinPluginImpl() {
8 delete pinPlugin; 11 delete pinPlugin;
9} 12}
10 13
11MultiauthPluginObject* PinPluginImpl::plugin() { 14MultiauthPluginObject* PinPluginImpl::plugin() {
12 return pinPlugin; 15 return pinPlugin;
13} 16}
14 17
15Q_EXPORT_INTERFACE() { 18Q_EXPORT_INTERFACE() {
16 Q_CREATE_INSTANCE( PinPluginImpl ) 19 Q_CREATE_INSTANCE( PinPluginImpl )
17} 20}
18 21
19QRESULT PinPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) { 22QRESULT PinPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) {
20 *iface = 0; 23 *iface = 0;
21 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MultiauthPluginInterface ) ) { 24 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MultiauthPluginInterface ) ) {
22 *iface = this, (*iface)->addRef(); 25 *iface = this, (*iface)->addRef();
23 } else { 26 } else {
24 return QE_NOINTERFACE; 27 return QE_NOINTERFACE;
25 } 28 }
26 return QS_OK; 29 return QS_OK;
27 30
28} 31}
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
@@ -8,51 +8,50 @@
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 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
40class PinPluginImpl : public MultiauthPluginInterface{ 40class 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