summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
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/plugins/sharpdtm/resourcesharpdtm.cpp
parenta040c9d56282dae396b02627fafb602e44323837 (diff)
downloadkdepimpi-0a2900e71fd3d80393d67c81aab3aae19d2d680c.zip
kdepimpi-0a2900e71fd3d80393d67c81aab3aae19d2d680c.tar.gz
kdepimpi-0a2900e71fd3d80393d67c81aab3aae19d2d680c.tar.bz2
Bugfixes
Diffstat (limited to 'kabc/plugins/sharpdtm/resourcesharpdtm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/sharpdtm/resourcesharpdtm.cpp15
1 files changed, 11 insertions, 4 deletions
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
@@ -51,13 +51,13 @@ $Id$
#include "syncprefwidget.h"
#include "stdaddressbook.h"
#include "sharpdtmconverter.h"
-
+//#define ALLOW_LOCKING
using namespace KABC;
extern "C"
{
void *init_microkabc_sharpdtm()
{
return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig,SyncPrefWidgetContainer>();
@@ -102,23 +102,24 @@ void ResourceSharpDTM::writeConfig( KConfig *config )
{
Resource::writeConfig( config );
}
Ticket *ResourceSharpDTM::requestSaveTicket()
{
- kdDebug(5700) << "ResourceSharpDTM::requestSaveTicket()" << endl;
+
qDebug("ResourceSharpDTM::requestSaveTicket: %s", fileName().latin1());
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 );
}
bool ResourceSharpDTM::doOpen()
{
@@ -237,12 +238,13 @@ bool ResourceSharpDTM::save( Ticket *ticket )
return true;
}
bool ResourceSharpDTM::lock( const QString &lockfileName )
{
+#ifdef ALLOW_LOCKING
qDebug("ResourceSharpDTM::lock: %s", fileName().latin1());
kdDebug(5700) << "ResourceSharpDTM::lock()" << endl;
QString fn = lockfileName;
@@ -282,25 +284,30 @@ bool ResourceSharpDTM::lock( const QString &lockfileName )
return true;
}
// TODO: check stat
return false;
+#else
+ return true;
+#endif
}
void ResourceSharpDTM::unlock( const QString &fileName )
{
+#ifdef ALLOW_LOCKING
qDebug("ResourceSharpDTM::unlock() %s", fileName.latin1());
QString fn = fileName;
KURL url(fn);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
QFile::remove( lockName );
QFile::remove( mLockUniqueName );
addressBook()->emitAddressBookUnlocked();
+#endif
}
void ResourceSharpDTM::setFileName( const QString &newFileName )
{
mDirWatch.stopScan();
mDirWatch.removeFile( fileName() );