Diffstat (limited to 'kabc/plugins/dir/resourcedir.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kabc/plugins/dir/resourcedir.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp index 52863d5..d978e61 100644 --- a/kabc/plugins/dir/resourcedir.cpp +++ b/kabc/plugins/dir/resourcedir.cpp @@ -57,12 +57,13 @@ $Id$ #include <qdir.h> #include "resourcedir.h" +#include "syncwidget.h" using namespace KABC; extern "C" #ifdef _WIN32_ -__declspec(dllexport) +__declspec(dllexport) #else { #endif @@ -70,14 +71,14 @@ __declspec(dllexport) //US void *init_kabc_dir() void *init_microkabc_dir() { - return new KRES::PluginFactory<ResourceDir,ResourceDirConfig>(); + return new KRES::PluginFactory<ResourceDir,ResourceDirConfig, KRES::SyncWidget>(); } #ifndef _WIN32_ } #endif -ResourceDir::ResourceDir( const KConfig *config ) - : Resource( config ) +ResourceDir::ResourceDir( const KConfig *config, bool syncable ) + : Resource( config, syncable ) { QString path; @@ -101,7 +102,7 @@ ResourceDir::ResourceDir( const KConfig *config ) mFormat = factory->format( mFormatName ); } -/*US +/*US //US qDebug("ResourceDir::ResourceDir initialized with format %s ", mFormatName.latin1()); if (mFormatName == "vcard") mFormat = new VCardFormatPlugin2(); @@ -110,7 +111,7 @@ ResourceDir::ResourceDir( const KConfig *config ) else qDebug("ResourceFile::init format unknown !!! %s ", mFormatName.latin1()); */ - + connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( pathChanged() ) ); connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) ); connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) ); @@ -125,8 +126,8 @@ ResourceDir::~ResourceDir() } void ResourceDir::writeConfig( KConfig *config ) -{ - config->setGroup( "Resource_" + identifier() ); +{ + config->setGroup( "Resource_" + identifier() ); Resource::writeConfig( config ); config->writeEntry( "FilePath", mPath ); @@ -241,10 +242,10 @@ bool ResourceDir::lock( const QString &path ) //US change the implementation how the lockfilename is getting created //US p.replace( QRegExp("/"), "_" ); //US QString lockName = locateLocal( "data", "kabc/lock/" + p + ".lock" ); - KURL url(p); + KURL url(p); QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); - - + + kdDebug(5700) << "-- lock name: " << lockName << endl; if ( QFile::exists( lockName ) ) return false; @@ -252,10 +253,10 @@ bool ResourceDir::lock( const QString &path ) QString lockUniqueName; lockUniqueName = p + KApplication::randomString( 8 ); - url = lockUniqueName; + url = lockUniqueName; //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); - + kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; // Create unique file @@ -285,7 +286,7 @@ void ResourceDir::unlock( const QString &path ) //US change the implementation how the lockfilename is getting created //US p.replace( QRegExp( "/" ), "_" ); //US QString lockName = locate( "data", "kabc/lock/" + p + ".lock" ); - KURL url(p); + KURL url(p); QString lockName = locate( "data", "kabc/lock/" + url.fileName() + ".lock" ); ::unlink( QFile::encodeName( lockName ) ); @@ -297,13 +298,13 @@ void ResourceDir::setPath( const QString &path ) { mDirWatch.stopScan(); mDirWatch.removeDir( mPath ); - + mPath = path; mDirWatch.addDir( mPath, true ); mDirWatch.startScan(); -//US simulate KDirWatch event +//US simulate KDirWatch event //US pathChanged(); } @@ -322,7 +323,7 @@ void ResourceDir::setFormat( const QString &format ) FormatFactory *factory = FormatFactory::self(); mFormat = factory->format( mFormatName ); -/*US +/*US qDebug("ResourceDir::setFormat initialized with format %s ", format.latin1()); if (mFormatName == "vcard") mFormat = new VCardFormatPlugin2(); |