From a3083042bb9c69193cc43105e6c9d045bd79e8b2 Mon Sep 17 00:00:00 2001 From: ulf69 Date: Fri, 20 Aug 2004 19:53:52 +0000 Subject: merged bugfix from KDE Head: Don't KDirWatch for own changes --- diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp index eccd482..fac06a1 100644 --- a/kabc/plugins/dir/resourcedir.cpp +++ b/kabc/plugins/dir/resourcedir.cpp @@ -210,6 +210,8 @@ bool ResourceDir::save( Ticket *ticket ) AddressBook::Iterator it; bool ok = true; + mDirWatch.stopScan(); + for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { if ( (*it).resource() != this || !(*it).changed() ) continue; @@ -227,6 +229,7 @@ bool ResourceDir::save( Ticket *ticket ) file.close(); } + mDirWatch.startScan(); delete ticket; unlock( mPath ); diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp index da2e4d7..fa6bc49 100644 --- a/kabc/plugins/file/resourcefile.cpp +++ b/kabc/plugins/file/resourcefile.cpp @@ -204,7 +204,7 @@ bool ResourceFile::load() bool ResourceFile::save( Ticket *ticket ) { -// qDebug("ResourceFile::save format %s, %s", mFileName.latin1(), mFormatName.latin1()); +// qDebug("ResourceFile::save format %s, %s", mFileName.latin1(), mFormatName.latin1()); // create backup file @@ -225,6 +225,8 @@ bool ResourceFile::save( Ticket *ticket ) */ //US ToDo: write backupfile + mDirWatch.stopScan(); + QFile info; info.setName( mFileName ); bool ok = info.open( IO_WriteOnly ); @@ -241,13 +243,12 @@ bool ResourceFile::save( Ticket *ticket ) if ( !ok ) addressBook()->error( i18n( "Unable to save file '%1'." ).arg( mFileName ) ); + mDirWatch.startScan(); + delete ticket; unlock( mFileName ); return ok; - - qDebug("ResourceFile::save has to be changed"); - return true; } bool ResourceFile::lock( const QString &fileName ) diff --git a/kabc/plugins/opie/resourceopie.cpp b/kabc/plugins/opie/resourceopie.cpp index 4b811e9..22237dc 100644 --- a/kabc/plugins/opie/resourceopie.cpp +++ b/kabc/plugins/opie/resourceopie.cpp @@ -211,7 +211,7 @@ bool ResourceOpie::save( Ticket *ticket ) { qDebug("ResourceOpie::save: %s", fileName().latin1()); - + mDirWatch.stopScan(); KABC::AddressBook::Iterator it; bool res; @@ -235,6 +235,8 @@ bool ResourceOpie::save( Ticket *ticket ) mAccess->save(); + mDirWatch.startScan(); + delete ticket; unlock( fileName() ); diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp index 93a4d33..48a9f22 100644 --- a/kabc/plugins/qtopia/resourceqtopia.cpp +++ b/kabc/plugins/qtopia/resourceqtopia.cpp @@ -191,6 +191,7 @@ bool ResourceQtopia::save( Ticket *ticket ) { qDebug("ResourceQtopia::save: %s", fileName().latin1()); + mDirWatch.stopScan(); KABC::AddressBook::Iterator it; bool res; @@ -214,6 +215,8 @@ bool ResourceQtopia::save( Ticket *ticket ) // mAccess->addressBookUpdated(); + mDirWatch.startScan(); + delete ticket; unlock( fileName() ); diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp index b63df0c..8a795e9 100644 --- a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp +++ b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp @@ -197,6 +197,7 @@ bool ResourceSharpDTM::save( Ticket *ticket ) { qDebug("ResourceSharpDTM::save: %s", fileName().latin1()); + mDirWatch.stopScan(); KABC::AddressBook::Iterator it; bool res; @@ -230,6 +231,7 @@ bool ResourceSharpDTM::save( Ticket *ticket ) //US mAccess->save(); + mDirWatch.startScan(); delete ticket; unlock( fileName() ); -- cgit v0.9.0.2