summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/pwmdocui.h
authorulf69 <ulf69>2004-09-15 17:53:22 (UTC)
committer ulf69 <ulf69>2004-09-15 17:53:22 (UTC)
commitd3925ba5bd25224bc4a60d3d6a107c464994a1ea (patch) (side-by-side diff)
tree60f69da1d2b79ee3081e7ef5c09a46470ca6eda0 /pwmanager/pwmanager/pwmdocui.h
parentce83a3479d23b9e8a59c745ccd0a0b14f64ef4e8 (diff)
downloadkdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.zip
kdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.tar.gz
kdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.tar.bz2
initial revision
Diffstat (limited to 'pwmanager/pwmanager/pwmdocui.h') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmdocui.h129
1 files changed, 129 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/pwmdocui.h b/pwmanager/pwmanager/pwmdocui.h
new file mode 100644
index 0000000..4ee0ad4
--- a/dev/null
+++ b/pwmanager/pwmanager/pwmdocui.h
@@ -0,0 +1,129 @@
+/***************************************************************************
+ * *
+ * copyright (C) 2003, 2004 by Michael Buesch *
+ * email: mbuesch@freenet.de *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License version 2 *
+ * as published by the Free Software Foundation. *
+ * *
+ ***************************************************************************/
+
+/***************************************************************************
+ * copyright (C) 2004 by Ulf Schenk
+ * This file is originaly based on version 1.0.1 of pwmanager
+ * and was modified to run on embedded devices that run microkde
+ *
+ * $Id$
+ **************************************************************************/
+
+#ifndef __PWMDOCUI_H
+#define __PWMDOCUI_H
+
+#include <qwidget.h>
+#include <klocale.h>
+
+/** string to display, if the pw-entry
+ * is locked, in place of the password.
+ */
+#define LOCKED_STRING PwMDocUi::string_locked()
+
+/** The name of the "default" category */
+#define DEFAULT_CATEGORY PwMDocUi::string_defaultCategory()
+
+/** deep-lock message to display in main-view, if it's locked */
+#define IS_DEEPLOCKED_SHORTMSG PwMDocUi::string_deepLockedShort()
+#define IS_DEEPLOCKED_MSG PwMDocUi::string_deepLockedLong()
+
+/** default title. Display if the doc has no title, yet */
+#define DEFAULT_TITLE PwMDocUi::string_defaultTitle()
+
+class PwMKeyCard;
+class PwMDoc;
+
+/** User-interface layer for PwMDoc.
+ * This class handles for example all Master-password related things (asking
+ * the user for the password od the chipcard) and some
+ * other UI-things, that PwMDoc is not allowed to
+ * handle. (PwMDoc is _NOT_ allowed to handle anything
+ * UI related.)
+ */
+class PwMDocUi : public QObject
+{
+ Q_OBJECT
+public:
+ PwMDocUi(QObject* parent = 0, const char *name = 0);
+ ~PwMDocUi();
+
+ /** when a new view is activated, call this to
+ * inform the Master-password-layer about this.
+ */
+ void setCurrentView(QWidget *view)
+ { currentView = view; }
+ /** return the currentView pointer */
+ QWidget* getCurrentView()
+ { return currentView; }
+ /** set pointer to the keycard-access object */
+ void setPwMKeyCard(PwMKeyCard *_keyCard)
+ { keyCard = _keyCard; }
+ /** saves the document (with user dialog) */
+ bool saveDocUi(PwMDoc *doc);
+ /** save as (with user dialog) */
+ bool saveAsDocUi(PwMDoc *doc);
+ /** opens a new document (with user dialog) */
+ bool openDocUi(PwMDoc *doc,
+ QString filename = QString::null,
+ bool openDeepLocked = false);
+
+ static QString string_defaultCategory();
+ static QString string_locked();
+ static QString string_deepLockedShort();
+ static QString string_deepLockedLong();
+ static QString string_defaultTitle();
+
+protected:
+ /** request the user to enter the master-password or
+ * to insert his chipcard.
+ * If forcePw is true, it will always ask for a pw
+ * and never for a chipcard.
+ */
+ QString requestMpw(bool chipcard);
+ /** request the user to enter a new master-password of
+ * to create a new chipcard.
+ * It "chipcard" is a NULL pointer, chipcards will not be
+ * allowed.
+ */
+ QString requestNewMpw(bool *chipcard);
+ /** request a master-pw change.(or chipcard change).
+ * This function asks the user and requests the pw
+ */
+ QString requestMpwChange(const QString *currentPw, bool *chipcard);
+ /** informs the user, that he entered the wrong mpw.
+ * It opens a message-box
+ */
+ void wrongMpwMsgBox(bool chipcard,
+ QString prefix = "",
+ QString postfix = "");
+ /** informs the user, that the mpw is needed, but he
+ * didn't enter one
+ */
+ void noMpwMsgBox(bool chipcard,
+ QString prefix = "",
+ QString postfix = "");
+ /** display "feature not availavle while UID 0" msg box */
+ void rootAlertMsgBox();
+ /** display "can't deeplock, because not saved yet" msg box */
+ void cantDeeplock_notSavedMsgBox();
+ /** gpasman-export password length error */
+ void gpmPwLenErrMsgBox();
+ /** ask for saving */
+ int dirtyAskSave(const QString &docTitle);
+
+private:
+ /** the currently active view */
+ QWidget *currentView;
+ /** pointer to the keycard-access object */
+ PwMKeyCard *keyCard;
+};
+
+#endif