summaryrefslogtreecommitdiffabout
path: root/kabc/plugins
Side-by-side diff
Diffstat (limited to 'kabc/plugins') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/dir/resourcedir.cpp32
-rw-r--r--kabc/plugins/file/resourcefile.cpp16
-rw-r--r--kabc/plugins/sharpdtm/resourcesharpdtm.cpp15
3 files changed, 42 insertions, 21 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
}
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp
index fa6bc49..17263ae 100644
--- a/kabc/plugins/file/resourcefile.cpp
+++ b/kabc/plugins/file/resourcefile.cpp
@@ -55,2 +55,3 @@ $Id$
+//#define ALLOW_LOCKING
@@ -149,7 +150,8 @@ Ticket *ResourceFile::requestSaveTicket()
+#ifdef ALLOW_LOCKING
if ( !lock( mFileName ) ) {
- kdDebug(5700) << "ResourceFile::requestSaveTicket(): Unable to lock file '"
- << mFileName << "'" << endl;
+ qDebug("unablt to lock file ");
return 0;
}
+#endif
return createTicket( this );
@@ -248,3 +250,5 @@ bool ResourceFile::save( Ticket *ticket )
delete ticket;
+#ifdef ALLOW_LOCKING
unlock( mFileName );
+#endif
@@ -255,2 +259,3 @@ bool ResourceFile::lock( const QString &fileName )
{
+#ifdef ALLOW_LOCKING
@@ -297,2 +302,5 @@ bool ResourceFile::lock( const QString &fileName )
return false;
+#else
+ return true;
+#endif
}
@@ -301,2 +309,3 @@ void ResourceFile::unlock( const QString &fileName )
{
+#ifdef ALLOW_LOCKING
QString fn = fileName;
@@ -312,2 +321,5 @@ void ResourceFile::unlock( const QString &fileName )
addressBook()->emitAddressBookUnlocked();
+#else
+ return;
+#endif
}
diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
index 8a795e9..867bc07 100644
--- a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
+++ b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
@@ -56,3 +56,3 @@ $Id$
#include "sharpdtmconverter.h"
-
+//#define ALLOW_LOCKING
using namespace KABC;
@@ -107,3 +107,3 @@ Ticket *ResourceSharpDTM::requestSaveTicket()
{
- kdDebug(5700) << "ResourceSharpDTM::requestSaveTicket()" << endl;
+
@@ -113,7 +113,8 @@ Ticket *ResourceSharpDTM::requestSaveTicket()
+#ifdef ALLOW_LOCKING
if ( !lock( fileName() ) ) {
- kdDebug(5700) << "ResourceSharpDTM::requestSaveTicket(): Unable to lock file '"
- << fileName() << "'" << endl;
+ qDebug("ResourceSharpDTM::requestSaveTicket(): Unable to lock file ");
return 0;
}
+#endif
return createTicket( this );
@@ -242,2 +243,3 @@ bool ResourceSharpDTM::lock( const QString &lockfileName )
{
+#ifdef ALLOW_LOCKING
qDebug("ResourceSharpDTM::lock: %s", fileName().latin1());
@@ -287,2 +289,5 @@ bool ResourceSharpDTM::lock( const QString &lockfileName )
return false;
+#else
+ return true;
+#endif
}
@@ -291,2 +296,3 @@ void ResourceSharpDTM::unlock( const QString &fileName )
{
+#ifdef ALLOW_LOCKING
qDebug("ResourceSharpDTM::unlock() %s", fileName.latin1());
@@ -300,2 +306,3 @@ void ResourceSharpDTM::unlock( const QString &fileName )
addressBook()->emitAddressBookUnlocked();
+#endif
}