-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) "Falling back to Blowfish."); _cryptAlgo = PWM_CRYPT_BLOWFISH; } if (_hashAlgo < PWM_HASH_SHA1 || _hashAlgo > PWM_HASH_TIGER) { printWarn("Invalid Hash-Algorithm selected! " "Config-file seems to be corrupt. " "Falling back to SHA1."); _hashAlgo = PWM_HASH_SHA1; } char cryptAlgo = static_cast<char>(_cryptAlgo); char hashAlgo = static_cast<char>(_hashAlgo); if (conf()->confGlobMakeFileBackup()) { if (!backupFile(filename)) return e_fileBackup; } int mLastBackupDate = 0; KConfig configGlobal (locateLocal("config","pwmanagerbuprc")); QFileInfo fileInfo ( filename ); mLastBackupDate = configGlobal.readNumEntry( "LastBackupDate-"+ fileInfo.fileName (), 0 ); KConfig config (locateLocal("config","microkdeglobalrc")); config.setGroup( "BackupSettings" ); bool b_enabled = config.readBoolEntry( "BackupEnabled" ); - if ( b_enabled ) { + if ( b_enabled && QFile::exists(filename)) { int num = config.readNumEntry( "BackupNumbers" ); int d_count = config.readNumEntry( "BackupDayCount" ); bool stdDir = config.readBoolEntry( "BackupUseDefaultDir" ); QString bupDir = config.readEntry( "BackupDatadir" ); QDate reference ( 2000,1,1 ); int daysTo = reference.daysTo ( QDate::currentDate() ); bool saveDate = false; if ( daysTo - d_count >= mLastBackupDate ) { qDebug("KA: Last backup was %d days ago ", daysTo - mLastBackupDate ); if ( stdDir ) bupDir = KGlobalSettings::backupDataDir(); int retval = KApplication::createBackup( filename, bupDir, num ); if ( retval == 0 ) { qDebug("KO: Backup cancelled. Will try again tomorrow "); // retval == 0 : backup skipped for today, try again tomorrow mLastBackupDate = daysTo - d_count+1; saveDate = true; } else if ( retval == 1 ){ qDebug("KO: Backup created."); // backup ok mLastBackupDate = daysTo; saveDate = true; } else if ( retval == 2 ){ qDebug("KO: Backup globally cancelled."); |