-rw-r--r-- | pwmanager/pwmanager/pwmdocui.cpp | 2 |
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 | |||
@@ -269,189 +269,189 @@ bool PwMDocUi::saveDocUi(PwMDoc *doc) | |||
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 | ||
289 | bool PwMDocUi::saveAsDocUi(PwMDoc *doc) | 289 | bool 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 | ||
334 | bool PwMDocUi::openDocUi(PwMDoc *doc, | 334 | bool 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 | ||
425 | QString PwMDocUi::string_defaultCategory() | 425 | QString PwMDocUi::string_defaultCategory() |
426 | { | 426 | { |
427 | return i18n("Default"); | 427 | return i18n("Default"); |
428 | } | 428 | } |
429 | 429 | ||
430 | QString PwMDocUi::string_locked() | 430 | 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\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 | ||
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 |