summaryrefslogtreecommitdiffabout
path: root/pwmanager
authorulf69 <ulf69>2004-10-15 19:05:03 (UTC)
committer ulf69 <ulf69>2004-10-15 19:05:03 (UTC)
commit3f4c05c0f72b269b70a508ac42d74fea3bfb20cc (patch) (unidiff)
treea3c3a14048afbba18c69a799870506af9d385e17 /pwmanager
parentb7fbbfff6b939278cb7665d78b2615c77856ce7d (diff)
downloadkdepimpi-3f4c05c0f72b269b70a508ac42d74fea3bfb20cc.zip
kdepimpi-3f4c05c0f72b269b70a508ac42d74fea3bfb20cc.tar.gz
kdepimpi-3f4c05c0f72b269b70a508ac42d74fea3bfb20cc.tar.bz2
added settings for crypto and hashalgorythm
Diffstat (limited to 'pwmanager') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmprefs.cpp20
-rw-r--r--pwmanager/pwmanager/pwmprefs.h46
2 files changed, 49 insertions, 17 deletions
diff --git a/pwmanager/pwmanager/pwmprefs.cpp b/pwmanager/pwmanager/pwmprefs.cpp
index 7fd347f..fdc34e0 100644
--- a/pwmanager/pwmanager/pwmprefs.cpp
+++ b/pwmanager/pwmanager/pwmprefs.cpp
@@ -24,48 +24,50 @@
24*/ 24*/
25 25
26 26
27#include <kconfig.h> 27#include <kconfig.h>
28#include <klocale.h> 28#include <klocale.h>
29#include <kstaticdeleter.h> 29#include <kstaticdeleter.h>
30 30
31#include "pwmprefs.h" 31#include "pwmprefs.h"
32 32
33PWMPrefs *PWMPrefs::sInstance = 0; 33PWMPrefs *PWMPrefs::sInstance = 0;
34static KStaticDeleter<PWMPrefs> staticDeleter; 34static KStaticDeleter<PWMPrefs> staticDeleter;
35 35
36PWMPrefs::PWMPrefs() 36PWMPrefs::PWMPrefs()
37 : KPimPrefs("pwmanagerrc") 37 : KPimPrefs("pwmanagerrc")
38{ 38{
39 KPrefs::setCurrentGroup( "Global" ); 39 KPrefs::setCurrentGroup( "Global" );
40 40
41 addItemString( "autoStart", &mAutoStart, "" ); 41 addItemString( "autoStart", &mAutoStart, "" );
42 addItemString( "browserCommand", &mBrowserCommand, "" ); 42 addItemString( "browserCommand", &mBrowserCommand, "" );
43 addItemString( "xtermCommand", &mXTermCommand, CONF_DEFAULT_XTERMCOMMAND); 43 addItemString( "xtermCommand", &mXTermCommand, CONF_DEFAULT_XTERMCOMMAND);
44 addItemFont( "entryFont", &mEntryFont); 44 addItemFont( "entryFont", &mEntryFont);
45 addItemInt( "pwTimeout", &mPwTimeout, CONF_DEFAULT_PWTIMEOUT ); 45 addItemInt( "pwTimeout", &mPwTimeout, CONF_DEFAULT_PWTIMEOUT );
46 addItemInt( "lockTimeout", &mLockTimeout, CONF_DEFAULT_LOCKTIMEOUT ); 46 addItemInt( "lockTimeout", &mLockTimeout, CONF_DEFAULT_LOCKTIMEOUT );
47 addItemInt( "compression", &mCompression, CONF_DEFAULT_COMPRESSION ); 47 addItemInt( "compression", &mCompression, CONF_DEFAULT_COMPRESSION );
48 addItemInt("cryptAlgo", &mCryptAlgo, CONF_DEFAULT_CRYPTALGO);
49 addItemInt("hashAlgo", &mHashAlgo, CONF_DEFAULT_HASHALGO);
48 addItemInt( "filePermissions", &mFilePermissions, CONF_DEFAULT_FILEPERMISSIONS ); 50 addItemInt( "filePermissions", &mFilePermissions, CONF_DEFAULT_FILEPERMISSIONS );
49 addItemInt( "minimizeLock", &mMinimizeLock, CONF_DEFAULT_MINIMIZELOCK ); 51 addItemInt( "minimizeLock", &mMinimizeLock, CONF_DEFAULT_MINIMIZELOCK );
50 addItemBool( "unlockOnOpen", &mUnlockOnOpen, CONF_DEFAULT_UNLOCKONOPEN ); 52 addItemBool( "unlockOnOpen", &mUnlockOnOpen, CONF_DEFAULT_UNLOCKONOPEN );
51 addItemBool( "tray", &mTray, CONF_DEFAULT_TRAY ); 53 addItemBool( "tray", &mTray, CONF_DEFAULT_TRAY );
52 addItemBool( "makeFileBackup", &mMakeFileBackup, CONF_DEFAULT_MAKEFILEBACKUP ); 54 addItemBool( "makeFileBackup", &mMakeFileBackup, CONF_DEFAULT_MAKEFILEBACKUP );
53 addItemBool( "autostartDeepLocked", &mAutostartDeeplocked, CONF_DEFAULT_AUTOSTART_DEEPL ); 55 addItemBool( "autostartDeepLocked", &mAutostartDeeplocked, CONF_DEFAULT_AUTOSTART_DEEPL );
54 addItemBool( "autoDeepLock", &mAutoDeeplock, CONF_DEFAULT_AUTODEEPLOCK ); 56 addItemBool( "autoDeepLock", &mAutoDeeplock, CONF_DEFAULT_AUTODEEPLOCK );
55 addItemBool( "kwalletEmu", &mKWalletEmu, CONF_DEFAULT_KWALLETEMU ); 57 addItemBool( "kwalletEmu", &mKWalletEmu, CONF_DEFAULT_KWALLETEMU );
56 addItemBool( "newEntrLockStat", &mNewEntrLockStat, CONF_DEFAULT_NEWENTRLOCKSTAT ); 58 addItemBool( "newEntrLockStat", &mNewEntrLockStat, CONF_DEFAULT_NEWENTRLOCKSTAT );
57 59
58 KPrefs::setCurrentGroup( "Wnd" ); 60 KPrefs::setCurrentGroup( "Wnd" );
59 61
60 addItemSize( "MainWndSize", &mMainWndSize); 62 addItemSize( "MainWndSize", &mMainWndSize);
61 addItemInt( "MainViewStyle", &mMainViewStyle, CONF_DEFAULT_MAINVIEWSTYLE ); 63 addItemInt( "MainViewStyle", &mMainViewStyle, CONF_DEFAULT_MAINVIEWSTYLE );
62 addItemBool( "autoMinimizeOnStart", &mAutoMinimizeOnStart, CONF_DEFAULT_AUTOMINIMIZE ); 64 addItemBool( "autoMinimizeOnStart", &mAutoMinimizeOnStart, CONF_DEFAULT_AUTOMINIMIZE );
63 addItemBool( "close", &mClose, CONF_DEFAULT_WNDCLOSE ); 65 addItemBool( "close", &mClose, CONF_DEFAULT_WNDCLOSE );
64 addItemIntList( "commentSplitter", &mCommentSplitter ); 66 addItemIntList( "commentSplitter", &mCommentSplitter );
65 addItemIntList( "categorySplitter", &mCategorySplitter ); 67 addItemIntList( "categorySplitter", &mCategorySplitter );
66} 68}
67 69
68PWMPrefs::~PWMPrefs() 70PWMPrefs::~PWMPrefs()
69{ 71{
70} 72}
71 73
@@ -173,48 +175,58 @@ bool PWMPrefs::confGlobNewEntrLockStat()
173{ 175{
174 return mNewEntrLockStat; 176 return mNewEntrLockStat;
175} 177}
176 178
177QSize PWMPrefs::confWndMainWndSize() 179QSize PWMPrefs::confWndMainWndSize()
178{ 180{
179 return mMainWndSize; 181 return mMainWndSize;
180} 182}
181 183
182int PWMPrefs::confWndMainViewStyle() 184int PWMPrefs::confWndMainViewStyle()
183{ 185{
184 return mMainViewStyle; 186 return mMainViewStyle;
185} 187}
186 188
187bool PWMPrefs::confWndAutoMinimizeOnStart() 189bool PWMPrefs::confWndAutoMinimizeOnStart()
188{ 190{
189 return mAutoMinimizeOnStart; 191 return mAutoMinimizeOnStart;
190} 192}
191 193
192bool PWMPrefs::confWndClose() 194bool PWMPrefs::confWndClose()
193{ 195{
194 return mClose; 196 return mClose;
195} 197}
196 198
199int PWMPrefs::confGlobCryptAlgo()
200{
201 return mCryptAlgo + 1;
202}
203
204int PWMPrefs::confGlobHashAlgo()
205{
206 return mHashAlgo + 1;
207}
208
197/******************************************************************* 209/*******************************************************************
198 * functions for writing the configuration settings 210 * functions for writing the configuration settings
199 *******************************************************************/ 211 *******************************************************************/
200 212
201void PWMPrefs::confGlobAutoStart(const QString &e) 213void PWMPrefs::confGlobAutoStart(const QString &e)
202{ 214{
203 mAutoStart = e; 215 mAutoStart = e;
204} 216}
205 217
206void PWMPrefs::confGlobBrowserCommand(const QString &e) 218void PWMPrefs::confGlobBrowserCommand(const QString &e)
207{ 219{
208 mBrowserCommand = e; 220 mBrowserCommand = e;
209} 221}
210 222
211void PWMPrefs::confGlobXtermCommand(const QString &e) 223void PWMPrefs::confGlobXtermCommand(const QString &e)
212{ 224{
213 mXTermCommand = e; 225 mXTermCommand = e;
214} 226}
215 227
216void PWMPrefs::confGlobEntryFont(const QFont &e) 228void PWMPrefs::confGlobEntryFont(const QFont &e)
217{ 229{
218 mEntryFont = e; 230 mEntryFont = e;
219} 231}
220 232
@@ -277,25 +289,33 @@ void PWMPrefs::confGlobNewEntrLockStat(bool e)
277{ 289{
278 mNewEntrLockStat = e; 290 mNewEntrLockStat = e;
279} 291}
280 292
281void PWMPrefs::confWndMainWndSize(const QSize &e) 293void PWMPrefs::confWndMainWndSize(const QSize &e)
282{ 294{
283 mMainWndSize = e; 295 mMainWndSize = e;
284} 296}
285 297
286void PWMPrefs::confWndMainViewStyle(int e) 298void PWMPrefs::confWndMainViewStyle(int e)
287{ 299{
288 mMainViewStyle = e; 300 mMainViewStyle = e;
289} 301}
290 302
291void PWMPrefs::confWndAutoMinimizeOnStart(bool e) 303void PWMPrefs::confWndAutoMinimizeOnStart(bool e)
292{ 304{
293 mAutoMinimizeOnStart = e; 305 mAutoMinimizeOnStart = e;
294} 306}
295 307
296void PWMPrefs::confWndClose(bool e) 308void PWMPrefs::confWndClose(bool e)
297{ 309{
298 mClose = e; 310 mClose = e;
299} 311}
300 312
313void PWMPrefs::confGlobCryptAlgo(int e)
314{
315 mCryptAlgo = e - 1;
316}
301 317
318void PWMPrefs::confGlobHashAlgo(int e)
319{
320 mHashAlgo = e - 1;
321}
diff --git a/pwmanager/pwmanager/pwmprefs.h b/pwmanager/pwmanager/pwmprefs.h
index 9fed7d2..1c8b982 100644
--- a/pwmanager/pwmanager/pwmprefs.h
+++ b/pwmanager/pwmanager/pwmprefs.h
@@ -15,132 +15,144 @@
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22 22
23 $Id$ 23 $Id$
24*/ 24*/
25 25
26#ifndef PWMPREFS_H 26#ifndef PWMPREFS_H
27#define PWMPREFS_H 27#define PWMPREFS_H
28 28
29#include <qstringlist.h> 29#include <qstringlist.h>
30#include <qsize.h> 30#include <qsize.h>
31 31
32#include <kpimprefs.h> 32#include <kpimprefs.h>
33 33
34class KConfig; 34class KConfig;
35 35
36#define conf() PWMPrefs::instance() 36#define conf() PWMPrefs::instance()
37 37
38 38
39 #define CONF_DEFAULT_PWTIMEOUT 10/* 10 sec */ 39
40 #define CONF_DEFAULT_LOCKTIMEOUT 0/* 0 == disable */ 40
41 #define CONF_DEFAULT_TRAY true 41#define CONF_DEFAULT_PWTIMEOUT 10/* 10 sec */
42 #define CONF_DEFAULT_UNLOCKONOPENfalse 42#define CONF_DEFAULT_LOCKTIMEOUT 0/* 0 == disable */
43 #define CONF_DEFAULT_MAINVIEWSTYLE0 43#define CONF_DEFAULT_TRAY true
44 #define CONF_DEFAULT_COMPRESSION 0x01/* gzip */ 44#define CONF_DEFAULT_UNLOCKONOPEN true
45 #define CONF_DEFAULT_AUTOMINIMIZEfalse 45#define CONF_DEFAULT_MAINVIEWSTYLE 1/* Category List Left */
46 #define CONF_DEFAULT_BROWSERCOMMAND"" 46#define CONF_DEFAULT_COMPRESSION 0x01/* gzip */
47 #define CONF_DEFAULT_XTERMCOMMAND"konsole -e" 47#define CONF_DEFAULT_CRYPTALGO (0x01 - 1)/* blowfish */
48 #define CONF_DEFAULT_FILEPERMISSIONS0600 48#define CONF_DEFAULT_HASHALGO (0x01 - 1)/* sha1 */
49 #define CONF_DEFAULT_MAKEFILEBACKUPfalse 49#define CONF_DEFAULT_AUTOMINIMIZE false
50 #define CONF_DEFAULT_AUTOSTART_DEEPLtrue 50#define CONF_DEFAULT_BROWSERCOMMAND ""
51 #define CONF_DEFAULT_AUTODEEPLOCKtrue 51#define CONF_DEFAULT_XTERMCOMMAND "konsole -e"
52 #define CONF_DEFAULT_KWALLETEMU true 52#define CONF_DEFAULT_FILEPERMISSIONS 0600
53 #define CONF_DEFAULT_MINIMIZELOCK 2/* deep-lock */ 53#define CONF_DEFAULT_MAKEFILEBACKUP false
54 #define CONF_DEFAULT_NEWENTRLOCKSTAT true/* locked */ 54#define CONF_DEFAULT_AUTOSTART_DEEPL true
55 #define CONF_DEFAULT_WNDCLOSE true/* don't minimize to tray */ 55#define CONF_DEFAULT_AUTODEEPLOCK true
56#define CONF_DEFAULT_KWALLETEMU true
57#define CONF_DEFAULT_MINIMIZELOCK 2/* deep-lock */
58#define CONF_DEFAULT_NEWENTRLOCKSTAT false/* new entries unlocked */
59#define CONF_DEFAULT_WNDCLOSE true/* don't minimize to tray */
60
56 61
57class PWMPrefs : public KPimPrefs 62class PWMPrefs : public KPimPrefs
58{ 63{
59 public: 64 public:
60 virtual ~PWMPrefs(); 65 virtual ~PWMPrefs();
61 66
62 static PWMPrefs *instance(); 67 static PWMPrefs *instance();
63 68
64public: 69public:
65 /* functions for reading the configuration settings */ 70 /* functions for reading the configuration settings */
66 /* GLOBAL */ 71 /* GLOBAL */
67 QString confGlobAutoStart(); 72 QString confGlobAutoStart();
68 QString confGlobBrowserCommand(); 73 QString confGlobBrowserCommand();
69 QString confGlobXtermCommand(); 74 QString confGlobXtermCommand();
70 QFont confGlobEntryFont(); 75 QFont confGlobEntryFont();
71 int confGlobPwTimeout(); 76 int confGlobPwTimeout();
72 int confGlobLockTimeout(); 77 int confGlobLockTimeout();
73 int confGlobCompression(); 78 int confGlobCompression();
79 int confGlobCryptAlgo();
80 int confGlobHashAlgo();
74 int confGlobFilePermissions(); 81 int confGlobFilePermissions();
75 int confGlobMinimizeLock(); 82 int confGlobMinimizeLock();
76 bool confGlobUnlockOnOpen(); 83 bool confGlobUnlockOnOpen();
77 bool confGlobTray(); 84 bool confGlobTray();
78 bool confGlobMakeFileBackup(); 85 bool confGlobMakeFileBackup();
79 bool confGlobAutostartDeepLocked(); 86 bool confGlobAutostartDeepLocked();
80 bool confGlobAutoDeepLock(); 87 bool confGlobAutoDeepLock();
81 bool confGlobKwalletEmu(); 88 bool confGlobKwalletEmu();
82 bool confGlobNewEntrLockStat(); 89 bool confGlobNewEntrLockStat();
83 /* WND */ 90 /* WND */
84 QSize confWndMainWndSize(); 91 QSize confWndMainWndSize();
85 int confWndMainViewStyle(); 92 int confWndMainViewStyle();
86 bool confWndAutoMinimizeOnStart(); 93 bool confWndAutoMinimizeOnStart();
87 bool confWndClose(); 94 bool confWndClose();
88 95
89public: 96public:
90 /* functions for writing the configuration settings */ 97 /* functions for writing the configuration settings */
91 /* GLOBAL */ 98 /* GLOBAL */
92 void confGlobAutoStart(const QString &e); 99 void confGlobAutoStart(const QString &e);
93 void confGlobBrowserCommand(const QString &e); 100 void confGlobBrowserCommand(const QString &e);
94 void confGlobXtermCommand(const QString &e); 101 void confGlobXtermCommand(const QString &e);
95 void confGlobEntryFont(const QFont &e); 102 void confGlobEntryFont(const QFont &e);
96 void confGlobPwTimeout(int e); 103 void confGlobPwTimeout(int e);
97 void confGlobLockTimeout(int e); 104 void confGlobLockTimeout(int e);
98 void confGlobCompression(int e); 105 void confGlobCompression(int e);
106 void confGlobCryptAlgo(int e);
107 void confGlobHashAlgo(int e);
108
99 void confGlobFilePermissions(int e); 109 void confGlobFilePermissions(int e);
100 void confGlobMinimizeLock(int e); 110 void confGlobMinimizeLock(int e);
101 void confGlobUnlockOnOpen(bool e); 111 void confGlobUnlockOnOpen(bool e);
102 void confGlobTray(bool e); 112 void confGlobTray(bool e);
103 void confGlobMakeFileBackup(bool e); 113 void confGlobMakeFileBackup(bool e);
104 void confGlobAutostartDeepLocked(bool e); 114 void confGlobAutostartDeepLocked(bool e);
105 void confGlobAutoDeepLock(bool e); 115 void confGlobAutoDeepLock(bool e);
106 void confGlobKwalletEmu(bool e); 116 void confGlobKwalletEmu(bool e);
107 void confGlobNewEntrLockStat(bool e); 117 void confGlobNewEntrLockStat(bool e);
108 /* WND */ 118 /* WND */
109 void confWndMainWndSize(const QSize &e); 119 void confWndMainWndSize(const QSize &e);
110 void confWndMainViewStyle(int e); 120 void confWndMainViewStyle(int e);
111 void confWndAutoMinimizeOnStart(bool e); 121 void confWndAutoMinimizeOnStart(bool e);
112 void confWndClose(bool e); 122 void confWndClose(bool e);
113 123
114 124
115 125
116 QString mAutoStart; 126 QString mAutoStart;
117 QString mBrowserCommand; 127 QString mBrowserCommand;
118 QString mXTermCommand; 128 QString mXTermCommand;
119 QFont mEntryFont; 129 QFont mEntryFont;
120 int mPwTimeout; 130 int mPwTimeout;
121 int mLockTimeout; 131 int mLockTimeout;
122 int mCompression; 132 int mCompression;
133 int mCryptAlgo;
134 int mHashAlgo;
123 int mFilePermissions; 135 int mFilePermissions;
124 int mMinimizeLock; 136 int mMinimizeLock;
125 bool mUnlockOnOpen; 137 bool mUnlockOnOpen;
126 bool mTray; 138 bool mTray;
127 bool mMakeFileBackup; 139 bool mMakeFileBackup;
128 bool mAutostartDeeplocked; 140 bool mAutostartDeeplocked;
129 bool mAutoDeeplock; 141 bool mAutoDeeplock;
130 bool mKWalletEmu; 142 bool mKWalletEmu;
131 bool mNewEntrLockStat; 143 bool mNewEntrLockStat;
132 QSize mMainWndSize; 144 QSize mMainWndSize;
133 int mMainViewStyle; 145 int mMainViewStyle;
134 bool mAutoMinimizeOnStart; 146 bool mAutoMinimizeOnStart;
135 bool mClose; 147 bool mClose;
136 148
137 //US ENH 149 //US ENH
138 QValueList<int> mCommentSplitter; 150 QValueList<int> mCommentSplitter;
139 QValueList<int> mCategorySplitter; 151 QValueList<int> mCategorySplitter;
140 152
141 153
142 // US introduce a nonconst way to return the config object. 154 // US introduce a nonconst way to return the config object.
143 KConfig* getConfig(); 155 KConfig* getConfig();
144 156
145 private: 157 private:
146 PWMPrefs(); 158 PWMPrefs();