summaryrefslogtreecommitdiffabout
path: root/kabc
authorzautrix <zautrix>2004-09-11 23:25:03 (UTC)
committer zautrix <zautrix>2004-09-11 23:25:03 (UTC)
commit0a2900e71fd3d80393d67c81aab3aae19d2d680c (patch) (side-by-side diff)
tree1f2926eca6bee600819932603eaaf28c7f267d6b /kabc
parenta040c9d56282dae396b02627fafb602e44323837 (diff)
downloadkdepimpi-0a2900e71fd3d80393d67c81aab3aae19d2d680c.zip
kdepimpi-0a2900e71fd3d80393d67c81aab3aae19d2d680c.tar.gz
kdepimpi-0a2900e71fd3d80393d67c81aab3aae19d2d680c.tar.bz2
Bugfixes
Diffstat (limited to 'kabc') (more/less context) (show 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
@@ -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;
+ 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
}
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
@@ -54,4 +54,5 @@ $Id$
#include "syncprefwidget.h"
+//#define ALLOW_LOCKING
using namespace KABC;
@@ -148,9 +149,10 @@ Ticket *ResourceFile::requestSaveTicket()
if ( !addressBook() ) return 0;
+#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 );
}
@@ -247,5 +249,7 @@ bool ResourceFile::save( Ticket *ticket )
delete ticket;
+#ifdef ALLOW_LOCKING
unlock( mFileName );
+#endif
return ok;
@@ -254,4 +258,5 @@ bool ResourceFile::save( Ticket *ticket )
bool ResourceFile::lock( const QString &fileName )
{
+#ifdef ALLOW_LOCKING
@@ -296,8 +301,12 @@ bool ResourceFile::lock( const QString &fileName )
return false;
+#else
+ return true;
+#endif
}
void ResourceFile::unlock( const QString &fileName )
{
+#ifdef ALLOW_LOCKING
QString fn = fileName;
//US change the implementation how the lockfilename is getting created
@@ -311,4 +320,7 @@ void ResourceFile::unlock( const QString &fileName )
QFile::remove( mLockUniqueName );
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
@@ -55,5 +55,5 @@ $Id$
#include "sharpdtmconverter.h"
-
+//#define ALLOW_LOCKING
using namespace KABC;
extern "C"
@@ -106,5 +106,5 @@ void ResourceSharpDTM::writeConfig( KConfig *config )
Ticket *ResourceSharpDTM::requestSaveTicket()
{
- kdDebug(5700) << "ResourceSharpDTM::requestSaveTicket()" << endl;
+
qDebug("ResourceSharpDTM::requestSaveTicket: %s", fileName().latin1());
@@ -112,9 +112,10 @@ Ticket *ResourceSharpDTM::requestSaveTicket()
if ( !addressBook() ) return 0;
+#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 );
}
@@ -241,4 +242,5 @@ bool ResourceSharpDTM::save( Ticket *ticket )
bool ResourceSharpDTM::lock( const QString &lockfileName )
{
+#ifdef ALLOW_LOCKING
qDebug("ResourceSharpDTM::lock: %s", fileName().latin1());
@@ -286,8 +288,12 @@ bool ResourceSharpDTM::lock( const QString &lockfileName )
return false;
+#else
+ return true;
+#endif
}
void ResourceSharpDTM::unlock( const QString &fileName )
{
+#ifdef ALLOW_LOCKING
qDebug("ResourceSharpDTM::unlock() %s", fileName.latin1());
@@ -299,4 +305,5 @@ void ResourceSharpDTM::unlock( const QString &fileName )
QFile::remove( mLockUniqueName );
addressBook()->emitAddressBookUnlocked();
+#endif
}