Diffstat (limited to 'pwmanager/pwmanager/configuration_31compat.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | pwmanager/pwmanager/configuration_31compat.cpp | 365 |
1 files changed, 0 insertions, 365 deletions
diff --git a/pwmanager/pwmanager/configuration_31compat.cpp b/pwmanager/pwmanager/configuration_31compat.cpp deleted file mode 100644 index ffd522c..0000000 --- a/pwmanager/pwmanager/configuration_31compat.cpp +++ b/dev/null | |||
@@ -1,365 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * copyright (C) 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 | #include "configuration_31compat.h" | ||
21 | #include "configwndimpl.h" | ||
22 | #include "pwmexception.h" | ||
23 | |||
24 | #include <kconfig.h> | ||
25 | #include <kapplication.h> | ||
26 | |||
27 | #include <qfileinfo.h> | ||
28 | #include <qcheckbox.h> | ||
29 | #include <qcombobox.h> | ||
30 | #include <qspinbox.h> | ||
31 | #include <qlineedit.h> | ||
32 | #include <qlabel.h> | ||
33 | |||
34 | #ifdef PWM_EMBEDDED | ||
35 | #include <qfont.h> | ||
36 | #include <kglobal.h> | ||
37 | #endif | ||
38 | |||
39 | Configuration_31compat * Configuration_31compat::_obj (0); | ||
40 | |||
41 | Configuration_31compat::Configuration_31compat() | ||
42 | { | ||
43 | #ifndef PWM_EMBEDDED | ||
44 | conf = KApplication::kApplication()->config(); | ||
45 | #else | ||
46 | conf = KGlobal::config(); | ||
47 | #endif | ||
48 | } | ||
49 | |||
50 | Configuration_31compat::~Configuration_31compat() | ||
51 | { | ||
52 | } | ||
53 | |||
54 | bool Configuration_31compat::showConfWnd(QWidget * /*parent*/) | ||
55 | { | ||
56 | ConfigWndImpl cfgWnd; | ||
57 | cfgWnd.pwTimeoutSpinBox->setValue(confGlobPwTimeout()); | ||
58 | cfgWnd.lockTimeoutSpinBox->setValue(confGlobLockTimeout()); | ||
59 | cfgWnd.trayCheckBox->setChecked(confGlobTray()); | ||
60 | cfgWnd.autoStartLineEdit->setText(confGlobAutoStart()); | ||
61 | cfgWnd.openUnlockedCheckBox->setChecked(confGlobUnlockOnOpen()); | ||
62 | cfgWnd.currentEntryFont = confGlobEntryFont(); | ||
63 | cfgWnd.currEntrFont->setText(cfgWnd.currentEntryFont.family()); | ||
64 | cfgWnd.currEntrFont->setFont(cfgWnd.currentEntryFont); | ||
65 | cfgWnd.windowStyleComboBox->setCurrentItem(confWndMainViewStyle()); | ||
66 | cfgWnd.compressionComboBox->setCurrentItem(confGlobCompression()); | ||
67 | cfgWnd.autoMinimizeCheckBox->setChecked(confWndAutoMinimizeOnStart()); | ||
68 | cfgWnd.browserLineEdit->setText(confGlobBrowserCommand()); | ||
69 | cfgWnd.xtermLineEdit->setText(confGlobXtermCommand()); | ||
70 | cfgWnd.setFilePermissions(confGlobFilePermissions()); | ||
71 | cfgWnd.fileBackupCheckBox->setChecked(confGlobMakeFileBackup()); | ||
72 | cfgWnd.autostartDeeplockedCheckBox->setChecked(confGlobAutostartDeepLocked()); | ||
73 | cfgWnd.autoDeepLockCheckBox->setChecked(confGlobAutoDeepLock()); | ||
74 | cfgWnd.minimizeLockComboBox->setCurrentItem(confGlobMinimizeLock()); | ||
75 | cfgWnd.wndCloseCheckBox->setChecked(confWndClose()); | ||
76 | #ifdef CONFIG_KWALLETIF | ||
77 | cfgWnd.kwalletEmuCheckBox->setChecked(confGlobKwalletEmu()); | ||
78 | #else // CONFIG_KWALLETIF | ||
79 | cfgWnd.kwalletEmuCheckBox->setChecked(false); | ||
80 | cfgWnd.kwalletEmuCheckBox->setEnabled(false); | ||
81 | #endif // CONFIG_KWALLETIF | ||
82 | |||
83 | if (cfgWnd.exec()) | ||
84 | return false; | ||
85 | |||
86 | confGlobPwTimeout(cfgWnd.pwTimeoutSpinBox->value()); | ||
87 | confGlobLockTimeout(cfgWnd.lockTimeoutSpinBox->value()); | ||
88 | confGlobTray(cfgWnd.trayCheckBox->isChecked()); | ||
89 | confGlobAutoStart(cfgWnd.autoStartLineEdit->text()); | ||
90 | confGlobUnlockOnOpen(cfgWnd.openUnlockedCheckBox->isChecked()); | ||
91 | confGlobEntryFont(cfgWnd.currentEntryFont); | ||
92 | confWndMainViewStyle(cfgWnd.windowStyleComboBox->currentItem()); | ||
93 | confGlobCompression(cfgWnd.compressionComboBox->currentItem()); | ||
94 | confWndAutoMinimizeOnStart(cfgWnd.autoMinimizeCheckBox->isChecked()); | ||
95 | confGlobBrowserCommand(cfgWnd.browserLineEdit->text()); | ||
96 | confGlobXtermCommand(cfgWnd.xtermLineEdit->text()); | ||
97 | confGlobFilePermissions(cfgWnd.getFilePermissions()); | ||
98 | confGlobMakeFileBackup(cfgWnd.fileBackupCheckBox->isChecked()); | ||
99 | confGlobAutostartDeepLocked(cfgWnd. | ||
100 | autostartDeeplockedCheckBox->isChecked()); | ||
101 | confGlobAutoDeepLock(cfgWnd.autoDeepLockCheckBox->isChecked()); | ||
102 | confGlobMinimizeLock(cfgWnd.minimizeLockComboBox->currentItem()); | ||
103 | confWndClose(cfgWnd.wndCloseCheckBox->isChecked()); | ||
104 | #ifdef CONFIG_KWALLETIF | ||
105 | confGlobKwalletEmu(cfgWnd.kwalletEmuCheckBox->isChecked()); | ||
106 | #endif // CONFIG_KWALLETIF | ||
107 | return true; | ||
108 | } | ||
109 | |||
110 | /******************************************************************* | ||
111 | * functions for reading the configuration settings | ||
112 | *******************************************************************/ | ||
113 | |||
114 | QString Configuration_31compat::confGlobAutoStart() | ||
115 | { | ||
116 | conf->setGroup("GLOBAL"); | ||
117 | return conf->readEntry("autoStart"); | ||
118 | } | ||
119 | |||
120 | QString Configuration_31compat::confGlobBrowserCommand() | ||
121 | { | ||
122 | conf->setGroup("GLOBAL"); | ||
123 | return conf->readEntry("browserCommand", CONF_DEFAULT_BROWSERCOMMAND); | ||
124 | } | ||
125 | |||
126 | QString Configuration_31compat::confGlobXtermCommand() | ||
127 | { | ||
128 | conf->setGroup("GLOBAL"); | ||
129 | return conf->readEntry("xtermCommand", CONF_DEFAULT_XTERMCOMMAND); | ||
130 | } | ||
131 | |||
132 | QFont Configuration_31compat::confGlobEntryFont() | ||
133 | { | ||
134 | conf->setGroup("GLOBAL"); | ||
135 | #ifndef PWM_EMBEDDED | ||
136 | return conf->readFontEntry("entryFont"); | ||
137 | #else | ||
138 | QFont f; | ||
139 | return conf->readFontEntry("entryFont", &f); | ||
140 | #endif | ||
141 | } | ||
142 | |||
143 | int Configuration_31compat::confGlobPwTimeout() | ||
144 | { | ||
145 | conf->setGroup("GLOBAL"); | ||
146 | return conf->readNumEntry("pwTimeout", CONF_DEFAULT_PWTIMEOUT); | ||
147 | } | ||
148 | |||
149 | int Configuration_31compat::confGlobLockTimeout() | ||
150 | { | ||
151 | conf->setGroup("GLOBAL"); | ||
152 | return conf->readNumEntry("lockTimeout", CONF_DEFAULT_LOCKTIMEOUT); | ||
153 | } | ||
154 | |||
155 | int Configuration_31compat::confGlobCompression() | ||
156 | { | ||
157 | conf->setGroup("GLOBAL"); | ||
158 | return conf->readNumEntry("compression", CONF_DEFAULT_COMPRESSION); | ||
159 | } | ||
160 | |||
161 | int Configuration_31compat::confGlobFilePermissions() | ||
162 | { | ||
163 | conf->setGroup("GLOBAL"); | ||
164 | return conf->readNumEntry("filePermissions", CONF_DEFAULT_FILEPERMISSIONS); | ||
165 | } | ||
166 | |||
167 | int Configuration_31compat::confGlobMinimizeLock() | ||
168 | { | ||
169 | conf->setGroup("GLOBAL"); | ||
170 | return conf->readNumEntry("minimizeLock", CONF_DEFAULT_MINIMIZELOCK); | ||
171 | } | ||
172 | |||
173 | bool Configuration_31compat::confGlobUnlockOnOpen() | ||
174 | { | ||
175 | conf->setGroup("GLOBAL"); | ||
176 | return conf->readBoolEntry("unlockOnOpen", CONF_DEFAULT_UNLOCKONOPEN); | ||
177 | } | ||
178 | |||
179 | bool Configuration_31compat::confGlobTray() | ||
180 | { | ||
181 | conf->setGroup("GLOBAL"); | ||
182 | return conf->readBoolEntry("tray", CONF_DEFAULT_TRAY); | ||
183 | } | ||
184 | |||
185 | bool Configuration_31compat::confGlobMakeFileBackup() | ||
186 | { | ||
187 | conf->setGroup("GLOBAL"); | ||
188 | return conf->readBoolEntry("makeFileBackup", CONF_DEFAULT_MAKEFILEBACKUP); | ||
189 | } | ||
190 | |||
191 | bool Configuration_31compat::confGlobAutostartDeepLocked() | ||
192 | { | ||
193 | conf->setGroup("GLOBAL"); | ||
194 | return conf->readBoolEntry("autostartDeeplocked", CONF_DEFAULT_AUTOSTART_DEEPL); | ||
195 | } | ||
196 | |||
197 | bool Configuration_31compat::confGlobAutoDeepLock() | ||
198 | { | ||
199 | conf->setGroup("GLOBAL"); | ||
200 | return conf->readBoolEntry("autoDeepLock", CONF_DEFAULT_AUTODEEPLOCK); | ||
201 | } | ||
202 | |||
203 | bool Configuration_31compat::confGlobKwalletEmu() | ||
204 | { | ||
205 | conf->setGroup("GLOBAL"); | ||
206 | return conf->readBoolEntry("kwalletEmu", CONF_DEFAULT_KWALLETEMU); | ||
207 | } | ||
208 | |||
209 | bool Configuration_31compat::confGlobNewEntrLockStat() | ||
210 | { | ||
211 | conf->setGroup("GLOBAL"); | ||
212 | return conf->readBoolEntry("newEntrLockStat", CONF_DEFAULT_NEWENTRLOCKSTAT); | ||
213 | } | ||
214 | |||
215 | QSize Configuration_31compat::confWndMainWndSize() | ||
216 | { | ||
217 | conf->setGroup("WND"); | ||
218 | #ifndef PWM_EMBEDDED | ||
219 | return conf->readSizeEntry("MainWndSize"); | ||
220 | #else | ||
221 | return conf->readSizeEntry("MainWndSize", 0); | ||
222 | #endif | ||
223 | } | ||
224 | |||
225 | int Configuration_31compat::confWndMainViewStyle() | ||
226 | { | ||
227 | conf->setGroup("WND"); | ||
228 | return conf->readNumEntry("MainViewStyle", CONF_DEFAULT_MAINVIEWSTYLE); | ||
229 | } | ||
230 | |||
231 | bool Configuration_31compat::confWndAutoMinimizeOnStart() | ||
232 | { | ||
233 | conf->setGroup("WND"); | ||
234 | return conf->readBoolEntry("autoMinimizeOnStart", CONF_DEFAULT_AUTOMINIMIZE); | ||
235 | } | ||
236 | |||
237 | bool Configuration_31compat::confWndClose() | ||
238 | { | ||
239 | conf->setGroup("WND"); | ||
240 | return conf->readBoolEntry("close", CONF_DEFAULT_WNDCLOSE); | ||
241 | } | ||
242 | |||
243 | /******************************************************************* | ||
244 | * functions for writing the configuration settings | ||
245 | *******************************************************************/ | ||
246 | |||
247 | void Configuration_31compat::confGlobAutoStart(const QString &e) | ||
248 | { | ||
249 | conf->setGroup("GLOBAL"); | ||
250 | conf->writeEntry("autoStart", e); | ||
251 | } | ||
252 | |||
253 | void Configuration_31compat::confGlobBrowserCommand(const QString &e) | ||
254 | { | ||
255 | conf->setGroup("GLOBAL"); | ||
256 | conf->writeEntry("browserCommand", e); | ||
257 | } | ||
258 | |||
259 | void Configuration_31compat::confGlobXtermCommand(const QString &e) | ||
260 | { | ||
261 | conf->setGroup("GLOBAL"); | ||
262 | conf->writeEntry("xtermCommand", e); | ||
263 | } | ||
264 | |||
265 | void Configuration_31compat::confGlobEntryFont(const QFont &e) | ||
266 | { | ||
267 | conf->setGroup("GLOBAL"); | ||
268 | conf->writeEntry("entryFont", e); | ||
269 | } | ||
270 | |||
271 | void Configuration_31compat::confGlobPwTimeout(int e) | ||
272 | { | ||
273 | conf->setGroup("GLOBAL"); | ||
274 | conf->writeEntry("pwTimeout", e); | ||
275 | } | ||
276 | |||
277 | void Configuration_31compat::confGlobLockTimeout(int e) | ||
278 | { | ||
279 | conf->setGroup("GLOBAL"); | ||
280 | conf->writeEntry("lockTimeout", e); | ||
281 | } | ||
282 | |||
283 | void Configuration_31compat::confGlobCompression(int e) | ||
284 | { | ||
285 | conf->setGroup("GLOBAL"); | ||
286 | conf->writeEntry("compression", e); | ||
287 | } | ||
288 | |||
289 | void Configuration_31compat::confGlobFilePermissions(int e) | ||
290 | { | ||
291 | conf->setGroup("GLOBAL"); | ||
292 | conf->writeEntry("filePermissions", e); | ||
293 | } | ||
294 | |||
295 | void Configuration_31compat::confGlobMinimizeLock(int e) | ||
296 | { | ||
297 | conf->setGroup("GLOBAL"); | ||
298 | conf->writeEntry("minimizeLock", e); | ||
299 | } | ||
300 | |||
301 | void Configuration_31compat::confGlobUnlockOnOpen(bool e) | ||
302 | { | ||
303 | conf->setGroup("GLOBAL"); | ||
304 | conf->writeEntry("unlockOnOpen", e); | ||
305 | } | ||
306 | |||
307 | void Configuration_31compat::confGlobTray(bool e) | ||
308 | { | ||
309 | conf->setGroup("GLOBAL"); | ||
310 | conf->writeEntry("tray", e); | ||
311 | } | ||
312 | |||
313 | void Configuration_31compat::confGlobMakeFileBackup(bool e) | ||
314 | { | ||
315 | conf->setGroup("GLOBAL"); | ||
316 | conf->writeEntry("makeFileBackup", e); | ||
317 | } | ||
318 | |||
319 | void Configuration_31compat::confGlobAutostartDeepLocked(bool e) | ||
320 | { | ||
321 | conf->setGroup("GLOBAL"); | ||
322 | conf->writeEntry("autostartDeeplocked", e); | ||
323 | } | ||
324 | |||
325 | void Configuration_31compat::confGlobAutoDeepLock(bool e) | ||
326 | { | ||
327 | conf->setGroup("GLOBAL"); | ||
328 | conf->writeEntry("autoDeepLock", e); | ||
329 | } | ||
330 | |||
331 | void Configuration_31compat::confGlobKwalletEmu(bool e) | ||
332 | { | ||
333 | conf->setGroup("GLOBAL"); | ||
334 | conf->writeEntry("kwalletEmu", e); | ||
335 | } | ||
336 | |||
337 | void Configuration_31compat::confGlobNewEntrLockStat(bool e) | ||
338 | { | ||
339 | conf->setGroup("GLOBAL"); | ||
340 | conf->writeEntry("newEntrLockStat", e); | ||
341 | } | ||
342 | |||
343 | void Configuration_31compat::confWndMainWndSize(const QSize &e) | ||
344 | { | ||
345 | conf->setGroup("WND"); | ||
346 | conf->writeEntry("MainWndSize", e); | ||
347 | } | ||
348 | |||
349 | void Configuration_31compat::confWndMainViewStyle(int e) | ||
350 | { | ||
351 | conf->setGroup("WND"); | ||
352 | conf->writeEntry("MainViewStyle", e); | ||
353 | } | ||
354 | |||
355 | void Configuration_31compat::confWndAutoMinimizeOnStart(bool e) | ||
356 | { | ||
357 | conf->setGroup("WND"); | ||
358 | conf->writeEntry("autoMinimizeOnStart", e); | ||
359 | } | ||
360 | |||
361 | void Configuration_31compat::confWndClose(bool e) | ||
362 | { | ||
363 | conf->setGroup("WND"); | ||
364 | conf->writeEntry("close", e); | ||
365 | } | ||