author | zautrix <zautrix> | 2005-06-24 23:41:53 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-24 23:41:53 (UTC) |
commit | 6a5f5375a9d2370db7d774b31d299acc81a77f89 (patch) (unidiff) | |
tree | 536ac03a132b166596cde3c3a99caa440a3fd609 | |
parent | 184833db0d1bcb63e7d4bd5945ccdc0e6b92f7b8 (diff) | |
download | kdepimpi-6a5f5375a9d2370db7d774b31d299acc81a77f89.zip kdepimpi-6a5f5375a9d2370db7d774b31d299acc81a77f89.tar.gz kdepimpi-6a5f5375a9d2370db7d774b31d299acc81a77f89.tar.bz2 |
fixxxx
-rw-r--r-- | pwmanager/pwmanager/pwmdoc.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp index 36b0df5..1f3c58b 100644 --- a/pwmanager/pwmanager/pwmdoc.cpp +++ b/pwmanager/pwmanager/pwmdoc.cpp | |||
@@ -415,49 +415,49 @@ PwMerror PwMDoc::saveDoc(char compress, const QString *file) | |||
415 | "Falling back to Blowfish."); | 415 | "Falling back to Blowfish."); |
416 | _cryptAlgo = PWM_CRYPT_BLOWFISH; | 416 | _cryptAlgo = PWM_CRYPT_BLOWFISH; |
417 | } | 417 | } |
418 | if (_hashAlgo < PWM_HASH_SHA1 || | 418 | if (_hashAlgo < PWM_HASH_SHA1 || |
419 | _hashAlgo > PWM_HASH_TIGER) { | 419 | _hashAlgo > PWM_HASH_TIGER) { |
420 | printWarn("Invalid Hash-Algorithm selected! " | 420 | printWarn("Invalid Hash-Algorithm selected! " |
421 | "Config-file seems to be corrupt. " | 421 | "Config-file seems to be corrupt. " |
422 | "Falling back to SHA1."); | 422 | "Falling back to SHA1."); |
423 | _hashAlgo = PWM_HASH_SHA1; | 423 | _hashAlgo = PWM_HASH_SHA1; |
424 | } | 424 | } |
425 | char cryptAlgo = static_cast<char>(_cryptAlgo); | 425 | char cryptAlgo = static_cast<char>(_cryptAlgo); |
426 | char hashAlgo = static_cast<char>(_hashAlgo); | 426 | char hashAlgo = static_cast<char>(_hashAlgo); |
427 | 427 | ||
428 | if (conf()->confGlobMakeFileBackup()) { | 428 | if (conf()->confGlobMakeFileBackup()) { |
429 | if (!backupFile(filename)) | 429 | if (!backupFile(filename)) |
430 | return e_fileBackup; | 430 | return e_fileBackup; |
431 | } | 431 | } |
432 | int mLastBackupDate = 0; | 432 | int mLastBackupDate = 0; |
433 | KConfig configGlobal (locateLocal("config","pwmanagerbuprc")); | 433 | KConfig configGlobal (locateLocal("config","pwmanagerbuprc")); |
434 | QFileInfo fileInfo ( filename ); | 434 | QFileInfo fileInfo ( filename ); |
435 | mLastBackupDate = configGlobal.readNumEntry( "LastBackupDate-"+ fileInfo.fileName (), 0 ); | 435 | mLastBackupDate = configGlobal.readNumEntry( "LastBackupDate-"+ fileInfo.fileName (), 0 ); |
436 | KConfig config (locateLocal("config","microkdeglobalrc")); | 436 | KConfig config (locateLocal("config","microkdeglobalrc")); |
437 | config.setGroup( "BackupSettings" ); | 437 | config.setGroup( "BackupSettings" ); |
438 | bool b_enabled = config.readBoolEntry( "BackupEnabled" ); | 438 | bool b_enabled = config.readBoolEntry( "BackupEnabled" ); |
439 | if ( b_enabled ) { | 439 | if ( b_enabled && QFile::exists(filename)) { |
440 | int num = config.readNumEntry( "BackupNumbers" ); | 440 | int num = config.readNumEntry( "BackupNumbers" ); |
441 | int d_count = config.readNumEntry( "BackupDayCount" ); | 441 | int d_count = config.readNumEntry( "BackupDayCount" ); |
442 | bool stdDir = config.readBoolEntry( "BackupUseDefaultDir" ); | 442 | bool stdDir = config.readBoolEntry( "BackupUseDefaultDir" ); |
443 | QString bupDir = config.readEntry( "BackupDatadir" ); | 443 | QString bupDir = config.readEntry( "BackupDatadir" ); |
444 | QDate reference ( 2000,1,1 ); | 444 | QDate reference ( 2000,1,1 ); |
445 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 445 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
446 | bool saveDate = false; | 446 | bool saveDate = false; |
447 | if ( daysTo - d_count >= mLastBackupDate ) { | 447 | if ( daysTo - d_count >= mLastBackupDate ) { |
448 | qDebug("KA: Last backup was %d days ago ", daysTo - mLastBackupDate ); | 448 | qDebug("KA: Last backup was %d days ago ", daysTo - mLastBackupDate ); |
449 | if ( stdDir ) | 449 | if ( stdDir ) |
450 | bupDir = KGlobalSettings::backupDataDir(); | 450 | bupDir = KGlobalSettings::backupDataDir(); |
451 | int retval = KApplication::createBackup( filename, bupDir, num ); | 451 | int retval = KApplication::createBackup( filename, bupDir, num ); |
452 | if ( retval == 0 ) { | 452 | if ( retval == 0 ) { |
453 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 453 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
454 | // retval == 0 : backup skipped for today, try again tomorrow | 454 | // retval == 0 : backup skipped for today, try again tomorrow |
455 | mLastBackupDate = daysTo - d_count+1; | 455 | mLastBackupDate = daysTo - d_count+1; |
456 | saveDate = true; | 456 | saveDate = true; |
457 | } else if ( retval == 1 ){ | 457 | } else if ( retval == 1 ){ |
458 | qDebug("KO: Backup created."); | 458 | qDebug("KO: Backup created."); |
459 | // backup ok | 459 | // backup ok |
460 | mLastBackupDate = daysTo; | 460 | mLastBackupDate = daysTo; |
461 | saveDate = true; | 461 | saveDate = true; |
462 | } else if ( retval == 2 ){ | 462 | } else if ( retval == 2 ){ |
463 | qDebug("KO: Backup globally cancelled."); | 463 | qDebug("KO: Backup globally cancelled."); |