summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/file
Side-by-side diff
Diffstat (limited to 'kabc/plugins/file') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/file/resourcefile.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp
index da2e4d7..fa6bc49 100644
--- a/kabc/plugins/file/resourcefile.cpp
+++ b/kabc/plugins/file/resourcefile.cpp
@@ -195,68 +195,69 @@ bool ResourceFile::load()
if ( !file.open( IO_ReadOnly ) ) {
addressBook()->error( i18n( "Unable to open file '%1'." ).arg( mFileName ) );
return false;
}
// qDebug("ResourceFile::load format %s, %s", mFileName.latin1(), mFormatName.latin1());
return mFormat->loadAll( addressBook(), this, &file );
}
bool ResourceFile::save( Ticket *ticket )
{
-// qDebug("ResourceFile::save format %s, %s", mFileName.latin1(), mFormatName.latin1());
+// qDebug("ResourceFile::save format %s, %s", mFileName.latin1(), mFormatName.latin1());
// create backup file
QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() );
/*US we use a simpler method to create a backupfile
(void) KSaveFile::backupFile( mFileName, QString::null
,extension );
KSaveFile saveFile( mFileName );
bool ok = false;
if ( saveFile.status() == 0 && saveFile.file() )
{
mFormat->saveAll( addressBook(), this, saveFile.file() );
ok = saveFile.close();
}
*/
//US ToDo: write backupfile
+ mDirWatch.stopScan();
+
QFile info;
info.setName( mFileName );
bool ok = info.open( IO_WriteOnly );
if ( ok ) {
mFormat->saveAll( addressBook(), this, &info );
info.close();
ok = true;
}
else {
}
if ( !ok )
addressBook()->error( i18n( "Unable to save file '%1'." ).arg( mFileName ) );
+ mDirWatch.startScan();
+
delete ticket;
unlock( mFileName );
return ok;
-
- qDebug("ResourceFile::save has to be changed");
- return true;
}
bool ResourceFile::lock( const QString &fileName )
{
QString fn = fileName;
//US change the implementation how the lockfilename is getting created
//US fn.replace( QRegExp("/"), "_" );
//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );