summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/pwm.cpp
Unidiff
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 @@
40#include <kcmconfigs/kcmpwmconfig.h> 40#include <kcmconfigs/kcmpwmconfig.h>
41#include <kcmconfigs/kcmkdepimconfig.h> 41#include <kcmconfigs/kcmkdepimconfig.h>
42#include <kcmultidialog.h> 42#include <kcmultidialog.h>
43#include "editcategory.h"
43#endif 44#endif
44 45
45 46
@@ -117,6 +118,9 @@ enum {
117// Button IDs for "options" popup menu 118// Button IDs for "options" popup menu
118enum { 119enum {
119 BUTTON_POPUP_OPTIONS_CONFIG = 0 120 BUTTON_POPUP_OPTIONS_CONFIG = 0
121#ifdef PWM_EMBEDDED
122 ,BUTTON_POPUP_OPTIONS_CATEGORY
123#endif
120}; 124};
121// Button IDs for "export" popup menu (in "file" popup menu) 125// Button IDs for "export" popup menu (in "file" popup menu)
122enum { 126enum {
@@ -360,6 +364,12 @@ void PwM::initMenubar()
360#ifndef PWM_EMBEDDED 364#ifndef PWM_EMBEDDED
361 helpPopup = helpMenu(QString::null, false); 365 helpPopup = helpMenu(QString::null, false);
362#else 366#else
367 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
368 i18n("C&ategories..."), this,
369 SLOT(category_slot()),
370 BUTTON_POPUP_OPTIONS_CATEGORY);
371
372
363 menuBar()->insertItem(i18n("&Sync"), syncPopup); 373 menuBar()->insertItem(i18n("&Sync"), syncPopup);
364 374
365 375
@@ -1391,6 +1401,65 @@ void PwM::focusInEvent(QFocusEvent *e)
1391 1401
1392#ifdef PWM_EMBEDDED 1402#ifdef PWM_EMBEDDED
1393 1403
1404void PwM::category_slot()
1405{
1406 PwMDoc *doc = curDoc();
1407 PWM_ASSERT(doc);
1408 doc->timer()->getLock(DocTimer::id_autoLockTimer);
1409
1410 editCategoryWnd w(doc, this, "editcategory");
1411/*
1412 vector<string> catList;
1413 doc->getCategoryList(&catList);
1414 unsigned i, size = catList.size();
1415 for (i = 0; i < size; ++i) {
1416 w.addCategory(catList[i].c_str());
1417 }
1418 w.setCurrCategory(view->getCurrentCategory());
1419 if (pw)
1420 w.pwLineEdit->setText(*pw);
1421*/
1422 w.setCurrCategory(view->getCurrentCategory());
1423
1424 tryAgain:
1425 if (w.exec() == 1)
1426 {
1427 PwMDataItem d;
1428
1429 //US BUG: to initialize all values of curEntr with meaningfulldata,
1430 // we call clear on it. Reason: Metadata will be uninitialized otherwise.
1431 // another option would be to create a constructor for PwMDataItem
1432 d.clear(true);
1433 /*
1434 d.desc = w.getDescription().latin1();
1435 d.name = w.getUsername().latin1();
1436 d.pw = w.getPassword().latin1();
1437 d.comment = w.getComment().latin1();
1438 d.url = w.getUrl().latin1();
1439 d.launcher = w.getLauncher().latin1();
1440 PwMerror ret = doc->addEntry(w.getCategory(), &d);
1441 if (ret == e_entryExists) {
1442 KMessageBox::error(this,
1443 i18n
1444 ("An entry with this \"Description\",\n"
1445 "does already exist.\n"
1446 "Please select another description."),
1447 i18n("entry already exists."));
1448 goto tryAgain;
1449 } else if (ret == e_maxAllowedEntr) {
1450 KMessageBox::error(this, i18n("The maximum possible number of\nentries"
1451 "has been reached.\nYou can't add more entries."),
1452 i18n("maximum number of entries"));
1453 doc->timer()->putLock(DocTimer::id_autoLockTimer);
1454 return;
1455 }
1456 */
1457 }
1458 setVirgin(false);
1459 doc->timer()->putLock(DocTimer::id_autoLockTimer);
1460}
1461
1462
1394void PwM::whatsnew_slot() 1463void PwM::whatsnew_slot()
1395{ 1464{
1396 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1465 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );