author | zecke <zecke> | 2004-07-17 16:42:51 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-17 16:42:51 (UTC) |
commit | 889c782a33abc8f5f15a0669c6d97688d22c304f (patch) (unidiff) | |
tree | b3c3a24b763152049cce8f9e01f53597404e623f /libopie2 | |
parent | cff9ca4211a9b3ab3669957c9c3e991732f8cfb3 (diff) | |
download | opie-889c782a33abc8f5f15a0669c6d97688d22c304f.zip opie-889c782a33abc8f5f15a0669c6d97688d22c304f.tar.gz opie-889c782a33abc8f5f15a0669c6d97688d22c304f.tar.bz2 |
-move OMAF into a namespace on its own
-add d'ptr were applicable
-rw-r--r-- | libopie2/opiesecurity/multiauthcommon.cpp | 7 | ||||
-rw-r--r-- | libopie2/opiesecurity/multiauthcommon.h | 13 | ||||
-rw-r--r-- | libopie2/opiesecurity/multiauthconfigwidget.h | 20 | ||||
-rw-r--r-- | libopie2/opiesecurity/multiauthmainwindow.cpp | 8 | ||||
-rw-r--r-- | libopie2/opiesecurity/multiauthmainwindow.h | 10 | ||||
-rw-r--r-- | libopie2/opiesecurity/multiauthplugininterface.h | 20 | ||||
-rw-r--r-- | libopie2/opiesecurity/opiesecurity.pro | 6 |
7 files changed, 69 insertions, 15 deletions
diff --git a/libopie2/opiesecurity/multiauthcommon.cpp b/libopie2/opiesecurity/multiauthcommon.cpp index b72b9b1..d8e26d5 100644 --- a/libopie2/opiesecurity/multiauthcommon.cpp +++ b/libopie2/opiesecurity/multiauthcommon.cpp | |||
@@ -1,79 +1,82 @@ | |||
1 | #include "multiauthplugininterface.h" | 1 | #include "multiauthplugininterface.h" |
2 | #include "multiauthcommon.h" | 2 | #include "multiauthcommon.h" |
3 | 3 | ||
4 | /* Opie */ | 4 | /* Opie */ |
5 | #include <opie2/odebug.h> | 5 | #include <opie2/odebug.h> |
6 | #include <opie2/oapplication.h> | 6 | #include <opie2/oapplication.h> |
7 | 7 | ||
8 | /* Qt */ | 8 | /* Qt */ |
9 | #include <qpe/qpeapplication.h> | 9 | #include <qpe/qpeapplication.h> |
10 | #include <qpe/qlibrary.h> | 10 | #include <qpe/qlibrary.h> |
11 | #include <qpe/qcom.h> | 11 | #include <qpe/qcom.h> |
12 | #include <qtextview.h> | 12 | #include <qtextview.h> |
13 | #include <qdir.h> | 13 | #include <qdir.h> |
14 | 14 | ||
15 | /* UNIX */ | 15 | /* UNIX */ |
16 | #include <unistd.h> | 16 | #include <unistd.h> |
17 | #include <qpe/config.h> | 17 | #include <qpe/config.h> |
18 | 18 | ||
19 | namespace Opie { | ||
20 | namespace Security { | ||
19 | 21 | ||
20 | SecOwnerDlg::SecOwnerDlg( QWidget *parent, const char * name, Contact c, | 22 | SecOwnerDlg::SecOwnerDlg( QWidget *parent, const char * name, Contact c, |
21 | bool modal, bool fullscreen = FALSE ) | 23 | bool modal, bool fullscreen = FALSE ) |
22 | : QDialog( parent, name, modal, | 24 | : QDialog( parent, name, modal, |
23 | fullscreen ? | 25 | fullscreen ? |
24 | WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop : 0 ) | 26 | WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop : 0 ) |
25 | { | 27 | { |
26 | if ( fullscreen ) { | 28 | if ( fullscreen ) { |
27 | QRect desk = qApp->desktop()->geometry(); | 29 | QRect desk = qApp->desktop()->geometry(); |
28 | setGeometry( 0, 0, desk.width(), desk.height() ); | 30 | setGeometry( 0, 0, desk.width(), desk.height() ); |
29 | } | 31 | } |
30 | // set up contents. | 32 | // set up contents. |
31 | QString text("<H3>" + tr("Please contact the owner (directions follow), or try again clicking of this screen (and waiting for the penalty time) if you are the legitimate owner") + "</H3>"); | 33 | QString text("<H3>" + tr("Please contact the owner (directions follow), or try again clicking of this screen (and waiting for the penalty time) if you are the legitimate owner") + "</H3>"); |
32 | text += c.toRichText(); | 34 | text += c.toRichText(); |
33 | tv = new QTextView(this); | 35 | tv = new QTextView(this); |
34 | tv->setText(text); | 36 | tv->setText(text); |
35 | 37 | ||
36 | tv->viewport()->installEventFilter(this); | 38 | tv->viewport()->installEventFilter(this); |
37 | } | 39 | } |
38 | 40 | ||
39 | void SecOwnerDlg::resizeEvent( QResizeEvent * ) | 41 | void SecOwnerDlg::resizeEvent( QResizeEvent * ) |
40 | { | 42 | { |
41 | tv->resize( size() ); | 43 | tv->resize( size() ); |
42 | } | 44 | } |
43 | 45 | ||
44 | bool SecOwnerDlg::eventFilter(QObject *o, QEvent *e) | 46 | bool SecOwnerDlg::eventFilter(QObject *o, QEvent *e) |
45 | { | 47 | { |
46 | if (e->type() == QEvent::KeyPress || e->type() == QEvent::MouseButtonPress ) { | 48 | if (e->type() == QEvent::KeyPress || e->type() == QEvent::MouseButtonPress ) { |
47 | accept(); | 49 | accept(); |
48 | return TRUE; | 50 | return TRUE; |
49 | } | 51 | } |
50 | return QWidget::eventFilter(o, e); | 52 | return QWidget::eventFilter(o, e); |
51 | } | 53 | } |
52 | 54 | ||
53 | void SecOwnerDlg::mousePressEvent( QMouseEvent * ) { accept(); } | 55 | void SecOwnerDlg::mousePressEvent( QMouseEvent * ) { accept(); } |
54 | 56 | ||
55 | 57 | ||
58 | namespace Internal { | ||
56 | /// run plugins until we reach nbSuccessMin successes | 59 | /// run plugins until we reach nbSuccessMin successes |
57 | int runPlugins() { | 60 | int runPlugins() { |
58 | 61 | ||
59 | SecOwnerDlg *oi = 0; | 62 | SecOwnerDlg *oi = 0; |
60 | // see if there is contact information. | 63 | // see if there is contact information. |
61 | QString vfilename = Global::applicationFileName("addressbook", | 64 | QString vfilename = Global::applicationFileName("addressbook", |
62 | "businesscard.vcf"); | 65 | "businesscard.vcf"); |
63 | if (QFile::exists(vfilename)) { | 66 | if (QFile::exists(vfilename)) { |
64 | Contact c; | 67 | Contact c; |
65 | c = Contact::readVCard( vfilename )[0]; | 68 | c = Contact::readVCard( vfilename )[0]; |
66 | 69 | ||
67 | oi = new SecOwnerDlg(0, 0, c, TRUE, TRUE); | 70 | oi = new SecOwnerDlg(0, 0, c, TRUE, TRUE); |
68 | } | 71 | } |
69 | 72 | ||
70 | Config config("Security"); | 73 | Config config("Security"); |
71 | config.setGroup("Plugins"); | 74 | config.setGroup("Plugins"); |
72 | QStringList plugins = config.readListEntry("IncludePlugins", ','); | 75 | QStringList plugins = config.readListEntry("IncludePlugins", ','); |
73 | config.setGroup("Misc"); | 76 | config.setGroup("Misc"); |
74 | int nbSuccessMin = config.readNumEntry("nbSuccessMin", 1); | 77 | int nbSuccessMin = config.readNumEntry("nbSuccessMin", 1); |
75 | int nbSuccess = 0; | 78 | int nbSuccess = 0; |
76 | 79 | ||
77 | /* tries to launch successively each plugin in $OPIEDIR/plugins/security | 80 | /* tries to launch successively each plugin in $OPIEDIR/plugins/security |
78 | * directory which file name is in Security.conf / [Misc] / IncludePlugins | 81 | * directory which file name is in Security.conf / [Misc] / IncludePlugins |
79 | */ | 82 | */ |
@@ -156,24 +159,28 @@ int runPlugins() { | |||
156 | resultMessage = "Failure..."; | 159 | resultMessage = "Failure..."; |
157 | break; | 160 | break; |
158 | case MultiauthPluginObject::Skip: | 161 | case MultiauthPluginObject::Skip: |
159 | resultMessage = "Skip"; | 162 | resultMessage = "Skip"; |
160 | break; | 163 | break; |
161 | } | 164 | } |
162 | odebug << "Plugin result: " << resultMessage << oendl; | 165 | odebug << "Plugin result: " << resultMessage << oendl; |
163 | } | 166 | } |
164 | delete lib; | 167 | delete lib; |
165 | 168 | ||
166 | if (resultCode == MultiauthPluginObject::Success && nbSuccess == nbSuccessMin) | 169 | if (resultCode == MultiauthPluginObject::Success && nbSuccess == nbSuccessMin) |
167 | { | 170 | { |
168 | if(oi) delete oi; | 171 | if(oi) delete oi; |
169 | // we have reached the required number of successes, we can exit the plugin loop | 172 | // we have reached the required number of successes, we can exit the plugin loop |
170 | return 0; | 173 | return 0; |
171 | } | 174 | } |
172 | } else { | 175 | } else { |
173 | owarn << "Could not recognize plugin " << QString( path + "/" + *libIt ) << oendl; | 176 | owarn << "Could not recognize plugin " << QString( path + "/" + *libIt ) << oendl; |
174 | delete lib; | 177 | delete lib; |
175 | } // end if plugin recognized | 178 | } // end if plugin recognized |
176 | } //end for | 179 | } //end for |
177 | if(oi) delete oi; | 180 | if(oi) delete oi; |
178 | return 1; | 181 | return 1; |
179 | } | 182 | } |
183 | |||
184 | } | ||
185 | } | ||
186 | } | ||
diff --git a/libopie2/opiesecurity/multiauthcommon.h b/libopie2/opiesecurity/multiauthcommon.h index 6d6d5d1..46beab0 100644 --- a/libopie2/opiesecurity/multiauthcommon.h +++ b/libopie2/opiesecurity/multiauthcommon.h | |||
@@ -20,43 +20,56 @@ | |||
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 MULTIAUTHCOMMON_H | 34 | #ifndef MULTIAUTHCOMMON_H |
35 | #define MULTIAUTHCOMMON_H | 35 | #define MULTIAUTHCOMMON_H |
36 | 36 | ||
37 | 37 | ||
38 | /* OwnerDialog stuff */ | 38 | /* OwnerDialog stuff */ |
39 | #include <qpe/global.h> | 39 | #include <qpe/global.h> |
40 | #include <qpe/contact.h> | 40 | #include <qpe/contact.h> |
41 | #include <qtextview.h> | 41 | #include <qtextview.h> |
42 | #include <qdialog.h> | 42 | #include <qdialog.h> |
43 | 43 | ||
44 | |||
45 | namespace Opie { | ||
46 | namespace Security { | ||
47 | |||
44 | class SecOwnerDlg : public QDialog | 48 | class SecOwnerDlg : public QDialog |
45 | { | 49 | { |
46 | Q_OBJECT | 50 | Q_OBJECT |
47 | public: | 51 | public: |
48 | 52 | ||
49 | SecOwnerDlg( QWidget *parent, const char * name, Contact c, | 53 | SecOwnerDlg( QWidget *parent, const char * name, Contact c, |
50 | bool modal, bool fullscreen); | 54 | bool modal, bool fullscreen); |
51 | 55 | ||
52 | void resizeEvent( QResizeEvent * ); | 56 | void resizeEvent( QResizeEvent * ); |
53 | bool eventFilter(QObject *o, QEvent *e); | 57 | bool eventFilter(QObject *o, QEvent *e); |
54 | void mousePressEvent( QMouseEvent * ); | 58 | void mousePressEvent( QMouseEvent * ); |
55 | 59 | ||
56 | private: | 60 | private: |
57 | QTextView *tv; | 61 | QTextView *tv; |
62 | |||
63 | private: | ||
64 | struct Private; | ||
65 | Private *d; | ||
58 | }; | 66 | }; |
59 | 67 | ||
68 | namespace Internal { | ||
60 | int runPlugins(); | 69 | int runPlugins(); |
70 | } | ||
71 | |||
72 | } | ||
73 | } | ||
61 | 74 | ||
62 | #endif // MULTIAUTHCOMMON_H | 75 | #endif // MULTIAUTHCOMMON_H |
diff --git a/libopie2/opiesecurity/multiauthconfigwidget.h b/libopie2/opiesecurity/multiauthconfigwidget.h index cd6f047..2ed8fc0 100644 --- a/libopie2/opiesecurity/multiauthconfigwidget.h +++ b/libopie2/opiesecurity/multiauthconfigwidget.h | |||
@@ -1,68 +1,78 @@ | |||
1 | /** | 1 | /** |
2 | * \file multiauthconfigwidget.h | 2 | * \file multiauthconfigwidget.h |
3 | * \brief Defines the Opie multiauth configuration widget interface. | 3 | * \brief Defines the Opie multiauth configuration widget interface. |
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 MULTIAUTHCONFIGWIDGET_H | 34 | #ifndef MULTIAUTHCONFIGWIDGET_H |
35 | #define MULTIAUTHCONFIGWIDGET_H | 35 | #define MULTIAUTHCONFIGWIDGET_H |
36 | 36 | ||
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include <qobject.h> | 38 | #include <qobject.h> |
39 | 39 | ||
40 | namespace Opie { | ||
41 | namespace Security { | ||
42 | |||
40 | /// Base class of all Opie multiauth config widgets | 43 | /// Base class of all Opie multiauth config widgets |
41 | /** | 44 | /** |
42 | * A base class for all Opie Multiauth Config Widgets. | 45 | * A base class for all Opie Multiauth Config Widgets. |
43 | * This will let a Opie multiauth plugin to add the possibility of configuration. | 46 | * This will let a Opie multiauth plugin to add the possibility of configuration. |
44 | * Plugins need to inherit from this class and need to implement | 47 | * Plugins need to inherit from this class and need to implement |
45 | * the pure virtual method to control configuration. | 48 | * the pure virtual method to control configuration. |
46 | * The Plugin should read its configuration during creation of the Widget | 49 | * The Plugin should read its configuration during creation of the Widget |
47 | * | 50 | * |
48 | * \author Clement Seveillac (helped by Maximilian Reiß's Today framework) | 51 | * \author Clement Seveillac (helped by Maximilian Reiß's Today framework) |
49 | */ | 52 | */ |
50 | class MultiauthConfigWidget : public QWidget { | 53 | class MultiauthConfigWidget : public QWidget { |
51 | 54 | ||
52 | Q_OBJECT | 55 | Q_OBJECT |
53 | 56 | ||
54 | public: | 57 | public: |
55 | 58 | ||
56 | /// standard widget constructor | 59 | /// standard widget constructor |
57 | MultiauthConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {} | 60 | MultiauthConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {} |
58 | virtual ~MultiauthConfigWidget() {} | 61 | virtual ~MultiauthConfigWidget() {} |
59 | 62 | ||
60 | /// Method to reimplement, supposed to save the plugin configuration | 63 | /// Method to reimplement, supposed to save the plugin configuration |
61 | /** | 64 | /** |
62 | * Plugins need to reimplement this in the config widget | 65 | * Plugins need to reimplement this in the config widget |
63 | * Used when the config dialog is closed to write config stuff | 66 | * Used when the config dialog is closed to write config stuff |
64 | */ | 67 | */ |
65 | virtual void writeConfig() = 0; | 68 | virtual void writeConfig() = 0; |
69 | |||
70 | private: | ||
71 | struct Private; | ||
72 | Private *d; | ||
66 | }; | 73 | }; |
67 | 74 | ||
75 | } | ||
76 | } | ||
77 | |||
68 | #endif // MULTIAUTHCONFIGWIDGET_H | 78 | #endif // MULTIAUTHCONFIGWIDGET_H |
diff --git a/libopie2/opiesecurity/multiauthmainwindow.cpp b/libopie2/opiesecurity/multiauthmainwindow.cpp index 2be3473..c6229c7 100644 --- a/libopie2/opiesecurity/multiauthmainwindow.cpp +++ b/libopie2/opiesecurity/multiauthmainwindow.cpp | |||
@@ -1,29 +1,32 @@ | |||
1 | #include "multiauthmainwindow.h" | 1 | #include "multiauthmainwindow.h" |
2 | 2 | ||
3 | #include "multiauthcommon.h" | 3 | #include "multiauthcommon.h" |
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | 5 | ||
6 | namespace Opie { | ||
7 | namespace Security { | ||
8 | |||
6 | /// Initializes widgets according to allowBypass and explanScreens config | 9 | /// Initializes widgets according to allowBypass and explanScreens config |
7 | MultiauthMainWindow::MultiauthMainWindow() | 10 | MultiauthMainWindow::MultiauthMainWindow() |
8 | : QDialog(0, "main Opie multiauth modal dialog", TRUE, | 11 | : QDialog(0, "main Opie multiauth modal dialog", TRUE, |
9 | Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop) | 12 | Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop) |
10 | 13 | ||
11 | { | 14 | { |
12 | alreadyDone = false; | 15 | alreadyDone = false; |
13 | // initializes widget pointers which not always point to an object | 16 | // initializes widget pointers which not always point to an object |
14 | quit = 0; | 17 | quit = 0; |
15 | message2 = 0; | 18 | message2 = 0; |
16 | 19 | ||
17 | Config *pcfg = new Config("Security"); | 20 | Config *pcfg = new Config("Security"); |
18 | pcfg->setGroup("Misc"); | 21 | pcfg->setGroup("Misc"); |
19 | explanScreens = pcfg->readBoolEntry("explanScreens", true); | 22 | explanScreens = pcfg->readBoolEntry("explanScreens", true); |
20 | allowBypass = pcfg->readBoolEntry("allowBypass", true); | 23 | allowBypass = pcfg->readBoolEntry("allowBypass", true); |
21 | delete pcfg; | 24 | delete pcfg; |
22 | 25 | ||
23 | layout = new QVBoxLayout(this); | 26 | layout = new QVBoxLayout(this); |
24 | layout->setSpacing(11); | 27 | layout->setSpacing(11); |
25 | layout->setMargin(11); | 28 | layout->setMargin(11); |
26 | layout->setAlignment( Qt::AlignTop ); | 29 | layout->setAlignment( Qt::AlignTop ); |
27 | 30 | ||
28 | // if explanScreens is false, we don't show any text in the QDialog, | 31 | // if explanScreens is false, we don't show any text in the QDialog, |
29 | // and we proceed directly | 32 | // and we proceed directly |
@@ -54,49 +57,49 @@ MultiauthMainWindow::MultiauthMainWindow() | |||
54 | layout->addWidget(message2); | 57 | layout->addWidget(message2); |
55 | QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); | 58 | QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); |
56 | } | 59 | } |
57 | else | 60 | else |
58 | { | 61 | { |
59 | quit->hide(); | 62 | quit->hide(); |
60 | } | 63 | } |
61 | 64 | ||
62 | } | 65 | } |
63 | else | 66 | else |
64 | { | 67 | { |
65 | // we will need this button only if runPlugins() fails in proceed() | 68 | // we will need this button only if runPlugins() fails in proceed() |
66 | proceedButton->hide(); | 69 | proceedButton->hide(); |
67 | // let's proceed now | 70 | // let's proceed now |
68 | proceed(); | 71 | proceed(); |
69 | } | 72 | } |
70 | } | 73 | } |
71 | 74 | ||
72 | /// nothing to do | 75 | /// nothing to do |
73 | MultiauthMainWindow::~MultiauthMainWindow() { | 76 | MultiauthMainWindow::~MultiauthMainWindow() { |
74 | } | 77 | } |
75 | 78 | ||
76 | /// launch the authentication | 79 | /// launch the authentication |
77 | void MultiauthMainWindow::proceed() { | 80 | void MultiauthMainWindow::proceed() { |
78 | int result = runPlugins(); | 81 | int result = Internal::runPlugins(); |
79 | 82 | ||
80 | 83 | ||
81 | if ( (result == 0) && !explanScreens ) | 84 | if ( (result == 0) && !explanScreens ) |
82 | { | 85 | { |
83 | // the authentication has succeeded, we can exit directly | 86 | // the authentication has succeeded, we can exit directly |
84 | // this will work if we haven't been called by the constructor of MultiauthMainWindow | 87 | // this will work if we haven't been called by the constructor of MultiauthMainWindow |
85 | close(); | 88 | close(); |
86 | // and if we've been called by this constructor, we use this variable to tell our | 89 | // and if we've been called by this constructor, we use this variable to tell our |
87 | // caller we're already done | 90 | // caller we're already done |
88 | alreadyDone = true; | 91 | alreadyDone = true; |
89 | return; | 92 | return; |
90 | } | 93 | } |
91 | else | 94 | else |
92 | { | 95 | { |
93 | 96 | ||
94 | proceedButton->setText("Another try?"); | 97 | proceedButton->setText("Another try?"); |
95 | QString resultMessage; | 98 | QString resultMessage; |
96 | 99 | ||
97 | if (result == 0) | 100 | if (result == 0) |
98 | { | 101 | { |
99 | // authentication has succeeded, adapt interface then | 102 | // authentication has succeeded, adapt interface then |
100 | message->setText( "<center><h3>" + tr("Congratulations! Your authentication has been successful.") + "</h3></center>" ); | 103 | message->setText( "<center><h3>" + tr("Congratulations! Your authentication has been successful.") + "</h3></center>" ); |
101 | quit->setText("Enter Opie"); | 104 | quit->setText("Enter Opie"); |
102 | if ( quit->isHidden() ) | 105 | if ( quit->isHidden() ) |
@@ -106,24 +109,27 @@ void MultiauthMainWindow::proceed() { | |||
106 | quit->show(); | 109 | quit->show(); |
107 | } else { | 110 | } else { |
108 | if ( message2 != 0 ) message2->hide(); | 111 | if ( message2 != 0 ) message2->hide(); |
109 | } | 112 | } |
110 | } | 113 | } |
111 | else | 114 | else |
112 | { | 115 | { |
113 | // authentication has failed, explain that according to allowBypass | 116 | // authentication has failed, explain that according to allowBypass |
114 | message->setText( "<center><h3>" + tr("You have not succeeded enough authentication steps!") + "</h3></center>" ); | 117 | message->setText( "<center><h3>" + tr("You have not succeeded enough authentication steps!") + "</h3></center>" ); |
115 | proceedButton->show(); | 118 | proceedButton->show(); |
116 | if ( allowBypass == true ) | 119 | if ( allowBypass == true ) |
117 | message2->setText( "<center><p>" + tr("Note: if 'allow to bypass' was uncheck in Security config, you would have to go back through all the steps now.") + "</p></center>" ); | 120 | message2->setText( "<center><p>" + tr("Note: if 'allow to bypass' was uncheck in Security config, you would have to go back through all the steps now.") + "</p></center>" ); |
118 | } | 121 | } |
119 | } | 122 | } |
120 | } | 123 | } |
121 | 124 | ||
122 | /** When we don't show explanatory screens and we succeed authentication, | 125 | /** When we don't show explanatory screens and we succeed authentication, |
123 | * as early as during the proceed() call of the constructor, the caller must know | 126 | * as early as during the proceed() call of the constructor, the caller must know |
124 | * (through this function) authentication has already been succeeded.. | 127 | * (through this function) authentication has already been succeeded.. |
125 | * \todo try to avoid this hack? | 128 | * \todo try to avoid this hack? |
126 | */ | 129 | */ |
127 | bool MultiauthMainWindow::isAlreadyDone() { | 130 | bool MultiauthMainWindow::isAlreadyDone() { |
128 | return alreadyDone; | 131 | return alreadyDone; |
129 | } | 132 | } |
133 | |||
134 | } | ||
135 | } | ||
diff --git a/libopie2/opiesecurity/multiauthmainwindow.h b/libopie2/opiesecurity/multiauthmainwindow.h index d5f53c6..626b8b3 100644 --- a/libopie2/opiesecurity/multiauthmainwindow.h +++ b/libopie2/opiesecurity/multiauthmainwindow.h | |||
@@ -20,55 +20,65 @@ | |||
20 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 20 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
21 | : .. .:, . . . without even the implied warranty of | 21 | : .. .:, . . . without even the implied warranty of |
22 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 22 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
23 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 23 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
24 | ..}^=.= = ; Library General Public License for more | 24 | ..}^=.= = ; Library General Public License for more |
25 | ++= -. .` .: details. | 25 | ++= -. .` .: details. |
26 | : = ...= . :.=- | 26 | : = ...= . :.=- |
27 | -. .:....=;==+<; You should have received a copy of the GNU | 27 | -. .:....=;==+<; You should have received a copy of the GNU |
28 | -_. . . )=. = Library General Public License along with | 28 | -_. . . )=. = Library General Public License along with |
29 | -- :-=` this library; see the file COPYING.LIB. | 29 | -- :-=` this library; see the file COPYING.LIB. |
30 | If not, write to the Free Software Foundation, | 30 | If not, write to the Free Software Foundation, |
31 | Inc., 59 Temple Place - Suite 330, | 31 | Inc., 59 Temple Place - Suite 330, |
32 | Boston, MA 02111-1307, USA. | 32 | Boston, MA 02111-1307, USA. |
33 | 33 | ||
34 | */ | 34 | */ |
35 | 35 | ||
36 | #ifndef MULTIAUTHMAINWINDOW_H | 36 | #ifndef MULTIAUTHMAINWINDOW_H |
37 | #define MULTIAUTHMAINWINDOW_H | 37 | #define MULTIAUTHMAINWINDOW_H |
38 | 38 | ||
39 | #include <qdialog.h> | 39 | #include <qdialog.h> |
40 | #include <qlayout.h> | 40 | #include <qlayout.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qlabel.h> | 42 | #include <qlabel.h> |
43 | 43 | ||
44 | |||
45 | namespace Opie { | ||
46 | namespace Security { | ||
47 | |||
44 | /// Multiauth main window | 48 | /// Multiauth main window |
45 | /** | 49 | /** |
46 | * This QDialog window displays some information and an exit button, | 50 | * This QDialog window displays some information and an exit button, |
47 | * and completely hides the desktop, preventing user interactions | 51 | * and completely hides the desktop, preventing user interactions |
48 | * with it. | 52 | * with it. |
49 | */ | 53 | */ |
50 | class MultiauthMainWindow : public QDialog { | 54 | class MultiauthMainWindow : public QDialog { |
51 | Q_OBJECT | 55 | Q_OBJECT |
52 | 56 | ||
53 | public: | 57 | public: |
54 | MultiauthMainWindow(); | 58 | MultiauthMainWindow(); |
55 | ~MultiauthMainWindow(); | 59 | ~MultiauthMainWindow(); |
56 | bool isAlreadyDone(); | 60 | bool isAlreadyDone(); |
57 | 61 | ||
58 | private: | 62 | private: |
59 | QVBoxLayout * layout; | 63 | QVBoxLayout * layout; |
60 | QLabel * title, * message, * message2; | 64 | QLabel * title, * message, * message2; |
61 | QPushButton * proceedButton, * quit; | 65 | QPushButton * proceedButton, * quit; |
62 | /// whether to show explanatory screens before and after the authentication plugins | 66 | /// whether to show explanatory screens before and after the authentication plugins |
63 | bool explanScreens; | 67 | bool explanScreens; |
64 | /// allow to bypass authnentication via 'exit' buttons on both explan. screens | 68 | /// allow to bypass authnentication via 'exit' buttons on both explan. screens |
65 | bool allowBypass; | 69 | bool allowBypass; |
66 | /// true when the authentication has been done successfully | 70 | /// true when the authentication has been done successfully |
67 | bool alreadyDone; | 71 | bool alreadyDone; |
68 | 72 | ||
69 | private slots: | 73 | private slots: |
70 | void proceed(); | 74 | void proceed(); |
75 | private: | ||
76 | struct Private; | ||
77 | Private *d; | ||
71 | }; | 78 | }; |
72 | 79 | ||
80 | } | ||
81 | } | ||
82 | |||
73 | #endif // MULTIAUTHMAINWINDOW_H | 83 | #endif // MULTIAUTHMAINWINDOW_H |
74 | 84 | ||
diff --git a/libopie2/opiesecurity/multiauthplugininterface.h b/libopie2/opiesecurity/multiauthplugininterface.h index 0035107..5998a18 100644 --- a/libopie2/opiesecurity/multiauthplugininterface.h +++ b/libopie2/opiesecurity/multiauthplugininterface.h | |||
@@ -1,69 +1,72 @@ | |||
1 | /** | 1 | /** |
2 | * \file multiauthplugininterface.h | 2 | * \file multiauthplugininterface.h |
3 | * \brief Main public interface to Opie multiauth authentication plugins. | 3 | * \brief Main public interface to Opie multiauth authentication plugins. |
4 | * | 4 | * |
5 | * This implementation was derived from the todolist plugin implementation. | 5 | * This implementation was derived from the todolist plugin implementation. |
6 | * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr) | 6 | * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr) |
7 | */ | 7 | */ |
8 | /* | 8 | /* |
9 | =. This file is part of the Opie Project | 9 | =. This file is part of the Opie Project |
10 | .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org> | 10 | .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org> |
11 | .>+-= | 11 | .>+-= |
12 | _;:, .> :=|. This library is free software; you can | 12 | _;:, .> :=|. This library is free software; you can |
13 | .> <`_, > . <= redistribute it and/or modify it under | 13 | .> <`_, > . <= redistribute it and/or modify it under |
14 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 14 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
15 | .="- .-=="i, .._ License as published by the Free Software | 15 | .="- .-=="i, .._ License as published by the Free Software |
16 | - . .-<_> .<> Foundation; either version 2 of the License, | 16 | - . .-<_> .<> Foundation; either version 2 of the License, |
17 | ._= =} : or (at your option) any later version. | 17 | ._= =} : or (at your option) any later version. |
18 | .%`+i> _;_. | 18 | .%`+i> _;_. |
19 | .i_,=:_. -<s. This library is distributed in the hope that | 19 | .i_,=:_. -<s. This library is distributed in the hope that |
20 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 20 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
21 | : .. .:, . . . without even the implied warranty of | 21 | : .. .:, . . . without even the implied warranty of |
22 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 22 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
23 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 23 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
24 | ..}^=.= = ; Library General Public License for more | 24 | ..}^=.= = ; Library General Public License for more |
25 | ++= -. .` .: details. | 25 | ++= -. .` .: details. |
26 | : = ...= . :.=- | 26 | : = ...= . :.=- |
27 | -. .:....=;==+<; You should have received a copy of the GNU | 27 | -. .:....=;==+<; You should have received a copy of the GNU |
28 | -_. . . )=. = Library General Public License along with | 28 | -_. . . )=. = Library General Public License along with |
29 | -- :-=` this library; see the file COPYING.LIB. | 29 | -- :-=` this library; see the file COPYING.LIB. |
30 | If not, write to the Free Software Foundation, | 30 | If not, write to the Free Software Foundation, |
31 | Inc., 59 Temple Place - Suite 330, | 31 | Inc., 59 Temple Place - Suite 330, |
32 | Boston, MA 02111-1307, USA. | 32 | Boston, MA 02111-1307, USA. |
33 | 33 | ||
34 | */ | 34 | */ |
35 | 35 | ||
36 | #ifndef MULTIAUTH_PLUGIN_INTERFACE | 36 | #ifndef MULTIAUTH_PLUGIN_INTERFACE |
37 | #define MULTIAUTH_PLUGIN_INTERFACE | 37 | #define MULTIAUTH_PLUGIN_INTERFACE |
38 | 38 | ||
39 | #include <qpe/qcom.h> | 39 | #include <qpe/qcom.h> |
40 | 40 | ||
41 | #include "multiauthconfigwidget.h" | 41 | #include "multiauthconfigwidget.h" |
42 | 42 | ||
43 | class QString; | 43 | class QString; |
44 | class QWidget; | 44 | class QWidget; |
45 | 45 | ||
46 | namespace Opie { | ||
47 | namespace Security { | ||
48 | |||
46 | #ifndef IID_MultiauthPluginInterface | 49 | #ifndef IID_MultiauthPluginInterface |
47 | /// Universally Unique Id of the interface (required by QCOM): | 50 | /// Universally Unique Id of the interface (required by QCOM): |
48 | /// {AD5BE8B1-8421-447b-9AED-250BE1CDA49c} | 51 | /// {AD5BE8B1-8421-447b-9AED-250BE1CDA49c} |
49 | #define IID_MultiauthPluginInterface QUuid(0xad5be8b1, 0x8421, 0x447b, 0x9a, 0xed, 0x25, 0x0b, 0xe1, 0xcd, 0xa4, 0x9c) | 52 | #define IID_MultiauthPluginInterface QUuid(0xad5be8b1, 0x8421, 0x447b, 0x9a, 0xed, 0x25, 0x0b, 0xe1, 0xcd, 0xa4, 0x9c) |
50 | #endif | 53 | #endif |
51 | 54 | ||
52 | /// Base class for Opie multiauth plugins | 55 | /// Base class for Opie multiauth plugins |
53 | /** | 56 | /** |
54 | * A MultiauthPluginObject is the base for all Multiauth Plugins. | 57 | * A MultiauthPluginObject is the base for all Multiauth Plugins. |
55 | * A plugin author needs to inherit this class and implement | 58 | * A plugin author needs to inherit this class and implement |
56 | * the pure virtual methods. | 59 | * the pure virtual methods. |
57 | * | 60 | * |
58 | * \author Clement Seveillac (helped by Maximilian Reiß's Today framework) | 61 | * \author Clement Seveillac (helped by Maximilian Reiß's Today framework) |
59 | */ | 62 | */ |
60 | class MultiauthPluginObject { | 63 | class MultiauthPluginObject { |
61 | 64 | ||
62 | public: | 65 | public: |
63 | 66 | ||
64 | virtual ~MultiauthPluginObject() {}; | 67 | virtual ~MultiauthPluginObject() {}; |
65 | 68 | ||
66 | /// The name of the plugin | 69 | /// The name of the plugin |
67 | /* | 70 | /* |
68 | * \return The plugin should return its name here | 71 | * \return The plugin should return its name here |
69 | */ | 72 | */ |
@@ -76,34 +79,37 @@ class MultiauthPluginObject { | |||
76 | enum authResult { Success = 0, | 79 | enum authResult { Success = 0, |
77 | Failure = 1, | 80 | Failure = 1, |
78 | Skip = 2 }; | 81 | Skip = 2 }; |
79 | 82 | ||
80 | /// Pointer to the (optional) plugin configuration widget | 83 | /// Pointer to the (optional) plugin configuration widget |
81 | virtual MultiauthConfigWidget * configWidget(QWidget * parent) = 0; | 84 | virtual MultiauthConfigWidget * configWidget(QWidget * parent) = 0; |
82 | 85 | ||
83 | /// (optional) plugin configuration tab icon | 86 | /// (optional) plugin configuration tab icon |
84 | /** | 87 | /** |
85 | * \return path to the image file (without the extension) | 88 | * \return path to the image file (without the extension) |
86 | * from $OPIEDIR/pics | 89 | * from $OPIEDIR/pics |
87 | */ | 90 | */ |
88 | virtual QString pixmapNameConfig() const = 0; | 91 | virtual QString pixmapNameConfig() const = 0; |
89 | 92 | ||
90 | /// Plugin icon, to be displayed in the plugin list configuration widget | 93 | /// Plugin icon, to be displayed in the plugin list configuration widget |
91 | /** | 94 | /** |
92 | * \return path to the image file (without the extension) | 95 | * \return path to the image file (without the extension) |
93 | * from $OPIEDIR/pics | 96 | * from $OPIEDIR/pics |
94 | */ | 97 | */ |
95 | virtual QString pixmapNameWidget() const = 0; | 98 | virtual QString pixmapNameWidget() const = 0; |
96 | 99 | ||
97 | }; | 100 | }; |
98 | 101 | ||
99 | /// Interface for multiauth plugin classes. | 102 | /// Interface for multiauth plugin classes. |
100 | /* | 103 | /* |
101 | * This is part of the QCOM works. See example plugins how to do it right. | 104 | * This is part of the QCOM works. See example plugins how to do it right. |
102 | * \see http://doc.trolltech.com/qtopia/html/pluginintro.html | 105 | * \see http://doc.trolltech.com/qtopia/html/pluginintro.html |
103 | */ | 106 | */ |
104 | struct MultiauthPluginInterface : public QUnknownInterface { | 107 | struct MultiauthPluginInterface : public QUnknownInterface { |
105 | /// return the MultiauthPluginObject implementation | 108 | /// return the MultiauthPluginObject implementation |
106 | virtual MultiauthPluginObject *plugin() = 0; | 109 | virtual MultiauthPluginObject *plugin() = 0; |
107 | }; | 110 | }; |
108 | 111 | ||
112 | } | ||
113 | } | ||
114 | |||
109 | #endif | 115 | #endif |
diff --git a/libopie2/opiesecurity/opiesecurity.pro b/libopie2/opiesecurity/opiesecurity.pro index 8cb4821..8535785 100644 --- a/libopie2/opiesecurity/opiesecurity.pro +++ b/libopie2/opiesecurity/opiesecurity.pro | |||
@@ -1,15 +1,17 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | DESTDIR = $(OPIEDIR)/lib | 3 | DESTDIR = $(OPIEDIR)/lib |
4 | HEADERS = multiauthcommon.h \ | 4 | HEADERS = multiauthcommon.h \ |
5 | multiauthmainwindow.h \ | 5 | multiauthmainwindow.h \ |
6 | multiauthconfigwidget.h \ | 6 | multiauthconfigwidget.h \ |
7 | multiauthplugininterface.h | 7 | multiauthplugininterface.h \ |
8 | multiauthpassword.h | ||
8 | SOURCES = multiauthcommon.cpp \ | 9 | SOURCES = multiauthcommon.cpp \ |
9 | multiauthmainwindow.cpp | 10 | multiauthmainwindow.cpp \ |
11 | multiauthpassword.cpp | ||
10 | TARGET = opiesecurity2 | 12 | TARGET = opiesecurity2 |
11 | VERSION = 0.0.2 | 13 | VERSION = 0.0.2 |
12 | INCLUDEPATH += $(OPIEDIR)/include | 14 | INCLUDEPATH += $(OPIEDIR)/include |
13 | DEPENDPATH += $(OPIEDIR)/include | 15 | DEPENDPATH += $(OPIEDIR)/include |
14 | 16 | ||
15 | include ( $(OPIEDIR)/include.pro ) | 17 | include ( $(OPIEDIR)/include.pro ) |