-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 @@ | |||
37 | #include <qmessagebox.h> | 37 | #include <qmessagebox.h> |
38 | #include <pwmprefs.h> | 38 | #include <pwmprefs.h> |
39 | #include <kpimglobalprefs.h> | 39 | #include <kpimglobalprefs.h> |
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 | ||
46 | #ifndef DESKTOP_VERSION | 47 | #ifndef DESKTOP_VERSION |
47 | #include <qpe/global.h> | 48 | #include <qpe/global.h> |
48 | #endif | 49 | #endif |
@@ -114,12 +115,15 @@ enum { | |||
114 | BUTTON_POPUP_VIEW_DEEPLOCK, | 115 | BUTTON_POPUP_VIEW_DEEPLOCK, |
115 | BUTTON_POPUP_VIEW_UNLOCK | 116 | BUTTON_POPUP_VIEW_UNLOCK |
116 | }; | 117 | }; |
117 | // Button IDs for "options" popup menu | 118 | // Button IDs for "options" popup menu |
118 | enum { | 119 | enum { |
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) |
122 | enum { | 126 | enum { |
123 | BUTTON_POPUP_EXPORT_TEXT = 0, | 127 | BUTTON_POPUP_EXPORT_TEXT = 0, |
124 | BUTTON_POPUP_EXPORT_GPASMAN, | 128 | BUTTON_POPUP_EXPORT_GPASMAN, |
125 | BUTTON_POPUP_EXPORT_CSV | 129 | BUTTON_POPUP_EXPORT_CSV |
@@ -357,12 +361,18 @@ void PwM::initMenubar() | |||
357 | BUTTON_POPUP_OPTIONS_CONFIG); | 361 | BUTTON_POPUP_OPTIONS_CONFIG); |
358 | menuBar()->insertItem(i18n("&Options"), optionsPopup); | 362 | menuBar()->insertItem(i18n("&Options"), optionsPopup); |
359 | // "help" popup menu | 363 | // "help" popup menu |
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 | ||
366 | 376 | ||
367 | 377 | ||
368 | 378 | ||
@@ -1388,12 +1398,71 @@ void PwM::focusInEvent(QFocusEvent *e) | |||
1388 | } | 1398 | } |
1389 | } | 1399 | } |
1390 | 1400 | ||
1391 | 1401 | ||
1392 | #ifdef PWM_EMBEDDED | 1402 | #ifdef PWM_EMBEDDED |
1393 | 1403 | ||
1404 | void 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 | |||
1394 | void PwM::whatsnew_slot() | 1463 | void 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" ); |
1397 | } | 1466 | } |
1398 | 1467 | ||
1399 | void PwM::showLicense_slot() | 1468 | void PwM::showLicense_slot() |