summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmdocui.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/pwmanager/pwmanager/pwmdocui.cpp b/pwmanager/pwmanager/pwmdocui.cpp
index 41afa6a..9040b2d 100644
--- a/pwmanager/pwmanager/pwmdocui.cpp
+++ b/pwmanager/pwmanager/pwmdocui.cpp
@@ -162,94 +162,94 @@ void PwMDocUi::noMpwMsgBox(bool chipcard, QString prefix, QString postfix)
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, " 186 i18n("This feature is not available,n"
187 "if you execute PwM with \"root\" " 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 " 195 i18n("Can't deep-lock, because the document\n"
196 "hasn't been saved, yet. Please save " 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 " 204 i18n("GPasman does not support passwords\n"
205 "shorter than 4 characters! Please try " 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 ("\" has 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"));
@@ -300,49 +300,49 @@ bool PwMDocUi::saveAsDocUi(PwMDoc *doc)
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 " 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
@@ -361,74 +361,74 @@ bool PwMDocUi::openDocUi(PwMDoc *doc,
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 older 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 " 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, " 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