summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/dir
Side-by-side diff
Diffstat (limited to 'kabc/plugins/dir') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/dir/resourcedir.cpp32
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
@@ -60,4 +60,6 @@ $Id$
#include "syncprefwidget.h"
+//#define ALLOW_LOCKING
+
using namespace KABC;
@@ -137,14 +139,15 @@ void ResourceDir::writeConfig( KConfig *config )
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 );
+
}
@@ -179,6 +182,4 @@ void ResourceDir::doClose()
bool ResourceDir::load()
{
- kdDebug(5700) << "ResourceDir::load(): '" << mPath << "'" << endl;
-
QDir dir( mPath );
QStringList files = dir.entryList( QDir::Files );
@@ -206,6 +207,4 @@ bool ResourceDir::load()
bool ResourceDir::save( Ticket *ticket )
{
- kdDebug(5700) << "ResourceDir::save(): '" << mPath << "'" << endl;
-
AddressBook::Iterator it;
bool ok = true;
@@ -233,6 +232,7 @@ bool ResourceDir::save( Ticket *ticket )
delete ticket;
+#ifdef ALLOW_LOCKING
unlock( mPath );
-
+#endif
return ok;
}
@@ -240,6 +240,5 @@ bool ResourceDir::save( Ticket *ticket )
bool ResourceDir::lock( const QString &path )
{
- kdDebug(5700) << "ResourceDir::lock()" << endl;
-
+#ifdef ALLOW_LOCKING
QString p = path;
//US change the implementation how the lockfilename is getting created
@@ -250,6 +249,4 @@ bool ResourceDir::lock( const QString &path )
- kdDebug(5700) << "-- lock name: " << lockName << endl;
-
if ( QFile::exists( lockName ) ) return false;
@@ -261,6 +258,4 @@ bool ResourceDir::lock( const QString &path )
mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() );
- kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl;
-
// Create unique file
QFile file( mLockUniqueName );
@@ -282,8 +277,12 @@ bool ResourceDir::lock( const QString &path )
return false;
+#else
+ return true;
+#endif
}
void ResourceDir::unlock( const QString &path )
{
+#ifdef ALLOW_LOCKING
QString p = path;
//US change the implementation how the lockfilename is getting created
@@ -296,4 +295,7 @@ void ResourceDir::unlock( const QString &path )
QFile::remove( mLockUniqueName );
addressBook()->emitAddressBookUnlocked();
+#else
+ return;
+#endif
}