-rw-r--r-- | kabc/plugins/dir/resourcedir.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp index fac06a1..7d96cb7 100644 --- a/kabc/plugins/dir/resourcedir.cpp +++ b/kabc/plugins/dir/resourcedir.cpp @@ -61,2 +61,4 @@ $Id$ +//#define ALLOW_LOCKING + using namespace KABC; @@ -138,12 +140,13 @@ Ticket *ResourceDir::requestSaveTicket() { - kdDebug(5700) << "ResourceDir::requestSaveTicket()" << endl; + if ( !addressBook() ) return 0; - +#ifdef ALLOW_LOCKING if ( !lock( mPath ) ) { - kdDebug(5700) << "ResourceDir::requestSaveTicket(): Unable to lock path '" - << mPath << "'" << endl; + return 0; } +#endif return createTicket( this ); + } @@ -180,4 +183,2 @@ bool ResourceDir::load() { - kdDebug(5700) << "ResourceDir::load(): '" << mPath << "'" << endl; - QDir dir( mPath ); @@ -207,4 +208,2 @@ bool ResourceDir::save( Ticket *ticket ) { - kdDebug(5700) << "ResourceDir::save(): '" << mPath << "'" << endl; - AddressBook::Iterator it; @@ -234,4 +233,5 @@ bool ResourceDir::save( Ticket *ticket ) delete ticket; +#ifdef ALLOW_LOCKING unlock( mPath ); - +#endif return ok; @@ -241,4 +241,3 @@ bool ResourceDir::lock( const QString &path ) { - kdDebug(5700) << "ResourceDir::lock()" << endl; - +#ifdef ALLOW_LOCKING QString p = path; @@ -251,4 +250,2 @@ bool ResourceDir::lock( const QString &path ) - kdDebug(5700) << "-- lock name: " << lockName << endl; - if ( QFile::exists( lockName ) ) return false; @@ -262,4 +259,2 @@ bool ResourceDir::lock( const QString &path ) - kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; - // Create unique file @@ -283,2 +278,5 @@ bool ResourceDir::lock( const QString &path ) return false; +#else + return true; +#endif } @@ -287,2 +285,3 @@ void ResourceDir::unlock( const QString &path ) { +#ifdef ALLOW_LOCKING QString p = path; @@ -297,2 +296,5 @@ void ResourceDir::unlock( const QString &path ) addressBook()->emitAddressBookUnlocked(); +#else + return; +#endif } |