summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/file
authorzautrix <zautrix>2004-09-15 10:22:55 (UTC)
committer zautrix <zautrix>2004-09-15 10:22:55 (UTC)
commitd4adafe41cf399585b8e35cb600ff35706d55ae0 (patch) (side-by-side diff)
tree1becc87f6c40390fd73082996d18f71fb5e9c772 /kabc/plugins/file
parent8889ffd6f6958c3a1d07bafedcc8af5d786a1660 (diff)
downloadkdepimpi-d4adafe41cf399585b8e35cb600ff35706d55ae0.zip
kdepimpi-d4adafe41cf399585b8e35cb600ff35706d55ae0.tar.gz
kdepimpi-d4adafe41cf399585b8e35cb600ff35706d55ae0.tar.bz2
fixes for desktop version
Diffstat (limited to 'kabc/plugins/file') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/file/resourcefile.cpp20
-rw-r--r--kabc/plugins/file/resourcefile.h3
2 files changed, 15 insertions, 8 deletions
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp
index 17263ae..b8c32d5 100644
--- a/kabc/plugins/file/resourcefile.cpp
+++ b/kabc/plugins/file/resourcefile.cpp
@@ -49,12 +49,14 @@ $Id$
#include "resource.h"
#include "resourcefileconfig.h"
#include "stdaddressbook.h"
-
+#define NO_DIRWATCH
#include "resourcefile.h"
#include "syncprefwidget.h"
//#define ALLOW_LOCKING
+
+
using namespace KABC;
extern "C"
@@ -115,11 +117,11 @@ void ResourceFile::init( const QString &fileName, const QString &formatName )
mFormat = factory->format( mFormatName );
}
-
+#ifndef NO_DIRWATCH
connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
-
+#endif
setFileName( fileName );
}
@@ -227,8 +229,9 @@ bool ResourceFile::save( Ticket *ticket )
*/
//US ToDo: write backupfile
+#ifndef NO_DIRWATCH
mDirWatch.stopScan();
-
+#endif
QFile info;
info.setName( mFileName );
bool ok = info.open( IO_WriteOnly );
@@ -244,9 +247,9 @@ bool ResourceFile::save( Ticket *ticket )
if ( !ok )
addressBook()->error( i18n( "Unable to save file '%1'." ).arg( mFileName ) );
-
+#ifndef NO_DIRWATCH
mDirWatch.startScan();
-
+#endif
delete ticket;
#ifdef ALLOW_LOCKING
unlock( mFileName );
@@ -326,14 +329,17 @@ void ResourceFile::unlock( const QString &fileName )
void ResourceFile::setFileName( const QString &fileName )
{
+#ifndef NO_DIRWATCH
mDirWatch.stopScan();
mDirWatch.removeFile( mFileName );
-
mFileName = fileName;
mDirWatch.addFile( mFileName );
mDirWatch.startScan();
+#else
+ mFileName = fileName;
+#endif
//US simulate KDirWatch event
//US fileChanged();
diff --git a/kabc/plugins/file/resourcefile.h b/kabc/plugins/file/resourcefile.h
index 0a3027c..8339340 100644
--- a/kabc/plugins/file/resourcefile.h
+++ b/kabc/plugins/file/resourcefile.h
@@ -153,8 +153,9 @@ private:
FormatPlugin *mFormat;
QString mLockUniqueName;
-
+#ifndef NO_DIRWATCH
KDirWatch mDirWatch;
+#endif
};
}