summaryrefslogtreecommitdiffabout
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
parentccf18890228a471d048d591c0d488e63c2de1ccc (diff)
downloadkdepimpi-15c6615421bc50d6d54dc334c90944749c347d9e.zip
kdepimpi-15c6615421bc50d6d54dc334c90944749c347d9e.tar.gz
kdepimpi-15c6615421bc50d6d54dc334c90944749c347d9e.tar.bz2
modified the add password dialog to fit on embedded devices
Diffstat (more/less context) (ignore 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
@@ -1,177 +1,203 @@
/***************************************************************************
* *
* copyright (C) 2003, 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* Many very good improvements and the original implementations of *
* them came from Matt Scifo <mscifo@o1.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* 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$
**************************************************************************/
#include "addentrywndimpl.h"
#include "pwmexception.h"
#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();
}
void AddEntryWndImpl::revealButton_slot()
{
if (revealButton->isOn()) {
pwLineEdit->setEchoMode(QLineEdit::Normal);
} else {
pwLineEdit->setEchoMode(QLineEdit::Password);
}
}
void AddEntryWndImpl::generateButton_slot()
{
if (!pwGen->exec())
return;
setPassword(pwGen->getPassword());
}
QString AddEntryWndImpl::getComment()
{
if (isAdvancedComment()) {
return advCommentDta;
}
return commentTextEdit->text();
}
void AddEntryWndImpl::setComment(const QString &comm)
{
if (HtmlGen::isHtml(comm)) {
advancedCommentButton->setOn(true);
advCommentDta = comm;
} else {
advancedCommentButton->setOn(false);
commentTextEdit->setText(comm);
}
}
void AddEntryWndImpl::advancedCommentButton_slot(bool on)
{
switchComment(on);
}
void AddEntryWndImpl::switchComment(bool toAdvanced)
{
useAdvComment = toAdvanced;
if (toAdvanced) {
if (commentTextEdit) {
savedCommentText = commentTextEdit->text();
delete_and_null(commentTextEdit);
}
if (editAdvCommentButton)
return;
editAdvCommentButton = new QPushButton(i18n("Edit advanced comment..."),
commentDummy);
editAdvCommentButton->resize(commentDummy->size().width(), 50);
connect(editAdvCommentButton, SIGNAL(clicked()),
this, SLOT(editAdvCommentButton_slot()));
editAdvCommentButton->show();
} else {
delete_ifnot_null(editAdvCommentButton);
if (commentTextEdit)
return;
#ifndef PWM_EMBEDDED
commentTextEdit = new QTextEdit(commentDummy);
commentTextEdit->setTextFormat(Qt::PlainText);
#else
commentTextEdit = new QMultiLineEdit(commentDummy);
#endif
commentTextEdit->resize(commentDummy->size());
commentTextEdit->setText(savedCommentText);
commentTextEdit->show();
}
}
void AddEntryWndImpl::editAdvCommentButton_slot()
{
#ifndef PWM_EMBEDDED
AdvCommEditImpl editor(this);
editor.setHtmlDta(advCommentDta);
if (editor.exec())
return;
advCommentDta = editor.getHtmlDta();
#endif
}
#ifndef PWM_EMBEDDED
#include "addentrywndimpl.moc"
#endif
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
@@ -1,114 +1,127 @@
/***************************************************************************
* *
* copyright (C) 2003, 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* 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()
{ return urlLineEdit->text(); }
QString getLauncher()
{ return launcherLineEdit->text(); }
QString getComment();
/* set... functions */
void setDescription(const QString &desc)
{ descLineEdit->setText(desc); }
void setCurrCategory(const QString &cat);
void addCategory(const QString &cat)
{ categoryComboBox->insertItem(cat); }
void setUsername(const QString &name)
{ usernameLineEdit->setText(name); }
void setPassword(const QString &pw)
{ 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);
protected:
QPushButton *editAdvCommentButton;
#ifndef PWM_EMBEDDED
QTextEdit *commentTextEdit;
#else
QMultiLineEdit * commentTextEdit;
#endif
/** saved data from normal comment text edit box */
QString savedCommentText;
/** use an advanced comment? */
bool useAdvComment;
/** data of advanced comment (if available) */
QString advCommentDta;
/** password generation object */
PwGenWndImpl *pwGen;
};
#endif
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
@@ -1,112 +1,137 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* 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$
**************************************************************************/
#include "pwgenwndimpl.h"
#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;
if (int_charUserCheckBox->isChecked()) {
if (int_userDefLineEdit->text().length() >= 2)
return true;
if (int_charBlankCheckBox->isChecked())
return true;
}
KMessageBox::error(this,
i18n("Incorrect Charset selection!\n"
"It's impossible to generate a sane "
"password with the selected charset(s).\n"
"Please select more charsets."),
i18n("Incorrect Charset selection"));
return false;
}
bool PwGenWndImpl::startIntGen()
{
GenPasswd gen;
gen.setLen(int_lenSpinBox->value());
gen.setUseFilter(int_filterCheckBox->isChecked());
gen.setCharset(int_charLowerCheckBox->isChecked(),
int_charUpperCheckBox->isChecked(),
int_charNumCheckBox->isChecked(),
int_charSpecCheckBox->isChecked(),
int_charBlankCheckBox->isChecked(),
int_charUserCheckBox->isChecked() ?
int_userDefLineEdit->text() :
QString::null);
QString pw(gen.gen());
if (pw.isEmpty())
return false;
password = pw;
return true;
}
QString PwGenWndImpl::getPassword()
{
QString ret(password);
password = QString::null;
return ret;
}
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
@@ -1,54 +1,66 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* 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;
};
#endif // __PWGENWNDIMPL_H
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
@@ -379,385 +379,390 @@ void PwM::initToolbar()
SLOT(addPwd_slot()), true,
i18n("Add password"));
toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar),
BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this,
SLOT(editPwd_slot()), true,
i18n("Edit password"));
toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar),
BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this,
SLOT(deletePwd_slot()), true,
i18n("Delete password"));
toolBar()->insertSeparator();
toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar),
BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this,
SLOT(find_slot()), true, i18n("Find entry"));
toolBar()->insertSeparator();
toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar),
BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this,
SLOT(lockWnd_slot()), true,
i18n("Lock all entries"));
toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar),
BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this,
SLOT(deepLockWnd_slot()), true,
i18n("Deep-Lock all entries"));
toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar),
BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this,
SLOT(unlockWnd_slot()), true,
i18n("Unlock all entries"));
}
void PwM::initMetrics()
{
QSize s = conf()->confWndMainWndSize();
if (s.isValid())
resize(s);
else
resize(DEFAULT_SIZE);
}
void PwM::updateCaption()
{
setPlainCaption(curDoc()->getTitle() + " - " PROG_NAME " " PACKAGE_VER);
}
void PwM::hideEvent(QHideEvent *)
{
if (isMinimized()) {
if (init->tray()) {
forceMinimizeToTray = true;
close();
}
int mmlock = conf()->confGlobMinimizeLock();
switch (mmlock) {
case 0: // don't lock anything
break;
case 1: { // normal lock
curDoc()->lockAll(true);
break;
} case 2: { // deep-lock
curDoc()->deepLock();
break;
} default:
WARN();
}
}
}
void PwM::setVirgin(bool v)
{
if (virgin == v)
return;
virgin = v;
filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVE, !v);
filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVEAS, !v);
filePopup->setItemEnabled(BUTTON_POPUP_FILE_EXPORT, !v);
filePopup->setItemEnabled(BUTTON_POPUP_FILE_PRINT, !v);
managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_EDIT, !v);
managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_DEL, !v);
managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, !v);
viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_LOCK, !v);
viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_DEEPLOCK, !v);
viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_UNLOCK, !v);
viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_FIND, !v);
toolBar()->setItemEnabled(BUTTON_TOOL_SAVE, !v);
toolBar()->setItemEnabled(BUTTON_TOOL_SAVEAS, !v);
toolBar()->setItemEnabled(BUTTON_TOOL_PRINT, !v);
toolBar()->setItemEnabled(BUTTON_TOOL_EDIT, !v);
toolBar()->setItemEnabled(BUTTON_TOOL_DEL, !v);
toolBar()->setItemEnabled(BUTTON_TOOL_LOCK, !v);
toolBar()->setItemEnabled(BUTTON_TOOL_DEEPLOCK, !v);
toolBar()->setItemEnabled(BUTTON_TOOL_UNLOCK, !v);
toolBar()->setItemEnabled(BUTTON_TOOL_FIND, !v);
}
void PwM::new_slot()
{
init->createMainWnd();
}
//US ENH
void PwM::open_slot()
{
open_slot("");
}
void PwM::open_slot(QString fn)
{
openDoc(fn);
}
PwMDoc * PwM::openDoc(QString filename, bool openDeepLocked)
{
if (!isVirgin()) {
// open the document in a new window.
PwM *newInstance = init->createMainWnd();
PwMDoc *newDoc = newInstance->openDoc(filename, openDeepLocked);
if (!newDoc) {
newInstance->setForceQuit(true);
delete_and_null(newInstance);
}
return newDoc;
}
if (!curDoc()->openDocUi(curDoc(), filename, openDeepLocked))
return 0;
showStatMsg(i18n("Successfully opened file."));
updateCaption();
setVirgin(false);
return curDoc();
}
PwMView * PwM::makeNewListView(PwMDoc *doc)
{
PwMView *ret = new PwMView(this, this, doc);
ret->setFont(conf()->confGlobEntryFont());
ret->show();
return ret;
}
void PwM::close_slot()
{
close();
}
void PwM::quitButton_slot()
{
init->shutdownApp(0);
}
void PwM::save_slot()
{
save();
}
bool PwM::save()
{
if (!curDoc()->saveDocUi(curDoc()))
return false;
showStatMsg(i18n("Successfully saved data."));
updateCaption();
return true;
}
void PwM::saveAs_slot()
{
saveAs();
}
bool PwM::saveAs()
{
if (!curDoc()->saveAsDocUi(curDoc()))
return false;
showStatMsg(i18n("Successfully saved data."));
updateCaption();
return true;
}
//US ENH : changed code to run with older MOC
void PwM::addPwd_slot()
{
addPwd_slot(0, 0);
}
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)
{
PwMDataItem d;
d.desc = w.getDescription().latin1();
d.name = w.getUsername().latin1();
d.pw = w.getPassword().latin1();
d.comment = w.getComment().latin1();
d.url = w.getUrl().latin1();
d.launcher = w.getLauncher().latin1();
PwMerror ret = doc->addEntry(w.getCategory(), &d);
if (ret == e_entryExists) {
KMessageBox::error(this,
i18n
("An entry with this \"Description\", "
"does already exist.\n"
"Please select another description."),
i18n("entry already exists."));
goto tryAgain;
} else if (ret == e_maxAllowedEntr) {
KMessageBox::error(this, i18n("The maximum possible number of entries "
"has been reached. You can't add more entries."),
i18n("maximum number of entries"));
doc->timer()->putLock(DocTimer::id_autoLockTimer);
return;
}
}
setVirgin(false);
doc->timer()->putLock(DocTimer::id_autoLockTimer);
}
//US ENH : changed code to run with older MOC
void PwM::editPwd_slot()
{
editPwd_slot(0,0,0);
}
void PwM::editPwd_slot(const QString *category)
{
editPwd_slot(category, 0, 0);
}
void PwM::editPwd_slot(const QString *category, const int *index,
PwMDoc *_doc)
{
PwMDoc *doc;
if (_doc) {
doc = _doc;
} else {
doc = curDoc();
}
PWM_ASSERT(doc);
if (doc->isDocEmpty())
return;
if (doc->isDeepLocked())
return;
doc->timer()->getLock(DocTimer::id_autoLockTimer);
unsigned int curEntryIndex;
if (index) {
curEntryIndex = *index;
} else {
if (!(view->getCurEntryIndex(&curEntryIndex))) {
printDebug("couldn't get index. Maybe we have a binary entry here.");
doc->timer()->putLock(DocTimer::id_autoLockTimer);
return;
}
}
QString curCategory;
if (category) {
curCategory = *category;
} else {
curCategory = view->getCurrentCategory();
}
PwMDataItem currItem;
if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) {
doc->timer()->putLock(DocTimer::id_autoLockTimer);
return;
}
BUG_ON(currItem.binary);
AddEntryWndImpl w;
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(curCategory);
w.setDescription(currItem.desc.c_str());
w.setUsername(currItem.name.c_str());
w.setPassword(currItem.pw.c_str());
w.setUrl(currItem.url.c_str());
w.setLauncher(currItem.launcher.c_str());
w.setComment(currItem.comment.c_str());
if (w.exec() == 1) {
currItem.desc = w.getDescription().latin1();
currItem.name = w.getUsername().latin1();
currItem.pw = w.getPassword().latin1();
currItem.comment = w.getComment().latin1();
currItem.url = w.getUrl().latin1();
currItem.launcher = w.getLauncher().latin1();
if (!doc->editEntry(curCategory, w.getCategory(),
curEntryIndex, &currItem)) {
KMessageBox::error(this,
i18n("Couldn't edit the entry.\n"
"Maybe you changed the category and "
"this entry is already present in the new "
"category?"),
i18n("couldn't edit entry."));
doc->timer()->putLock(DocTimer::id_autoLockTimer);
return;
}
}
doc->timer()->putLock(DocTimer::id_autoLockTimer);
}
void PwM::deletePwd_slot()
{
PWM_ASSERT(curDoc());
if (curDoc()->isDocEmpty())
return;
if (curDoc()->isDeepLocked())
return;
curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
unsigned int curEntryIndex = 0;
if (!(view->getCurEntryIndex(&curEntryIndex))) {
printDebug("couldn't get index");
curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
return;
}
PwMDataItem currItem;
QString curCategory = view->getCurrentCategory();
if (!curDoc()->getEntry(curCategory, curEntryIndex, &currItem)) {
printDebug("couldn't get entry");
curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
return;
}
if (KMessageBox::
questionYesNo(this,
i18n
("Do you really want to delete the selected entry") +
" \"" + QString(currItem.desc.c_str())
+ "\" ?", i18n("delete?"))
== KMessageBox::Yes) {
curDoc()->delEntry(curCategory, curEntryIndex);
}
curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
}
void PwM::changeMasterPwd_slot()
{
PWM_ASSERT(curDoc());
curDoc()->changeCurrentPw();
}
void PwM::lockWnd_slot()
{
PWM_ASSERT(curDoc());
curDoc()->lockAll(true);
}
void PwM::deepLockWnd_slot()
{
PWM_ASSERT(curDoc());
curDoc()->deepLock();
}
void PwM::unlockWnd_slot()
{
PWM_ASSERT(curDoc());
curDoc()->lockAll(false);
}
void PwM::config_slot()
{
int oldStyle = conf()->confWndMainViewStyle();
#ifdef PWM_EMBEDDED
KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"pwmconfigdialog", true );
KCMPwmConfig* pwmcfg = new KCMPwmConfig( ConfigureDialog->getNewVBoxPage(i18n( "PwManager")) , "KCMPwmConfig" );
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
@@ -1,153 +1,153 @@
TEMPLATE = app
CONFIG += qt warn_on
TARGET = pwmpi
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR=$(QPEDIR)/bin
INCLUDEPATH += . ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils $(QPEDIR)/include
DEFINES += PWM_EMBEDDED PWM_DEBUG
LIBS += -lmicrokde
LIBS += -lmicroqtcompat
LIBS += -lmicrokdepim
LIBS += -L$(QPEDIR)/lib
LIBS += -lqpe
LIBS += -lbz2
LIBS += $(QTOPIALIB)
#INTERFACES = \
#addentrywnd.ui \
#configwnd.ui \
#findwnd.ui \
#getmasterpwwnd.ui \
#pwgenwnd.ui \
#setmasterpwwnd.ui \
#subtbledit.ui
#INTERFACES = \
#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 \
pwmviewstyle.h \
randomizer.h \
rc2.h \
rencatwnd.h \
serializer.h \
setmasterpwwnd.h \
setmasterpwwndimpl.h \
sha1.h \
subtbledit.h \
subtbleditimpl.h \
waitwnd.h \
kcmconfigs/kcmpwmconfig.h \
kcmconfigs/pwmconfigwidget.h \
#sources that need not be build
#SOURCES = \
#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 \
randomizer.cpp \
rc2.cpp \
rencatwnd.cpp \
serializer.cpp \
setmasterpwwnd.cpp \
setmasterpwwndimpl.cpp \
sha1.cpp \
subtbledit.cpp \
subtbleditimpl.cpp \
waitwnd.cpp \
kcmconfigs/kcmpwmconfig.cpp \
kcmconfigs/pwmconfigwidget.cpp \