summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/pwm.cpp
Side-by-side diff
Diffstat (limited to 'pwmanager/pwmanager/pwm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwm.cpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index 6ae6e28..bd98d72 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -40,6 +40,7 @@
#include <kcmconfigs/kcmpwmconfig.h>
#include <kcmconfigs/kcmkdepimconfig.h>
#include <kcmultidialog.h>
+#include "editcategory.h"
#endif
@@ -117,6 +118,9 @@ enum {
// Button IDs for "options" popup menu
enum {
BUTTON_POPUP_OPTIONS_CONFIG = 0
+#ifdef PWM_EMBEDDED
+ ,BUTTON_POPUP_OPTIONS_CATEGORY
+#endif
};
// Button IDs for "export" popup menu (in "file" popup menu)
enum {
@@ -360,6 +364,12 @@ void PwM::initMenubar()
#ifndef PWM_EMBEDDED
helpPopup = helpMenu(QString::null, false);
#else
+ optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
+ i18n("C&ategories..."), this,
+ SLOT(category_slot()),
+ BUTTON_POPUP_OPTIONS_CATEGORY);
+
+
menuBar()->insertItem(i18n("&Sync"), syncPopup);
@@ -1391,6 +1401,65 @@ void PwM::focusInEvent(QFocusEvent *e)
#ifdef PWM_EMBEDDED
+void PwM::category_slot()
+{
+ PwMDoc *doc = curDoc();
+ PWM_ASSERT(doc);
+ doc->timer()->getLock(DocTimer::id_autoLockTimer);
+
+ editCategoryWnd w(doc, this, "editcategory");
+/*
+ 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);
+*/
+ w.setCurrCategory(view->getCurrentCategory());
+
+ tryAgain:
+ if (w.exec() == 1)
+ {
+ PwMDataItem d;
+
+ //US BUG: to initialize all values of curEntr with meaningfulldata,
+ // we call clear on it. Reason: Metadata will be uninitialized otherwise.
+ // another option would be to create a constructor for PwMDataItem
+ d.clear(true);
+ /*
+ 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\",\n"
+ "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\nentries"
+ "has been reached.\nYou 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);
+}
+
+
void PwM::whatsnew_slot()
{
KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );