author | ulf69 <ulf69> | 2004-09-24 22:21:25 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-09-24 22:21:25 (UTC) |
commit | e695903cc49b33e63505b651b13d830e318fc29a (patch) (unidiff) | |
tree | fd210e2defbdcb3f3d9d739d0b00e6853705af29 | |
parent | a884dac6f756b3702a10ae97aa8782e4d2a84b20 (diff) | |
download | kdepimpi-e695903cc49b33e63505b651b13d830e318fc29a.zip kdepimpi-e695903cc49b33e63505b651b13d830e318fc29a.tar.gz kdepimpi-e695903cc49b33e63505b651b13d830e318fc29a.tar.bz2 |
fixed bug with QDomDocument handling, plus some GUI enhancements
-rw-r--r-- | pwmanager/pwmanager/pwmdocui.cpp | 8 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmexception.cpp | 7 | ||||
-rw-r--r-- | pwmanager/pwmanager/serializer.cpp | 12 |
3 files changed, 23 insertions, 4 deletions
diff --git a/pwmanager/pwmanager/pwmdocui.cpp b/pwmanager/pwmanager/pwmdocui.cpp index e42dd9d..5e675fc 100644 --- a/pwmanager/pwmanager/pwmdocui.cpp +++ b/pwmanager/pwmanager/pwmdocui.cpp | |||
@@ -431,27 +431,27 @@ QString PwMDocUi::string_locked() | |||
431 | { | 431 | { |
432 | return i18n("<LOCKED>"); | 432 | return i18n("<LOCKED>"); |
433 | } | 433 | } |
434 | 434 | ||
435 | QString PwMDocUi::string_deepLockedShort() | 435 | QString PwMDocUi::string_deepLockedShort() |
436 | { | 436 | { |
437 | return i18n("DEEP-LOCKED"); | 437 | return i18n("DEEP-LOCKED"); |
438 | } | 438 | } |
439 | 439 | ||
440 | QString PwMDocUi::string_deepLockedLong() | 440 | QString PwMDocUi::string_deepLockedLong() |
441 | { | 441 | { |
442 | return i18n("This file is DEEP-LOCKED!\n" | 442 | return i18n("This file is DEEP-LOCKED!\n" |
443 | "That means all data has been encrypted " | 443 | "That means all data has been encrypted\n" |
444 | "and written out to the file. If you want " | 444 | "and written out to the file. If you want\n" |
445 | "to see the entries, please UNLOCK the file. " | 445 | "to see the entries, please UNLOCK the file.\n" |
446 | "While unlocking, you will be prompted for the " | 446 | "While unlocking, you will be prompted for the\n" |
447 | "master-password or the key-card."); | 447 | "master-password or the key-card."); |
448 | } | 448 | } |
449 | 449 | ||
450 | QString PwMDocUi::string_defaultTitle() | 450 | QString PwMDocUi::string_defaultTitle() |
451 | { | 451 | { |
452 | return i18n("Untitled"); | 452 | return i18n("Untitled"); |
453 | } | 453 | } |
454 | 454 | ||
455 | #ifndef PWM_EMBEDDED | 455 | #ifndef PWM_EMBEDDED |
456 | #include "pwmdocui.moc" | 456 | #include "pwmdocui.moc" |
457 | #endif | 457 | #endif |
diff --git a/pwmanager/pwmanager/pwmexception.cpp b/pwmanager/pwmanager/pwmexception.cpp index 4c00b04..c0dbb39 100644 --- a/pwmanager/pwmanager/pwmexception.cpp +++ b/pwmanager/pwmanager/pwmexception.cpp | |||
@@ -34,25 +34,32 @@ void pwmFatal(const char *id, | |||
34 | 34 | ||
35 | void __printError(const string &msg) | 35 | void __printError(const string &msg) |
36 | { | 36 | { |
37 | QString __msg(PROG_NAME " generated a fatal fault:\n"); | 37 | QString __msg(PROG_NAME " generated a fatal fault:\n"); |
38 | __msg += msg.c_str(); | 38 | __msg += msg.c_str(); |
39 | cerr << "\n\n" << __msg.latin1() << endl; | 39 | cerr << "\n\n" << __msg.latin1() << endl; |
40 | KMessageBox::error(0, __msg, PROG_NAME " fatal ERROR!"); | 40 | KMessageBox::error(0, __msg, PROG_NAME " fatal ERROR!"); |
41 | } | 41 | } |
42 | 42 | ||
43 | void __printInfo(const string &msg) | 43 | void __printInfo(const string &msg) |
44 | { | 44 | { |
45 | cout << PROG_NAME " INFO: " << msg << endl; | 45 | cout << PROG_NAME " INFO: " << msg << endl; |
46 | #ifdef PWM_DEBUG | ||
47 | qDebug("%s INFO: %s", PROG_NAME, msg.c_str()) ; | ||
48 | #endif | ||
46 | } | 49 | } |
47 | 50 | ||
48 | void __printWarn(const string &msg) | 51 | void __printWarn(const string &msg) |
49 | { | 52 | { |
50 | cerr << PROG_NAME " WARNING: " << msg << endl; | 53 | cerr << PROG_NAME " WARNING: " << msg << endl; |
54 | #ifdef PWM_DEBUG | ||
55 | qDebug("%s WARNING: %s", PROG_NAME, msg.c_str()) ; | ||
56 | #endif | ||
51 | } | 57 | } |
52 | 58 | ||
53 | #ifdef PWM_DEBUG | 59 | #ifdef PWM_DEBUG |
54 | void __printDebug(const string &msg) | 60 | void __printDebug(const string &msg) |
55 | { | 61 | { |
56 | cout << PROG_NAME " DEBUG: " << msg << endl; | 62 | cout << PROG_NAME " DEBUG: " << msg << endl; |
63 | qDebug("%s DEBUG: %s", PROG_NAME, msg.c_str()) ; | ||
57 | } | 64 | } |
58 | #endif // PWM_DEBUG | 65 | #endif // PWM_DEBUG |
diff --git a/pwmanager/pwmanager/serializer.cpp b/pwmanager/pwmanager/serializer.cpp index 2810b48..fcdcec3 100644 --- a/pwmanager/pwmanager/serializer.cpp +++ b/pwmanager/pwmanager/serializer.cpp | |||
@@ -111,31 +111,42 @@ | |||
111 | # define ENTRY_COMMENT_WRENTRY_COMMENT_NEW | 111 | # define ENTRY_COMMENT_WRENTRY_COMMENT_NEW |
112 | # define ENTRY_URL_WR ENTRY_URL_NEW | 112 | # define ENTRY_URL_WR ENTRY_URL_NEW |
113 | # define ENTRY_LAUNCHER_WRENTRY_LAUNCHER_NEW | 113 | # define ENTRY_LAUNCHER_WRENTRY_LAUNCHER_NEW |
114 | # define ENTRY_LVP_WR ENTRY_LVP_NEW | 114 | # define ENTRY_LVP_WR ENTRY_LVP_NEW |
115 | # define ENTRY_BIN_WR ENTRY_BIN_NEW | 115 | # define ENTRY_BIN_WR ENTRY_BIN_NEW |
116 | # define ENTRY_META_WR ENTRY_META_NEW | 116 | # define ENTRY_META_WR ENTRY_META_NEW |
117 | #endif | 117 | #endif |
118 | 118 | ||
119 | 119 | ||
120 | Serializer::Serializer() | 120 | Serializer::Serializer() |
121 | { | 121 | { |
122 | defaultLockStat = true; | 122 | defaultLockStat = true; |
123 | //US BUG: I needed to specify a document name. Otherwise impl will not be created for serializing | ||
124 | #ifndef PWM_EMBEDDED | ||
123 | domDoc = new QDomDocument; | 125 | domDoc = new QDomDocument; |
126 | #else | ||
127 | domDoc = new QDomDocument("mydoc"); | ||
128 | #endif | ||
124 | } | 129 | } |
125 | 130 | ||
126 | Serializer::Serializer(const QCString &buffer) | 131 | Serializer::Serializer(const QCString &buffer) |
127 | { | 132 | { |
128 | defaultLockStat = true; | 133 | defaultLockStat = true; |
134 | //US BUG: I needed to specify a document name. Otherwise impl will not be created for serializing | ||
135 | #ifndef PWM_EMBEDDED | ||
129 | domDoc = new QDomDocument; | 136 | domDoc = new QDomDocument; |
137 | #else | ||
138 | domDoc = new QDomDocument("mydoc"); | ||
139 | #endif | ||
140 | |||
130 | if (!parseXml(buffer)) { | 141 | if (!parseXml(buffer)) { |
131 | delete domDoc; | 142 | delete domDoc; |
132 | #ifndef PWM_EMBEDDED | 143 | #ifndef PWM_EMBEDDED |
133 | throw PwMException(PwMException::EX_PARSE); | 144 | throw PwMException(PwMException::EX_PARSE); |
134 | #else | 145 | #else |
135 | qDebug("Serializer::Serializer : Parse Exception "); | 146 | qDebug("Serializer::Serializer : Parse Exception "); |
136 | #endif | 147 | #endif |
137 | } | 148 | } |
138 | } | 149 | } |
139 | 150 | ||
140 | Serializer::~Serializer() | 151 | Serializer::~Serializer() |
141 | { | 152 | { |
@@ -174,24 +185,25 @@ QCString Serializer::getXml() | |||
174 | cout << tmp << endl; | 185 | cout << tmp << endl; |
175 | printDebug("<END Serializer::getXml() dump>"); | 186 | printDebug("<END Serializer::getXml() dump>"); |
176 | #endif // DEBUG | 187 | #endif // DEBUG |
177 | 188 | ||
178 | QCString ret(domDoc->toCString(0)); | 189 | QCString ret(domDoc->toCString(0)); |
179 | ret.replace('\n', ""); | 190 | ret.replace('\n', ""); |
180 | return ret; | 191 | return ret; |
181 | #else | 192 | #else |
182 | 193 | ||
183 | #if defined(PWM_DEBUG) && SERIALIZER_DEBUG != 0 | 194 | #if defined(PWM_DEBUG) && SERIALIZER_DEBUG != 0 |
184 | QCString tmp(" " + domDoc->toCString()); | 195 | QCString tmp(" " + domDoc->toCString()); |
185 | printDebug("<BEGIN Serializer::getXml() dump>\n"); | 196 | printDebug("<BEGIN Serializer::getXml() dump>\n"); |
197 | qDebug(tmp); | ||
186 | cout << tmp << endl; | 198 | cout << tmp << endl; |
187 | printDebug("<END Serializer::getXml() dump>"); | 199 | printDebug("<END Serializer::getXml() dump>"); |
188 | #endif // DEBUG | 200 | #endif // DEBUG |
189 | 201 | ||
190 | QCString ret(domDoc->toCString()); | 202 | QCString ret(domDoc->toCString()); |
191 | ret.replace(QRegExp("\n"), ""); | 203 | ret.replace(QRegExp("\n"), ""); |
192 | return ret; | 204 | return ret; |
193 | 205 | ||
194 | #endif | 206 | #endif |
195 | } | 207 | } |
196 | 208 | ||
197 | bool Serializer::serialize(const vector<PwMCategoryItem> &dta) | 209 | bool Serializer::serialize(const vector<PwMCategoryItem> &dta) |