-rw-r--r-- | pwmanager/pwmanager/configwndimpl.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pwmanager/pwmanager/configwndimpl.cpp b/pwmanager/pwmanager/configwndimpl.cpp index 595a6e7..5440498 100644 --- a/pwmanager/pwmanager/configwndimpl.cpp +++ b/pwmanager/pwmanager/configwndimpl.cpp | |||
@@ -5,129 +5,129 @@ | |||
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 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 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | 12 | ||
13 | /*************************************************************************** | 13 | /*************************************************************************** |
14 | * copyright (C) 2004 by Ulf Schenk | 14 | * copyright (C) 2004 by Ulf Schenk |
15 | * This file is originaly based on version 1.0.1 of pwmanager | 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 | 16 | * and was modified to run on embedded devices that run microkde |
17 | * | 17 | * |
18 | * $Id$ | 18 | * $Id$ |
19 | **************************************************************************/ | 19 | **************************************************************************/ |
20 | 20 | ||
21 | #include "configwndimpl.h" | 21 | #include "configwndimpl.h" |
22 | #include "pwm.h" | 22 | #include "pwm.h" |
23 | #include "configuration.h" | 23 | #include "configuration.h" |
24 | 24 | ||
25 | #include <qfileinfo.h> | 25 | #include <qfileinfo.h> |
26 | #include <qlineedit.h> | 26 | #include <qlineedit.h> |
27 | 27 | ||
28 | #include <kstandarddirs.h> | 28 | #include <kstandarddirs.h> |
29 | #include <kfiledialog.h> | 29 | #include <kfiledialog.h> |
30 | #include <klocale.h> | 30 | #include <klocale.h> |
31 | 31 | ||
32 | #include <stdlib.h> | 32 | #include <stdlib.h> |
33 | #include <stdio.h> | 33 | #include <stdio.h> |
34 | 34 | ||
35 | #ifdef PWM_EMBEDDED | 35 | #ifdef PWM_EMBEDDED |
36 | #include <kfontdialog.h> | 36 | #include <kfontdialog.h> |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | ConfigWndImpl::ConfigWndImpl() | 39 | ConfigWndImpl::ConfigWndImpl() |
40 | #ifdef PWM_EMBEDDED | 40 | #ifdef PWM_EMBEDDED |
41 | : configWnd(0, "ConfigWndImpl", TRUE) | 41 | : configWnd(0, "ConfigWndImpl", TRUE) |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | { | 44 | { |
45 | } | 45 | } |
46 | 46 | ||
47 | ConfigWndImpl::~ConfigWndImpl() | 47 | ConfigWndImpl::~ConfigWndImpl() |
48 | { | 48 | { |
49 | } | 49 | } |
50 | 50 | ||
51 | void ConfigWndImpl::okButton_slot() | 51 | void ConfigWndImpl::okButton_slot() |
52 | { | 52 | { |
53 | done(0); | 53 | done(0); |
54 | } | 54 | } |
55 | 55 | ||
56 | void ConfigWndImpl::cancelButton_slot() | 56 | void ConfigWndImpl::cancelButton_slot() |
57 | { | 57 | { |
58 | done(1); | 58 | done(1); |
59 | } | 59 | } |
60 | 60 | ||
61 | void ConfigWndImpl::browseAutoStButton_slot() | 61 | void ConfigWndImpl::browseAutoStButton_slot() |
62 | { | 62 | { |
63 | #ifndef PWM_EMBEDDED | 63 | #ifndef PWM_EMBEDDED |
64 | QString path(KFileDialog::getOpenFileName(QString::null, | 64 | QString path(KFileDialog::getOpenFileName(QString::null, |
65 | i18n("*.pwm|PwM Password file\n" | 65 | i18n("*.pwm|PwM Password file\n" |
66 | "*|All files"), this)); | 66 | "*|All files"), this)); |
67 | #else | 67 | #else |
68 | QString path = locateLocal( "data", KGlobal::getAppName() + "/*.pwm"); | 68 | QString path = locateLocal( "data", KGlobal::getAppName() + "/*.pwm"); |
69 | path = KFileDialog::getOpenFileName(filename, | 69 | path = KFileDialog::getOpenFileName(path, |
70 | i18n("password filename(*.pwm)"), this); | 70 | i18n("password filename(*.pwm)"), this); |
71 | #endif | 71 | #endif |
72 | if (path != QString::null) | 72 | if (path != QString::null) |
73 | autoStartLineEdit->setText(path); | 73 | autoStartLineEdit->setText(path); |
74 | } | 74 | } |
75 | 75 | ||
76 | void ConfigWndImpl::selEntrFontButton_slot() | 76 | void ConfigWndImpl::selEntrFontButton_slot() |
77 | { | 77 | { |
78 | bool ok; | 78 | bool ok; |
79 | #ifndef PWM_EMBEDDED | 79 | #ifndef PWM_EMBEDDED |
80 | QFont fnt = QFontDialog::getFont(&ok, currentEntryFont, this); | 80 | QFont fnt = QFontDialog::getFont(&ok, currentEntryFont, this); |
81 | #else | 81 | #else |
82 | QFont fnt = KFontDialog::getFont(currentEntryFont, ok); | 82 | QFont fnt = KFontDialog::getFont(currentEntryFont, ok); |
83 | #endif | 83 | #endif |
84 | if (!ok) | 84 | if (!ok) |
85 | return; | 85 | return; |
86 | currEntrFont->setFont(fnt); | 86 | currEntrFont->setFont(fnt); |
87 | currEntrFont->setText(fnt.family()); | 87 | currEntrFont->setText(fnt.family()); |
88 | currentEntryFont = fnt; | 88 | currentEntryFont = fnt; |
89 | } | 89 | } |
90 | 90 | ||
91 | int ConfigWndImpl::getFilePermissions() | 91 | int ConfigWndImpl::getFilePermissions() |
92 | { | 92 | { |
93 | char octalDigits[] = "01234567"; | 93 | char octalDigits[] = "01234567"; |
94 | bool isOctal; | 94 | bool isOctal; |
95 | QString permString(permissionLineEdit->text()); | 95 | QString permString(permissionLineEdit->text()); |
96 | int i, j, length = permString.length(); | 96 | int i, j, length = permString.length(); |
97 | if (length != 3) { | 97 | if (length != 3) { |
98 | printWarn("Wrong permission string length! Please enter " | 98 | printWarn("Wrong permission string length! Please enter " |
99 | "the string like the following example: 600"); | 99 | "the string like the following example: 600"); |
100 | return CONF_DEFAULT_FILEPERMISSIONS; | 100 | return CONF_DEFAULT_FILEPERMISSIONS; |
101 | } | 101 | } |
102 | for (i = 0; i < length; ++i) { | 102 | for (i = 0; i < length; ++i) { |
103 | isOctal = false; | 103 | isOctal = false; |
104 | for (j = 0; j < 8; ++j) { | 104 | for (j = 0; j < 8; ++j) { |
105 | if (permString.at(i) == octalDigits[j]) { | 105 | if (permString.at(i) == octalDigits[j]) { |
106 | isOctal = true; | 106 | isOctal = true; |
107 | break; | 107 | break; |
108 | } | 108 | } |
109 | } | 109 | } |
110 | if (!isOctal) { | 110 | if (!isOctal) { |
111 | printWarn("CONFIG: File-permissions: This is " | 111 | printWarn("CONFIG: File-permissions: This is " |
112 | "not an octal number "); | 112 | "not an octal number "); |
113 | return CONF_DEFAULT_FILEPERMISSIONS; | 113 | return CONF_DEFAULT_FILEPERMISSIONS; |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | int ret = strtol(permString.latin1(), 0, 8); | 117 | int ret = strtol(permString.latin1(), 0, 8); |
118 | if (ret == 0) { | 118 | if (ret == 0) { |
119 | /* either an error occured, or the user did really type 000 */ | 119 | /* either an error occured, or the user did really type 000 */ |
120 | printWarn("CONFIG: File-permissions: Hm, either conversion error, " | 120 | printWarn("CONFIG: File-permissions: Hm, either conversion error, " |
121 | "or you really typed 000. 8-)"); | 121 | "or you really typed 000. 8-)"); |
122 | return CONF_DEFAULT_FILEPERMISSIONS; | 122 | return CONF_DEFAULT_FILEPERMISSIONS; |
123 | } | 123 | } |
124 | return ret; | 124 | return ret; |
125 | } | 125 | } |
126 | 126 | ||
127 | void ConfigWndImpl::setFilePermissions(int perm) | 127 | void ConfigWndImpl::setFilePermissions(int perm) |
128 | { | 128 | { |
129 | char tmpBuf[30]; | 129 | char tmpBuf[30]; |
130 | sprintf(tmpBuf, "%o", perm); | 130 | sprintf(tmpBuf, "%o", perm); |
131 | permissionLineEdit->setText(tmpBuf); | 131 | permissionLineEdit->setText(tmpBuf); |
132 | } | 132 | } |
133 | 133 | ||