author | zecke <zecke> | 2004-07-17 16:42:51 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-17 16:42:51 (UTC) |
commit | 889c782a33abc8f5f15a0669c6d97688d22c304f (patch) (side-by-side diff) | |
tree | b3c3a24b763152049cce8f9e01f53597404e623f | |
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 @@ -7,24 +7,26 @@ /* Qt */ #include <qpe/qpeapplication.h> #include <qpe/qlibrary.h> #include <qpe/qcom.h> #include <qtextview.h> #include <qdir.h> /* UNIX */ #include <unistd.h> #include <qpe/config.h> +namespace Opie { +namespace Security { SecOwnerDlg::SecOwnerDlg( QWidget *parent, const char * name, Contact c, bool modal, bool fullscreen = FALSE ) : QDialog( parent, name, modal, fullscreen ? WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop : 0 ) { if ( fullscreen ) { QRect desk = qApp->desktop()->geometry(); setGeometry( 0, 0, desk.width(), desk.height() ); } // set up contents. @@ -44,24 +46,25 @@ void SecOwnerDlg::resizeEvent( QResizeEvent * ) bool SecOwnerDlg::eventFilter(QObject *o, QEvent *e) { if (e->type() == QEvent::KeyPress || e->type() == QEvent::MouseButtonPress ) { accept(); return TRUE; } return QWidget::eventFilter(o, e); } void SecOwnerDlg::mousePressEvent( QMouseEvent * ) { accept(); } +namespace Internal { /// run plugins until we reach nbSuccessMin successes int runPlugins() { SecOwnerDlg *oi = 0; // see if there is contact information. QString vfilename = Global::applicationFileName("addressbook", "businesscard.vcf"); if (QFile::exists(vfilename)) { Contact c; c = Contact::readVCard( vfilename )[0]; oi = new SecOwnerDlg(0, 0, c, TRUE, TRUE); @@ -168,12 +171,16 @@ int runPlugins() { if(oi) delete oi; // we have reached the required number of successes, we can exit the plugin loop return 0; } } else { owarn << "Could not recognize plugin " << QString( path + "/" + *libIt ) << oendl; delete lib; } // end if plugin recognized } //end for if(oi) delete oi; return 1; } + +} +} +} 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 @@ -32,31 +32,44 @@ */ #ifndef MULTIAUTHCOMMON_H #define MULTIAUTHCOMMON_H /* OwnerDialog stuff */ #include <qpe/global.h> #include <qpe/contact.h> #include <qtextview.h> #include <qdialog.h> + +namespace Opie { +namespace Security { + class SecOwnerDlg : public QDialog { Q_OBJECT public: SecOwnerDlg( QWidget *parent, const char * name, Contact c, bool modal, bool fullscreen); void resizeEvent( QResizeEvent * ); bool eventFilter(QObject *o, QEvent *e); void mousePressEvent( QMouseEvent * ); private: QTextView *tv; + + private: + struct Private; + Private *d; }; +namespace Internal { int runPlugins(); +} + +} +} #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,51 +1,54 @@ /** * \file multiauthconfigwidget.h * \brief Defines the Opie multiauth configuration widget interface. * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr) */ /* =. This file is part of the Opie Project .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org> .>+-= - _;:, .> :=|. This library is free software; you can + _;:, .> :=|. This library is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This library is distributed in the hope that + .%`+i> _;_. + .i_,=:_. -<s. This library is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. - : = ...= . :.=- + : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with - -- :-=` this library; see the file COPYING.LIB. + -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef MULTIAUTHCONFIGWIDGET_H #define MULTIAUTHCONFIGWIDGET_H #include <qwidget.h> #include <qobject.h> +namespace Opie { +namespace Security { + /// Base class of all Opie multiauth config widgets /** * A base class for all Opie Multiauth Config Widgets. * This will let a Opie multiauth plugin to add the possibility of configuration. * Plugins need to inherit from this class and need to implement * the pure virtual method to control configuration. * The Plugin should read its configuration during creation of the Widget * * \author Clement Seveillac (helped by Maximilian Reiß's Today framework) */ class MultiauthConfigWidget : public QWidget { @@ -54,15 +57,22 @@ class MultiauthConfigWidget : public QWidget { public: /// standard widget constructor MultiauthConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {} virtual ~MultiauthConfigWidget() {} /// Method to reimplement, supposed to save the plugin configuration /** * Plugins need to reimplement this in the config widget * Used when the config dialog is closed to write config stuff */ virtual void writeConfig() = 0; + + private: + struct Private; + Private *d; }; +} +} + #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,17 +1,20 @@ #include "multiauthmainwindow.h" #include "multiauthcommon.h" #include <qpe/config.h> +namespace Opie { +namespace Security { + /// Initializes widgets according to allowBypass and explanScreens config MultiauthMainWindow::MultiauthMainWindow() : QDialog(0, "main Opie multiauth modal dialog", TRUE, Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop) { alreadyDone = false; // initializes widget pointers which not always point to an object quit = 0; message2 = 0; Config *pcfg = new Config("Security"); @@ -66,25 +69,25 @@ MultiauthMainWindow::MultiauthMainWindow() proceedButton->hide(); // let's proceed now proceed(); } } /// nothing to do MultiauthMainWindow::~MultiauthMainWindow() { } /// launch the authentication void MultiauthMainWindow::proceed() { - int result = runPlugins(); + int result = Internal::runPlugins(); if ( (result == 0) && !explanScreens ) { // the authentication has succeeded, we can exit directly // this will work if we haven't been called by the constructor of MultiauthMainWindow close(); // and if we've been called by this constructor, we use this variable to tell our // caller we're already done alreadyDone = true; return; } @@ -118,12 +121,15 @@ void MultiauthMainWindow::proceed() { } } } /** When we don't show explanatory screens and we succeed authentication, * as early as during the proceed() call of the constructor, the caller must know * (through this function) authentication has already been succeeded.. * \todo try to avoid this hack? */ bool MultiauthMainWindow::isAlreadyDone() { return alreadyDone; } + +} +} 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 @@ -32,24 +32,28 @@ Boston, MA 02111-1307, USA. */ #ifndef MULTIAUTHMAINWINDOW_H #define MULTIAUTHMAINWINDOW_H #include <qdialog.h> #include <qlayout.h> #include <qpushbutton.h> #include <qlabel.h> + +namespace Opie { +namespace Security { + /// Multiauth main window /** * This QDialog window displays some information and an exit button, * and completely hides the desktop, preventing user interactions * with it. */ class MultiauthMainWindow : public QDialog { Q_OBJECT public: MultiauthMainWindow(); ~MultiauthMainWindow(); @@ -59,16 +63,22 @@ class MultiauthMainWindow : public QDialog { QVBoxLayout * layout; QLabel * title, * message, * message2; QPushButton * proceedButton, * quit; /// whether to show explanatory screens before and after the authentication plugins bool explanScreens; /// allow to bypass authnentication via 'exit' buttons on both explan. screens bool allowBypass; /// true when the authentication has been done successfully bool alreadyDone; private slots: void proceed(); + private: + struct Private; + Private *d; }; +} +} + #endif // MULTIAUTHMAINWINDOW_H 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,57 +1,60 @@ /** * \file multiauthplugininterface.h * \brief Main public interface to Opie multiauth authentication plugins. - * + * * This implementation was derived from the todolist plugin implementation. * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr) */ /* =. This file is part of the Opie Project .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org> .>+-= - _;:, .> :=|. This library is free software; you can + _;:, .> :=|. This library is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This library is distributed in the hope that + .%`+i> _;_. + .i_,=:_. -<s. This library is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. - : = ...= . :.=- + : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with - -- :-=` this library; see the file COPYING.LIB. + -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef MULTIAUTH_PLUGIN_INTERFACE #define MULTIAUTH_PLUGIN_INTERFACE #include <qpe/qcom.h> #include "multiauthconfigwidget.h" class QString; class QWidget; +namespace Opie { +namespace Security { + #ifndef IID_MultiauthPluginInterface /// Universally Unique Id of the interface (required by QCOM): /// {AD5BE8B1-8421-447b-9AED-250BE1CDA49c} #define IID_MultiauthPluginInterface QUuid(0xad5be8b1, 0x8421, 0x447b, 0x9a, 0xed, 0x25, 0x0b, 0xe1, 0xcd, 0xa4, 0x9c) #endif /// Base class for Opie multiauth plugins /** * A MultiauthPluginObject is the base for all Multiauth Plugins. * A plugin author needs to inherit this class and implement * the pure virtual methods. * @@ -88,22 +91,25 @@ class MultiauthPluginObject { virtual QString pixmapNameConfig() const = 0; /// Plugin icon, to be displayed in the plugin list configuration widget /** * \return path to the image file (without the extension) * from $OPIEDIR/pics */ virtual QString pixmapNameWidget() const = 0; }; /// Interface for multiauth plugin classes. -/* +/* * This is part of the QCOM works. See example plugins how to do it right. * \see http://doc.trolltech.com/qtopia/html/pluginintro.html */ struct MultiauthPluginInterface : public QUnknownInterface { /// return the MultiauthPluginObject implementation virtual MultiauthPluginObject *plugin() = 0; }; +} +} + #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 @@ TEMPLATE = lib CONFIG += qt warn_on DESTDIR = $(OPIEDIR)/lib HEADERS = multiauthcommon.h \ multiauthmainwindow.h \ multiauthconfigwidget.h \ - multiauthplugininterface.h + multiauthplugininterface.h \ + multiauthpassword.h SOURCES = multiauthcommon.cpp \ - multiauthmainwindow.cpp + multiauthmainwindow.cpp \ + multiauthpassword.cpp TARGET = opiesecurity2 VERSION = 0.0.2 INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include include ( $(OPIEDIR)/include.pro ) |