-rw-r--r-- | pwmanager/pwmanager/configuration.cpp | 459 | ||||
-rw-r--r-- | pwmanager/pwmanager/configuration.h | 336 | ||||
-rw-r--r-- | pwmanager/pwmanager/configuration_31compat.cpp | 365 | ||||
-rw-r--r-- | pwmanager/pwmanager/configuration_31compat.h | 146 | ||||
-rw-r--r-- | pwmanager/pwmanager/configwnd.cpp | 265 | ||||
-rw-r--r-- | pwmanager/pwmanager/configwnd.h | 91 | ||||
-rw-r--r-- | pwmanager/pwmanager/configwndimpl.cpp | 136 | ||||
-rw-r--r-- | pwmanager/pwmanager/configwndimpl.h | 55 |
8 files changed, 0 insertions, 1853 deletions
diff --git a/pwmanager/pwmanager/configuration.cpp b/pwmanager/pwmanager/configuration.cpp deleted file mode 100644 index 8d67977..0000000 --- a/pwmanager/pwmanager/configuration.cpp +++ b/dev/null | |||
@@ -1,459 +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 2.0 of pwmanager | ||
15 | * and was modified to run on embedded devices that run microkde | ||
16 | * | ||
17 | * $Id$ | ||
18 | **************************************************************************/ | ||
19 | |||
20 | #include "configuration.h" | ||
21 | #if KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0) | ||
22 | |||
23 | #include <kconfigdialog.h> | ||
24 | #include <kfiledialog.h> | ||
25 | #include <klocale.h> | ||
26 | #include <kfontrequester.h> | ||
27 | |||
28 | #include <qcheckbox.h> | ||
29 | #include <qcombobox.h> | ||
30 | #include <qlabel.h> | ||
31 | #include <qlineedit.h> | ||
32 | #include <qpushbutton.h> | ||
33 | #include <qgroupbox.h> | ||
34 | #include <qfileinfo.h> | ||
35 | #include <qfontdialog.h> | ||
36 | #include <qspinbox.h> | ||
37 | #include <qvalidator.h> | ||
38 | #include <qsqlpropertymap.h> | ||
39 | #include <qlayout.h> | ||
40 | |||
41 | #include <stdlib.h> | ||
42 | #include <stdio.h> | ||
43 | |||
44 | #define INITIAL_CONFWND_SIZE(QSize(600, 450)) | ||
45 | |||
46 | |||
47 | /********************************************************* | ||
48 | ** class Configuration ** | ||
49 | *********************************************************/ | ||
50 | |||
51 | Configuration * Configuration::_obj (0); | ||
52 | |||
53 | Configuration::Configuration() | ||
54 | { | ||
55 | skel = new KConfigSkeleton; | ||
56 | initSkel(); | ||
57 | readConfig(); | ||
58 | } | ||
59 | |||
60 | Configuration::~Configuration() | ||
61 | { | ||
62 | writeConfig(); | ||
63 | delete_ifnot_null(skel); | ||
64 | } | ||
65 | |||
66 | void Configuration::initSkel() | ||
67 | { | ||
68 | skel->setCurrentGroup("GLOBAL"); | ||
69 | skel->addItemString("autoStart", cGlobAutoStart); | ||
70 | skel->addItemString("browserCommand", cGlobBrowserCommand, CONF_DEFAULT_BROWSERCOMMAND); | ||
71 | skel->addItemString("xtermCommand", cGlobXtermCommand, CONF_DEFAULT_XTERMCOMMAND); | ||
72 | skel->addItemFont("entryFont", cGlobEntryFont); | ||
73 | skel->addItemInt("pwTimeout", cGlobPwTimeout, CONF_DEFAULT_PWTIMEOUT); | ||
74 | skel->addItemInt("lockTimeout", cGlobLockTimeout, CONF_DEFAULT_LOCKTIMEOUT); | ||
75 | skel->addItemInt("compression", cGlobCompression, CONF_DEFAULT_COMPRESSION); | ||
76 | skel->addItemInt("filePermissions", cGlobFilePermissions, CONF_DEFAULT_FILEPERMISSIONS); | ||
77 | skel->addItemInt("minimizeLock", cGlobMinimizeLock, CONF_DEFAULT_MINIMIZELOCK); | ||
78 | skel->addItemBool("unlockOnOpen", cGlobUnlockOnOpen, CONF_DEFAULT_UNLOCKONOPEN); | ||
79 | skel->addItemBool("tray", cGlobTray, CONF_DEFAULT_TRAY); | ||
80 | skel->addItemBool("makeFileBackup", cGlobMakeFileBackup, CONF_DEFAULT_MAKEFILEBACKUP); | ||
81 | skel->addItemBool("autostartDeeplocked", cGlobAutostartDeepLocked, CONF_DEFAULT_AUTOSTART_DEEPL); | ||
82 | skel->addItemBool("autoDeepLock", cGlobAutoDeepLock, CONF_DEFAULT_AUTODEEPLOCK); | ||
83 | skel->addItemBool("kwalletEmu", cGlobKwalletEmu, CONF_DEFAULT_KWALLETEMU); | ||
84 | skel->addItemBool("newEntrLockStat", cGlobNewEntrLockStat, CONF_DEFAULT_NEWENTRLOCKSTAT); | ||
85 | |||
86 | skel->setCurrentGroup("WND"); | ||
87 | skel->addItemSize("MainWndSize", cWndMainWndSize); | ||
88 | skel->addItemInt("MainViewStyle", cWndMainViewStyle, CONF_DEFAULT_MAINVIEWSTYLE); | ||
89 | skel->addItemBool("autoMinimizeOnStart", cWndAutoMinimizeOnStart, CONF_DEFAULT_AUTOMINIMIZE); | ||
90 | skel->addItemBool("close", cWndClose, CONF_DEFAULT_WNDCLOSE); | ||
91 | } | ||
92 | |||
93 | bool Configuration::showConfWnd(QWidget *parent) | ||
94 | { | ||
95 | bool ret = true; | ||
96 | KConfigDialog *confDlg; | ||
97 | confDlg = new KConfigDialog(parent, i18n("Main configuration").latin1(), skel, | ||
98 | KDialogBase::IconList, | ||
99 | KConfigDialog::Default | KConfigDialog::Ok | | ||
100 | KConfigDialog::Cancel | KConfigDialog::Help, | ||
101 | KConfigDialog::Ok, true); | ||
102 | ConfPageGlobal *confPageGlobal = new ConfPageGlobal; | ||
103 | ConfPageLookNFeel *confPageLookNFeel = new ConfPageLookNFeel; | ||
104 | ConfPageFile *confPageFile = new ConfPageFile; | ||
105 | ConfPageTimeouts *confPageTimeouts = new ConfPageTimeouts; | ||
106 | ConfPageExtApps *confPageExtApps = new ConfPageExtApps; | ||
107 | ConfPageAutostart *confPageAutostart = new ConfPageAutostart; | ||
108 | confDlg->addPage(confPageGlobal, i18n("General"), "pwmanager"); | ||
109 | confDlg->addPage(confPageLookNFeel, i18n("Look & Feel"), "fonts"); | ||
110 | confDlg->addPage(confPageFile, i18n("Files"), "filesave"); | ||
111 | confDlg->addPage(confPageTimeouts, i18n("Timeouts"), "clock"); | ||
112 | confDlg->addPage(confPageExtApps, i18n("External Applications"), "gear"); | ||
113 | confDlg->addPage(confPageAutostart, i18n("Autostart"), "fileopen"); | ||
114 | confDlg->resize(INITIAL_CONFWND_SIZE); | ||
115 | if (confDlg->exec() == 0) | ||
116 | ret = false; | ||
117 | delete confPageGlobal; | ||
118 | delete confPageLookNFeel; | ||
119 | delete confPageFile; | ||
120 | delete confPageTimeouts; | ||
121 | delete confPageExtApps; | ||
122 | delete confPageAutostart; | ||
123 | return ret; | ||
124 | } | ||
125 | |||
126 | |||
127 | /********************************************************* | ||
128 | ** class OctLineEdit ** | ||
129 | *********************************************************/ | ||
130 | |||
131 | OctLineEdit::OctLineEdit(QWidget *parent, const char *name) | ||
132 | : QLineEdit(parent, name) | ||
133 | { | ||
134 | } | ||
135 | |||
136 | OctLineEdit::~OctLineEdit() | ||
137 | { | ||
138 | } | ||
139 | |||
140 | void OctLineEdit::setText(const QString &t) | ||
141 | { | ||
142 | bool ok; | ||
143 | int tmp = t.toInt(&ok, 10); | ||
144 | if (!ok) | ||
145 | return; | ||
146 | QString ret; | ||
147 | ret.setNum(tmp, 8); | ||
148 | QLineEdit::setText(ret); | ||
149 | } | ||
150 | |||
151 | QString OctLineEdit::text() const | ||
152 | { | ||
153 | bool ok; | ||
154 | QString ret; | ||
155 | QString t(QLineEdit::text()); | ||
156 | int tmp = t.toInt(&ok, 8); | ||
157 | if (!ok) | ||
158 | return ret; | ||
159 | ret.setNum(tmp, 10); | ||
160 | return ret; | ||
161 | } | ||
162 | |||
163 | void OctLineEdit::keyPressEvent(QKeyEvent *e) | ||
164 | { | ||
165 | int key = e->key(); | ||
166 | switch (key) { | ||
167 | case Qt::Key_0: | ||
168 | case Qt::Key_1: | ||
169 | case Qt::Key_2: | ||
170 | case Qt::Key_3: | ||
171 | case Qt::Key_4: | ||
172 | case Qt::Key_5: | ||
173 | case Qt::Key_6: | ||
174 | case Qt::Key_7: | ||
175 | case Qt::Key_Escape: | ||
176 | case Qt::Key_Backtab: | ||
177 | case Qt::Key_Backspace: | ||
178 | case Qt::Key_Return: | ||
179 | case Qt::Key_Enter: | ||
180 | case Qt::Key_Insert: | ||
181 | case Qt::Key_Delete: | ||
182 | case Qt::Key_Home: | ||
183 | case Qt::Key_End: | ||
184 | case Qt::Key_Left: | ||
185 | case Qt::Key_Up: | ||
186 | case Qt::Key_Right: | ||
187 | case Qt::Key_Down: | ||
188 | e->accept(); | ||
189 | QLineEdit::keyPressEvent(e); | ||
190 | break; | ||
191 | default: | ||
192 | e->ignore(); | ||
193 | } | ||
194 | } | ||
195 | |||
196 | |||
197 | /********************************************************* | ||
198 | ** class ConfPageGlobal ** | ||
199 | *********************************************************/ | ||
200 | |||
201 | ConfPageGlobal::ConfPageGlobal(QWidget *parent, const char *name, WFlags f) | ||
202 | : QWidget(parent, name, f) | ||
203 | { | ||
204 | QCheckBox *kcfg_tray; | ||
205 | QCheckBox *kcfg_autoMinimizeOnStart; | ||
206 | QCheckBox *kcfg_unlockOnOpen; | ||
207 | QCheckBox *kcfg_newEntrLockStat; | ||
208 | QCheckBox *kcfg_close; | ||
209 | QComboBox *kcfg_minimizeLock; | ||
210 | QLabel *kcfg_minimizeLock_label; | ||
211 | |||
212 | QBoxLayout *l = new QVBoxLayout(this); | ||
213 | l->setSpacing(4); | ||
214 | kcfg_tray = new QCheckBox(i18n("Show icon in system-tray"), this, "kcfg_tray"); | ||
215 | l->addWidget(kcfg_tray); | ||
216 | kcfg_autoMinimizeOnStart = new QCheckBox(i18n("auto-minimize to tray on startup"), | ||
217 | this, "kcfg_autoMinimizeOnStart"); | ||
218 | l->addWidget(kcfg_autoMinimizeOnStart); | ||
219 | kcfg_unlockOnOpen = new QCheckBox(i18n("Open document with passwords unlocked"), | ||
220 | this, "kcfg_unlockOnOpen"); | ||
221 | l->addWidget(kcfg_unlockOnOpen); | ||
222 | #ifdef CONFIG_KWALLETIF | ||
223 | QCheckBox *kcfg_kwalletEmu; | ||
224 | kcfg_kwalletEmu = new QCheckBox(i18n("KWallet emulation"), | ||
225 | this, "kcfg_kwalletEmu"); | ||
226 | l->addWidget(kcfg_kwalletEmu); | ||
227 | #endif // CONFIG_KWALLETIF | ||
228 | kcfg_newEntrLockStat = new QCheckBox(i18n("Automatically lock new entries"), | ||
229 | this, "kcfg_newEntrLockStat"); | ||
230 | l->addWidget(kcfg_newEntrLockStat); | ||
231 | kcfg_close = new QCheckBox(i18n("Do not minimize windows into tray. (Close the window)"), | ||
232 | this, "kcfg_close"); | ||
233 | l->addWidget(kcfg_close); | ||
234 | l->addSpacing(4); | ||
235 | QBoxLayout *hl = new QHBoxLayout(this); | ||
236 | hl->setSpacing(10); | ||
237 | kcfg_minimizeLock_label = new QLabel(i18n("auto-lock on minimize:"), this); | ||
238 | hl->addWidget(kcfg_minimizeLock_label); | ||
239 | kcfg_minimizeLock = new QComboBox(this, "kcfg_minimizeLock"); | ||
240 | hl->addStretch(); | ||
241 | hl->addWidget(kcfg_minimizeLock); | ||
242 | kcfg_minimizeLock->insertItem(i18n("don't lock")); | ||
243 | kcfg_minimizeLock->insertItem(i18n("normal lock")); | ||
244 | kcfg_minimizeLock->insertItem(i18n("deep-lock")); | ||
245 | l->addLayout(hl); | ||
246 | l->addStretch(); | ||
247 | } | ||
248 | |||
249 | |||
250 | /********************************************************* | ||
251 | ** class ConfPageLookNFeel ** | ||
252 | *********************************************************/ | ||
253 | |||
254 | ConfPageLookNFeel::ConfPageLookNFeel(QWidget *parent, const char *name, WFlags f) | ||
255 | : QWidget(parent, name, f) | ||
256 | { | ||
257 | QComboBox *kcfg_MainViewStyle; | ||
258 | QLabel *kcfg_MainViewStyle_label; | ||
259 | KFontRequester *kcfg_entryFont; | ||
260 | QGroupBox *kcfg_entryFont_box; | ||
261 | |||
262 | QBoxLayout *l = new QVBoxLayout(this); | ||
263 | l->setSpacing(10); | ||
264 | // font | ||
265 | kcfg_entryFont_box = new QGroupBox(i18n("Font for the password entries:"), this); | ||
266 | l->addWidget(kcfg_entryFont_box); | ||
267 | kcfg_entryFont_box->setColumns(1); | ||
268 | kcfg_entryFont = new KFontRequester(kcfg_entryFont_box, "kcfg_entryFont", false); | ||
269 | // wnd style | ||
270 | QBoxLayout *hl = new QHBoxLayout(this); | ||
271 | hl->setSpacing(10); | ||
272 | kcfg_MainViewStyle_label = new QLabel(i18n("Window-style:"), this); | ||
273 | hl->addWidget(kcfg_MainViewStyle_label); | ||
274 | kcfg_MainViewStyle = new QComboBox(this, "kcfg_MainViewStyle"); | ||
275 | hl->addStretch(); | ||
276 | hl->addWidget(kcfg_MainViewStyle); | ||
277 | kcfg_MainViewStyle->insertItem(i18n("Category on top")); | ||
278 | kcfg_MainViewStyle->insertItem(i18n("Category-list left")); | ||
279 | l->addLayout(hl); | ||
280 | l->addStretch(); | ||
281 | } | ||
282 | |||
283 | |||
284 | /********************************************************* | ||
285 | ** class ConfPageFile ** | ||
286 | *********************************************************/ | ||
287 | |||
288 | ConfPageFile::ConfPageFile(QWidget *parent, const char *name, WFlags f) | ||
289 | : QWidget(parent, name, f) | ||
290 | { | ||
291 | QComboBox *kcfg_compression; | ||
292 | QLabel *kcfg_compression_label; | ||
293 | OctLineEdit *kcfg_filePermissions; | ||
294 | QLabel *kcfg_filePermissions_label; | ||
295 | QCheckBox *kcfg_makeFileBackup; | ||
296 | |||
297 | QBoxLayout *l = new QVBoxLayout(this); | ||
298 | l->setSpacing(10); | ||
299 | // compression | ||
300 | QBoxLayout *hl = new QHBoxLayout(this); | ||
301 | hl->setSpacing(10); | ||
302 | kcfg_compression_label = new QLabel(i18n("*.pwm file compression:"), this); | ||
303 | hl->addWidget(kcfg_compression_label); | ||
304 | kcfg_compression = new QComboBox(this, "kcfg_compression"); | ||
305 | hl->addStretch(); | ||
306 | hl->addWidget(kcfg_compression); | ||
307 | kcfg_compression->insertItem(i18n("none")); | ||
308 | kcfg_compression->insertItem(i18n("gzip")); | ||
309 | kcfg_compression->insertItem(i18n("bzip2")); | ||
310 | l->addLayout(hl); | ||
311 | // permissions | ||
312 | hl = new QHBoxLayout(this); | ||
313 | hl->setSpacing(10); | ||
314 | kcfg_filePermissions_label = new QLabel(i18n("permissions:"), this); | ||
315 | hl->addWidget(kcfg_filePermissions_label); | ||
316 | kcfg_filePermissions = new OctLineEdit(this, "kcfg_filePermissions"); | ||
317 | hl->addStretch(); | ||
318 | hl->addWidget(kcfg_filePermissions); | ||
319 | kcfg_filePermissions->setMaxLength(3); | ||
320 | l->addLayout(hl); | ||
321 | // backup | ||
322 | kcfg_makeFileBackup = new QCheckBox(i18n("Make file backup before saving"), | ||
323 | this, "kcfg_makeFileBackup"); | ||
324 | l->addWidget(kcfg_makeFileBackup); | ||
325 | l->addStretch(); | ||
326 | } | ||
327 | |||
328 | |||
329 | /********************************************************* | ||
330 | ** class ConfPageTimeouts ** | ||
331 | *********************************************************/ | ||
332 | |||
333 | ConfPageTimeouts::ConfPageTimeouts(QWidget *parent, const char *name, WFlags f) | ||
334 | : QWidget(parent, name, f) | ||
335 | { | ||
336 | QSpinBox *kcfg_pwTimeout; | ||
337 | QLabel *kcfg_pwTimeout_label; | ||
338 | QSpinBox *kcfg_lockTimeout; | ||
339 | QLabel *kcfg_lockTimeout_label; | ||
340 | QCheckBox *kcfg_autoDeepLock; | ||
341 | |||
342 | QBoxLayout *l = new QVBoxLayout(this); | ||
343 | l->setSpacing(10); | ||
344 | // pw timeout | ||
345 | QBoxLayout *hl = new QHBoxLayout(this); | ||
346 | hl->setSpacing(10); | ||
347 | kcfg_pwTimeout_label = new QLabel(i18n("Password timeout (timeout to hold " | ||
348 | "password in memory, so you don't have " | ||
349 | "to re-enter it, if you already have " | ||
350 | "entered it) [set to 0 to disable]:"), | ||
351 | this); | ||
352 | hl->addWidget(kcfg_pwTimeout_label); | ||
353 | kcfg_pwTimeout_label->setAlignment(QLabel::WordBreak); | ||
354 | kcfg_pwTimeout = new QSpinBox(this, "kcfg_pwTimeout"); | ||
355 | hl->addStretch(); | ||
356 | hl->addWidget(kcfg_pwTimeout); | ||
357 | l->addLayout(hl); | ||
358 | // lock timeout | ||
359 | hl = new QHBoxLayout(this); | ||
360 | hl->setSpacing(10); | ||
361 | kcfg_lockTimeout_label = new QLabel(i18n("Auto-lock timeout (auto lock document " | ||
362 | "after this amount of seconds) " | ||
363 | "[set to 0 to disable]:"), | ||
364 | this); | ||
365 | hl->addWidget(kcfg_lockTimeout_label); | ||
366 | kcfg_lockTimeout_label->setAlignment(QLabel::WordBreak); | ||
367 | kcfg_lockTimeout = new QSpinBox(this, "kcfg_lockTimeout"); | ||
368 | hl->addStretch(); | ||
369 | hl->addWidget(kcfg_lockTimeout); | ||
370 | l->addLayout(hl); | ||
371 | // auto deep lock checkbox | ||
372 | kcfg_autoDeepLock = new QCheckBox(i18n("deep-lock on autolock"), | ||
373 | this, "kcfg_autoDeepLock"); | ||
374 | l->addWidget(kcfg_autoDeepLock); | ||
375 | l->addStretch(); | ||
376 | } | ||
377 | |||
378 | |||
379 | /********************************************************* | ||
380 | ** class ConfPageExtApps ** | ||
381 | *********************************************************/ | ||
382 | |||
383 | ConfPageExtApps::ConfPageExtApps(QWidget *parent, const char *name, WFlags f) | ||
384 | : QWidget(parent, name, f) | ||
385 | { | ||
386 | QLineEdit *kcfg_browserCommand; | ||
387 | QLabel *kcfg_browserCommand_label; | ||
388 | QLineEdit *kcfg_xtermCommand; | ||
389 | QLabel *kcfg_xtermCommand_label; | ||
390 | |||
391 | QBoxLayout *l = new QVBoxLayout(this); | ||
392 | l->setSpacing(4); | ||
393 | // browser command | ||
394 | QBoxLayout *hl = new QHBoxLayout(this); | ||
395 | hl->setSpacing(10); | ||
396 | kcfg_browserCommand_label = new QLabel(i18n("Favourite browser:"), this); | ||
397 | hl->addWidget(kcfg_browserCommand_label); | ||
398 | kcfg_browserCommand = new QLineEdit(this, "kcfg_browserCommand"); | ||
399 | hl->addStretch(); | ||
400 | hl->addWidget(kcfg_browserCommand); | ||
401 | l->addLayout(hl); | ||
402 | // xterm command | ||
403 | hl = new QHBoxLayout(this); | ||
404 | hl->setSpacing(10); | ||
405 | kcfg_xtermCommand_label = new QLabel(i18n("Favourite X-terminal:"), this); | ||
406 | hl->addWidget(kcfg_xtermCommand_label); | ||
407 | kcfg_xtermCommand = new QLineEdit(this, "kcfg_xtermCommand"); | ||
408 | hl->addStretch(); | ||
409 | hl->addWidget(kcfg_xtermCommand); | ||
410 | l->addLayout(hl); | ||
411 | l->addStretch(); | ||
412 | } | ||
413 | |||
414 | |||
415 | /********************************************************* | ||
416 | ** class ConfPageAutostart ** | ||
417 | *********************************************************/ | ||
418 | |||
419 | ConfPageAutostart::ConfPageAutostart(QWidget *parent, const char *name, WFlags f) | ||
420 | : QWidget(parent, name, f) | ||
421 | { | ||
422 | QGroupBox *kcfg_autoStart_box; | ||
423 | QPushButton *kcfg_autoStart_button; | ||
424 | QCheckBox *kcfg_autostartDeeplocked; | ||
425 | |||
426 | QBoxLayout *l = new QVBoxLayout(this); | ||
427 | l->setSpacing(4); | ||
428 | // autostart | ||
429 | kcfg_autoStart_box = new QGroupBox(i18n("Open this file automatically on startup:"), | ||
430 | this); | ||
431 | l->addWidget(kcfg_autoStart_box); | ||
432 | kcfg_autoStart_box->setColumns(2); | ||
433 | kcfg_autoStart = new QLineEdit(kcfg_autoStart_box, "kcfg_autoStart"); | ||
434 | kcfg_autoStart_button = new QPushButton("...", kcfg_autoStart_box); | ||
435 | kcfg_autostartDeeplocked = new QCheckBox(i18n("open deeplocked"), | ||
436 | kcfg_autoStart_box, "kcfg_autostartDeeplocked"); | ||
437 | l->addStretch(); | ||
438 | // connections | ||
439 | connect(kcfg_autoStart_button, SIGNAL(clicked()), | ||
440 | this, SLOT(browseButton_slot())); | ||
441 | } | ||
442 | |||
443 | void ConfPageAutostart::browseButton_slot() | ||
444 | { | ||
445 | QString path(KFileDialog::getOpenFileName(QString::null, | ||
446 | i18n("*.pwm|PwM Password file\n" | ||
447 | "*|All files"), this)); | ||
448 | if (path == QString::null) | ||
449 | return; | ||
450 | kcfg_autoStart->setText(path); | ||
451 | } | ||
452 | |||
453 | |||
454 | #include "configuration.moc" | ||
455 | |||
456 | #else // KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0) | ||
457 | /* XXX: This is the code for KDE-3.1 compatibility. */ | ||
458 | # include "configuration_31compat.cpp" | ||
459 | #endif // KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0) | ||
diff --git a/pwmanager/pwmanager/configuration.h b/pwmanager/pwmanager/configuration.h deleted file mode 100644 index 9001147..0000000 --- a/pwmanager/pwmanager/configuration.h +++ b/dev/null | |||
@@ -1,336 +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 | #ifndef __CONFIGURATION_H | ||
21 | #define __CONFIGURATION_H | ||
22 | |||
23 | #define CONF_DEFAULT_PWTIMEOUT 10/* 10 sec */ | ||
24 | #define CONF_DEFAULT_LOCKTIMEOUT 0/* 0 == disable */ | ||
25 | #define CONF_DEFAULT_TRAY true | ||
26 | #define CONF_DEFAULT_UNLOCKONOPENfalse | ||
27 | #define CONF_DEFAULT_MAINVIEWSTYLE0 | ||
28 | #define CONF_DEFAULT_COMPRESSION 0x01/* gzip */ | ||
29 | #define CONF_DEFAULT_AUTOMINIMIZEfalse | ||
30 | #define CONF_DEFAULT_BROWSERCOMMAND"" | ||
31 | #define CONF_DEFAULT_XTERMCOMMAND"konsole -e" | ||
32 | #define CONF_DEFAULT_FILEPERMISSIONS0600 | ||
33 | #define CONF_DEFAULT_MAKEFILEBACKUPfalse | ||
34 | #define CONF_DEFAULT_AUTOSTART_DEEPLtrue | ||
35 | #define CONF_DEFAULT_AUTODEEPLOCKtrue | ||
36 | #define CONF_DEFAULT_KWALLETEMU true | ||
37 | #define CONF_DEFAULT_MINIMIZELOCK 2/* deep-lock */ | ||
38 | #define CONF_DEFAULT_NEWENTRLOCKSTAT true/* locked */ | ||
39 | #define CONF_DEFAULT_WNDCLOSE true/* don't minimize to tray */ | ||
40 | |||
41 | /** This is just because I'm too lazy to always | ||
42 | * type this loooong statement, when accessing | ||
43 | * configuration parameters. | ||
44 | */ | ||
45 | #define conf()Configuration::obj() | ||
46 | |||
47 | #include <kstandarddirs.h> | ||
48 | |||
49 | #ifndef PWM_EMBEDDED | ||
50 | #include <kdeversion.h> | ||
51 | #else | ||
52 | #define KDE_VERSION 310 | ||
53 | #define KDE_MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c)) | ||
54 | #endif | ||
55 | |||
56 | // Set this to 1 to debug the 3.1 compatibility interface | ||
57 | #if 0 | ||
58 | # warning configuration.h KDE_VERSION debugging enabled! | ||
59 | # undef KDE_VERSION | ||
60 | # define KDE_VERSIONKDE_MAKE_VERSION(3, 1, 0) | ||
61 | #endif | ||
62 | |||
63 | #if !defined(KDE_VERSION) || !defined(KDE_MAKE_VERSION) | ||
64 | # error "KDE_VERSION or KDE_MAKE_VERSION not defined" | ||
65 | #endif | ||
66 | #if KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0) | ||
67 | |||
68 | #ifndef PWM_EMBEDDED | ||
69 | //MOC_SKIP_BEGIN | ||
70 | #endif | ||
71 | |||
72 | #include <qstring.h> | ||
73 | #include <qsize.h> | ||
74 | #include <qfont.h> | ||
75 | #include <qwidget.h> | ||
76 | #include <qvbox.h> | ||
77 | #include <qhbox.h> | ||
78 | #include <qlineedit.h> | ||
79 | |||
80 | #include <kconfigskeleton.h> | ||
81 | |||
82 | #include "pwmexception.h" | ||
83 | |||
84 | class QLabel; | ||
85 | class QGroupBox; | ||
86 | class QPushButton; | ||
87 | class QResizeEvent; | ||
88 | |||
89 | /** New global configuration file interface | ||
90 | * using KDE-3.2 KConfigSkeleton model. | ||
91 | */ | ||
92 | class Configuration | ||
93 | { | ||
94 | public: | ||
95 | Configuration(); | ||
96 | ~Configuration(); | ||
97 | |||
98 | static Configuration * obj() | ||
99 | { | ||
100 | PWM_ASSERT(_obj); | ||
101 | return _obj; | ||
102 | } | ||
103 | static void init() | ||
104 | { | ||
105 | PWM_ASSERT(!_obj); | ||
106 | _obj = new Configuration; | ||
107 | } | ||
108 | static void cleanup() | ||
109 | { delete_ifnot_null(_obj); } | ||
110 | |||
111 | |||
112 | /** Read the configuration from the file. | ||
113 | * Normally this function has not to be called manually. | ||
114 | */ | ||
115 | void readConfig() | ||
116 | { skel->readConfig(); } | ||
117 | /** Write the configuration to the file. | ||
118 | * Normally this function has not to be called manually. | ||
119 | */ | ||
120 | void writeConfig() | ||
121 | { skel->writeConfig(); } | ||
122 | /** reset the whole configuration to its defaults */ | ||
123 | void resetConfig() | ||
124 | { skel->setDefaults(); } | ||
125 | /** show the configuration window */ | ||
126 | bool showConfWnd(QWidget *parent); | ||
127 | |||
128 | public: | ||
129 | /* functions for reading the configuration settings */ | ||
130 | /* GLOBAL */ | ||
131 | QString confGlobAutoStart() | ||
132 | { return cGlobAutoStart; } | ||
133 | QString confGlobBrowserCommand() | ||
134 | { return cGlobBrowserCommand; } | ||
135 | QString confGlobXtermCommand() | ||
136 | { return cGlobXtermCommand; } | ||
137 | QFont confGlobEntryFont() | ||
138 | { return cGlobEntryFont; } | ||
139 | int confGlobPwTimeout() | ||
140 | { return cGlobPwTimeout; } | ||
141 | int confGlobLockTimeout() | ||
142 | { return cGlobLockTimeout; } | ||
143 | int confGlobCompression() | ||
144 | { return cGlobCompression; } | ||
145 | int confGlobFilePermissions() | ||
146 | { return cGlobFilePermissions; } | ||
147 | int confGlobMinimizeLock() | ||
148 | { return cGlobMinimizeLock; } | ||
149 | bool confGlobUnlockOnOpen() | ||
150 | { return cGlobUnlockOnOpen; } | ||
151 | bool confGlobTray() | ||
152 | { return cGlobTray; } | ||
153 | bool confGlobMakeFileBackup() | ||
154 | { return cGlobMakeFileBackup; } | ||
155 | bool confGlobAutostartDeepLocked() | ||
156 | { return cGlobAutostartDeepLocked; } | ||
157 | bool confGlobAutoDeepLock() | ||
158 | { return cGlobAutoDeepLock; } | ||
159 | bool confGlobKwalletEmu() | ||
160 | { return cGlobKwalletEmu; } | ||
161 | bool confGlobNewEntrLockStat() | ||
162 | { return cGlobNewEntrLockStat; } | ||
163 | /* WND */ | ||
164 | QSize confWndMainWndSize() | ||
165 | { return cWndMainWndSize; } | ||
166 | int confWndMainViewStyle() | ||
167 | { return cWndMainViewStyle; } | ||
168 | bool confWndAutoMinimizeOnStart() | ||
169 | { return cWndAutoMinimizeOnStart; } | ||
170 | bool confWndClose() | ||
171 | { return cWndClose; } | ||
172 | |||
173 | public: | ||
174 | /* functions for writing the configuration settings */ | ||
175 | /* GLOBAL */ | ||
176 | void confGlobAutoStart(const QString &e) | ||
177 | { cGlobAutoStart = e; } | ||
178 | void confGlobBrowserCommand(const QString &e) | ||
179 | { cGlobBrowserCommand = e; } | ||
180 | void confGlobXtermCommand(const QString &e) | ||
181 | { cGlobXtermCommand = e; } | ||
182 | void confGlobEntryFont(const QFont &e) | ||
183 | { cGlobEntryFont = e; } | ||
184 | void confGlobPwTimeout(int e) | ||
185 | { cGlobPwTimeout = e; } | ||
186 | void confGlobLockTimeout(int e) | ||
187 | { cGlobLockTimeout = e; } | ||
188 | void confGlobCompression(int e) | ||
189 | { cGlobCompression = e; } | ||
190 | void confGlobFilePermissions(int e) | ||
191 | { cGlobFilePermissions = e; } | ||
192 | void confGlobMinimizeLock(int e) | ||
193 | { cGlobMinimizeLock = e; } | ||
194 | void confGlobUnlockOnOpen(bool e) | ||
195 | { cGlobUnlockOnOpen = e; } | ||
196 | void confGlobTray(bool e) | ||
197 | { cGlobTray = e; } | ||
198 | void confGlobMakeFileBackup(bool e) | ||
199 | { cGlobMakeFileBackup = e; } | ||
200 | void confGlobAutostartDeepLocked(bool e) | ||
201 | { cGlobAutostartDeepLocked = e; } | ||
202 | void confGlobAutoDeepLock(bool e) | ||
203 | { cGlobAutoDeepLock = e; } | ||
204 | void confGlobKwalletEmu(bool e) | ||
205 | { cGlobKwalletEmu = e; } | ||
206 | void confGlobNewEntrLockStat(bool e) | ||
207 | { cGlobNewEntrLockStat = e; } | ||
208 | /* WND */ | ||
209 | void confWndMainWndSize(const QSize &e) | ||
210 | { cWndMainWndSize = e; } | ||
211 | void confWndMainViewStyle(int e) | ||
212 | { cWndMainViewStyle = e; } | ||
213 | void confWndAutoMinimizeOnStart(bool e) | ||
214 | { cWndAutoMinimizeOnStart = e; } | ||
215 | void confWndClose(bool e) | ||
216 | { cWndClose = e; } | ||
217 | |||
218 | protected: | ||
219 | /** initialize the skeleton */ | ||
220 | void initSkel(); | ||
221 | |||
222 | protected: | ||
223 | /** static instance of this class returned by obj() */ | ||
224 | static Configuration *_obj; | ||
225 | /** main configuration access skeleton */ | ||
226 | KConfigSkeleton *skel; | ||
227 | |||
228 | protected: | ||
229 | /* configuration variables. All prefixed with 'c'. */ | ||
230 | /* GLOBAL */ | ||
231 | QString cGlobAutoStart; | ||
232 | QString cGlobBrowserCommand; | ||
233 | QString cGlobXtermCommand; | ||
234 | QFont cGlobEntryFont; | ||
235 | int cGlobPwTimeout; | ||
236 | int cGlobLockTimeout; | ||
237 | int cGlobCompression; | ||
238 | int cGlobFilePermissions; | ||
239 | int cGlobMinimizeLock; | ||
240 | bool cGlobUnlockOnOpen; | ||
241 | bool cGlobTray; | ||
242 | bool cGlobMakeFileBackup; | ||
243 | bool cGlobAutostartDeepLocked; | ||
244 | bool cGlobAutoDeepLock; | ||
245 | bool cGlobKwalletEmu; | ||
246 | bool cGlobNewEntrLockStat; | ||
247 | /* WND */ | ||
248 | QSize cWndMainWndSize; | ||
249 | int cWndMainViewStyle; | ||
250 | bool cWndAutoMinimizeOnStart; | ||
251 | bool cWndClose; | ||
252 | }; | ||
253 | |||
254 | /* Big fat note: Internal stuff follows. | ||
255 | * ============ Don't use the following classes outside of | ||
256 | * the Configuration code, because it's unavailable | ||
257 | * when compiled under KDE-3.1 | ||
258 | */ | ||
259 | |||
260 | /** class for input of octal numbers (for example file permissions) */ | ||
261 | class OctLineEdit : public QLineEdit | ||
262 | { | ||
263 | Q_OBJECT | ||
264 | Q_OVERRIDE( QString text READ text WRITE setText ) | ||
265 | |||
266 | public: | ||
267 | OctLineEdit(QWidget *parent, const char *name = 0); | ||
268 | ~OctLineEdit(); | ||
269 | |||
270 | void setText(const QString &t); | ||
271 | QString text() const; | ||
272 | |||
273 | protected: | ||
274 | void keyPressEvent(QKeyEvent *e); | ||
275 | }; | ||
276 | |||
277 | /** global configuration page */ | ||
278 | class ConfPageGlobal : public QWidget | ||
279 | { | ||
280 | public: | ||
281 | ConfPageGlobal(QWidget *parent = 0, const char *name = 0, WFlags f = 0); | ||
282 | }; | ||
283 | |||
284 | /** configuration page for look&feel */ | ||
285 | class ConfPageLookNFeel : public QWidget | ||
286 | { | ||
287 | public: | ||
288 | ConfPageLookNFeel(QWidget *parent = 0, const char *name = 0, WFlags f = 0); | ||
289 | }; | ||
290 | |||
291 | /** file configuration page */ | ||
292 | class ConfPageFile : public QWidget | ||
293 | { | ||
294 | public: | ||
295 | ConfPageFile(QWidget *parent = 0, const char *name = 0, WFlags f = 0); | ||
296 | }; | ||
297 | |||
298 | /** timeouts configuration page */ | ||
299 | class ConfPageTimeouts : public QWidget | ||
300 | { | ||
301 | public: | ||
302 | ConfPageTimeouts(QWidget *parent = 0, const char *name = 0, WFlags f = 0); | ||
303 | }; | ||
304 | |||
305 | /** configuration page for external apps */ | ||
306 | class ConfPageExtApps : public QWidget | ||
307 | { | ||
308 | public: | ||
309 | ConfPageExtApps(QWidget *parent = 0, const char *name = 0, WFlags f = 0); | ||
310 | }; | ||
311 | |||
312 | /** autostart configuration page */ | ||
313 | class ConfPageAutostart : public QWidget | ||
314 | { | ||
315 | Q_OBJECT | ||
316 | public: | ||
317 | ConfPageAutostart(QWidget *parent = 0, const char *name = 0, WFlags f = 0); | ||
318 | |||
319 | protected slots: | ||
320 | void browseButton_slot(); | ||
321 | |||
322 | protected: | ||
323 | QLineEdit *kcfg_autoStart; | ||
324 | }; | ||
325 | |||
326 | |||
327 | #ifndef PWM_EMBEDDED | ||
328 | //MOC_SKIP_END | ||
329 | #endif | ||
330 | |||
331 | |||
332 | #else // KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0) | ||
333 | /* XXX: This is the code for KDE-3.1 compatibility. */ | ||
334 | # include "configuration_31compat.h" | ||
335 | #endif // KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0) | ||
336 | #endif // CONFIGURATION_H | ||
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 | } | ||
diff --git a/pwmanager/pwmanager/configuration_31compat.h b/pwmanager/pwmanager/configuration_31compat.h deleted file mode 100644 index 8ad6e09..0000000 --- a/pwmanager/pwmanager/configuration_31compat.h +++ b/dev/null | |||
@@ -1,146 +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 | #ifndef CONFIGURATION_31COMPAT_H | ||
21 | #define CONFIGURATION_31COMPAT_H | ||
22 | |||
23 | #include "pwmexception.h" | ||
24 | |||
25 | #include <qsize.h> | ||
26 | #include <qfont.h> | ||
27 | #include <qstring.h> | ||
28 | |||
29 | #ifdef PWM_EMBEDDED | ||
30 | #include <configuration.h> | ||
31 | #endif | ||
32 | |||
33 | class KConfig; | ||
34 | |||
35 | /** This class is the compatibility layer for | ||
36 | * running the new KDE-3.2 Configuration interface on KDE-3.1. | ||
37 | * We have to keep this class in sync with the real configuration | ||
38 | * interface. | ||
39 | */ | ||
40 | class Configuration_31compat | ||
41 | { | ||
42 | public: | ||
43 | Configuration_31compat(); | ||
44 | ~Configuration_31compat(); | ||
45 | |||
46 | static Configuration_31compat * obj() | ||
47 | { | ||
48 | PWM_ASSERT(_obj); | ||
49 | return _obj; | ||
50 | } | ||
51 | static void init() | ||
52 | { | ||
53 | PWM_ASSERT(!_obj); | ||
54 | _obj = new Configuration_31compat; | ||
55 | } | ||
56 | static void cleanup() | ||
57 | { delete_ifnot_null(_obj); } | ||
58 | |||
59 | |||
60 | /** Read the configuration from the file. | ||
61 | * Normally this function has not to be called manually. | ||
62 | * | ||
63 | * This function is a NOP in KDE-3.1 compatibility layer. | ||
64 | */ | ||
65 | void readConfig() | ||
66 | { } | ||
67 | /** Write the configuration to the file. | ||
68 | * Normally this function has not to be called manually. | ||
69 | * | ||
70 | * This function is a NOP in KDE-3.1 compatibility layer. | ||
71 | */ | ||
72 | void writeConfig() | ||
73 | { } | ||
74 | /** reset the whole configuration to its defaults. | ||
75 | * | ||
76 | * This function is a NOP in KDE-3.1 compatibility layer. | ||
77 | * It should not be, but it is. :) | ||
78 | */ | ||
79 | void resetConfig() | ||
80 | { } | ||
81 | /** show the configuration window */ | ||
82 | bool showConfWnd(QWidget *parent); | ||
83 | |||
84 | public: | ||
85 | /* functions for reading the configuration settings */ | ||
86 | /* GLOBAL */ | ||
87 | QString confGlobAutoStart(); | ||
88 | QString confGlobBrowserCommand(); | ||
89 | QString confGlobXtermCommand(); | ||
90 | QFont confGlobEntryFont(); | ||
91 | int confGlobPwTimeout(); | ||
92 | int confGlobLockTimeout(); | ||
93 | int confGlobCompression(); | ||
94 | int confGlobFilePermissions(); | ||
95 | int confGlobMinimizeLock(); | ||
96 | bool confGlobUnlockOnOpen(); | ||
97 | bool confGlobTray(); | ||
98 | bool confGlobMakeFileBackup(); | ||
99 | bool confGlobAutostartDeepLocked(); | ||
100 | bool confGlobAutoDeepLock(); | ||
101 | bool confGlobKwalletEmu(); | ||
102 | bool confGlobNewEntrLockStat(); | ||
103 | /* WND */ | ||
104 | QSize confWndMainWndSize(); | ||
105 | int confWndMainViewStyle(); | ||
106 | bool confWndAutoMinimizeOnStart(); | ||
107 | bool confWndClose(); | ||
108 | |||
109 | public: | ||
110 | /* functions for writing the configuration settings */ | ||
111 | /* GLOBAL */ | ||
112 | void confGlobAutoStart(const QString &e); | ||
113 | void confGlobBrowserCommand(const QString &e); | ||
114 | void confGlobXtermCommand(const QString &e); | ||
115 | void confGlobEntryFont(const QFont &e); | ||
116 | void confGlobPwTimeout(int e); | ||
117 | void confGlobLockTimeout(int e); | ||
118 | void confGlobCompression(int e); | ||
119 | void confGlobFilePermissions(int e); | ||
120 | void confGlobMinimizeLock(int e); | ||
121 | void confGlobUnlockOnOpen(bool e); | ||
122 | void confGlobTray(bool e); | ||
123 | void confGlobMakeFileBackup(bool e); | ||
124 | void confGlobAutostartDeepLocked(bool e); | ||
125 | void confGlobAutoDeepLock(bool e); | ||
126 | void confGlobKwalletEmu(bool e); | ||
127 | void confGlobNewEntrLockStat(bool e); | ||
128 | /* WND */ | ||
129 | void confWndMainWndSize(const QSize &e); | ||
130 | void confWndMainViewStyle(int e); | ||
131 | void confWndAutoMinimizeOnStart(bool e); | ||
132 | void confWndClose(bool e); | ||
133 | |||
134 | protected: | ||
135 | /** static instance of this class returned by obj() */ | ||
136 | static Configuration_31compat *_obj; | ||
137 | /** configuration object */ | ||
138 | KConfig *conf; | ||
139 | }; | ||
140 | |||
141 | #ifdef Configuration | ||
142 | # error "Configuration already defined!" | ||
143 | #endif | ||
144 | #define ConfigurationConfiguration_31compat | ||
145 | |||
146 | #endif | ||
diff --git a/pwmanager/pwmanager/configwnd.cpp b/pwmanager/pwmanager/configwnd.cpp deleted file mode 100644 index 108c40f..0000000 --- a/pwmanager/pwmanager/configwnd.cpp +++ b/dev/null | |||
@@ -1,265 +0,0 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form implementation generated from reading ui file 'configwnd.ui' | ||
3 | ** | ||
4 | ** Created: Tue Sep 14 15:20:58 2004 | ||
5 | ** by: The User Interface Compiler ($Id$) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | |||
10 | #include "configwnd.h" | ||
11 | |||
12 | #include <qvariant.h> | ||
13 | #include <qpushbutton.h> | ||
14 | #include <qtabwidget.h> | ||
15 | #include <qwidget.h> | ||
16 | #include <qcombobox.h> | ||
17 | #include <qlabel.h> | ||
18 | #include <qlineedit.h> | ||
19 | #include <qcheckbox.h> | ||
20 | #include <qspinbox.h> | ||
21 | #include <qlayout.h> | ||
22 | #include <qtooltip.h> | ||
23 | #include <qwhatsthis.h> | ||
24 | |||
25 | /* | ||
26 | * Constructs a configWnd as a child of 'parent', with the | ||
27 | * name 'name' and widget flags set to 'f'. | ||
28 | * | ||
29 | * The dialog will by default be modeless, unless you set 'modal' to | ||
30 | * TRUE to construct a modal dialog. | ||
31 | */ | ||
32 | configWnd::configWnd( QWidget* parent, const char* name, bool modal, WFlags fl ) | ||
33 | : QDialog( parent, name, modal, fl ) | ||
34 | { | ||
35 | if ( !name ) | ||
36 | setName( "configWnd" ); | ||
37 | |||
38 | okButton = new QPushButton( this, "okButton" ); | ||
39 | okButton->setGeometry( QRect( 10, 280, 107, 27 ) ); | ||
40 | |||
41 | cancelButton = new QPushButton( this, "cancelButton" ); | ||
42 | cancelButton->setGeometry( QRect( 370, 280, 107, 27 ) ); | ||
43 | |||
44 | tabWidget2 = new QTabWidget( this, "tabWidget2" ); | ||
45 | tabWidget2->setGeometry( QRect( 10, 10, 470, 260 ) ); | ||
46 | |||
47 | ////////////////////////////// | ||
48 | tab = new QWidget( tabWidget2, "tab" ); | ||
49 | |||
50 | windowStyleComboBox = new QComboBox( FALSE, tab, "windowStyleComboBox" ); | ||
51 | windowStyleComboBox->setGeometry( QRect( 220, 180, 210, 28 ) ); | ||
52 | |||
53 | textLabel1_5 = new QLabel( tab, "textLabel1_5" ); | ||
54 | textLabel1_5->setGeometry( QRect( 30, 180, 180, 20 ) ); | ||
55 | textLabel1_5->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); | ||
56 | |||
57 | textLabel1_4 = new QLabel( tab, "textLabel1_4" ); | ||
58 | textLabel1_4->setGeometry( QRect( 30, 40, 400, 20 ) ); | ||
59 | |||
60 | selEntrFontButton = new QPushButton( tab, "selEntrFontButton" ); | ||
61 | selEntrFontButton->setGeometry( QRect( 30, 90, 160, 27 ) ); | ||
62 | |||
63 | currEntrFont = new QLabel( tab, "currEntrFont" ); | ||
64 | currEntrFont->setGeometry( QRect( 30, 70, 230, 20 ) ); | ||
65 | tabWidget2->insertTab( tab, QString("") ); | ||
66 | ////////////////////////////////////// | ||
67 | TabPage = new QWidget( tabWidget2, "TabPage" ); | ||
68 | |||
69 | compressionComboBox = new QComboBox( FALSE, TabPage, "compressionComboBox" ); | ||
70 | compressionComboBox->setGeometry( QRect( 290, 50, 150, 28 ) ); | ||
71 | |||
72 | textLabel1_6 = new QLabel( TabPage, "textLabel1_6" ); | ||
73 | textLabel1_6->setGeometry( QRect( 10, 50, 270, 20 ) ); | ||
74 | textLabel1_6->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); | ||
75 | |||
76 | textLabel1_8 = new QLabel( TabPage, "textLabel1_8" ); | ||
77 | textLabel1_8->setGeometry( QRect( 10, 90, 270, 20 ) ); | ||
78 | textLabel1_8->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); | ||
79 | |||
80 | permissionLineEdit = new QLineEdit( TabPage, "permissionLineEdit" ); | ||
81 | permissionLineEdit->setGeometry( QRect( 290, 90, 142, 27 ) ); | ||
82 | permissionLineEdit->setMaxLength( 3 ); | ||
83 | |||
84 | fileBackupCheckBox = new QCheckBox( TabPage, "fileBackupCheckBox" ); | ||
85 | fileBackupCheckBox->setGeometry( QRect( 80, 140, 360, 23 ) ); | ||
86 | tabWidget2->insertTab( TabPage, QString("") ); | ||
87 | ////////////////////////////////////// | ||
88 | tab_2 = new QWidget( tabWidget2, "tab_2" ); | ||
89 | |||
90 | pwTimeoutSpinBox = new QSpinBox( tab_2, "pwTimeoutSpinBox" ); | ||
91 | pwTimeoutSpinBox->setGeometry( QRect( 390, 50, 55, 23 ) ); | ||
92 | |||
93 | textLabel1 = new QLabel( tab_2, "textLabel1" ); | ||
94 | textLabel1->setGeometry( QRect( 10, 20, 370, 80 ) ); | ||
95 | textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) ); | ||
96 | |||
97 | textLabel1_7 = new QLabel( tab_2, "textLabel1_7" ); | ||
98 | textLabel1_7->setGeometry( QRect( 10, 110, 370, 80 ) ); | ||
99 | textLabel1_7->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) ); | ||
100 | |||
101 | lockTimeoutSpinBox = new QSpinBox( tab_2, "lockTimeoutSpinBox" ); | ||
102 | lockTimeoutSpinBox->setGeometry( QRect( 390, 140, 55, 23 ) ); | ||
103 | |||
104 | autoDeepLockCheckBox = new QCheckBox( tab_2, "autoDeepLockCheckBox" ); | ||
105 | autoDeepLockCheckBox->setGeometry( QRect( 60, 180, 380, 25 ) ); | ||
106 | tabWidget2->insertTab( tab_2, QString("") ); | ||
107 | /////////////////////////////////////////// | ||
108 | tab_3 = new QWidget( tabWidget2, "tab_3" ); | ||
109 | |||
110 | textLabel1_3 = new QLabel( tab_3, "textLabel1_3" ); | ||
111 | textLabel1_3->setGeometry( QRect( 30, 30, 400, 20 ) ); | ||
112 | |||
113 | autoStartLineEdit = new QLineEdit( tab_3, "autoStartLineEdit" ); | ||
114 | autoStartLineEdit->setGeometry( QRect( 30, 50, 360, 20 ) ); | ||
115 | |||
116 | browseAutoStButton = new QPushButton( tab_3, "browseAutoStButton" ); | ||
117 | browseAutoStButton->setGeometry( QRect( 400, 50, 30, 20 ) ); | ||
118 | |||
119 | autostartDeeplockedCheckBox = new QCheckBox( tab_3, "autostartDeeplockedCheckBox" ); | ||
120 | autostartDeeplockedCheckBox->setGeometry( QRect( 40, 80, 390, 25 ) ); | ||
121 | tabWidget2->insertTab( tab_3, QString("") ); | ||
122 | //////////////////////////////////////////// | ||
123 | tab_4 = new QWidget( tabWidget2, "tab_4" ); | ||
124 | |||
125 | textLabel2 = new QLabel( tab_4, "textLabel2" ); | ||
126 | textLabel2->setGeometry( QRect( 20, 40, 280, 20 ) ); | ||
127 | textLabel2->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); | ||
128 | |||
129 | browserLineEdit = new QLineEdit( tab_4, "browserLineEdit" ); | ||
130 | browserLineEdit->setGeometry( QRect( 310, 40, 130, 27 ) ); | ||
131 | |||
132 | xtermLineEdit = new QLineEdit( tab_4, "xtermLineEdit" ); | ||
133 | xtermLineEdit->setGeometry( QRect( 310, 100, 130, 27 ) ); | ||
134 | |||
135 | textLabel3 = new QLabel( tab_4, "textLabel3" ); | ||
136 | textLabel3->setGeometry( QRect( 20, 100, 280, 20 ) ); | ||
137 | textLabel3->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); | ||
138 | tabWidget2->insertTab( tab_4, QString("") ); | ||
139 | /////////////////////////////////////////////// | ||
140 | tab_5 = new QWidget( tabWidget2, "tab_5" ); | ||
141 | |||
142 | trayCheckBox = new QCheckBox( tab_5, "trayCheckBox" ); | ||
143 | trayCheckBox->setGeometry( QRect( 30, 30, 400, 20 ) ); | ||
144 | |||
145 | openUnlockedCheckBox = new QCheckBox( tab_5, "openUnlockedCheckBox" ); | ||
146 | openUnlockedCheckBox->setGeometry( QRect( 30, 80, 400, 20 ) ); | ||
147 | |||
148 | autoMinimizeCheckBox = new QCheckBox( tab_5, "autoMinimizeCheckBox" ); | ||
149 | autoMinimizeCheckBox->setEnabled( FALSE ); | ||
150 | autoMinimizeCheckBox->setGeometry( QRect( 50, 50, 380, 25 ) ); | ||
151 | |||
152 | minimizeLockComboBox = new QComboBox( FALSE, tab_5, "minimizeLockComboBox" ); | ||
153 | minimizeLockComboBox->setGeometry( QRect( 310, 170, 120, 27 ) ); | ||
154 | |||
155 | textLabel1_9 = new QLabel( tab_5, "textLabel1_9" ); | ||
156 | textLabel1_9->setGeometry( QRect( 30, 180, 270, 20 ) ); | ||
157 | textLabel1_9->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); | ||
158 | |||
159 | kwalletEmuCheckBox = new QCheckBox( tab_5, "kwalletEmuCheckBox" ); | ||
160 | kwalletEmuCheckBox->setGeometry( QRect( 30, 110, 400, 25 ) ); | ||
161 | |||
162 | wndCloseCheckBox = new QCheckBox( tab_5, "wndCloseCheckBox" ); | ||
163 | wndCloseCheckBox->setGeometry( QRect( 30, 140, 430, 24 ) ); | ||
164 | tabWidget2->insertTab( tab_5, QString("") ); | ||
165 | languageChange(); | ||
166 | resize( QSize(490, 318).expandedTo(minimumSizeHint()) ); | ||
167 | clearWState( WState_Polished ); | ||
168 | |||
169 | // signals and slots connections | ||
170 | connect( okButton, SIGNAL( clicked() ), this, SLOT( okButton_slot() ) ); | ||
171 | connect( cancelButton, SIGNAL( clicked() ), this, SLOT( cancelButton_slot() ) ); | ||
172 | connect( browseAutoStButton, SIGNAL( clicked() ), this, SLOT( browseAutoStButton_slot() ) ); | ||
173 | connect( selEntrFontButton, SIGNAL( clicked() ), this, SLOT( selEntrFontButton_slot() ) ); | ||
174 | connect( trayCheckBox, SIGNAL( toggled(bool) ), autoMinimizeCheckBox, SLOT( setEnabled(bool) ) ); | ||
175 | |||
176 | // tab order | ||
177 | setTabOrder( pwTimeoutSpinBox, trayCheckBox ); | ||
178 | setTabOrder( trayCheckBox, okButton ); | ||
179 | setTabOrder( okButton, cancelButton ); | ||
180 | } | ||
181 | |||
182 | /* | ||
183 | * Destroys the object and frees any allocated resources | ||
184 | */ | ||
185 | configWnd::~configWnd() | ||
186 | { | ||
187 | // no need to delete child widgets, Qt does it all for us | ||
188 | } | ||
189 | |||
190 | /* | ||
191 | * Sets the strings of the subwidgets using the current | ||
192 | * language. | ||
193 | */ | ||
194 | void configWnd::languageChange() | ||
195 | { | ||
196 | setCaption( tr( "PwManager Configuration" ) ); | ||
197 | okButton->setText( tr( "&OK" ) ); | ||
198 | //US ENH okButton->setAccel( QKeySequence( tr( "Alt+O" ) ) ); | ||
199 | cancelButton->setText( tr( "&Cancel" ) ); | ||
200 | //US ENH cancelButton->setAccel( QKeySequence( tr( "Alt+C" ) ) ); | ||
201 | windowStyleComboBox->clear(); | ||
202 | windowStyleComboBox->insertItem( tr( "Category on top" ) ); | ||
203 | windowStyleComboBox->insertItem( tr( "Category-list left" ) ); | ||
204 | textLabel1_5->setText( tr( "Window-style:" ) ); | ||
205 | textLabel1_4->setText( tr( "Font for the password entries:" ) ); | ||
206 | selEntrFontButton->setText( tr( "select Font" ) ); | ||
207 | currEntrFont->setText( QString::null ); | ||
208 | tabWidget2->changeTab( tab, tr( "Look && feel" ) ); | ||
209 | compressionComboBox->clear(); | ||
210 | compressionComboBox->insertItem( tr( "none" ) ); | ||
211 | compressionComboBox->insertItem( tr( "gzip" ) ); | ||
212 | compressionComboBox->insertItem( tr( "bzip2" ) ); | ||
213 | textLabel1_6->setText( tr( "*.pwm file compression:" ) ); | ||
214 | textLabel1_8->setText( tr( "permissions:" ) ); | ||
215 | fileBackupCheckBox->setText( tr( "Make file backup before saving" ) ); | ||
216 | tabWidget2->changeTab( TabPage, tr( "File" ) ); | ||
217 | textLabel1->setText( tr( "Password timeout (timeout to hold password in memory, so you don't have to re-enter it, if you already have entered it) [set to 0 to disable]:" ) ); | ||
218 | textLabel1_7->setText( tr( "Auto-lock timeout (auto lock document after this amount of seconds) [set to 0 to disable]:" ) ); | ||
219 | autoDeepLockCheckBox->setText( tr( "deep-lock on autolock" ) ); | ||
220 | tabWidget2->changeTab( tab_2, tr( "Timeout" ) ); | ||
221 | textLabel1_3->setText( tr( "Open this file automatically on startup:" ) ); | ||
222 | browseAutoStButton->setText( tr( "..." ) ); | ||
223 | autostartDeeplockedCheckBox->setText( tr( "open deeplocked" ) ); | ||
224 | tabWidget2->changeTab( tab_3, tr( "Autostart" ) ); | ||
225 | textLabel2->setText( tr( "Favourite browser:" ) ); | ||
226 | textLabel3->setText( tr( "Favourite X-terminal:" ) ); | ||
227 | tabWidget2->changeTab( tab_4, tr( "External apps" ) ); | ||
228 | trayCheckBox->setText( tr( "Show icon in system-tray" ) ); | ||
229 | openUnlockedCheckBox->setText( tr( "Open document with passwords unlocked" ) ); | ||
230 | autoMinimizeCheckBox->setText( tr( "auto-minimize to tray on startup" ) ); | ||
231 | minimizeLockComboBox->clear(); | ||
232 | minimizeLockComboBox->insertItem( tr( "don't lock" ) ); | ||
233 | minimizeLockComboBox->insertItem( tr( "normal lock" ) ); | ||
234 | minimizeLockComboBox->insertItem( tr( "deep-lock" ) ); | ||
235 | textLabel1_9->setText( tr( "auto-lock on minimize:" ) ); | ||
236 | kwalletEmuCheckBox->setText( tr( "KWallet emulation" ) ); | ||
237 | wndCloseCheckBox->setText( tr( "Do not minimize windows into tray. (Close the window)" ) ); | ||
238 | tabWidget2->changeTab( tab_5, tr( "Miscellaneous" ) ); | ||
239 | } | ||
240 | |||
241 | void configWnd::okButton_slot() | ||
242 | { | ||
243 | qWarning( "configWnd::okButton_slot(): Not implemented yet" ); | ||
244 | } | ||
245 | |||
246 | void configWnd::cancelButton_slot() | ||
247 | { | ||
248 | qWarning( "configWnd::cancelButton_slot(): Not implemented yet" ); | ||
249 | } | ||
250 | |||
251 | void configWnd::browseBgButton_slot() | ||
252 | { | ||
253 | qWarning( "configWnd::browseBgButton_slot(): Not implemented yet" ); | ||
254 | } | ||
255 | |||
256 | void configWnd::browseAutoStButton_slot() | ||
257 | { | ||
258 | qWarning( "configWnd::browseAutoStButton_slot(): Not implemented yet" ); | ||
259 | } | ||
260 | |||
261 | void configWnd::selEntrFontButton_slot() | ||
262 | { | ||
263 | qWarning( "configWnd::selEntrFontButton_slot(): Not implemented yet" ); | ||
264 | } | ||
265 | |||
diff --git a/pwmanager/pwmanager/configwnd.h b/pwmanager/pwmanager/configwnd.h deleted file mode 100644 index 608a38b..0000000 --- a/pwmanager/pwmanager/configwnd.h +++ b/dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form interface generated from reading ui file 'configwnd.ui' | ||
3 | ** | ||
4 | ** Created: Tue Sep 14 15:20:50 2004 | ||
5 | ** by: The User Interface Compiler ($Id$) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | |||
10 | #ifndef CONFIGWND_H | ||
11 | #define CONFIGWND_H | ||
12 | |||
13 | #include <qvariant.h> | ||
14 | #include <qdialog.h> | ||
15 | |||
16 | class QVBoxLayout; | ||
17 | class QHBoxLayout; | ||
18 | class QGridLayout; | ||
19 | class QSpacerItem; | ||
20 | class QPushButton; | ||
21 | class QTabWidget; | ||
22 | class QWidget; | ||
23 | class QComboBox; | ||
24 | class QLabel; | ||
25 | class QLineEdit; | ||
26 | class QCheckBox; | ||
27 | class QSpinBox; | ||
28 | |||
29 | class configWnd : public QDialog | ||
30 | { | ||
31 | Q_OBJECT | ||
32 | |||
33 | public: | ||
34 | configWnd( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | ||
35 | ~configWnd(); | ||
36 | |||
37 | QPushButton* okButton; | ||
38 | QPushButton* cancelButton; | ||
39 | QTabWidget* tabWidget2; | ||
40 | QWidget* tab; | ||
41 | QComboBox* windowStyleComboBox; | ||
42 | QLabel* textLabel1_5; | ||
43 | QLabel* textLabel1_4; | ||
44 | QPushButton* selEntrFontButton; | ||
45 | QLabel* currEntrFont; | ||
46 | QWidget* TabPage; | ||
47 | QComboBox* compressionComboBox; | ||
48 | QLabel* textLabel1_6; | ||
49 | QLabel* textLabel1_8; | ||
50 | QLineEdit* permissionLineEdit; | ||
51 | QCheckBox* fileBackupCheckBox; | ||
52 | QWidget* tab_2; | ||
53 | QSpinBox* pwTimeoutSpinBox; | ||
54 | QLabel* textLabel1; | ||
55 | QLabel* textLabel1_7; | ||
56 | QSpinBox* lockTimeoutSpinBox; | ||
57 | QCheckBox* autoDeepLockCheckBox; | ||
58 | QWidget* tab_3; | ||
59 | QLabel* textLabel1_3; | ||
60 | QLineEdit* autoStartLineEdit; | ||
61 | QPushButton* browseAutoStButton; | ||
62 | QCheckBox* autostartDeeplockedCheckBox; | ||
63 | QWidget* tab_4; | ||
64 | QLabel* textLabel2; | ||
65 | QLineEdit* browserLineEdit; | ||
66 | QLineEdit* xtermLineEdit; | ||
67 | QLabel* textLabel3; | ||
68 | QWidget* tab_5; | ||
69 | QCheckBox* trayCheckBox; | ||
70 | QCheckBox* openUnlockedCheckBox; | ||
71 | QCheckBox* autoMinimizeCheckBox; | ||
72 | QComboBox* minimizeLockComboBox; | ||
73 | QLabel* textLabel1_9; | ||
74 | QCheckBox* kwalletEmuCheckBox; | ||
75 | QCheckBox* wndCloseCheckBox; | ||
76 | |||
77 | public slots: | ||
78 | virtual void okButton_slot(); | ||
79 | virtual void cancelButton_slot(); | ||
80 | virtual void browseBgButton_slot(); | ||
81 | virtual void browseAutoStButton_slot(); | ||
82 | virtual void selEntrFontButton_slot(); | ||
83 | |||
84 | protected: | ||
85 | |||
86 | protected slots: | ||
87 | virtual void languageChange(); | ||
88 | |||
89 | }; | ||
90 | |||
91 | #endif // CONFIGWND_H | ||
diff --git a/pwmanager/pwmanager/configwndimpl.cpp b/pwmanager/pwmanager/configwndimpl.cpp deleted file mode 100644 index 5440498..0000000 --- a/pwmanager/pwmanager/configwndimpl.cpp +++ b/dev/null | |||
@@ -1,136 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * copyright (C) 2003 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 | /*************************************************************************** | ||
14 | * copyright (C) 2004 by Ulf Schenk | ||
15 | * This file is originaly based on version 1.0.1 of pwmanager | ||
16 | * and was modified to run on embedded devices that run microkde | ||
17 | * | ||
18 | * $Id$ | ||
19 | **************************************************************************/ | ||
20 | |||
21 | #include "configwndimpl.h" | ||
22 | #include "pwm.h" | ||
23 | #include "configuration.h" | ||
24 | |||
25 | #include <qfileinfo.h> | ||
26 | #include <qlineedit.h> | ||
27 | |||
28 | #include <kstandarddirs.h> | ||
29 | #include <kfiledialog.h> | ||
30 | #include <klocale.h> | ||
31 | |||
32 | #include <stdlib.h> | ||
33 | #include <stdio.h> | ||
34 | |||
35 | #ifdef PWM_EMBEDDED | ||
36 | #include <kfontdialog.h> | ||
37 | #endif | ||
38 | |||
39 | ConfigWndImpl::ConfigWndImpl() | ||
40 | #ifdef PWM_EMBEDDED | ||
41 | : configWnd(0, "ConfigWndImpl", TRUE) | ||
42 | #endif | ||
43 | |||
44 | { | ||
45 | } | ||
46 | |||
47 | ConfigWndImpl::~ConfigWndImpl() | ||
48 | { | ||
49 | } | ||
50 | |||
51 | void ConfigWndImpl::okButton_slot() | ||
52 | { | ||
53 | done(0); | ||
54 | } | ||
55 | |||
56 | void ConfigWndImpl::cancelButton_slot() | ||
57 | { | ||
58 | done(1); | ||
59 | } | ||
60 | |||
61 | void ConfigWndImpl::browseAutoStButton_slot() | ||
62 | { | ||
63 | #ifndef PWM_EMBEDDED | ||
64 | QString path(KFileDialog::getOpenFileName(QString::null, | ||
65 | i18n("*.pwm|PwM Password file\n" | ||
66 | "*|All files"), this)); | ||
67 | #else | ||
68 | QString path = locateLocal( "data", KGlobal::getAppName() + "/*.pwm"); | ||
69 | path = KFileDialog::getOpenFileName(path, | ||
70 | i18n("password filename(*.pwm)"), this); | ||
71 | #endif | ||
72 | if (path != QString::null) | ||
73 | autoStartLineEdit->setText(path); | ||
74 | } | ||
75 | |||
76 | void ConfigWndImpl::selEntrFontButton_slot() | ||
77 | { | ||
78 | bool ok; | ||
79 | #ifndef PWM_EMBEDDED | ||
80 | QFont fnt = QFontDialog::getFont(&ok, currentEntryFont, this); | ||
81 | #else | ||
82 | QFont fnt = KFontDialog::getFont(currentEntryFont, ok); | ||
83 | #endif | ||
84 | if (!ok) | ||
85 | return; | ||
86 | currEntrFont->setFont(fnt); | ||
87 | currEntrFont->setText(fnt.family()); | ||
88 | currentEntryFont = fnt; | ||
89 | } | ||
90 | |||
91 | int ConfigWndImpl::getFilePermissions() | ||
92 | { | ||
93 | char octalDigits[] = "01234567"; | ||
94 | bool isOctal; | ||
95 | QString permString(permissionLineEdit->text()); | ||
96 | int i, j, length = permString.length(); | ||
97 | if (length != 3) { | ||
98 | printWarn("Wrong permission string length! Please enter " | ||
99 | "the string like the following example: 600"); | ||
100 | return CONF_DEFAULT_FILEPERMISSIONS; | ||
101 | } | ||
102 | for (i = 0; i < length; ++i) { | ||
103 | isOctal = false; | ||
104 | for (j = 0; j < 8; ++j) { | ||
105 | if (permString.at(i) == octalDigits[j]) { | ||
106 | isOctal = true; | ||
107 | break; | ||
108 | } | ||
109 | } | ||
110 | if (!isOctal) { | ||
111 | printWarn("CONFIG: File-permissions: This is " | ||
112 | "not an octal number "); | ||
113 | return CONF_DEFAULT_FILEPERMISSIONS; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | int ret = strtol(permString.latin1(), 0, 8); | ||
118 | if (ret == 0) { | ||
119 | /* either an error occured, or the user did really type 000 */ | ||
120 | printWarn("CONFIG: File-permissions: Hm, either conversion error, " | ||
121 | "or you really typed 000. 8-)"); | ||
122 | return CONF_DEFAULT_FILEPERMISSIONS; | ||
123 | } | ||
124 | return ret; | ||
125 | } | ||
126 | |||
127 | void ConfigWndImpl::setFilePermissions(int perm) | ||
128 | { | ||
129 | char tmpBuf[30]; | ||
130 | sprintf(tmpBuf, "%o", perm); | ||
131 | permissionLineEdit->setText(tmpBuf); | ||
132 | } | ||
133 | |||
134 | #ifndef PWM_EMBEDDED | ||
135 | #include "configwndimpl.moc" | ||
136 | #endif | ||
diff --git a/pwmanager/pwmanager/configwndimpl.h b/pwmanager/pwmanager/configwndimpl.h deleted file mode 100644 index f67f459..0000000 --- a/pwmanager/pwmanager/configwndimpl.h +++ b/dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * copyright (C) 2003 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 | /*************************************************************************** | ||
14 | * copyright (C) 2004 by Ulf Schenk | ||
15 | * This file is originaly based on version 1.0.1 of pwmanager | ||
16 | * and was modified to run on embedded devices that run microkde | ||
17 | * | ||
18 | * $Id$ | ||
19 | **************************************************************************/ | ||
20 | |||
21 | #ifndef CONFIGWNDIMPL_H | ||
22 | #define CONFIGWNDIMPL_H | ||
23 | |||
24 | #include <qfontdialog.h> | ||
25 | |||
26 | #include "configwnd.h" | ||
27 | |||
28 | /** "add" Window */ | ||
29 | class ConfigWndImpl : public configWnd | ||
30 | { | ||
31 | Q_OBJECT | ||
32 | public: | ||
33 | ConfigWndImpl(); | ||
34 | ~ConfigWndImpl(); | ||
35 | |||
36 | /** currently selected entry-font */ | ||
37 | QFont currentEntryFont; | ||
38 | |||
39 | /** gets the content of permissionLineEdit */ | ||
40 | int getFilePermissions(); | ||
41 | /** sets the content of permissionLineEdit */ | ||
42 | void setFilePermissions(int perm); | ||
43 | |||
44 | public slots: | ||
45 | /** OK button pressed */ | ||
46 | void okButton_slot(); | ||
47 | /** cancel button pressed */ | ||
48 | void cancelButton_slot(); | ||
49 | /** browse autostart file button pressed */ | ||
50 | void browseAutoStButton_slot(); | ||
51 | /** select entry-font button pressed */ | ||
52 | void selEntrFontButton_slot(); | ||
53 | }; | ||
54 | |||
55 | #endif | ||