summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-10-19 00:48:15 (UTC)
committer ulf69 <ulf69>2004-10-19 00:48:15 (UTC)
commit9120b7e74bb928a7c148d27abb130990f8977a31 (patch) (unidiff)
treefbfe7c668c7a64699f8460968452bb0abff75bdf
parent08c6df8a9f7804278ac4029299d9d6de51976856 (diff)
downloadkdepimpi-9120b7e74bb928a7c148d27abb130990f8977a31.zip
kdepimpi-9120b7e74bb928a7c148d27abb130990f8977a31.tar.gz
kdepimpi-9120b7e74bb928a7c148d27abb130990f8977a31.tar.bz2
removed debugoutput
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmdocui.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/pwmanager/pwmanager/pwmdocui.cpp b/pwmanager/pwmanager/pwmdocui.cpp
index 9040b2d..7b8e0ee 100644
--- a/pwmanager/pwmanager/pwmdocui.cpp
+++ b/pwmanager/pwmanager/pwmdocui.cpp
@@ -1,457 +1,457 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * copyright (C) 2003, 2004 by Michael Buesch * 3 * copyright (C) 2003, 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de * 4 * email: mbuesch@freenet.de *
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 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 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 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#include "pwmdocui.h" 20#include "pwmdocui.h"
21#include "setmasterpwwndimpl.h" 21#include "setmasterpwwndimpl.h"
22#include "getmasterpwwndimpl.h" 22#include "getmasterpwwndimpl.h"
23#include "pwmexception.h" 23#include "pwmexception.h"
24#include "getkeycardwnd.h" 24#include "getkeycardwnd.h"
25#include "pwm.h" 25#include "pwm.h"
26#include "globalstuff.h" 26#include "globalstuff.h"
27#include "spinforsignal.h" 27#include "spinforsignal.h"
28 28
29#include <qlineedit.h> 29#include <qlineedit.h>
30#include <qtabwidget.h> 30#include <qtabwidget.h>
31 31
32#include <kmessagebox.h> 32#include <kmessagebox.h>
33#include <kfiledialog.h> 33#include <kfiledialog.h>
34 34
35#ifndef PWM_EMBEDDED 35#ifndef PWM_EMBEDDED
36#include <kwin.h> 36#include <kwin.h>
37#else 37#else
38#include <qdir.h> 38#include <qdir.h>
39#include "pwmprefs.h" 39#include "pwmprefs.h"
40#endif 40#endif
41 41
42 42
43#ifdef CONFIG_KEYCARD 43#ifdef CONFIG_KEYCARD
44# include "pwmkeycard.h" 44# include "pwmkeycard.h"
45#endif 45#endif
46 46
47 47
48PwMDocUi::PwMDocUi(QObject *parent, const char *name) 48PwMDocUi::PwMDocUi(QObject *parent, const char *name)
49 : QObject(parent, name) 49 : QObject(parent, name)
50{ 50{
51 currentView = 0; 51 currentView = 0;
52 keyCard = 0; 52 keyCard = 0;
53} 53}
54 54
55PwMDocUi::~PwMDocUi() 55PwMDocUi::~PwMDocUi()
56{ 56{
57} 57}
58 58
59QString PwMDocUi::requestMpw(bool chipcard) 59QString PwMDocUi::requestMpw(bool chipcard)
60{ 60{
61 QString pw; 61 QString pw;
62 62
63 if (chipcard) { 63 if (chipcard) {
64#ifdef CONFIG_KEYCARD 64#ifdef CONFIG_KEYCARD
65 PWM_ASSERT(keyCard); 65 PWM_ASSERT(keyCard);
66 uint32_t id; 66 uint32_t id;
67 string ret; 67 string ret;
68 SpinForSignal *spinner = keyCard->getSpinner(); 68 SpinForSignal *spinner = keyCard->getSpinner();
69 connect(keyCard, SIGNAL(keyAvailable(uint32_t, const string &)), 69 connect(keyCard, SIGNAL(keyAvailable(uint32_t, const string &)),
70 spinner, SLOT(u32_str_slot(uint32_t, const string &))); 70 spinner, SLOT(u32_str_slot(uint32_t, const string &)));
71 keyCard->getKey(); 71 keyCard->getKey();
72 spinner->spin(&id, &ret); 72 spinner->spin(&id, &ret);
73 disconnect(keyCard, SIGNAL(keyAvailable(uint32_t, const string &)), 73 disconnect(keyCard, SIGNAL(keyAvailable(uint32_t, const string &)),
74 spinner, SLOT(u32_str_slot(uint32_t, const string &))); 74 spinner, SLOT(u32_str_slot(uint32_t, const string &)));
75 if (ret == "") 75 if (ret == "")
76 return ""; 76 return "";
77 pw = ret.c_str(); 77 pw = ret.c_str();
78#else // CONFIG_KEYCARD 78#else // CONFIG_KEYCARD
79 no_keycard_support_msg_box(currentView); 79 no_keycard_support_msg_box(currentView);
80#endif // CONFIG_KEYCARD 80#endif // CONFIG_KEYCARD
81 } else { 81 } else {
82#ifndef PWM_EMBEDDED 82#ifndef PWM_EMBEDDED
83 GetMasterPwWndImpl pwWnd; 83 GetMasterPwWndImpl pwWnd;
84 KWin::setState(pwWnd.winId(), NET::StaysOnTop); 84 KWin::setState(pwWnd.winId(), NET::StaysOnTop);
85#else 85#else
86 GetMasterPwWndImpl pwWnd; 86 GetMasterPwWndImpl pwWnd;
87#endif 87#endif
88 if (pwWnd.exec() != 1) 88 if (pwWnd.exec() != 1)
89 return ""; 89 return "";
90 pw = pwWnd.pwLineEdit->text(); 90 pw = pwWnd.pwLineEdit->text();
91 } 91 }
92 92
93 return pw; 93 return pw;
94} 94}
95 95
96QString PwMDocUi::requestNewMpw(bool *chipcard) 96QString PwMDocUi::requestNewMpw(bool *chipcard)
97{ 97{
98 QString pw; 98 QString pw;
99 SetMasterPwWndImpl pwWnd(currentView); 99 SetMasterPwWndImpl pwWnd(currentView);
100 pwWnd.setPwMKeyCard(keyCard); 100 pwWnd.setPwMKeyCard(keyCard);
101 if (!chipcard) { 101 if (!chipcard) {
102#ifndef PWM_EMBEDDED 102#ifndef PWM_EMBEDDED
103 pwWnd.mainTab->removePage(pwWnd.mainTab->page(1)); 103 pwWnd.mainTab->removePage(pwWnd.mainTab->page(1));
104#else 104#else
105 pwWnd.mainTab->removePage(pwWnd.tab_2); 105 pwWnd.mainTab->removePage(pwWnd.tab_2);
106#endif 106#endif
107 } 107 }
108 108
109 if (pwWnd.exec() != 1) 109 if (pwWnd.exec() != 1)
110 return ""; 110 return "";
111 pw = pwWnd.getPw(chipcard).c_str(); 111 pw = pwWnd.getPw(chipcard).c_str();
112 112
113 return pw; 113 return pw;
114} 114}
115 115
116QString PwMDocUi::requestMpwChange(const QString *currentPw, bool *chipcard) 116QString PwMDocUi::requestMpwChange(const QString *currentPw, bool *chipcard)
117{ 117{
118 QString pw(requestMpw(*chipcard)); 118 QString pw(requestMpw(*chipcard));
119 if (pw == "") 119 if (pw == "")
120 return ""; 120 return "";
121 if (pw != *currentPw) { 121 if (pw != *currentPw) {
122 wrongMpwMsgBox(*chipcard); 122 wrongMpwMsgBox(*chipcard);
123 return ""; 123 return "";
124 } 124 }
125 125
126 pw = requestNewMpw(chipcard); 126 pw = requestNewMpw(chipcard);
127 if (pw == "") 127 if (pw == "")
128 return ""; 128 return "";
129 return pw; 129 return pw;
130} 130}
131 131
132void PwMDocUi::wrongMpwMsgBox(bool chipcard, QString prefix, QString postfix) 132void PwMDocUi::wrongMpwMsgBox(bool chipcard, QString prefix, QString postfix)
133{ 133{
134 QString msg; 134 QString msg;
135 if (prefix != "") { 135 if (prefix != "") {
136 msg += prefix; 136 msg += prefix;
137 msg += "\n"; 137 msg += "\n";
138 } 138 }
139 139
140 if (chipcard) { 140 if (chipcard) {
141 msg += i18n("Wrong key-card!\n" 141 msg += i18n("Wrong key-card!\n"
142 "Please try again with the\n" 142 "Please try again with the\n"
143 "correct key-card."); 143 "correct key-card.");
144 } else { 144 } else {
145 msg += i18n("Wrong master-password!\n" 145 msg += i18n("Wrong master-password!\n"
146 "Please try again."); 146 "Please try again.");
147 } 147 }
148 148
149 if (postfix != "") { 149 if (postfix != "") {
150 msg += "\n"; 150 msg += "\n";
151 msg += postfix; 151 msg += postfix;
152 } 152 }
153 KMessageBox::error(currentView, msg, 153 KMessageBox::error(currentView, msg,
154 (chipcard) ? (i18n("wrong chipcard")) 154 (chipcard) ? (i18n("wrong chipcard"))
155 : (i18n("password error"))); 155 : (i18n("password error")));
156} 156}
157 157
158void PwMDocUi::noMpwMsgBox(bool chipcard, QString prefix, QString postfix) 158void PwMDocUi::noMpwMsgBox(bool chipcard, QString prefix, QString postfix)
159{ 159{
160 QString msg; 160 QString msg;
161 if (prefix != "") { 161 if (prefix != "") {
162 msg += prefix; 162 msg += prefix;
163 msg += "\n"; 163 msg += "\n";
164 } 164 }
165 165
166 if (chipcard) { 166 if (chipcard) {
167 msg += i18n("No key-card found!\n" 167 msg += i18n("No key-card found!\n"
168 "Please insert the\n" 168 "Please insert the\n"
169 "correct key-card."); 169 "correct key-card.");
170 } else { 170 } else {
171 msg += i18n("No master-password given!"); 171 msg += i18n("No master-password given!");
172 } 172 }
173 173
174 if (postfix != "") { 174 if (postfix != "") {
175 msg += "\n"; 175 msg += "\n";
176 msg += postfix; 176 msg += postfix;
177 } 177 }
178 KMessageBox::error(currentView, msg, 178 KMessageBox::error(currentView, msg,
179 (chipcard) ? (i18n("no chipcard")) 179 (chipcard) ? (i18n("no chipcard"))
180 : (i18n("password error"))); 180 : (i18n("password error")));
181} 181}
182 182
183void PwMDocUi::rootAlertMsgBox() 183void PwMDocUi::rootAlertMsgBox()
184{ 184{
185 KMessageBox::error(currentView, 185 KMessageBox::error(currentView,
186 i18n("This feature is not available,n" 186 i18n("This feature is not available,n"
187 "if you execute PwM with \"root\" \n" 187 "if you execute PwM with \"root\" \n"
188 "UID 0 privileges, for security reasons!"), 188 "UID 0 privileges, for security reasons!"),
189 i18n("not allowed as root!")); 189 i18n("not allowed as root!"));
190} 190}
191 191
192void PwMDocUi::cantDeeplock_notSavedMsgBox() 192void PwMDocUi::cantDeeplock_notSavedMsgBox()
193{ 193{
194 KMessageBox::error(currentView, 194 KMessageBox::error(currentView,
195 i18n("Can't deep-lock, because the document\n" 195 i18n("Can't deep-lock, because the document\n"
196 "hasn't been saved, yet. Please save\n" 196 "hasn't been saved, yet. Please save\n"
197 "to a file and try again."), 197 "to a file and try again."),
198 i18n("not saved, yet")); 198 i18n("not saved, yet"));
199} 199}
200 200
201void PwMDocUi::gpmPwLenErrMsgBox() 201void PwMDocUi::gpmPwLenErrMsgBox()
202{ 202{
203 KMessageBox::error(currentView, 203 KMessageBox::error(currentView,
204 i18n("GPasman does not support passwords\n" 204 i18n("GPasman does not support passwords\n"
205 "shorter than 4 characters! Please try\n" 205 "shorter than 4 characters! Please try\n"
206 "again with a longer password."), 206 "again with a longer password."),
207 i18n("password too short")); 207 i18n("password too short"));
208} 208}
209 209
210int PwMDocUi::dirtyAskSave(const QString &docTitle) 210int PwMDocUi::dirtyAskSave(const QString &docTitle)
211{ 211{
212 int ret; 212 int ret;
213#ifndef PWM_EMBEDDED 213#ifndef PWM_EMBEDDED
214 ret = KMessageBox::questionYesNoCancel(currentView, 214 ret = KMessageBox::questionYesNoCancel(currentView,
215 i18n("The list \"") + 215 i18n("The list \"") +
216 docTitle + 216 docTitle +
217 i18n 217 i18n
218 ("\" has been modified.\n" 218 ("\" has been modified.\n"
219 "Do you want to save it?"), 219 "Do you want to save it?"),
220 i18n("save?")); 220 i18n("save?"));
221 if (ret == KMessageBox::Yes) { 221 if (ret == KMessageBox::Yes) {
222 return 0; 222 return 0;
223 } else if (ret == KMessageBox::No) { 223 } else if (ret == KMessageBox::No) {
224 return 1; 224 return 1;
225 } 225 }
226#else 226#else
227 ret = KMessageBox::warningYesNoCancel(currentView, 227 ret = KMessageBox::warningYesNoCancel(currentView,
228 i18n("The list \"") + 228 i18n("The list \"") +
229 docTitle + 229 docTitle +
230 i18n 230 i18n
231 ("\"\nhas been modified.\n" 231 ("\"\nhas been modified.\n"
232 "Do you want to save it?"), 232 "Do you want to save it?"),
233 i18n("save?")); 233 i18n("save?"));
234 if (ret == KMessageBox::Yes) { 234 if (ret == KMessageBox::Yes) {
235 return 0; 235 return 0;
236 } else if (ret == KMessageBox::No) { 236 } else if (ret == KMessageBox::No) {
237 return 1; 237 return 1;
238 } 238 }
239 239
240#endif 240#endif
241 241
242 // cancel 242 // cancel
243 return -1; 243 return -1;
244} 244}
245 245
246bool PwMDocUi::saveDocUi(PwMDoc *doc) 246bool PwMDocUi::saveDocUi(PwMDoc *doc)
247{ 247{
248 PWM_ASSERT(doc); 248 PWM_ASSERT(doc);
249 doc->timer()->getLock(DocTimer::id_autoLockTimer); 249 doc->timer()->getLock(DocTimer::id_autoLockTimer);
250 if (doc->isDocEmpty()) { 250 if (doc->isDocEmpty()) {
251 KMessageBox::information(currentView, 251 KMessageBox::information(currentView,
252 i18n 252 i18n
253 ("Sorry, there's nothing to save.\n" 253 ("Sorry, there's nothing to save.\n"
254 "Please first add some passwords."), 254 "Please first add some passwords."),
255 i18n("nothing to do")); 255 i18n("nothing to do"));
256 doc->timer()->putLock(DocTimer::id_autoLockTimer); 256 doc->timer()->putLock(DocTimer::id_autoLockTimer);
257 return true; 257 return true;
258 } 258 }
259 PwMerror ret = doc->saveDoc(conf()->confGlobCompression()); 259 PwMerror ret = doc->saveDoc(conf()->confGlobCompression());
260 if (ret == e_filename) { 260 if (ret == e_filename) {
261 doc->timer()->putLock(DocTimer::id_autoLockTimer); 261 doc->timer()->putLock(DocTimer::id_autoLockTimer);
262 return saveAsDocUi(doc); 262 return saveAsDocUi(doc);
263 } else if (ret == e_weakPw) { 263 } else if (ret == e_weakPw) {
264 KMessageBox::error(currentView, 264 KMessageBox::error(currentView,
265 i18n("Error: This is a weak password.\n" 265 i18n("Error: This is a weak password.\n"
266 "Please select another password."), 266 "Please select another password."),
267 i18n("weak password")); 267 i18n("weak password"));
268 doc->timer()->putLock(DocTimer::id_autoLockTimer); 268 doc->timer()->putLock(DocTimer::id_autoLockTimer);
269 return false; 269 return false;
270 } else if (ret == e_fileBackup) { 270 } else if (ret == e_fileBackup) {
271 KMessageBox::error(currentView, 271 KMessageBox::error(currentView,
272 i18n("Error: Couldn't make backup-file!"), 272 i18n("Error: Couldn't make backup-file!"),
273 i18n("backup failed")); 273 i18n("backup failed"));
274 doc->timer()->putLock(DocTimer::id_autoLockTimer); 274 doc->timer()->putLock(DocTimer::id_autoLockTimer);
275 return false; 275 return false;
276 } else if (ret != e_success) { 276 } else if (ret != e_success) {
277 KMessageBox::error(currentView, 277 KMessageBox::error(currentView,
278 i18n("Error: Couldn't write to file.\n" 278 i18n("Error: Couldn't write to file.\n"
279 "Please check if you have permission to\n" 279 "Please check if you have permission to\n"
280 "write to the file in that directory."), 280 "write to the file in that directory."),
281 i18n("error while writing")); 281 i18n("error while writing"));
282 doc->timer()->putLock(DocTimer::id_autoLockTimer); 282 doc->timer()->putLock(DocTimer::id_autoLockTimer);
283 return false; 283 return false;
284 } 284 }
285 doc->timer()->putLock(DocTimer::id_autoLockTimer); 285 doc->timer()->putLock(DocTimer::id_autoLockTimer);
286 return true; 286 return true;
287} 287}
288 288
289bool PwMDocUi::saveAsDocUi(PwMDoc *doc) 289bool PwMDocUi::saveAsDocUi(PwMDoc *doc)
290{ 290{
291 PWM_ASSERT(doc); 291 PWM_ASSERT(doc);
292 doc->timer()->getLock(DocTimer::id_autoLockTimer); 292 doc->timer()->getLock(DocTimer::id_autoLockTimer);
293 if (doc->isDocEmpty()) { 293 if (doc->isDocEmpty()) {
294 KMessageBox::information(currentView, 294 KMessageBox::information(currentView,
295 i18n 295 i18n
296 ("Sorry, there's nothing to save.\n" 296 ("Sorry, there's nothing to save.\n"
297 "Please first add some passwords."), 297 "Please first add some passwords."),
298 i18n("nothing to do")); 298 i18n("nothing to do"));
299 doc->timer()->putLock(DocTimer::id_autoLockTimer); 299 doc->timer()->putLock(DocTimer::id_autoLockTimer);
300 return true; 300 return true;
301 } 301 }
302#ifndef PWM_EMBEDDED 302#ifndef PWM_EMBEDDED
303 QString fn(KFileDialog::getSaveFileName(QString::null, 303 QString fn(KFileDialog::getSaveFileName(QString::null,
304 i18n("*.pwm|PwManager Password file"), 304 i18n("*.pwm|PwManager Password file"),
305 currentView)); 305 currentView));
306#else 306#else
307 QString fn = locateLocal( "data", KGlobal::getAppName() + "/*.pwm" ); 307 QString fn = locateLocal( "data", KGlobal::getAppName() + "/*.pwm" );
308 fn = KFileDialog::getSaveFileName(fn, 308 fn = KFileDialog::getSaveFileName(fn,
309 i18n("password filename(*.pwm)"), 309 i18n("password filename(*.pwm)"),
310 currentView); 310 currentView);
311 311
312#endif 312#endif
313 if (fn == "") { 313 if (fn == "") {
314 doc->timer()->putLock(DocTimer::id_autoLockTimer); 314 doc->timer()->putLock(DocTimer::id_autoLockTimer);
315 return false; 315 return false;
316 } 316 }
317 if (fn.right(4) != ".pwm") 317 if (fn.right(4) != ".pwm")
318 fn += ".pwm"; 318 fn += ".pwm";
319 319
320 PwMerror ret = doc->saveDoc(conf()->confGlobCompression(), &fn); 320 PwMerror ret = doc->saveDoc(conf()->confGlobCompression(), &fn);
321 if (ret != e_success) { 321 if (ret != e_success) {
322 KMessageBox::error(currentView, 322 KMessageBox::error(currentView,
323 i18n("Error: Couldn't write to file.\n" 323 i18n("Error: Couldn't write to file.\n"
324 "Please check if you have permission to\n" 324 "Please check if you have permission to\n"
325 "write to the file in that directory."), 325 "write to the file in that directory."),
326 i18n("error while writing")); 326 i18n("error while writing"));
327 doc->timer()->putLock(DocTimer::id_autoLockTimer); 327 doc->timer()->putLock(DocTimer::id_autoLockTimer);
328 return false; 328 return false;
329 } 329 }
330 doc->timer()->putLock(DocTimer::id_autoLockTimer); 330 doc->timer()->putLock(DocTimer::id_autoLockTimer);
331 return true; 331 return true;
332} 332}
333 333
334bool PwMDocUi::openDocUi(PwMDoc *doc, 334bool PwMDocUi::openDocUi(PwMDoc *doc,
335 QString filename, 335 QString filename,
336 bool openDeepLocked) 336 bool openDeepLocked)
337{ 337{
338 if (filename.isEmpty()) 338 if (filename.isEmpty())
339 { 339 {
340#ifndef PWM_EMBEDDED 340#ifndef PWM_EMBEDDED
341 filename = KFileDialog::getOpenFileName(QString::null, 341 filename = KFileDialog::getOpenFileName(QString::null,
342 i18n("*.pwm|PwManager Password file\n" 342 i18n("*.pwm|PwManager Password file\n"
343 "*|All files"), getCurrentView()); 343 "*|All files"), getCurrentView());
344#else 344#else
345 filename = locateLocal( "data", KGlobal::getAppName() + "/*.pwm"); 345 filename = locateLocal( "data", KGlobal::getAppName() + "/*.pwm");
346 filename = KFileDialog::getOpenFileName(filename, 346 filename = KFileDialog::getOpenFileName(filename,
347 i18n("password filename(*.pwm)"), getCurrentView()); 347 i18n("password filename(*.pwm)"), getCurrentView());
348#endif 348#endif
349 } 349 }
350 if (filename.isEmpty()) 350 if (filename.isEmpty())
351 goto cancelOpen; 351 goto cancelOpen;
352 PwMerror ret; 352 PwMerror ret;
353 while (true) { 353 while (true) {
354 int lockStat = -1; 354 int lockStat = -1;
355 if (openDeepLocked) { 355 if (openDeepLocked) {
356 lockStat = 2; 356 lockStat = 2;
357 } else { 357 } else {
358 if (conf()->confGlobUnlockOnOpen()) { 358 if (conf()->confGlobUnlockOnOpen()) {
359 lockStat = 0; 359 lockStat = 0;
360 } else { 360 } else {
361 lockStat = 1; 361 lockStat = 1;
362 } 362 }
363 } 363 }
364 ret = doc->openDoc(&filename, lockStat); 364 ret = doc->openDoc(&filename, lockStat);
365 qDebug("pwmdocui::OpenDocui %i", ret); 365 //qDebug("pwmdocui::OpenDocui %i", ret);
366 if (ret != e_success) { 366 if (ret != e_success) {
367 if (ret == e_readFile || ret == e_openFile) { 367 if (ret == e_readFile || ret == e_openFile) {
368 KMessageBox::error(getCurrentView(), 368 KMessageBox::error(getCurrentView(),
369 i18n("Could not read file!") 369 i18n("Could not read file!")
370 + "\n" 370 + "\n"
371 + filename, 371 + filename,
372 i18n("file error")); 372 i18n("file error"));
373 goto cancelOpen; 373 goto cancelOpen;
374 } 374 }
375 if (ret == e_alreadyOpen) { 375 if (ret == e_alreadyOpen) {
376 KMessageBox::error(getCurrentView(), 376 KMessageBox::error(getCurrentView(),
377 i18n("This file is already open."), 377 i18n("This file is already open."),
378 i18n("already open")); 378 i18n("already open"));
379 goto cancelOpen; 379 goto cancelOpen;
380 } 380 }
381 if (ret == e_fileVer) { 381 if (ret == e_fileVer) {
382 KMessageBox::error(getCurrentView(), 382 KMessageBox::error(getCurrentView(),
383 i18n 383 i18n
384 ("File-version is not supported!\n" 384 ("File-version is not supported!\n"
385 "Did you create this file with an\nolder or newer version of PwM?"), 385 "Did you create this file with an\nolder or newer version of PwM?"),
386 i18n 386 i18n
387 ("incompatible version")); 387 ("incompatible version"));
388 goto cancelOpen; 388 goto cancelOpen;
389 } 389 }
390 if (ret == e_wrongPw) { 390 if (ret == e_wrongPw) {
391 continue; 391 continue;
392 } 392 }
393 if (ret == e_noPw) { 393 if (ret == e_noPw) {
394 goto cancelOpen; 394 goto cancelOpen;
395 } 395 }
396 if (ret == e_fileFormat) { 396 if (ret == e_fileFormat) {
397 KMessageBox::error(getCurrentView(), 397 KMessageBox::error(getCurrentView(),
398 i18n 398 i18n
399 ("Sorry, this file has not been recognized\n" 399 ("Sorry, this file has not been recognized\n"
400 "as a PwM Password file.\n" 400 "as a PwM Password file.\n"
401 "Probably you have selected the wrong file."), 401 "Probably you have selected the wrong file."),
402 i18n 402 i18n
403 ("no PwM password-file")); 403 ("no PwM password-file"));
404 goto cancelOpen; 404 goto cancelOpen;
405 } 405 }
406 if (ret == e_fileCorrupt) { 406 if (ret == e_fileCorrupt) {
407 KMessageBox::error(getCurrentView(), 407 KMessageBox::error(getCurrentView(),
408 i18n 408 i18n
409 ("File corrupt!\n" 409 ("File corrupt!\n"
410 "Maybe the media, you stored this file on,\n" 410 "Maybe the media, you stored this file on,\n"
411 "had bad sectors?"), 411 "had bad sectors?"),
412 i18n 412 i18n
413 ("checksum error")); 413 ("checksum error"));
414 goto cancelOpen; 414 goto cancelOpen;
415 } 415 }
416 } 416 }
417 break; 417 break;
418 } 418 }
419 return true; 419 return true;
420 420
421 cancelOpen: 421 cancelOpen:
422 return false; 422 return false;
423} 423}
424 424
425QString PwMDocUi::string_defaultCategory() 425QString PwMDocUi::string_defaultCategory()
426{ 426{
427 return i18n("Default"); 427 return i18n("Default");
428} 428}
429 429
430QString PwMDocUi::string_locked() 430QString PwMDocUi::string_locked()
431{ 431{
432 return i18n("<LOCKED>"); 432 return i18n("<LOCKED>");
433} 433}
434 434
435QString PwMDocUi::string_deepLockedShort() 435QString PwMDocUi::string_deepLockedShort()
436{ 436{
437 return i18n("DEEP-LOCKED"); 437 return i18n("DEEP-LOCKED");
438} 438}
439 439
440QString PwMDocUi::string_deepLockedLong() 440QString 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\n" 443 "That means all data has been encrypted\n"
444 "and written out to the file. If you want\n" 444 "and written out to the file. If you want\n"
445 "to see the entries, please UNLOCK the file.\n" 445 "to see the entries, please UNLOCK the file.\n"
446 "While unlocking, you will be prompted for the\n" 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
450QString PwMDocUi::string_defaultTitle() 450QString 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