summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/pwmdocui.h
Unidiff
Diffstat (limited to 'pwmanager/pwmanager/pwmdocui.h') (more/less context) (show 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 @@
1/***************************************************************************
2 * *
3 * copyright (C) 2003, 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de *
5 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License version 2 *
8 * as published by the Free Software Foundation. *
9 * *
10 ***************************************************************************/
11
12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde
16 *
17 * $Id$
18 **************************************************************************/
19
20#ifndef __PWMDOCUI_H
21#define __PWMDOCUI_H
22
23#include <qwidget.h>
24#include <klocale.h>
25
26/** string to display, if the pw-entry
27 * is locked, in place of the password.
28 */
29 #define LOCKED_STRING PwMDocUi::string_locked()
30
31/** The name of the "default" category */
32 #define DEFAULT_CATEGORYPwMDocUi::string_defaultCategory()
33
34/** deep-lock message to display in main-view, if it's locked */
35 #define IS_DEEPLOCKED_SHORTMSGPwMDocUi::string_deepLockedShort()
36 #define IS_DEEPLOCKED_MSGPwMDocUi::string_deepLockedLong()
37
38/** default title. Display if the doc has no title, yet */
39 #define DEFAULT_TITLE PwMDocUi::string_defaultTitle()
40
41class PwMKeyCard;
42class PwMDoc;
43
44/** User-interface layer for PwMDoc.
45 * This class handles for example all Master-password related things (asking
46 * the user for the password od the chipcard) and some
47 * other UI-things, that PwMDoc is not allowed to
48 * handle. (PwMDoc is _NOT_ allowed to handle anything
49 * UI related.)
50 */
51class PwMDocUi : public QObject
52{
53 Q_OBJECT
54public:
55 PwMDocUi(QObject* parent = 0, const char *name = 0);
56 ~PwMDocUi();
57
58 /** when a new view is activated, call this to
59 * inform the Master-password-layer about this.
60 */
61 void setCurrentView(QWidget *view)
62 { currentView = view; }
63 /** return the currentView pointer */
64 QWidget* getCurrentView()
65 { return currentView; }
66 /** set pointer to the keycard-access object */
67 void setPwMKeyCard(PwMKeyCard *_keyCard)
68 { keyCard = _keyCard; }
69 /** saves the document (with user dialog) */
70 bool saveDocUi(PwMDoc *doc);
71 /** save as (with user dialog) */
72 bool saveAsDocUi(PwMDoc *doc);
73 /** opens a new document (with user dialog) */
74 bool openDocUi(PwMDoc *doc,
75 QString filename = QString::null,
76 bool openDeepLocked = false);
77
78 static QString string_defaultCategory();
79 static QString string_locked();
80 static QString string_deepLockedShort();
81 static QString string_deepLockedLong();
82 static QString string_defaultTitle();
83
84protected:
85 /** request the user to enter the master-password or
86 * to insert his chipcard.
87 * If forcePw is true, it will always ask for a pw
88 * and never for a chipcard.
89 */
90 QString requestMpw(bool chipcard);
91 /** request the user to enter a new master-password of
92 * to create a new chipcard.
93 * It "chipcard" is a NULL pointer, chipcards will not be
94 * allowed.
95 */
96 QString requestNewMpw(bool *chipcard);
97 /** request a master-pw change.(or chipcard change).
98 * This function asks the user and requests the pw
99 */
100 QString requestMpwChange(const QString *currentPw, bool *chipcard);
101 /** informs the user, that he entered the wrong mpw.
102 * It opens a message-box
103 */
104 void wrongMpwMsgBox(bool chipcard,
105 QString prefix = "",
106 QString postfix = "");
107 /** informs the user, that the mpw is needed, but he
108 * didn't enter one
109 */
110 void noMpwMsgBox(bool chipcard,
111 QString prefix = "",
112 QString postfix = "");
113 /** display "feature not availavle while UID 0" msg box */
114 void rootAlertMsgBox();
115 /** display "can't deeplock, because not saved yet" msg box */
116 void cantDeeplock_notSavedMsgBox();
117 /** gpasman-export password length error */
118 void gpmPwLenErrMsgBox();
119 /** ask for saving */
120 int dirtyAskSave(const QString &docTitle);
121
122private:
123 /** the currently active view */
124 QWidget *currentView;
125 /** pointer to the keycard-access object */
126 PwMKeyCard *keyCard;
127};
128
129#endif