summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (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
-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
@@ -60,4 +60,6 @@ $Id$
60#include "syncprefwidget.h" 60#include "syncprefwidget.h"
61 61
62//#define ALLOW_LOCKING
63
62using namespace KABC; 64using namespace KABC;
63 65
@@ -137,14 +139,15 @@ void ResourceDir::writeConfig( KConfig *config )
137Ticket *ResourceDir::requestSaveTicket() 139Ticket *ResourceDir::requestSaveTicket()
138{ 140{
139 kdDebug(5700) << "ResourceDir::requestSaveTicket()" << endl; 141
140 142
141 if ( !addressBook() ) return 0; 143 if ( !addressBook() ) return 0;
142 144#ifdef ALLOW_LOCKING
143 if ( !lock( mPath ) ) { 145 if ( !lock( mPath ) ) {
144 kdDebug(5700) << "ResourceDir::requestSaveTicket(): Unable to lock path '" 146
145 << mPath << "'" << endl;
146 return 0; 147 return 0;
147 } 148 }
149#endif
148 return createTicket( this ); 150 return createTicket( this );
151
149} 152}
150 153
@@ -179,6 +182,4 @@ void ResourceDir::doClose()
179bool ResourceDir::load() 182bool ResourceDir::load()
180{ 183{
181 kdDebug(5700) << "ResourceDir::load(): '" << mPath << "'" << endl;
182
183 QDir dir( mPath ); 184 QDir dir( mPath );
184 QStringList files = dir.entryList( QDir::Files ); 185 QStringList files = dir.entryList( QDir::Files );
@@ -206,6 +207,4 @@ bool ResourceDir::load()
206bool ResourceDir::save( Ticket *ticket ) 207bool ResourceDir::save( Ticket *ticket )
207{ 208{
208 kdDebug(5700) << "ResourceDir::save(): '" << mPath << "'" << endl;
209
210 AddressBook::Iterator it; 209 AddressBook::Iterator it;
211 bool ok = true; 210 bool ok = true;
@@ -233,6 +232,7 @@ bool ResourceDir::save( Ticket *ticket )
233 232
234 delete ticket; 233 delete ticket;
234#ifdef ALLOW_LOCKING
235 unlock( mPath ); 235 unlock( mPath );
236 236#endif
237 return ok; 237 return ok;
238} 238}
@@ -240,6 +240,5 @@ bool ResourceDir::save( Ticket *ticket )
240bool ResourceDir::lock( const QString &path ) 240bool ResourceDir::lock( const QString &path )
241{ 241{
242 kdDebug(5700) << "ResourceDir::lock()" << endl; 242#ifdef ALLOW_LOCKING
243
244 QString p = path; 243 QString p = path;
245//US change the implementation how the lockfilename is getting created 244//US change the implementation how the lockfilename is getting created
@@ -250,6 +249,4 @@ bool ResourceDir::lock( const QString &path )
250 249
251 250
252 kdDebug(5700) << "-- lock name: " << lockName << endl;
253
254 if ( QFile::exists( lockName ) ) return false; 251 if ( QFile::exists( lockName ) ) return false;
255 252
@@ -261,6 +258,4 @@ bool ResourceDir::lock( const QString &path )
261 mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); 258 mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() );
262 259
263 kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl;
264
265 // Create unique file 260 // Create unique file
266 QFile file( mLockUniqueName ); 261 QFile file( mLockUniqueName );
@@ -282,8 +277,12 @@ bool ResourceDir::lock( const QString &path )
282 277
283 return false; 278 return false;
279#else
280 return true;
281#endif
284} 282}
285 283
286void ResourceDir::unlock( const QString &path ) 284void ResourceDir::unlock( const QString &path )
287{ 285{
286#ifdef ALLOW_LOCKING
288 QString p = path; 287 QString p = path;
289//US change the implementation how the lockfilename is getting created 288//US change the implementation how the lockfilename is getting created
@@ -296,4 +295,7 @@ void ResourceDir::unlock( const QString &path )
296 QFile::remove( mLockUniqueName ); 295 QFile::remove( mLockUniqueName );
297 addressBook()->emitAddressBookUnlocked(); 296 addressBook()->emitAddressBookUnlocked();
297#else
298 return;
299#endif
298} 300}
299 301
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$
54#include "syncprefwidget.h" 54#include "syncprefwidget.h"
55 55
56//#define ALLOW_LOCKING
56 57
57using namespace KABC; 58using namespace KABC;
@@ -148,9 +149,10 @@ Ticket *ResourceFile::requestSaveTicket()
148 if ( !addressBook() ) return 0; 149 if ( !addressBook() ) return 0;
149 150
151#ifdef ALLOW_LOCKING
150 if ( !lock( mFileName ) ) { 152 if ( !lock( mFileName ) ) {
151 kdDebug(5700) << "ResourceFile::requestSaveTicket(): Unable to lock file '" 153 qDebug("unablt to lock file ");
152 << mFileName << "'" << endl;
153 return 0; 154 return 0;
154 } 155 }
156#endif
155 return createTicket( this ); 157 return createTicket( this );
156} 158}
@@ -247,5 +249,7 @@ bool ResourceFile::save( Ticket *ticket )
247 249
248 delete ticket; 250 delete ticket;
251#ifdef ALLOW_LOCKING
249 unlock( mFileName ); 252 unlock( mFileName );
253#endif
250 254
251 return ok; 255 return ok;
@@ -254,4 +258,5 @@ bool ResourceFile::save( Ticket *ticket )
254bool ResourceFile::lock( const QString &fileName ) 258bool ResourceFile::lock( const QString &fileName )
255{ 259{
260#ifdef ALLOW_LOCKING
256 261
257 262
@@ -296,8 +301,12 @@ bool ResourceFile::lock( const QString &fileName )
296 301
297 return false; 302 return false;
303#else
304 return true;
305#endif
298} 306}
299 307
300void ResourceFile::unlock( const QString &fileName ) 308void ResourceFile::unlock( const QString &fileName )
301{ 309{
310#ifdef ALLOW_LOCKING
302 QString fn = fileName; 311 QString fn = fileName;
303//US change the implementation how the lockfilename is getting created 312//US change the implementation how the lockfilename is getting created
@@ -311,4 +320,7 @@ void ResourceFile::unlock( const QString &fileName )
311 QFile::remove( mLockUniqueName ); 320 QFile::remove( mLockUniqueName );
312 addressBook()->emitAddressBookUnlocked(); 321 addressBook()->emitAddressBookUnlocked();
322#else
323 return;
324#endif
313} 325}
314 326
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$
55 55
56#include "sharpdtmconverter.h" 56#include "sharpdtmconverter.h"
57 57//#define ALLOW_LOCKING
58using namespace KABC; 58using namespace KABC;
59extern "C" 59extern "C"
@@ -106,5 +106,5 @@ void ResourceSharpDTM::writeConfig( KConfig *config )
106Ticket *ResourceSharpDTM::requestSaveTicket() 106Ticket *ResourceSharpDTM::requestSaveTicket()
107{ 107{
108 kdDebug(5700) << "ResourceSharpDTM::requestSaveTicket()" << endl; 108
109 109
110 qDebug("ResourceSharpDTM::requestSaveTicket: %s", fileName().latin1()); 110 qDebug("ResourceSharpDTM::requestSaveTicket: %s", fileName().latin1());
@@ -112,9 +112,10 @@ Ticket *ResourceSharpDTM::requestSaveTicket()
112 if ( !addressBook() ) return 0; 112 if ( !addressBook() ) return 0;
113 113
114#ifdef ALLOW_LOCKING
114 if ( !lock( fileName() ) ) { 115 if ( !lock( fileName() ) ) {
115 kdDebug(5700) << "ResourceSharpDTM::requestSaveTicket(): Unable to lock file '" 116 qDebug("ResourceSharpDTM::requestSaveTicket(): Unable to lock file ");
116 << fileName() << "'" << endl;
117 return 0; 117 return 0;
118 } 118 }
119#endif
119 return createTicket( this ); 120 return createTicket( this );
120} 121}
@@ -241,4 +242,5 @@ bool ResourceSharpDTM::save( Ticket *ticket )
241bool ResourceSharpDTM::lock( const QString &lockfileName ) 242bool ResourceSharpDTM::lock( const QString &lockfileName )
242{ 243{
244#ifdef ALLOW_LOCKING
243 qDebug("ResourceSharpDTM::lock: %s", fileName().latin1()); 245 qDebug("ResourceSharpDTM::lock: %s", fileName().latin1());
244 246
@@ -286,8 +288,12 @@ bool ResourceSharpDTM::lock( const QString &lockfileName )
286 288
287 return false; 289 return false;
290#else
291 return true;
292#endif
288} 293}
289 294
290void ResourceSharpDTM::unlock( const QString &fileName ) 295void ResourceSharpDTM::unlock( const QString &fileName )
291{ 296{
297#ifdef ALLOW_LOCKING
292 qDebug("ResourceSharpDTM::unlock() %s", fileName.latin1()); 298 qDebug("ResourceSharpDTM::unlock() %s", fileName.latin1());
293 299
@@ -299,4 +305,5 @@ void ResourceSharpDTM::unlock( const QString &fileName )
299 QFile::remove( mLockUniqueName ); 305 QFile::remove( mLockUniqueName );
300 addressBook()->emitAddressBookUnlocked(); 306 addressBook()->emitAddressBookUnlocked();
307#endif
301} 308}
302 309
diff --git a/kmicromail/accountitem.h b/kmicromail/accountitem.h
index faf919d..4c92bfc 100644
--- a/kmicromail/accountitem.h
+++ b/kmicromail/accountitem.h
@@ -2,7 +2,9 @@
2#define __ACCOUNT_ITEM 2#define __ACCOUNT_ITEM
3 3
4
4#include <qlistview.h> 5#include <qlistview.h>
5#include <qlist.h> 6#include <qlist.h>
6#include <opie2/osmartpointer.h> 7#include <opie2/osmartpointer.h>
8#include <libmailwrapper/mailwrapper.h>
7 9
8class POP3wrapper; 10class POP3wrapper;