-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 69 |
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 @@ -37,12 +37,13 @@ #include <qmessagebox.h> #include <pwmprefs.h> #include <kpimglobalprefs.h> #include <kcmconfigs/kcmpwmconfig.h> #include <kcmconfigs/kcmkdepimconfig.h> #include <kcmultidialog.h> +#include "editcategory.h" #endif #ifndef DESKTOP_VERSION #include <qpe/global.h> #endif @@ -114,12 +115,15 @@ enum { BUTTON_POPUP_VIEW_DEEPLOCK, BUTTON_POPUP_VIEW_UNLOCK }; // 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 { BUTTON_POPUP_EXPORT_TEXT = 0, BUTTON_POPUP_EXPORT_GPASMAN, BUTTON_POPUP_EXPORT_CSV @@ -357,12 +361,18 @@ void PwM::initMenubar() BUTTON_POPUP_OPTIONS_CONFIG); menuBar()->insertItem(i18n("&Options"), optionsPopup); // "help" popup menu #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); @@ -1388,12 +1398,71 @@ 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" ); } void PwM::showLicense_slot() |