summaryrefslogtreecommitdiffabout
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
parenta040c9d56282dae396b02627fafb602e44323837 (diff)
downloadkdepimpi-0a2900e71fd3d80393d67c81aab3aae19d2d680c.zip
kdepimpi-0a2900e71fd3d80393d67c81aab3aae19d2d680c.tar.gz
kdepimpi-0a2900e71fd3d80393d67c81aab3aae19d2d680c.tar.bz2
Bugfixes
Diffstat (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
-rw-r--r--kmicromail/accountitem.h2
4 files changed, 44 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
@@ -58,8 +58,10 @@ $Id$
#include "resourcedir.h"
#include "syncprefwidget.h"
+//#define ALLOW_LOCKING
+
using namespace KABC;
extern "C"
#ifdef _WIN32_
@@ -135,18 +137,19 @@ 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 );
+
}
bool ResourceDir::doOpen()
@@ -177,10 +180,8 @@ void ResourceDir::doClose()
}
bool ResourceDir::load()
{
- kdDebug(5700) << "ResourceDir::load(): '" << mPath << "'" << endl;
-
QDir dir( mPath );
QStringList files = dir.entryList( QDir::Files );
QStringList::Iterator it;
@@ -204,10 +205,8 @@ bool ResourceDir::load()
}
bool ResourceDir::save( Ticket *ticket )
{
- kdDebug(5700) << "ResourceDir::save(): '" << mPath << "'" << endl;
-
AddressBook::Iterator it;
bool ok = true;
mDirWatch.stopScan();
@@ -231,27 +230,25 @@ bool ResourceDir::save( Ticket *ticket )
}
mDirWatch.startScan();
delete ticket;
+#ifdef ALLOW_LOCKING
unlock( mPath );
-
+#endif
return ok;
}
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
//US p.replace( QRegExp("/"), "_" );
//US QString lockName = locateLocal( "data", "kabc/lock/" + p + ".lock" );
KURL url(p);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
- kdDebug(5700) << "-- lock name: " << lockName << endl;
-
if ( QFile::exists( lockName ) ) return false;
QString lockUniqueName;
lockUniqueName = p + KApplication::randomString( 8 );
@@ -259,10 +256,8 @@ bool ResourceDir::lock( const QString &path )
url = lockUniqueName;
//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName );
mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() );
- kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl;
-
// Create unique file
QFile file( mLockUniqueName );
file.open( IO_WriteOnly );
file.close();
@@ -280,12 +275,16 @@ bool ResourceDir::lock( const QString &path )
// TODO: check stat
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
//US p.replace( QRegExp( "/" ), "_" );
//US QString lockName = locate( "data", "kabc/lock/" + p + ".lock" );
@@ -294,8 +293,11 @@ void ResourceDir::unlock( const QString &path )
::unlink( QFile::encodeName( lockName ) );
QFile::remove( mLockUniqueName );
addressBook()->emitAddressBookUnlocked();
+#else
+ return;
+#endif
}
void ResourceDir::setPath( const QString &path )
{
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
@@ -52,8 +52,9 @@ $Id$
#include "resourcefile.h"
#include "syncprefwidget.h"
+//#define ALLOW_LOCKING
using namespace KABC;
extern "C"
@@ -146,13 +147,14 @@ Ticket *ResourceFile::requestSaveTicket()
kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl;
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 );
}
@@ -245,15 +247,18 @@ bool ResourceFile::save( Ticket *ticket )
mDirWatch.startScan();
delete ticket;
+#ifdef ALLOW_LOCKING
unlock( mFileName );
+#endif
return ok;
}
bool ResourceFile::lock( const QString &fileName )
{
+#ifdef ALLOW_LOCKING
QString fn = fileName;
@@ -294,12 +299,16 @@ bool ResourceFile::lock( const QString &fileName )
// TODO: check stat
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
//US fn.replace( QRegExp( "/" ), "_" );
//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );
@@ -309,8 +318,11 @@ void ResourceFile::unlock( const QString &fileName )
QFile::remove( lockName );
QFile::remove( mLockUniqueName );
addressBook()->emitAddressBookUnlocked();
+#else
+ return;
+#endif
}
void ResourceFile::setFileName( const QString &fileName )
{
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
@@ -53,9 +53,9 @@ $Id$
#include "stdaddressbook.h"
#include "sharpdtmconverter.h"
-
+//#define ALLOW_LOCKING
using namespace KABC;
extern "C"
{
void *init_microkabc_sharpdtm()
@@ -104,19 +104,20 @@ void ResourceSharpDTM::writeConfig( KConfig *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 );
}
@@ -239,8 +240,9 @@ bool ResourceSharpDTM::save( Ticket *ticket )
}
bool ResourceSharpDTM::lock( const QString &lockfileName )
{
+#ifdef ALLOW_LOCKING
qDebug("ResourceSharpDTM::lock: %s", fileName().latin1());
kdDebug(5700) << "ResourceSharpDTM::lock()" << endl;
@@ -284,12 +286,16 @@ bool ResourceSharpDTM::lock( const QString &lockfileName )
// 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);
@@ -297,8 +303,9 @@ void ResourceSharpDTM::unlock( const QString &fileName )
QFile::remove( lockName );
QFile::remove( mLockUniqueName );
addressBook()->emitAddressBookUnlocked();
+#endif
}
void ResourceSharpDTM::setFileName( const QString &newFileName )
{
diff --git a/kmicromail/accountitem.h b/kmicromail/accountitem.h
index faf919d..4c92bfc 100644
--- a/kmicromail/accountitem.h
+++ b/kmicromail/accountitem.h
@@ -1,10 +1,12 @@
#ifndef __ACCOUNT_ITEM
#define __ACCOUNT_ITEM
+
#include <qlistview.h>
#include <qlist.h>
#include <opie2/osmartpointer.h>
+#include <libmailwrapper/mailwrapper.h>
class POP3wrapper;
class RecMail;
class RecBody;