-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 | |||
@@ -80,21 +80,53 @@ PWMConfigWidget::PWMConfigWidget(PWMPrefs *prefs, QWidget *parent, const char *n | |||
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 | ||
@@ -222,38 +254,47 @@ PWMConfigWidget::PWMConfigWidget(PWMPrefs *prefs, QWidget *parent, const char *n | |||
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(); |
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 | |||
@@ -25,16 +25,18 @@ | |||
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 | ||
@@ -46,16 +48,20 @@ class PWMConfigWidget : public KPrefsWidget | |||
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 |