author | clem <clem> | 2004-08-03 22:59:45 (UTC) |
---|---|---|
committer | clem <clem> | 2004-08-03 22:59:45 (UTC) |
commit | 72d6b839da4aecba0ad6479c3e1d68192bbe6a51 (patch) (unidiff) | |
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 | |||
@@ -22,9 +22,8 @@ | |||
22 | **********************************************************************/ | 22 | **********************************************************************/ |
23 | 23 | ||
24 | #include "pin.h" | 24 | #include "pin.h" |
25 | #include "pinDialogBase.h" | 25 | #include "pinDialogBase.h" |
26 | #include "pinConfigWidget.h" | ||
27 | /* OPIE */ | 26 | /* OPIE */ |
28 | #include <opie2/odebug.h> | 27 | #include <opie2/odebug.h> |
29 | #include <opie2/oapplication.h> | 28 | #include <opie2/oapplication.h> |
30 | /* QT */ | 29 | /* QT */ |
@@ -317,8 +316,18 @@ int PinPlugin::authenticate() | |||
317 | owarn << "No PIN has been defined! We consider it as a successful authentication though." << oendl; | 316 | owarn << "No PIN has been defined! We consider it as a successful authentication though." << oendl; |
318 | return MultiauthPluginObject::Success; | 317 | return MultiauthPluginObject::Success; |
319 | } | 318 | } |
320 | 319 | ||
320 | /// Standard c'tor | ||
321 | PinPlugin::PinPlugin() : MultiauthPluginObject(), m_pinW(0) { | ||
322 | } | ||
323 | |||
324 | /// deletes m_pinW if we need to | ||
325 | PinPlugin::~PinPlugin() { | ||
326 | if (m_pinW != 0) | ||
327 | delete m_pinW; | ||
328 | } | ||
329 | |||
321 | /// Simply returns the plugin name (PIN plugin) | 330 | /// Simply returns the plugin name (PIN plugin) |
322 | QString PinPlugin::pluginName() const { | 331 | QString PinPlugin::pluginName() const { |
323 | return "PIN Plugin"; | 332 | return "PIN Plugin"; |
324 | } | 333 | } |
@@ -332,14 +341,15 @@ QString PinPlugin::pixmapNameConfig() const { | |||
332 | } | 341 | } |
333 | 342 | ||
334 | /// returns a PinConfigWidget | 343 | /// returns a PinConfigWidget |
335 | MultiauthConfigWidget * PinPlugin::configWidget(QWidget * parent) { | 344 | MultiauthConfigWidget * PinPlugin::configWidget(QWidget * parent) { |
336 | PinConfigWidget * pinw = new PinConfigWidget(parent, "PIN configuration widget"); | 345 | if (m_pinW == 0) { |
337 | 346 | m_pinW = new PinConfigWidget(parent, "PIN configuration widget"); | |
338 | connect(pinw->changePIN, SIGNAL( clicked() ), this, SLOT( changePIN() )); | ||
339 | connect(pinw->clearPIN, SIGNAL( clicked() ), this, SLOT( clearPIN() )); | ||
340 | 347 | ||
341 | return pinw; | 348 | connect(m_pinW->changePIN, SIGNAL( clicked() ), this, SLOT( changePIN() )); |
349 | connect(m_pinW->clearPIN, SIGNAL( clicked() ), this, SLOT( clearPIN() )); | ||
350 | } | ||
351 | return m_pinW; | ||
342 | } | 352 | } |
343 | 353 | ||
344 | #include "pin.moc" | 354 | #include "pin.moc" |
345 | 355 | ||
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 | |||
@@ -47,8 +47,10 @@ class PinPlugin : public QObject, public Opie::Security::MultiauthPluginObject { | |||
47 | 47 | ||
48 | Q_OBJECT | 48 | Q_OBJECT |
49 | 49 | ||
50 | public: | 50 | public: |
51 | PinPlugin(); | ||
52 | virtual ~PinPlugin(); | ||
51 | int authenticate(); | 53 | int authenticate(); |
52 | Opie::Security::MultiauthConfigWidget * configWidget(QWidget * parent); | 54 | Opie::Security::MultiauthConfigWidget * configWidget(QWidget * parent); |
53 | QString pixmapNameConfig() const; | 55 | QString pixmapNameConfig() const; |
54 | QString pixmapNameWidget() const; | 56 | QString pixmapNameWidget() const; |
@@ -60,8 +62,9 @@ private slots: | |||
60 | void changePIN(); | 62 | void changePIN(); |
61 | void clearPIN(); | 63 | void clearPIN(); |
62 | 64 | ||
63 | private: | 65 | private: |
66 | PinConfigWidget * m_pinW; | ||
64 | QString encrypt(const QString& pin); | 67 | QString encrypt(const QString& pin); |
65 | bool verify(const QString& pin, const QString& hash); | 68 | bool verify(const QString& pin, const QString& hash); |
66 | }; | 69 | }; |
67 | 70 | ||