-rw-r--r-- | pwmanager/pwmanager/addentrywndimpl.cpp | 30 | ||||
-rw-r--r-- | pwmanager/pwmanager/addentrywndimpl.h | 19 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwgenwndimpl.cpp | 25 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwgenwndimpl.h | 12 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 5 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmanagerE.pro | 8 |
6 files changed, 90 insertions, 9 deletions
diff --git a/pwmanager/pwmanager/addentrywndimpl.cpp b/pwmanager/pwmanager/addentrywndimpl.cpp index 73ba36c..ffd301f 100644 --- a/pwmanager/pwmanager/addentrywndimpl.cpp +++ b/pwmanager/pwmanager/addentrywndimpl.cpp @@ -34,10 +34,12 @@ #include <qpushbutton.h> #include <qlabel.h> - +#ifndef PWM_EMBEDDED AddEntryWndImpl::AddEntryWndImpl() -#ifdef PWM_EMBEDDED : addEntryWnd( 0, "AddEntryWndImpl", TRUE) +#else +AddEntryWndImpl::AddEntryWndImpl( QWidget* parent, const char* name) + : addEntryWnd( parent, name) #endif { editAdvCommentButton = 0; @@ -53,6 +55,29 @@ AddEntryWndImpl::~AddEntryWndImpl() delete pwGen; } +#ifdef PWM_EMBEDDED +void AddEntryWndImpl::slotOk() +{ + slotApply(); + + if (pwLineEdit->text().isEmpty()) { + KMessageBox::error(this, + i18n("Sorry, you haven't set a password."), + i18n("no password")); + return; + } + + if (descLineEdit->text().isEmpty()) { + KMessageBox::error(this, + i18n("You haven't set a \"Description\"."), + i18n("Description not set")); + return; + } + + KDialogBase::slotOk(); +} +#else + void AddEntryWndImpl::okButton_slot() { if (pwLineEdit->text().isEmpty()) { @@ -75,6 +100,7 @@ void AddEntryWndImpl::cancelButton_slot() { done(2); } +#endif void AddEntryWndImpl::setCurrCategory(const QString &cat) { diff --git a/pwmanager/pwmanager/addentrywndimpl.h b/pwmanager/pwmanager/addentrywndimpl.h index c0bfcee..622e9d2 100644 --- a/pwmanager/pwmanager/addentrywndimpl.h +++ b/pwmanager/pwmanager/addentrywndimpl.h @@ -20,16 +20,19 @@ #ifndef __ADDENTRYWNDIMPL_H #define __ADDENTRYWNDIMPL_H -#include "addentrywnd.h" -#include <qlineedit.h> #ifndef PWM_EMBEDDED +#include <qlineedit.h> #include <qtextedit.h> +#include <qcombobox.h> +#include "addentrywnd.h" #else +#include <klineedit.h> +#include <kcombobox.h> #include <qmultilineedit.h> +#include "addentrywnd_emb.h" #endif -#include <qcombobox.h> #include <qpushbutton.h> class PwGenWndImpl; @@ -39,7 +42,11 @@ class AddEntryWndImpl : public addEntryWnd { Q_OBJECT public: +#ifndef PWM_EMBEDDED AddEntryWndImpl(); +#else + AddEntryWndImpl( QWidget* parent = 0, const char* name = 0); +#endif ~AddEntryWndImpl(); /* get... functions */ @@ -78,10 +85,16 @@ public: { return useAdvComment; } public slots: +#ifndef PWM_EMBEDDED +//MOC_SKIP_BEGIN /** OK button pressed */ void okButton_slot(); /** cancel button pressed */ void cancelButton_slot(); +//MOC_SKIP_END +#else + virtual void slotOk(); +#endif /** Reveal button pressed */ void revealButton_slot(); /** Generate button pressed */ diff --git a/pwmanager/pwmanager/pwgenwndimpl.cpp b/pwmanager/pwmanager/pwgenwndimpl.cpp index 01f5740..5313060 100644 --- a/pwmanager/pwmanager/pwgenwndimpl.cpp +++ b/pwmanager/pwmanager/pwgenwndimpl.cpp @@ -30,6 +30,7 @@ #include <kmessagebox.h> +#ifndef PWM_EMBEDDED PwGenWndImpl::PwGenWndImpl(QWidget *parent, const char *name, bool modal, @@ -38,12 +39,33 @@ PwGenWndImpl::PwGenWndImpl(QWidget *parent, { } +#else +PwGenWndImpl::PwGenWndImpl( QWidget* parent, const char* name) + : pwGenWnd( parent, name) +{ +} +#endif + PwGenWndImpl::~PwGenWndImpl() { } +#ifdef PWM_EMBEDDED +void PwGenWndImpl::slotOk() +{ + // internal generator + if (!optionsSanityIntGen()) + return; + if (!startIntGen()) + return; + + KDialogBase::slotOk(); +} +#endif + void PwGenWndImpl::genButton_slot() { +#ifndef PWM_EMBEDDED // internal generator if (!optionsSanityIntGen()) return; @@ -52,11 +74,14 @@ void PwGenWndImpl::genButton_slot() done(0); exit_success: done(1); +#endif } void PwGenWndImpl::cancelButton_slot() { +#ifndef PWM_EMBEDDED done(0); +#endif } bool PwGenWndImpl::optionsSanityIntGen() diff --git a/pwmanager/pwmanager/pwgenwndimpl.h b/pwmanager/pwmanager/pwgenwndimpl.h index 5c25643..994ff2f 100644 --- a/pwmanager/pwmanager/pwgenwndimpl.h +++ b/pwmanager/pwmanager/pwgenwndimpl.h @@ -20,15 +20,24 @@ #ifndef __PWGENWNDIMPL_H #define __PWGENWNDIMPL_H +#ifndef PWM_EMBEDDED #include "pwgenwnd.h" +#else +#include "pwgenwnd_emb.h" +#endif class PwGenWndImpl : public pwGenWnd { public: +#ifndef PWM_EMBEDDED PwGenWndImpl(QWidget *parent = 0, const char *name = 0, bool modal = FALSE, WFlags fl = 0); +#else + PwGenWndImpl( QWidget* parent = 0, const char* name = 0); +#endif + ~PwGenWndImpl(); /** returns the generated password */ @@ -37,6 +46,9 @@ public: protected slots: /** generate button pressed */ void genButton_slot(); +#ifdef PWM_EMBEDDED + virtual void slotOk(); +#endif /** cancel button pressed */ void cancelButton_slot(); diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp index 08fcb25..107e845 100644 --- a/pwmanager/pwmanager/pwm.cpp +++ b/pwmanager/pwmanager/pwm.cpp @@ -568,7 +568,12 @@ void PwM::addPwd_slot(QString *pw, PwMDoc *_doc) } PWM_ASSERT(doc); doc->timer()->getLock(DocTimer::id_autoLockTimer); +#ifndef PWM_EMBEDDED AddEntryWndImpl w; +#else + AddEntryWndImpl w(this, "addentrywndimpl"); +#endif + vector<string> catList; doc->getCategoryList(&catList); unsigned i, size = catList.size(); diff --git a/pwmanager/pwmanager/pwmanagerE.pro b/pwmanager/pwmanager/pwmanagerE.pro index 5c29ea4..87142b7 100644 --- a/pwmanager/pwmanager/pwmanagerE.pro +++ b/pwmanager/pwmanager/pwmanagerE.pro @@ -39,7 +39,7 @@ LIBS += $(QTOPIALIB) #selftest.h HEADERS = \ -addentrywnd.h \ +addentrywnd_emb.h \ addentrywndimpl.h \ base64.h \ binentrygen.h \ @@ -62,7 +62,7 @@ ipc.h \ listobjselectwnd.h \ listviewpwm.h \ printtext.h \ -pwgenwnd.h \ +pwgenwnd_emb.h \ pwgenwndimpl.h \ pwmdoc.h \ pwmdocui.h \ @@ -103,7 +103,7 @@ kcmconfigs/pwmconfigwidget.h \ #spinforsignal.cpp SOURCES = \ -addentrywnd.cpp \ +addentrywnd_emb.cpp \ addentrywndimpl.cpp \ base64.cpp \ binentrygen.cpp \ @@ -124,7 +124,7 @@ ipc.cpp \ listobjselectwnd.cpp \ listviewpwm.cpp \ main.cpp \ -pwgenwnd.cpp \ +pwgenwnd_emb.cpp \ pwgenwndimpl.cpp \ pwm.cpp \ pwmdoc.cpp \ |