summaryrefslogtreecommitdiffabout
path: root/pwmanager
Side-by-side diff
Diffstat (limited to 'pwmanager') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwm.cpp167
-rw-r--r--pwmanager/pwmanager/pwm.h6
-rw-r--r--pwmanager/pwmanager/pwmdocui.cpp17
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
@@ -30,6 +30,7 @@
#include <dcopclient.h>
#else
#include <qmenubar.h>
+#include <qmessagebox.h>
#endif
#include <qpixmap.h>
@@ -120,6 +121,16 @@ enum {
,BUTTON_POPUP_IMPORT_KWALLET
#endif
};
+
+#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
enum {
BUTTON_TOOL_NEW = 0,
@@ -172,8 +183,13 @@ PwM::~PwM()
void PwM::initMenubar()
{
+ KIconLoader* picons;
+#ifndef PWM_EMBEDDED
KIconLoader icons;
-
+ picons = &icons;
+#else
+ picons = KGlobal::iconLoader();
+#endif
filePopup = new KPopupMenu(this);
importPopup = new KPopupMenu(filePopup);
exportPopup = new KPopupMenu(filePopup);
@@ -185,20 +201,20 @@ void PwM::initMenubar()
optionsPopup = new KPopupMenu(this);
// "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,
SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE);
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..."),
this, SLOT(saveAs_slot()), 0,
BUTTON_POPUP_FILE_SAVEAS);
@@ -212,7 +228,7 @@ void PwM::initMenubar()
exportPopup->insertItem(i18n("&KWallet..."), this,
SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET);
#endif
- filePopup->insertItem(QIconSet(icons.loadIcon("fileexport", KIcon::Small)),
+ filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)),
i18n("E&xport"), exportPopup,
BUTTON_POPUP_FILE_EXPORT);
// "file/import" popup menu
@@ -224,80 +240,80 @@ void PwM::initMenubar()
importPopup->insertItem(i18n("&KWallet..."), this,
SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET);
#endif
- filePopup->insertItem(QIconSet(icons.loadIcon("fileimport", KIcon::Small)),
+ filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)),
i18n("I&mport"), importPopup,
BUTTON_POPUP_FILE_IMPORT);
filePopup->insertSeparator();
- filePopup->insertItem(QIconSet(icons.loadIcon("fileprint", KIcon::Small)),
+ filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)),
i18n("&Print..."), this,
SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT);
filePopup->insertSeparator();
- filePopup->insertItem(QIconSet(icons.loadIcon("exit", KIcon::Small)),
+ filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)),
i18n("&Quit"), this,
SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT);
menuBar()->insertItem(i18n("&File"), filePopup);
// "manage" popup menu
- managePopup->insertItem(QIconSet(icons.loadIcon("pencil", KIcon::Small)),
+ managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)),
i18n("&Add password"), this,
SLOT(addPwd_slot()), 0,
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()),
0, BUTTON_POPUP_MANAGE_DEL);
managePopup->insertSeparator();
- managePopup->insertItem(QIconSet(icons.loadIcon("rotate", KIcon::Small)),
+ managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)),
i18n("Change &Master Password"), this,
SLOT(changeMasterPwd_slot()), 0,
BUTTON_POPUP_MANAGE_CHANGEMP);
menuBar()->insertItem(i18n("&Manage"), managePopup);
// "chipcard" popup menu
#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,
SLOT(genNewCard_slot()), 0,
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,
SLOT(eraseCard_slot()), 0,
BUTTON_POPUP_CHIPCARD_DEL);
- chipcardPopup->insertItem(QIconSet(icons.loadIcon("", KIcon::Small)),
+ chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)),
i18n("Read card-&ID"), this,
SLOT(readCardId_slot()), 0,
BUTTON_POPUP_CHIPCARD_READID);
chipcardPopup->insertSeparator();
- chipcardPopup->insertItem(QIconSet(icons.loadIcon("2rightarrow", KIcon::Small)),
+ chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)),
i18n("&Make card backup-image"), this,
SLOT(makeCardBackup_slot()), 0,
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,
SLOT(replayCardBackup_slot()), 0,
BUTTON_POPUP_CHIPCARD_REPLAYBACKUP);
menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup);
#endif // CONFIG_KEYCARD
// "view" popup menu
- viewPopup->insertItem(QIconSet(icons.loadIcon("find", KIcon::Small)),
+ viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)),
i18n("&Find"), this,
SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND);
viewPopup->insertSeparator();
- viewPopup->insertItem(QIconSet(icons.loadIcon("halfencrypted", KIcon::Small)),
+ viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)),
i18n("&Lock all entries"), this,
SLOT(lockWnd_slot()), 0,
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,
SLOT(deepLockWnd_slot()), 0,
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,
SLOT(unlockWnd_slot()), 0,
BUTTON_POPUP_VIEW_UNLOCK);
menuBar()->insertItem(i18n("&View"), viewPopup);
// "options" popup menu
- optionsPopup->insertItem(QIconSet(icons.loadIcon("configure", KIcon::Small)),
+ optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
i18n("&Configure..."), this,
SLOT(config_slot()),
BUTTON_POPUP_OPTIONS_CONFIG);
@@ -305,57 +321,80 @@ void PwM::initMenubar()
// "help" popup menu
#ifndef PWM_EMBEDDED
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);
+
}
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,
SLOT(open_slot()), true, i18n("Open"));
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,
SLOT(print_slot()), true, i18n("Print..."));
toolBar()->insertSeparator();
- toolBar()->insertButton(icons.loadIcon("pencil", KIcon::Toolbar),
+ toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar),
BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this,
SLOT(addPwd_slot()), true,
i18n("Add password"));
- toolBar()->insertButton(icons.loadIcon("edit", KIcon::Toolbar),
+ toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar),
BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this,
SLOT(editPwd_slot()), true,
i18n("Edit password"));
- toolBar()->insertButton(icons.loadIcon("editdelete", KIcon::Toolbar),
+ toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar),
BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this,
SLOT(deletePwd_slot()), true,
i18n("Delete password"));
toolBar()->insertSeparator();
- toolBar()->insertButton(icons.loadIcon("find", KIcon::Toolbar),
+ toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar),
BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this,
SLOT(find_slot()), true, i18n("Find entry"));
toolBar()->insertSeparator();
- toolBar()->insertButton(icons.loadIcon("halfencrypted", KIcon::Toolbar),
+ toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar),
BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this,
SLOT(lockWnd_slot()), true,
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,
SLOT(deepLockWnd_slot()), true,
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,
SLOT(unlockWnd_slot()), true,
i18n("Unlock all entries"));
@@ -536,7 +575,8 @@ void PwM::addPwd_slot(QString *pw, PwMDoc *_doc)
w.pwLineEdit->setText(*pw);
tryAgain:
- if (w.exec() == 1) {
+ if (w.exec() == 1)
+ {
PwMDataItem d;
d.desc = w.getDescription().latin1();
d.name = w.getUsername().latin1();
@@ -1187,6 +1227,57 @@ 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
#include "pwm.moc"
#endif
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
@@ -166,6 +166,12 @@ public slots:
/** write backup image to current card */
void replayCardBackup_slot();
+#ifdef PWM_EMBEDDED
+ void showLicense_slot();
+ void faq_slot();
+ void createAboutData_slot();
+#endif
+
protected:
/** is this window virgin? */
bool isVirgin()
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
@@ -35,6 +35,7 @@
#ifndef PWM_EMBEDDED
#include <kwin.h>
#else
+#include <qdir.h>
#endif
@@ -295,9 +296,17 @@ bool PwMDocUi::saveAsDocUi(PwMDoc *doc)
doc->timer()->putLock(DocTimer::id_autoLockTimer);
return true;
}
+#ifndef PWM_EMBEDDED
QString fn(KFileDialog::getSaveFileName(QString::null,
i18n("*.pwm|PwManager Password file"),
currentView));
+#else
+ QString fn = locateLocal( "data", KGlobal::getAppName() + "/*.pwm" );
+ fn = KFileDialog::getSaveFileName(fn,
+ i18n("password filename(*.pwm)"),
+ currentView);
+
+#endif
if (fn == "") {
doc->timer()->putLock(DocTimer::id_autoLockTimer);
return false;
@@ -324,9 +333,17 @@ bool PwMDocUi::openDocUi(PwMDoc *doc,
bool openDeepLocked)
{
if (filename.isEmpty())
+ {
+#ifndef PWM_EMBEDDED
filename = KFileDialog::getOpenFileName(QString::null,
i18n("*.pwm|PwManager Password file\n"
"*|All files"), getCurrentView());
+#else
+ filename = locateLocal( "data", KGlobal::getAppName() + "/*.pwm");
+ filename = KFileDialog::getOpenFileName(filename,
+ i18n("password filename(*.pwm)"), getCurrentView());
+#endif
+ }
if (filename.isEmpty())
goto cancelOpen;
PwMerror ret;