summaryrefslogtreecommitdiffabout
path: root/pwmanager
authorulf69 <ulf69>2004-09-23 19:33:54 (UTC)
committer ulf69 <ulf69>2004-09-23 19:33:54 (UTC)
commit15c6615421bc50d6d54dc334c90944749c347d9e (patch) (side-by-side diff)
tree9843c16340d2681dc529cca410472136ea1123fd /pwmanager
parentccf18890228a471d048d591c0d488e63c2de1ccc (diff)
downloadkdepimpi-15c6615421bc50d6d54dc334c90944749c347d9e.zip
kdepimpi-15c6615421bc50d6d54dc334c90944749c347d9e.tar.gz
kdepimpi-15c6615421bc50d6d54dc334c90944749c347d9e.tar.bz2
modified the add password dialog to fit on embedded devices
Diffstat (limited to 'pwmanager') (more/less context) (show whitespace changes)
-rw-r--r--pwmanager/pwmanager/addentrywndimpl.cpp30
-rw-r--r--pwmanager/pwmanager/addentrywndimpl.h19
-rw-r--r--pwmanager/pwmanager/pwgenwndimpl.cpp25
-rw-r--r--pwmanager/pwmanager/pwgenwndimpl.h12
-rw-r--r--pwmanager/pwmanager/pwm.cpp5
-rw-r--r--pwmanager/pwmanager/pwmanagerE.pro8
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
@@ -25,65 +25,91 @@
#include "pwgenwndimpl.h"
#ifndef PWM_EMBEDDED
#include "advcommeditimpl.h"
#endif
#include "htmlgen.h"
#include <kmessagebox.h>
#include <klocale.h>
#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;
commentTextEdit = 0;
switchComment(false);
pwGen = new PwGenWndImpl(this);
}
AddEntryWndImpl::~AddEntryWndImpl()
{
delete_ifnot_null(editAdvCommentButton);
delete_ifnot_null(commentTextEdit);
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()) {
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;
}
done(1);
}
void AddEntryWndImpl::cancelButton_slot()
{
done(2);
}
+#endif
void AddEntryWndImpl::setCurrCategory(const QString &cat)
{
int i, count = categoryComboBox->count();
for (i = 0; i < count; ++i) {
if (categoryComboBox->text(i) == cat) {
categoryComboBox->setCurrentItem(i);
return;
}
}
BUG();
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
@@ -11,44 +11,51 @@
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#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;
/** "add/edit" Window */
class AddEntryWndImpl : public addEntryWnd
{
Q_OBJECT
public:
+#ifndef PWM_EMBEDDED
AddEntryWndImpl();
+#else
+ AddEntryWndImpl( QWidget* parent = 0, const char* name = 0);
+#endif
~AddEntryWndImpl();
/* get... functions */
QString getDescription()
{ return descLineEdit->text(); }
QString getCategory()
{ return categoryComboBox->currentText(); }
QString getUsername()
{ return usernameLineEdit->text(); }
QString getPassword()
{ return pwLineEdit->text(); }
QString getUrl()
@@ -69,28 +76,34 @@ public:
{ pwLineEdit->setText(pw); }
void setUrl(const QString &url)
{ urlLineEdit->setText(url); }
void setLauncher(const QString launcher)
{ launcherLineEdit->setText(launcher); }
void setComment(const QString &comm);
/** are we using an advanced comment */
bool isAdvancedComment()
{ 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 */
void generateButton_slot();
/** advanced comment button pressed */
void advancedCommentButton_slot(bool on);
/** edit advanced comment button pressed */
void editAdvCommentButton_slot();
protected:
void switchComment(bool toAdvanced);
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
@@ -21,51 +21,76 @@
#include "pwmexception.h"
#include "genpasswd.h"
#include <qtabwidget.h>
#include <qspinbox.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <klocale.h>
#include <kmessagebox.h>
+#ifndef PWM_EMBEDDED
PwGenWndImpl::PwGenWndImpl(QWidget *parent,
const char *name,
bool modal,
WFlags fl)
: pwGenWnd(parent, name, modal, fl)
{
}
+#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;
if (startIntGen())
goto exit_success;
done(0);
exit_success:
done(1);
+#endif
}
void PwGenWndImpl::cancelButton_slot()
{
+#ifndef PWM_EMBEDDED
done(0);
+#endif
}
bool PwGenWndImpl::optionsSanityIntGen()
{
if (int_charLowerCheckBox->isChecked())
return true;
if (int_charUpperCheckBox->isChecked())
return true;
if (int_charNumCheckBox->isChecked())
return true;
if (int_charSpecCheckBox->isChecked())
return true;
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
@@ -11,41 +11,53 @@
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#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 */
QString getPassword();
protected slots:
/** generate button pressed */
void genButton_slot();
+#ifdef PWM_EMBEDDED
+ virtual void slotOk();
+#endif
/** cancel button pressed */
void cancelButton_slot();
protected:
/** start the internal generator */
bool startIntGen();
/** check all options of the internal generator */
bool optionsSanityIntGen();
protected:
/** the generated password */
QString password;
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
@@ -559,25 +559,30 @@ void PwM::addPwd_slot()
}
void PwM::addPwd_slot(QString *pw, PwMDoc *_doc)
{
PwMDoc *doc;
if (_doc) {
doc = _doc;
} else {
doc = curDoc();
}
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();
for (i = 0; i < size; ++i) {
w.addCategory(catList[i].c_str());
}
w.setCurrCategory(view->getCurrentCategory());
if (pw)
w.pwLineEdit->setText(*pw);
tryAgain:
if (w.exec() == 1)
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
@@ -30,48 +30,48 @@ LIBS += $(QTOPIALIB)
#subtbledit.ui \
#HEADERS = \
#configuration_31compat.h \
#configuration.h \
#configwnd.h \
#configwndimpl.h \
#selftest.h
HEADERS = \
-addentrywnd.h \
+addentrywnd_emb.h \
addentrywndimpl.h \
base64.h \
binentrygen.h \
blowfish.h \
commentbox.h \
compiler.h \
compressbzip2.h \
compressgzip.h \
findwnd.h \
findwndimpl.h \
genpasswd.h \
getkeycardwnd.h \
getmasterpwwnd.h \
getmasterpwwndimpl.h \
globalstuff.h \
gpasmanfile.h \
htmlgen.h \
htmlparse.h \
ipc.h \
listobjselectwnd.h \
listviewpwm.h \
printtext.h \
-pwgenwnd.h \
+pwgenwnd_emb.h \
pwgenwndimpl.h \
pwmdoc.h \
pwmdocui.h \
pwmexception.h \
pwm.h \
pwminit.h \
pwmprefs.h \
pwmprint.h \
pwmtray.h \
pwmview.h \
pwmviewstyle_0.h \
pwmviewstyle_1.h \
@@ -94,46 +94,46 @@ kcmconfigs/pwmconfigwidget.h \
#advcommeditimpl.cpp \
#configuration.cpp \
#configwnd.cpp \
#configwndimpl.cpp \
#configuration_31compat.cpp \
#htmlparse.cpp \
#printtext.cpp \
#selftest.cpp \
#pwmprint.cpp \
#spinforsignal.cpp
SOURCES = \
-addentrywnd.cpp \
+addentrywnd_emb.cpp \
addentrywndimpl.cpp \
base64.cpp \
binentrygen.cpp \
blowfish.cpp \
commentbox.cpp \
compressbzip2.cpp \
compressgzip.cpp \
findwnd.cpp \
findwndimpl.cpp \
genpasswd.cpp \
getkeycardwnd.cpp \
getmasterpwwnd.cpp \
getmasterpwwndimpl.cpp \
globalstuff.cpp \
gpasmanfile.cpp \
htmlgen.cpp \
ipc.cpp \
listobjselectwnd.cpp \
listviewpwm.cpp \
main.cpp \
-pwgenwnd.cpp \
+pwgenwnd_emb.cpp \
pwgenwndimpl.cpp \
pwm.cpp \
pwmdoc.cpp \
pwmdocui.cpp \
pwmexception.cpp \
pwminit.cpp \
pwmprefs.cpp \
pwmtray.cpp \
pwmview.cpp \
pwmviewstyle_0.cpp \
pwmviewstyle_1.cpp \
pwmviewstyle.cpp \