author | ulf69 <ulf69> | 2004-09-15 22:39:25 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-09-15 22:39:25 (UTC) |
commit | 610cf2a6c7aaf9855b54cd0453f347edf9c1a855 (patch) (side-by-side diff) | |
tree | 5ef182e00afa3fbc6cb9a2d6f59654c599c6118a | |
parent | 7fae8b87a05c3572bf0c9218d300d99fdc02adc4 (diff) | |
download | kdepimpi-610cf2a6c7aaf9855b54cd0453f347edf9c1a855.zip kdepimpi-610cf2a6c7aaf9855b54cd0453f347edf9c1a855.tar.gz kdepimpi-610cf2a6c7aaf9855b54cd0453f347edf9c1a855.tar.bz2 |
enhanced code
-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 167 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwm.h | 6 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmdocui.cpp | 17 |
3 files changed, 152 insertions, 38 deletions
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp index 0e57650..e5579f8 100644 --- a/pwmanager/pwmanager/pwm.cpp +++ b/pwmanager/pwmanager/pwm.cpp @@ -32,2 +32,3 @@ #include <qmenubar.h> +#include <qmessagebox.h> #endif @@ -122,2 +123,12 @@ enum { }; + +#ifdef PWM_EMBEDDED +// Button IDs for "help" popup menu +enum { + BUTTON_POPUP_HELP_LICENSE = 0, + BUTTON_POPUP_HELP_FAQ, + BUTTON_POPUP_HELP_ABOUT +}; +#endif + // Button IDs for toolbar @@ -174,4 +185,9 @@ void PwM::initMenubar() { + KIconLoader* picons; +#ifndef PWM_EMBEDDED KIconLoader icons; - + picons = &icons; +#else + picons = KGlobal::iconLoader(); +#endif filePopup = new KPopupMenu(this); @@ -187,9 +203,9 @@ void PwM::initMenubar() // "file" popup menu - filePopup->insertItem(QIconSet(icons.loadIcon("filenew", KIcon::Small)), + filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), i18n("&New"), this, SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); - filePopup->insertItem(QIconSet(icons.loadIcon("fileopen", KIcon::Small)), + filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)), i18n("&Open"), this, SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); - filePopup->insertItem(QIconSet(icons.loadIcon("fileclose", KIcon::Small)), + filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)), i18n("&Close"), this, @@ -197,6 +213,6 @@ void PwM::initMenubar() filePopup->insertSeparator(); - filePopup->insertItem(QIconSet(icons.loadIcon("filesave", KIcon::Small)), + filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)), i18n("&Save"), this, SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE); - filePopup->insertItem(QIconSet(icons.loadIcon("filesaveas", KIcon::Small)), + filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)), i18n("Save &as..."), @@ -214,3 +230,3 @@ void PwM::initMenubar() #endif - filePopup->insertItem(QIconSet(icons.loadIcon("fileexport", KIcon::Small)), + filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)), i18n("E&xport"), exportPopup, @@ -226,3 +242,3 @@ void PwM::initMenubar() #endif - filePopup->insertItem(QIconSet(icons.loadIcon("fileimport", KIcon::Small)), + filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)), i18n("I&mport"), importPopup, @@ -230,3 +246,3 @@ void PwM::initMenubar() filePopup->insertSeparator(); - filePopup->insertItem(QIconSet(icons.loadIcon("fileprint", KIcon::Small)), + filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)), i18n("&Print..."), this, @@ -234,3 +250,3 @@ void PwM::initMenubar() filePopup->insertSeparator(); - filePopup->insertItem(QIconSet(icons.loadIcon("exit", KIcon::Small)), + filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)), i18n("&Quit"), this, @@ -239,3 +255,3 @@ void PwM::initMenubar() // "manage" popup menu - managePopup->insertItem(QIconSet(icons.loadIcon("pencil", KIcon::Small)), + managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)), i18n("&Add password"), this, @@ -243,6 +259,6 @@ void PwM::initMenubar() BUTTON_POPUP_MANAGE_ADD); - managePopup->insertItem(QIconSet(icons.loadIcon("edit", KIcon::Small)), + managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)), i18n("&Edit"), this, SLOT(editPwd_slot()), 0, BUTTON_POPUP_MANAGE_EDIT); - managePopup->insertItem(QIconSet(icons.loadIcon("editdelete", KIcon::Small)), + managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), i18n("&Delete"), this, SLOT(deletePwd_slot()), @@ -250,3 +266,3 @@ void PwM::initMenubar() managePopup->insertSeparator(); - managePopup->insertItem(QIconSet(icons.loadIcon("rotate", KIcon::Small)), + managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)), i18n("Change &Master Password"), this, @@ -257,3 +273,3 @@ void PwM::initMenubar() #ifdef CONFIG_KEYCARD - chipcardPopup->insertItem(QIconSet(icons.loadIcon("filenew", KIcon::Small)), + chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), i18n("&Generate new key-card"), this, @@ -261,3 +277,3 @@ void PwM::initMenubar() BUTTON_POPUP_CHIPCARD_GENNEW); - chipcardPopup->insertItem(QIconSet(icons.loadIcon("editdelete", KIcon::Small)), + chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), i18n("&Erase key-card"), this, @@ -265,3 +281,3 @@ void PwM::initMenubar() BUTTON_POPUP_CHIPCARD_DEL); - chipcardPopup->insertItem(QIconSet(icons.loadIcon("", KIcon::Small)), + chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)), i18n("Read card-&ID"), this, @@ -270,3 +286,3 @@ void PwM::initMenubar() chipcardPopup->insertSeparator(); - chipcardPopup->insertItem(QIconSet(icons.loadIcon("2rightarrow", KIcon::Small)), + chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)), i18n("&Make card backup-image"), this, @@ -274,3 +290,3 @@ void PwM::initMenubar() BUTTON_POPUP_CHIPCARD_SAVEBACKUP); - chipcardPopup->insertItem(QIconSet(icons.loadIcon("2leftarrow", KIcon::Small)), + chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)), i18n("&Replay card backup-image"), this, @@ -281,3 +297,3 @@ void PwM::initMenubar() // "view" popup menu - viewPopup->insertItem(QIconSet(icons.loadIcon("find", KIcon::Small)), + viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)), i18n("&Find"), this, @@ -285,3 +301,3 @@ void PwM::initMenubar() viewPopup->insertSeparator(); - viewPopup->insertItem(QIconSet(icons.loadIcon("halfencrypted", KIcon::Small)), + viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)), i18n("&Lock all entries"), this, @@ -289,3 +305,3 @@ void PwM::initMenubar() BUTTON_POPUP_VIEW_LOCK); - viewPopup->insertItem(QIconSet(icons.loadIcon("encrypted", KIcon::Small)), + viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)), i18n("&Deep-lock all entries"), this, @@ -293,3 +309,3 @@ void PwM::initMenubar() BUTTON_POPUP_VIEW_DEEPLOCK); - viewPopup->insertItem(QIconSet(icons.loadIcon("decrypted", KIcon::Small)), + viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)), i18n("&Unlock all entries"), this, @@ -299,3 +315,3 @@ void PwM::initMenubar() // "options" popup menu - optionsPopup->insertItem(QIconSet(icons.loadIcon("configure", KIcon::Small)), + optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), i18n("&Configure..."), this, @@ -307,4 +323,21 @@ void PwM::initMenubar() helpPopup = helpMenu(QString::null, false); - menuBar()->insertItem(i18n("&Help"), helpPopup); +#else + helpPopup = new KPopupMenu(this); + + + helpPopup->insertItem(i18n("&License"), this, + SLOT(showLicense_slot()), 0, + BUTTON_POPUP_HELP_LICENSE); + + helpPopup->insertItem(i18n("&Faq"), this, + SLOT(faq_slot()), 0, + BUTTON_POPUP_HELP_FAQ); + + helpPopup->insertItem(i18n("&About PwManager"), this, + SLOT(createAboutData_slot()), 0, + BUTTON_POPUP_HELP_ABOUT); + #endif + menuBar()->insertItem(i18n("&Help"), helpPopup); + } @@ -313,8 +346,14 @@ void PwM::initToolbar() { + KIconLoader* picons; +#ifndef PWM_EMBEDDED KIconLoader icons; + picons = &icons; +#else + picons = KGlobal::iconLoader(); +#endif - toolBar()->insertButton(icons.loadIcon("filenew", KIcon::Toolbar), + toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar), BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this, SLOT(new_slot()), true, i18n("New")); - toolBar()->insertButton(icons.loadIcon("fileopen", KIcon::Toolbar), + toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar), BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this, @@ -322,9 +361,9 @@ void PwM::initToolbar() toolBar()->insertSeparator(); - toolBar()->insertButton(icons.loadIcon("filesave", KIcon::Toolbar), + toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar), BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this, SLOT(save_slot()), true, i18n("Save")); - toolBar()->insertButton(icons.loadIcon("filesaveas", KIcon::Toolbar), + toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar), BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this, SLOT(saveAs_slot()), true, i18n("Save as")); - toolBar()->insertButton(icons.loadIcon("fileprint", KIcon::Toolbar), + toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar), BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this, @@ -332,3 +371,3 @@ void PwM::initToolbar() toolBar()->insertSeparator(); - toolBar()->insertButton(icons.loadIcon("pencil", KIcon::Toolbar), + toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar), BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this, @@ -336,3 +375,3 @@ void PwM::initToolbar() i18n("Add password")); - toolBar()->insertButton(icons.loadIcon("edit", KIcon::Toolbar), + toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar), BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this, @@ -340,3 +379,3 @@ void PwM::initToolbar() i18n("Edit password")); - toolBar()->insertButton(icons.loadIcon("editdelete", KIcon::Toolbar), + toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar), BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this, @@ -345,3 +384,3 @@ void PwM::initToolbar() toolBar()->insertSeparator(); - toolBar()->insertButton(icons.loadIcon("find", KIcon::Toolbar), + toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar), BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this, @@ -349,3 +388,3 @@ void PwM::initToolbar() toolBar()->insertSeparator(); - toolBar()->insertButton(icons.loadIcon("halfencrypted", KIcon::Toolbar), + toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar), BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this, @@ -353,3 +392,3 @@ void PwM::initToolbar() i18n("Lock all entries")); - toolBar()->insertButton(icons.loadIcon("encrypted", KIcon::Toolbar), + toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar), BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this, @@ -357,3 +396,3 @@ void PwM::initToolbar() i18n("Deep-Lock all entries")); - toolBar()->insertButton(icons.loadIcon("decrypted", KIcon::Toolbar), + toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar), BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this, @@ -538,3 +577,4 @@ void PwM::addPwd_slot(QString *pw, PwMDoc *_doc) tryAgain: - if (w.exec() == 1) { + if (w.exec() == 1) + { PwMDataItem d; @@ -1189,2 +1229,53 @@ void PwM::focusInEvent(QFocusEvent *e) + +#ifdef PWM_EMBEDDED + +void PwM::showLicense_slot() +{ + KApplication::showLicence(); +} + +void PwM::faq_slot() +{ + KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" ); +} + +void PwM::createAboutData_slot() +{ + QString version; +#include <../version> + QMessageBox::about( this, "About PwManager/Pi", + "PwManager/Platform-independent\n" + "(PWM/Pi) " +version + " - " + +#ifdef DESKTOP_VERSION + "Desktop Edition\n" +#else + "PDA-Edition\n" + "for: Zaurus 5500 / 7x0 / 8x0\n" +#endif + + "(c) 2004 Ulf Schenk\n" + "(c) 2004 Lutz Rogowski\n" + "(c) 1997-2003, The KDE PIM Team\n" + + "Michael Buesch - main programming and current maintainer\nmbuesch@freenet.de\n" + "Matt Scifo - original implementaion of \n" + "\"categories\" and the password-tree \n" + "in the system-tray. Original implementations of \n" + "numerous view-improvements.\n" + "mscifo@o1.com\n" + "Elias Probst - Gentoo ebuild maintainer.\nelias.probst@gmx.de\n" + "George Staikos - KWallet\nstaikos@kde.org\n" + "Matthew Palmer - rc2 code\nmjp16@uow.edu.au\n" + "Olivier Sessink - gpasman\ngpasman@nl.linux.org\n" + "The libgcrypt developers - Blowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" + "Troy Engel - kpasman\n tengel@sonic.net\n" + "Wickey - graphics-design in older versions\nwickey@gmx.at\n" + "Ian MacGregor - original documentation author.\n" + ); +} + +#endif + + #ifndef PWM_EMBEDDED diff --git a/pwmanager/pwmanager/pwm.h b/pwmanager/pwmanager/pwm.h index 3a79e67..36a8b5b 100644 --- a/pwmanager/pwmanager/pwm.h +++ b/pwmanager/pwmanager/pwm.h @@ -168,2 +168,8 @@ public slots: +#ifdef PWM_EMBEDDED + void showLicense_slot(); + void faq_slot(); + void createAboutData_slot(); +#endif + protected: diff --git a/pwmanager/pwmanager/pwmdocui.cpp b/pwmanager/pwmanager/pwmdocui.cpp index 66a1b59..b308b40 100644 --- a/pwmanager/pwmanager/pwmdocui.cpp +++ b/pwmanager/pwmanager/pwmdocui.cpp @@ -37,2 +37,3 @@ #else +#include <qdir.h> #endif @@ -297,2 +298,3 @@ bool PwMDocUi::saveAsDocUi(PwMDoc *doc) } +#ifndef PWM_EMBEDDED QString fn(KFileDialog::getSaveFileName(QString::null, @@ -300,2 +302,9 @@ bool PwMDocUi::saveAsDocUi(PwMDoc *doc) currentView)); +#else + QString fn = locateLocal( "data", KGlobal::getAppName() + "/*.pwm" ); + fn = KFileDialog::getSaveFileName(fn, + i18n("password filename(*.pwm)"), + currentView); + +#endif if (fn == "") { @@ -326,2 +335,4 @@ bool PwMDocUi::openDocUi(PwMDoc *doc, if (filename.isEmpty()) + { +#ifndef PWM_EMBEDDED filename = KFileDialog::getOpenFileName(QString::null, @@ -329,2 +340,8 @@ bool PwMDocUi::openDocUi(PwMDoc *doc, "*|All files"), getCurrentView()); +#else + filename = locateLocal( "data", KGlobal::getAppName() + "/*.pwm"); + filename = KFileDialog::getOpenFileName(filename, + i18n("password filename(*.pwm)"), getCurrentView()); +#endif + } if (filename.isEmpty()) |