author | ulf69 <ulf69> | 2004-10-16 01:02:53 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-10-16 01:02:53 (UTC) |
commit | 9c82c0ed220d9efe16ea383e65f760f01492787d (patch) (unidiff) | |
tree | 2aedddfad3e72de7c2c92ff216d7df2cc83fe258 | |
parent | 1821dcc08c8f6f2bc0fdb991c335ed03262d1443 (diff) | |
download | kdepimpi-9c82c0ed220d9efe16ea383e65f760f01492787d.zip kdepimpi-9c82c0ed220d9efe16ea383e65f760f01492787d.tar.gz kdepimpi-9c82c0ed220d9efe16ea383e65f760f01492787d.tar.bz2 |
added configsettings for crypt ans hash algo
-rw-r--r-- | pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp | 51 | ||||
-rw-r--r-- | pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.h | 8 |
2 files changed, 53 insertions, 6 deletions
diff --git a/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp b/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp index 8afea76..525bdaa 100644 --- a/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp +++ b/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp | |||
@@ -1,302 +1,343 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qframe.h> | 25 | #include <qframe.h> |
26 | #include <qgroupbox.h> | 26 | #include <qgroupbox.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qtabwidget.h> | 29 | #include <qtabwidget.h> |
30 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qspinbox.h> | 32 | #include <qspinbox.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qvbox.h> | 35 | #include <qvbox.h> |
36 | 36 | ||
37 | #include <kconfig.h> | 37 | #include <kconfig.h> |
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <kdialog.h> | 39 | #include <kdialog.h> |
40 | #include <klistview.h> | 40 | #include <klistview.h> |
41 | #include <klocale.h> | 41 | #include <klocale.h> |
42 | #include <kglobal.h> | 42 | #include <kglobal.h> |
43 | #include <kmessagebox.h> | 43 | #include <kmessagebox.h> |
44 | #include <kstandarddirs.h> | 44 | #include <kstandarddirs.h> |
45 | #include <kio/kfile/kurlrequester.h> | 45 | #include <kio/kfile/kurlrequester.h> |
46 | 46 | ||
47 | #include "pwmprefs.h" | 47 | #include "pwmprefs.h" |
48 | 48 | ||
49 | #include "pwmconfigwidget.h" | 49 | #include "pwmconfigwidget.h" |
50 | #include "pwmexception.h" | 50 | #include "pwmexception.h" |
51 | 51 | ||
52 | PWMConfigWidget::PWMConfigWidget(PWMPrefs *prefs, QWidget *parent, const char *name ) | 52 | PWMConfigWidget::PWMConfigWidget(PWMPrefs *prefs, QWidget *parent, const char *name ) |
53 | : KPrefsWidget(prefs, parent, name ) | 53 | : KPrefsWidget(prefs, parent, name ) |
54 | { | 54 | { |
55 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 55 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
56 | KDialog::spacingHint() ); | 56 | KDialog::spacingHint() ); |
57 | 57 | ||
58 | QTabWidget *tabWidget = new QTabWidget( this ); | 58 | QTabWidget *tabWidget = new QTabWidget( this ); |
59 | topLayout->addWidget( tabWidget ); | 59 | topLayout->addWidget( tabWidget ); |
60 | 60 | ||
61 | // windowsStyle page | 61 | // windowsStyle page |
62 | ////////////////////////////////////////////////////// | 62 | ////////////////////////////////////////////////////// |
63 | QWidget *windowStylePage = new QWidget( this ); | 63 | QWidget *windowStylePage = new QWidget( this ); |
64 | QGridLayout *windowStyleLayout = new QGridLayout( windowStylePage, 3, 3); | 64 | QGridLayout *windowStyleLayout = new QGridLayout( windowStylePage, 3, 3); |
65 | 65 | ||
66 | int i = 0; | 66 | int i = 0; |
67 | KPrefsWidRadios * windowStyle = addWidRadios(i18n("Window-style:") ,&(prefs->mMainViewStyle), windowStylePage); | 67 | KPrefsWidRadios * windowStyle = addWidRadios(i18n("Window-style:") ,&(prefs->mMainViewStyle), windowStylePage); |
68 | windowStyle->addRadio(i18n("Category on top")); | 68 | windowStyle->addRadio(i18n("Category on top")); |
69 | windowStyle->addRadio(i18n("Category-list left/top")); | 69 | windowStyle->addRadio(i18n("Category-list left/top")); |
70 | windowStyleLayout->addMultiCellWidget( (QWidget*)windowStyle->groupBox(),i,i,0,2); | 70 | windowStyleLayout->addMultiCellWidget( (QWidget*)windowStyle->groupBox(),i,i,0,2); |
71 | ++i; | 71 | ++i; |
72 | 72 | ||
73 | KPrefsWidFont *selEntrFont = | 73 | KPrefsWidFont *selEntrFont = |
74 | addWidFont(i18n("Password"),i18n("Font for Pw entries:"), | 74 | addWidFont(i18n("Password"),i18n("Font for Pw entries:"), |
75 | &(prefs->mEntryFont),windowStylePage); | 75 | &(prefs->mEntryFont),windowStylePage); |
76 | windowStyleLayout->addWidget(selEntrFont->label(),i,0); | 76 | windowStyleLayout->addWidget(selEntrFont->label(),i,0); |
77 | windowStyleLayout->addWidget(selEntrFont->preview(),i,1); | 77 | windowStyleLayout->addWidget(selEntrFont->preview(),i,1); |
78 | windowStyleLayout->addWidget(selEntrFont->button(),i,2); | 78 | windowStyleLayout->addWidget(selEntrFont->button(),i,2); |
79 | ++i; | 79 | ++i; |
80 | 80 | ||
81 | 81 | ||
82 | // File page | 82 | // File page |
83 | ////////////////////////////////////////////////////// | 83 | ////////////////////////////////////////////////////// |
84 | QWidget *filePage = new QWidget( this ); | 84 | QWidget *filePage = new QWidget( this ); |
85 | QGridLayout *fileLayout = new QGridLayout( filePage, 3, 2); | 85 | QGridLayout *fileLayout = new QGridLayout( filePage, 3, 2); |
86 | 86 | ||
87 | i = 0; | 87 | i = 0; |
88 | KPrefsWidRadios * compr = addWidRadios(i18n("Compression:") ,&(prefs->mCompression), filePage); | 88 | QLabel* kcfg_compression_label = new QLabel(i18n("Compression:"), filePage); |
89 | compr->addRadio(i18n("none")); | 89 | fileLayout->addWidget(kcfg_compression_label,i,0); |
90 | compr->addRadio(i18n("gzip")); | 90 | kcfg_compression = new QComboBox(filePage, "kcfg_compression"); |
91 | compr->addRadio(i18n("bzip2")); | 91 | kcfg_compression->insertItem(i18n("None")); |
92 | fileLayout->addMultiCellWidget( (QWidget*)compr->groupBox(),i,i,0,1); | 92 | kcfg_compression->insertItem(i18n("gzip")); |
93 | //US not yet supported: kcfg_compression->insertItem(i18n("bzip2")); | ||
94 | fileLayout->addWidget( kcfg_compression,i,1); | ||
95 | ++i; | ||
96 | |||
97 | QLabel* kcfg_crypt_label = new QLabel(i18n("Encryption:"), filePage); | ||
98 | fileLayout->addWidget(kcfg_crypt_label,i,0); | ||
99 | kcfg_cryptAlgo = new QComboBox(filePage, "kcfg_cryptAlgo"); | ||
100 | kcfg_cryptAlgo->insertItem(i18n("Blowfish (128 bit)")); | ||
101 | #ifdef CONFIG_PWMANAGER_GCRY | ||
102 | kcfg_cryptAlgo->insertItem(i18n("AES-128, Rijndael (128 bit)")); | ||
103 | kcfg_cryptAlgo->insertItem(i18n("AES-192, Rijndael (192 bit)")); | ||
104 | kcfg_cryptAlgo->insertItem(i18n("AES-256, Rijndael (256 bit)")); | ||
105 | kcfg_cryptAlgo->insertItem(i18n("Triple-DES (168 bit)")); | ||
106 | kcfg_cryptAlgo->insertItem(i18n("Twofish (256 bit)")); | ||
107 | kcfg_cryptAlgo->insertItem(i18n("Twofish-128 (128 bit)")); | ||
108 | #endif // CONFIG_PWMANAGER_GCRY | ||
109 | fileLayout->addWidget( kcfg_cryptAlgo,i,1); | ||
110 | ++i; | ||
111 | |||
112 | QLabel* kcfg_hash_label = new QLabel(i18n("Hashing:"), filePage); | ||
113 | fileLayout->addWidget(kcfg_hash_label,i,0); | ||
114 | kcfg_hashAlgo = new QComboBox(filePage, "kcfg_hashAlgo"); | ||
115 | kcfg_hashAlgo->insertItem(i18n("SHA-160, SHA1 (160 bit)")); | ||
116 | #ifdef CONFIG_PWMANAGER_GCRY | ||
117 | kcfg_hashAlgo->insertItem(i18n("SHA-256 (256 bit)")); | ||
118 | kcfg_hashAlgo->insertItem(i18n("SHA-384 (384 bit)")); | ||
119 | kcfg_hashAlgo->insertItem(i18n("SHA-512 (512 bit)")); | ||
120 | kcfg_hashAlgo->insertItem(i18n("MD5 (128 bit)")); | ||
121 | kcfg_hashAlgo->insertItem(i18n("RIPE-MD-160 (160 bit)")); | ||
122 | kcfg_hashAlgo->insertItem(i18n("Tiger (192 bit)")); | ||
123 | #endif // CONFIG_PWMANAGER_GCRY | ||
124 | fileLayout->addWidget( kcfg_hashAlgo,i,1); | ||
93 | ++i; | 125 | ++i; |
94 | 126 | ||
95 | permissionLineEdit = new QLineEdit(filePage); | 127 | permissionLineEdit = new QLineEdit(filePage); |
96 | QLabel* permissionLineLabel = new QLabel(permissionLineEdit, i18n("Permissions:"), filePage); | 128 | QLabel* permissionLineLabel = new QLabel(permissionLineEdit, i18n("Permissions:"), filePage); |
97 | fileLayout->addWidget(permissionLineLabel,i,0); | 129 | fileLayout->addWidget(permissionLineLabel,i,0); |
98 | fileLayout->addWidget(permissionLineEdit,i,1); | 130 | fileLayout->addWidget(permissionLineEdit,i,1); |
99 | ++i; | 131 | ++i; |
100 | 132 | ||
101 | KPrefsWidBool *sb = addWidBool(i18n("Make backup before saving"), | 133 | KPrefsWidBool *sb = addWidBool(i18n("Make backup before saving"), |
102 | &(prefs->mMakeFileBackup),filePage); | 134 | &(prefs->mMakeFileBackup),filePage); |
103 | fileLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 135 | fileLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
104 | ++i; | 136 | ++i; |
105 | 137 | ||
106 | // Timeout page | 138 | // Timeout page |
107 | ////////////////////////////////////////////////////// | 139 | ////////////////////////////////////////////////////// |
108 | QWidget *timeoutPage = new QWidget( this ); | 140 | QWidget *timeoutPage = new QWidget( this ); |
109 | QGridLayout *timeoutLayout = new QGridLayout( timeoutPage, 3, 2); | 141 | QGridLayout *timeoutLayout = new QGridLayout( timeoutPage, 3, 2); |
110 | 142 | ||
111 | i = 0; | 143 | i = 0; |
112 | pwTimeoutSpinBox = new QSpinBox( timeoutPage, "pwTimeoutSpinBox" ); | 144 | pwTimeoutSpinBox = new QSpinBox( timeoutPage, "pwTimeoutSpinBox" ); |
113 | QLabel* timeoutLabel = new QLabel(pwTimeoutSpinBox, i18n("Password timeout\n(timeout to hold password in\nmemory,so you don't have to\nre-enter it,if you\nalready have entered it)\n[set to 0 to disable]:"), timeoutPage); | 145 | QLabel* timeoutLabel = new QLabel(pwTimeoutSpinBox, i18n("Password timeout\n(timeout to hold password in\nmemory,so you don't have to\nre-enter it,if you\nalready have entered it)\n[set to 0 to disable]:"), timeoutPage); |
114 | timeoutLayout->addMultiCellWidget(timeoutLabel,i, i, 0 ,0); | 146 | timeoutLayout->addMultiCellWidget(timeoutLabel,i, i, 0 ,0); |
115 | timeoutLayout->addWidget(pwTimeoutSpinBox,i,1); | 147 | timeoutLayout->addWidget(pwTimeoutSpinBox,i,1); |
116 | ++i; | 148 | ++i; |
117 | 149 | ||
118 | lockTimeoutSpinBox = new QSpinBox( timeoutPage, "lockTimeoutSpinBox" ); | 150 | lockTimeoutSpinBox = new QSpinBox( timeoutPage, "lockTimeoutSpinBox" ); |
119 | QLabel* lockTimeoutLabel = new QLabel(lockTimeoutSpinBox, i18n("Auto-lock timeout\n(auto lock document after this\namount of seconds)\n[set to 0 to disable]:"), timeoutPage); | 151 | QLabel* lockTimeoutLabel = new QLabel(lockTimeoutSpinBox, i18n("Auto-lock timeout\n(auto lock document after this\namount of seconds)\n[set to 0 to disable]:"), timeoutPage); |
120 | timeoutLayout->addMultiCellWidget(lockTimeoutLabel,i, i, 0 ,0); | 152 | timeoutLayout->addMultiCellWidget(lockTimeoutLabel,i, i, 0 ,0); |
121 | timeoutLayout->addWidget(lockTimeoutSpinBox,i,1); | 153 | timeoutLayout->addWidget(lockTimeoutSpinBox,i,1); |
122 | ++i; | 154 | ++i; |
123 | 155 | ||
124 | sb = addWidBool(i18n("deep-lock on autolock"), | 156 | sb = addWidBool(i18n("deep-lock on autolock"), |
125 | &(prefs->mAutoDeeplock),timeoutPage); | 157 | &(prefs->mAutoDeeplock),timeoutPage); |
126 | timeoutLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 158 | timeoutLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
127 | ++i; | 159 | ++i; |
128 | 160 | ||
129 | 161 | ||
130 | // Autostart page | 162 | // Autostart page |
131 | ////////////////////////////////////////////////////// | 163 | ////////////////////////////////////////////////////// |
132 | QWidget *autostartPage = new QWidget( this ); | 164 | QWidget *autostartPage = new QWidget( this ); |
133 | QGridLayout *autostartLayout = new QGridLayout( autostartPage, 3, 2); | 165 | QGridLayout *autostartLayout = new QGridLayout( autostartPage, 3, 2); |
134 | 166 | ||
135 | i = 0; | 167 | i = 0; |
136 | 168 | ||
137 | autostartLineEdit = new KURLRequester(autostartPage, "autoStartLineEdit"); | 169 | autostartLineEdit = new KURLRequester(autostartPage, "autoStartLineEdit"); |
138 | QLabel* autostartLineLabel = new QLabel(autostartLineEdit, "Open this file automatically on startup:",autostartPage); | 170 | QLabel* autostartLineLabel = new QLabel(autostartLineEdit, "Open this file automatically on startup:",autostartPage); |
139 | autostartLayout->addMultiCellWidget(autostartLineLabel,i,i,0,1); | 171 | autostartLayout->addMultiCellWidget(autostartLineLabel,i,i,0,1); |
140 | ++i; | 172 | ++i; |
141 | autostartLayout->addMultiCellWidget(autostartLineEdit,i,i,0,1); | 173 | autostartLayout->addMultiCellWidget(autostartLineEdit,i,i,0,1); |
142 | ++i; | 174 | ++i; |
143 | 175 | ||
144 | sb = addWidBool(i18n("open deeplocked"), | 176 | sb = addWidBool(i18n("open deeplocked"), |
145 | &(prefs->mAutostartDeeplocked),autostartPage); | 177 | &(prefs->mAutostartDeeplocked),autostartPage); |
146 | autostartLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 178 | autostartLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
147 | ++i; | 179 | ++i; |
148 | 180 | ||
149 | 181 | ||
150 | // external app page | 182 | // external app page |
151 | ////////////////////////////////////////////////////// | 183 | ////////////////////////////////////////////////////// |
152 | QWidget *externalappPage = new QWidget( this ); | 184 | QWidget *externalappPage = new QWidget( this ); |
153 | QGridLayout *externalappLayout = new QGridLayout( externalappPage, 3, 2); | 185 | QGridLayout *externalappLayout = new QGridLayout( externalappPage, 3, 2); |
154 | 186 | ||
155 | i = 0; | 187 | i = 0; |
156 | 188 | ||
157 | browserLineEdit = new QLineEdit(externalappPage); | 189 | browserLineEdit = new QLineEdit(externalappPage); |
158 | QLabel* browserLineLabel = new QLabel(browserLineEdit, i18n("Favourite browser:"), externalappPage); | 190 | QLabel* browserLineLabel = new QLabel(browserLineEdit, i18n("Favourite browser:"), externalappPage); |
159 | externalappLayout->addWidget(browserLineLabel,i,0); | 191 | externalappLayout->addWidget(browserLineLabel,i,0); |
160 | externalappLayout->addWidget(browserLineEdit,i,1); | 192 | externalappLayout->addWidget(browserLineEdit,i,1); |
161 | ++i; | 193 | ++i; |
162 | 194 | ||
163 | xtermLineEdit = new QLineEdit(externalappPage); | 195 | xtermLineEdit = new QLineEdit(externalappPage); |
164 | QLabel* xtermLineLabel = new QLabel(xtermLineEdit, i18n("Favourite x-terminal:"), externalappPage); | 196 | QLabel* xtermLineLabel = new QLabel(xtermLineEdit, i18n("Favourite x-terminal:"), externalappPage); |
165 | externalappLayout->addWidget(xtermLineLabel,i,0); | 197 | externalappLayout->addWidget(xtermLineLabel,i,0); |
166 | externalappLayout->addWidget(xtermLineEdit,i,1); | 198 | externalappLayout->addWidget(xtermLineEdit,i,1); |
167 | ++i; | 199 | ++i; |
168 | 200 | ||
169 | 201 | ||
170 | // miscelaneous page | 202 | // miscelaneous page |
171 | ////////////////////////////////////////////////////// | 203 | ////////////////////////////////////////////////////// |
172 | QWidget *miscPage = new QWidget( this ); | 204 | QWidget *miscPage = new QWidget( this ); |
173 | QGridLayout *miscLayout = new QGridLayout( miscPage, 3, 2); | 205 | QGridLayout *miscLayout = new QGridLayout( miscPage, 3, 2); |
174 | 206 | ||
175 | i = 0; | 207 | i = 0; |
176 | 208 | ||
177 | sb = addWidBool(i18n("Show icon in system-tray"),&(prefs->mTray),miscPage); | 209 | sb = addWidBool(i18n("Show icon in system-tray"),&(prefs->mTray),miscPage); |
178 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 210 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
179 | ++i; | 211 | ++i; |
180 | 212 | ||
181 | 213 | ||
182 | sb = addWidBool(i18n("Open document with passwords unlocked"),&(prefs->mUnlockOnOpen),miscPage); | 214 | sb = addWidBool(i18n("Open document with passwords unlocked"),&(prefs->mUnlockOnOpen),miscPage); |
183 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 215 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
184 | ++i; | 216 | ++i; |
185 | 217 | ||
186 | sb = addWidBool(i18n("auto-minimize to tray on startup"),&(prefs->mAutoMinimizeOnStart),miscPage); | 218 | sb = addWidBool(i18n("auto-minimize to tray on startup"),&(prefs->mAutoMinimizeOnStart),miscPage); |
187 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 219 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
188 | sb->checkBox()->setEnabled (FALSE); | 220 | sb->checkBox()->setEnabled (FALSE); |
189 | ++i; | 221 | ++i; |
190 | 222 | ||
191 | KPrefsWidRadios * minimizeRadio = addWidRadios(i18n("auto-lock on minimize:") ,&(prefs->mMinimizeLock), miscPage); | 223 | KPrefsWidRadios * minimizeRadio = addWidRadios(i18n("auto-lock on minimize:") ,&(prefs->mMinimizeLock), miscPage); |
192 | minimizeRadio->addRadio(i18n("don't lock")); | 224 | minimizeRadio->addRadio(i18n("don't lock")); |
193 | minimizeRadio->addRadio(i18n("normal lock")); | 225 | minimizeRadio->addRadio(i18n("normal lock")); |
194 | minimizeRadio->addRadio(i18n("deep-lock")); | 226 | minimizeRadio->addRadio(i18n("deep-lock")); |
195 | miscLayout->addMultiCellWidget( (QWidget*)minimizeRadio->groupBox(),i,i,0,2); | 227 | miscLayout->addMultiCellWidget( (QWidget*)minimizeRadio->groupBox(),i,i,0,2); |
196 | ++i; | 228 | ++i; |
197 | 229 | ||
198 | sb = addWidBool(i18n("KWallet emulation"),&(prefs->mKWalletEmu),miscPage); | 230 | sb = addWidBool(i18n("KWallet emulation"),&(prefs->mKWalletEmu),miscPage); |
199 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 231 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
200 | ++i; | 232 | ++i; |
201 | 233 | ||
202 | sb = addWidBool(i18n("Close instead Minimize into tray"),&(prefs->mClose),miscPage); | 234 | sb = addWidBool(i18n("Close instead Minimize into tray"),&(prefs->mClose),miscPage); |
203 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 235 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
204 | ++i; | 236 | ++i; |
205 | 237 | ||
206 | 238 | ||
207 | 239 | ||
208 | tabWidget->addTab( windowStylePage, i18n( "Look && feel" ) ); | 240 | tabWidget->addTab( windowStylePage, i18n( "Look && feel" ) ); |
209 | tabWidget->addTab( filePage, i18n( "File" ) ); | 241 | tabWidget->addTab( filePage, i18n( "File" ) ); |
210 | tabWidget->addTab( timeoutPage, i18n( "Timeout" ) ); | 242 | tabWidget->addTab( timeoutPage, i18n( "Timeout" ) ); |
211 | tabWidget->addTab( autostartPage, i18n( "Autostart" ) ); | 243 | tabWidget->addTab( autostartPage, i18n( "Autostart" ) ); |
212 | tabWidget->addTab( externalappPage, i18n( "External apps" ) ); | 244 | tabWidget->addTab( externalappPage, i18n( "External apps" ) ); |
213 | tabWidget->addTab( miscPage, i18n( "Miscellaneous" ) ); | 245 | tabWidget->addTab( miscPage, i18n( "Miscellaneous" ) ); |
214 | 246 | ||
215 | 247 | ||
216 | connect( permissionLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); | 248 | connect( permissionLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); |
217 | connect( pwTimeoutSpinBox, SIGNAL( valueChanged(int) ), this, SLOT( modified() ) ); | 249 | connect( pwTimeoutSpinBox, SIGNAL( valueChanged(int) ), this, SLOT( modified() ) ); |
218 | connect( lockTimeoutSpinBox, SIGNAL( valueChanged(int) ), this, SLOT( modified() ) ); | 250 | connect( lockTimeoutSpinBox, SIGNAL( valueChanged(int) ), this, SLOT( modified() ) ); |
219 | connect( autostartLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); | 251 | connect( autostartLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); |
220 | connect( browserLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); | 252 | connect( browserLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); |
221 | connect( xtermLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); | 253 | connect( xtermLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); |
222 | 254 | ||
223 | } | 255 | } |
224 | 256 | ||
225 | 257 | ||
226 | void PWMConfigWidget::usrReadConfig() | 258 | void PWMConfigWidget::usrReadConfig() |
227 | { | 259 | { |
228 | PWMPrefs* prefs = PWMPrefs::instance(); | 260 | PWMPrefs* prefs = PWMPrefs::instance(); |
229 | 261 | ||
262 | |||
230 | setFilePermissions(prefs->mFilePermissions); | 263 | setFilePermissions(prefs->mFilePermissions); |
231 | 264 | ||
232 | pwTimeoutSpinBox->setValue(prefs->mPwTimeout); | 265 | pwTimeoutSpinBox->setValue(prefs->mPwTimeout); |
233 | lockTimeoutSpinBox->setValue(prefs->mLockTimeout); | 266 | lockTimeoutSpinBox->setValue(prefs->mLockTimeout); |
234 | autostartLineEdit->setURL(prefs->mAutoStart); | 267 | autostartLineEdit->setURL(prefs->mAutoStart); |
235 | browserLineEdit->setText(prefs->mBrowserCommand); | 268 | browserLineEdit->setText(prefs->mBrowserCommand); |
236 | xtermLineEdit->setText(prefs->mXTermCommand); | 269 | xtermLineEdit->setText(prefs->mXTermCommand); |
237 | 270 | ||
271 | kcfg_compression->setCurrentItem(prefs->mCompression); | ||
272 | kcfg_cryptAlgo->setCurrentItem(prefs->mCryptAlgo); | ||
273 | kcfg_hashAlgo->setCurrentItem(prefs->mHashAlgo); | ||
238 | } | 274 | } |
239 | 275 | ||
240 | void PWMConfigWidget::usrWriteConfig() | 276 | void PWMConfigWidget::usrWriteConfig() |
241 | { | 277 | { |
242 | PWMPrefs* prefs = PWMPrefs::instance(); | 278 | PWMPrefs* prefs = PWMPrefs::instance(); |
243 | 279 | ||
244 | prefs->mFilePermissions = getFilePermissions(); | 280 | prefs->mFilePermissions = getFilePermissions(); |
245 | 281 | ||
246 | prefs->mPwTimeout = pwTimeoutSpinBox->value(); | 282 | prefs->mPwTimeout = pwTimeoutSpinBox->value(); |
247 | prefs->mLockTimeout = lockTimeoutSpinBox->value(); | 283 | prefs->mLockTimeout = lockTimeoutSpinBox->value(); |
248 | prefs->mAutoStart = autostartLineEdit->url(); | 284 | prefs->mAutoStart = autostartLineEdit->url(); |
249 | 285 | ||
250 | prefs->mBrowserCommand = browserLineEdit->text(); | 286 | prefs->mBrowserCommand = browserLineEdit->text(); |
251 | prefs->mXTermCommand = xtermLineEdit->text(); | 287 | prefs->mXTermCommand = xtermLineEdit->text(); |
288 | |||
289 | prefs->mCompression = kcfg_compression->currentItem(); | ||
290 | prefs->mCryptAlgo = kcfg_cryptAlgo->currentItem(); | ||
291 | prefs->mHashAlgo = kcfg_hashAlgo->currentItem(); | ||
292 | |||
252 | } | 293 | } |
253 | 294 | ||
254 | int PWMConfigWidget::getFilePermissions() | 295 | int PWMConfigWidget::getFilePermissions() |
255 | { | 296 | { |
256 | char octalDigits[] = "01234567"; | 297 | char octalDigits[] = "01234567"; |
257 | bool isOctal; | 298 | bool isOctal; |
258 | QString permString(permissionLineEdit->text()); | 299 | QString permString(permissionLineEdit->text()); |
259 | int i, j, length = permString.length(); | 300 | int i, j, length = permString.length(); |
260 | if (length != 3) { | 301 | if (length != 3) { |
261 | printWarn("Wrong permission string length! Please enter " | 302 | printWarn("Wrong permission string length! Please enter " |
262 | "the string like the following example: 600"); | 303 | "the string like the following example: 600"); |
263 | return CONF_DEFAULT_FILEPERMISSIONS; | 304 | return CONF_DEFAULT_FILEPERMISSIONS; |
264 | } | 305 | } |
265 | for (i = 0; i < length; ++i) { | 306 | for (i = 0; i < length; ++i) { |
266 | isOctal = false; | 307 | isOctal = false; |
267 | for (j = 0; j < 8; ++j) { | 308 | for (j = 0; j < 8; ++j) { |
268 | if (permString.at(i) == octalDigits[j]) { | 309 | if (permString.at(i) == octalDigits[j]) { |
269 | isOctal = true; | 310 | isOctal = true; |
270 | break; | 311 | break; |
271 | } | 312 | } |
272 | } | 313 | } |
273 | if (!isOctal) { | 314 | if (!isOctal) { |
274 | printWarn("CONFIG: File-permissions: This is " | 315 | printWarn("CONFIG: File-permissions: This is " |
275 | "not an octal number "); | 316 | "not an octal number "); |
276 | return CONF_DEFAULT_FILEPERMISSIONS; | 317 | return CONF_DEFAULT_FILEPERMISSIONS; |
277 | } | 318 | } |
278 | } | 319 | } |
279 | 320 | ||
280 | int ret = strtol(permString.latin1(), 0, 8); | 321 | int ret = strtol(permString.latin1(), 0, 8); |
281 | if (ret == 0) { | 322 | if (ret == 0) { |
282 | /* either an error occured, or the user did really type 000 */ | 323 | /* either an error occured, or the user did really type 000 */ |
283 | printWarn("CONFIG: File-permissions: Hm, either conversion error, " | 324 | printWarn("CONFIG: File-permissions: Hm, either conversion error, " |
284 | "or you really typed 000. 8-)"); | 325 | "or you really typed 000. 8-)"); |
285 | return CONF_DEFAULT_FILEPERMISSIONS; | 326 | return CONF_DEFAULT_FILEPERMISSIONS; |
286 | } | 327 | } |
287 | return ret; | 328 | return ret; |
288 | } | 329 | } |
289 | 330 | ||
290 | void PWMConfigWidget::setFilePermissions(int perm) | 331 | void PWMConfigWidget::setFilePermissions(int perm) |
291 | { | 332 | { |
292 | char tmpBuf[30]; | 333 | char tmpBuf[30]; |
293 | sprintf(tmpBuf, "%o", perm); | 334 | sprintf(tmpBuf, "%o", perm); |
294 | permissionLineEdit->setText(tmpBuf); | 335 | permissionLineEdit->setText(tmpBuf); |
295 | } | 336 | } |
296 | 337 | ||
297 | 338 | ||
298 | 339 | ||
299 | #ifndef PWM_EMBEDDED | 340 | #ifndef PWM_EMBEDDED |
300 | #include "pwmconfigwidget.moc" | 341 | #include "pwmconfigwidget.moc" |
301 | #endif //PWM_EMBEDDED | 342 | #endif //PWM_EMBEDDED |
302 | 343 | ||
diff --git a/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.h b/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.h index 1c7f5bf..0fad6af 100644 --- a/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.h +++ b/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.h | |||
@@ -1,61 +1,67 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of PwManager/Pi. | 2 | This file is part of PwManager/Pi. |
3 | Copyright (c) 2004 ulf Schenk | 3 | Copyright (c) 2004 ulf Schenk |
4 | 4 | ||
5 | program is free software; you can redistribute it and/or modify | 5 | program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | 22 | ||
23 | $Id$ | 23 | $Id$ |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #ifndef PWMCONFIGWIDGET_H | 26 | #ifndef PWMCONFIGWIDGET_H |
27 | #define PWMCONFIGWIDGET_H | 27 | #define PWMCONFIGWIDGET_H |
28 | 28 | ||
29 | #include <kprefswidget.h> | 29 | #include <kprefswidget.h> |
30 | 30 | ||
31 | class PWMPrefs; | 31 | class PWMPrefs; |
32 | class KURLRequester; | 32 | class KURLRequester; |
33 | class QComboBox; | ||
34 | |||
33 | 35 | ||
34 | class PWMConfigWidget : public KPrefsWidget | 36 | class PWMConfigWidget : public KPrefsWidget |
35 | { | 37 | { |
36 | Q_OBJECT | 38 | Q_OBJECT |
37 | 39 | ||
38 | public: | 40 | public: |
39 | PWMConfigWidget(PWMPrefs *prefs, QWidget *parent, const char *name = 0 ); | 41 | PWMConfigWidget(PWMPrefs *prefs, QWidget *parent, const char *name = 0 ); |
40 | 42 | ||
41 | protected: | 43 | protected: |
42 | /** Implement this to read custom configuration widgets. */ | 44 | /** Implement this to read custom configuration widgets. */ |
43 | virtual void usrReadConfig(); | 45 | virtual void usrReadConfig(); |
44 | /** Implement this to write custom configuration widgets. */ | 46 | /** Implement this to write custom configuration widgets. */ |
45 | virtual void usrWriteConfig(); | 47 | virtual void usrWriteConfig(); |
46 | 48 | ||
47 | private: | 49 | private: |
48 | QLineEdit* permissionLineEdit; | 50 | QLineEdit* permissionLineEdit; |
49 | QSpinBox* pwTimeoutSpinBox; | 51 | QSpinBox* pwTimeoutSpinBox; |
50 | QSpinBox* lockTimeoutSpinBox; | 52 | QSpinBox* lockTimeoutSpinBox; |
51 | KURLRequester* autostartLineEdit; | 53 | KURLRequester* autostartLineEdit; |
52 | QLineEdit* browserLineEdit; | 54 | QLineEdit* browserLineEdit; |
53 | QLineEdit* xtermLineEdit; | 55 | QLineEdit* xtermLineEdit; |
54 | 56 | QComboBox* kcfg_compression; | |
57 | QComboBox* kcfg_cryptAlgo; | ||
58 | QComboBox* kcfg_hashAlgo; | ||
59 | |||
60 | |||
55 | private: | 61 | private: |
56 | int getFilePermissions(); | 62 | int getFilePermissions(); |
57 | void setFilePermissions(int perm); | 63 | void setFilePermissions(int perm); |
58 | 64 | ||
59 | }; | 65 | }; |
60 | 66 | ||
61 | #endif | 67 | #endif |