summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/pwmprefs.h
blob: 42f7c2e65de1c81c285435f84042f027ba29e5dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
    This file is part of PwManager/Pi
    Copyright (c) 2004 Ulf Schenk

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

    As a special exception, permission is given to link this program
    with any edition of Qt, and distribute the resulting executable,
    without including the source code for Qt in the source distribution.

    $Id$
*/

#ifndef PWMPREFS_H
#define PWMPREFS_H

#include <qstringlist.h>
#include <qsize.h>
//Added by qt3to4:
#include <Q3ValueList>

#include <kpimprefs.h>

class KConfig;

#define conf() PWMPrefs::instance()




#define CONF_DEFAULT_PWTIMEOUT         10/* 10 sec */
#define CONF_DEFAULT_LOCKTIMEOUT       0/* 0 == disable */
#define CONF_DEFAULT_TRAY              false
#define CONF_DEFAULT_UNLOCKONOPEN      true
#define CONF_DEFAULT_MAINVIEWSTYLE     1/* Category List Left */
#define CONF_DEFAULT_COMPRESSION       0x01/* gzip */
#define CONF_DEFAULT_CRYPTALGO         (0x01 - 1)/* blowfish */
#define CONF_DEFAULT_HASHALGO          (0x01 - 1)/* sha1 */
#define CONF_DEFAULT_AUTOMINIMIZE      false
#define CONF_DEFAULT_BROWSERCOMMAND    ""
#define CONF_DEFAULT_XTERMCOMMAND      "konsole -e"
#define CONF_DEFAULT_FILEPERMISSIONS   0600
#define CONF_DEFAULT_MAKEFILEBACKUP    false
#define CONF_DEFAULT_AUTOSTART_DEEPL   true
#define CONF_DEFAULT_AUTODEEPLOCK      true
#define CONF_DEFAULT_KWALLETEMU        false
#define CONF_DEFAULT_MINIMIZELOCK      2/* deep-lock */
#define CONF_DEFAULT_NEWENTRLOCKSTAT   false/* new entries unlocked */
#define CONF_DEFAULT_WNDCLOSE          true/* don't minimize to tray */


class PWMPrefs : public KPimPrefs
{
  public:
    virtual ~PWMPrefs();

    static PWMPrefs *instance();

public:
	/* functions for reading the configuration settings */
	/* GLOBAL */
	QString confGlobAutoStart();
	QString confGlobBrowserCommand();
	QString confGlobXtermCommand();
	QFont confGlobEntryFont();
	QFont confGlobViewFont();
	int confGlobPwTimeout();
	int confGlobLockTimeout();
	int confGlobCompression();
	int confGlobCryptAlgo();
	int confGlobHashAlgo();
	int confGlobFilePermissions();
	int confGlobMinimizeLock();
	bool confGlobUnlockOnOpen();
	bool confGlobTray();
	bool confGlobMakeFileBackup();
	bool confGlobAutostartDeepLocked();
	bool confGlobAutoDeepLock();
	bool confGlobKwalletEmu();
	bool confGlobNewEntrLockStat();
	/* WND */
	QSize confWndMainWndSize();
	int confWndMainViewStyle();
	bool confWndAutoMinimizeOnStart();
	bool confWndClose();

public:
	/* functions for writing the configuration settings */
	/* GLOBAL */
	void confGlobAutoStart(const QString &e);
	void confGlobBrowserCommand(const QString &e);
	void confGlobXtermCommand(const QString &e);
	void confGlobEntryFont(const QFont &e);
	void confGlobViewFont(const QFont &e);
	void confGlobPwTimeout(int e);
	void confGlobLockTimeout(int e);
	void confGlobCompression(int e);
	void confGlobCryptAlgo(int e);
	void confGlobHashAlgo(int e);

	void confGlobFilePermissions(int e);
	void confGlobMinimizeLock(int e);
	void confGlobUnlockOnOpen(bool e);
	void confGlobTray(bool e);
	void confGlobMakeFileBackup(bool e);
	void confGlobAutostartDeepLocked(bool e);
	void confGlobAutoDeepLock(bool e);
	void confGlobKwalletEmu(bool e);
	void confGlobNewEntrLockStat(bool e);
	/* WND */
	void confWndMainWndSize(const QSize &e);
	void confWndMainViewStyle(int e);
	void confWndAutoMinimizeOnStart(bool e);
	void confWndClose(bool e);



  QString mAutoStart;
  QString mBrowserCommand;
  QString mXTermCommand;
  QFont mEntryFont;
  QFont mViewFont;
  int mPwTimeout;
  int mLockTimeout;
  int mCompression;
  int mCryptAlgo;
  int mHashAlgo;
  int mFilePermissions;
  int mMinimizeLock;
  bool mUnlockOnOpen;
  bool mTray;
  bool mMakeFileBackup;
  bool mAutostartDeeplocked;
  bool mAutoDeeplock;
  bool mKWalletEmu;
  bool mNewEntrLockStat;
  QSize mMainWndSize;
  int mMainViewStyle;
  bool mAutoMinimizeOnStart;
  bool mClose;

  //US ENH
  Q3ValueList<int> mCommentSplitter;
  Q3ValueList<int> mCategorySplitter;


    // US introduce a nonconst way to return the config object.
    KConfig* getConfig();

  private:
    PWMPrefs();

    static PWMPrefs *sInstance;
};

#endif