author | clem <clem> | 2004-08-03 22:59:45 (UTC) |
---|---|---|
committer | clem <clem> | 2004-08-03 22:59:45 (UTC) |
commit | 72d6b839da4aecba0ad6479c3e1d68192bbe6a51 (patch) (side-by-side diff) | |
tree | 1a60581005dfab811debe87e2eae6be905743dc2 | |
parent | 02434fe2d87d1c69c60693d9537b419d9dfd44e7 (diff) | |
download | opie-72d6b839da4aecba0ad6479c3e1d68192bbe6a51.zip opie-72d6b839da4aecba0ad6479c3e1d68192bbe6a51.tar.gz opie-72d6b839da4aecba0ad6479c3e1d68192bbe6a51.tar.bz2 |
manage better the MultiauthConfigWidget PinConfigWidget object, with a pointer managed by PinPlugin c'tor and d'tor (like in NoticePlugin)
-rw-r--r-- | noncore/securityplugins/pin/pin.cpp | 22 | ||||
-rw-r--r-- | noncore/securityplugins/pin/pin.h | 3 |
2 files changed, 19 insertions, 6 deletions
diff --git a/noncore/securityplugins/pin/pin.cpp b/noncore/securityplugins/pin/pin.cpp index c21ffcd..2accb9c 100644 --- a/noncore/securityplugins/pin/pin.cpp +++ b/noncore/securityplugins/pin/pin.cpp @@ -18,17 +18,16 @@ ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "pin.h" #include "pinDialogBase.h" -#include "pinConfigWidget.h" /* OPIE */ #include <opie2/odebug.h> #include <opie2/oapplication.h> /* QT */ #include <qpe/config.h> #include <qlabel.h> #include <qlineedit.h> #include <qtextview.h> @@ -313,33 +312,44 @@ int PinPlugin::authenticate() return MultiauthPluginObject::Success; else return MultiauthPluginObject::Failure; } owarn << "No PIN has been defined! We consider it as a successful authentication though." << oendl; return MultiauthPluginObject::Success; } +/// Standard c'tor +PinPlugin::PinPlugin() : MultiauthPluginObject(), m_pinW(0) { +} + +/// deletes m_pinW if we need to +PinPlugin::~PinPlugin() { + if (m_pinW != 0) + delete m_pinW; +} + /// Simply returns the plugin name (PIN plugin) QString PinPlugin::pluginName() const { return "PIN Plugin"; } QString PinPlugin::pixmapNameWidget() const { return "security/pinplugin"; } QString PinPlugin::pixmapNameConfig() const { return "security/pinplugin"; } /// returns a PinConfigWidget MultiauthConfigWidget * PinPlugin::configWidget(QWidget * parent) { - PinConfigWidget * pinw = new PinConfigWidget(parent, "PIN configuration widget"); - - connect(pinw->changePIN, SIGNAL( clicked() ), this, SLOT( changePIN() )); - connect(pinw->clearPIN, SIGNAL( clicked() ), this, SLOT( clearPIN() )); + if (m_pinW == 0) { + m_pinW = new PinConfigWidget(parent, "PIN configuration widget"); - return pinw; + connect(m_pinW->changePIN, SIGNAL( clicked() ), this, SLOT( changePIN() )); + connect(m_pinW->clearPIN, SIGNAL( clicked() ), this, SLOT( clearPIN() )); + } + return m_pinW; } #include "pin.moc" diff --git a/noncore/securityplugins/pin/pin.h b/noncore/securityplugins/pin/pin.h index 1832210..b5ae10a 100644 --- a/noncore/securityplugins/pin/pin.h +++ b/noncore/securityplugins/pin/pin.h @@ -43,26 +43,29 @@ /** * The plugin itself, implementing the main authenticate() function. */ class PinPlugin : public QObject, public Opie::Security::MultiauthPluginObject { Q_OBJECT public: + PinPlugin(); + virtual ~PinPlugin(); int authenticate(); Opie::Security::MultiauthConfigWidget * configWidget(QWidget * parent); QString pixmapNameConfig() const; QString pixmapNameWidget() const; QString pluginName() const; private slots: QString getPIN( const QString& prompt ); QString getCryptedPIN( const QString& prompt ); void changePIN(); void clearPIN(); private: + PinConfigWidget * m_pinW; QString encrypt(const QString& pin); bool verify(const QString& pin, const QString& hash); }; #endif // PIN_H |