-rw-r--r-- | kabc/plugins/dir/resourcedir.cpp | 3 | ||||
-rw-r--r-- | kabc/plugins/file/resourcefile.cpp | 7 | ||||
-rw-r--r-- | kabc/plugins/opie/resourceopie.cpp | 4 | ||||
-rw-r--r-- | kabc/plugins/qtopia/resourceqtopia.cpp | 3 | ||||
-rw-r--r-- | kabc/plugins/sharpdtm/resourcesharpdtm.cpp | 2 |
5 files changed, 15 insertions, 4 deletions
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 @@ -205,16 +205,18 @@ bool ResourceDir::load() bool ResourceDir::save( Ticket *ticket ) { kdDebug(5700) << "ResourceDir::save(): '" << mPath << "'" << endl; AddressBook::Iterator it; bool ok = true; + mDirWatch.stopScan(); + for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { if ( (*it).resource() != this || !(*it).changed() ) continue; QFile file( mPath + "/" + (*it).uid() ); if ( !file.open( IO_WriteOnly ) ) { addressBook()->error( i18n( "Unable to open file '%1' for writing" ).arg( file.name() ) ); continue; @@ -222,16 +224,17 @@ bool ResourceDir::save( Ticket *ticket ) mFormat->save( *it, &file ); // mark as unchanged (*it).setChanged( false ); file.close(); } + mDirWatch.startScan(); delete ticket; unlock( mPath ); return ok; } bool ResourceDir::lock( const QString &path ) 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 @@ -220,39 +220,40 @@ bool ResourceFile::save( Ticket *ticket ) if ( saveFile.status() == 0 && saveFile.file() ) { mFormat->saveAll( addressBook(), this, saveFile.file() ); ok = saveFile.close(); } */ //US ToDo: write backupfile + mDirWatch.stopScan(); + QFile info; info.setName( mFileName ); bool ok = info.open( IO_WriteOnly ); if ( ok ) { mFormat->saveAll( addressBook(), this, &info ); info.close(); ok = true; } else { } 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 ) { QString fn = 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 @@ -206,17 +206,17 @@ bool ResourceOpie::load() return true; } bool ResourceOpie::save( Ticket *ticket ) { qDebug("ResourceOpie::save: %s", fileName().latin1()); - + mDirWatch.stopScan(); KABC::AddressBook::Iterator it; bool res; for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { OContact c; KABC::Addressee addressee = (*it); @@ -230,16 +230,18 @@ bool ResourceOpie::save( Ticket *ticket ) else { qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1()); } } mAccess->save(); + mDirWatch.startScan(); + delete ticket; unlock( fileName() ); return true; } bool ResourceOpie::lock( const QString &lockfileName ) 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 @@ -186,16 +186,17 @@ bool ResourceQtopia::load() return true; } bool ResourceQtopia::save( Ticket *ticket ) { qDebug("ResourceQtopia::save: %s", fileName().latin1()); + mDirWatch.stopScan(); KABC::AddressBook::Iterator it; bool res; for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { PimContact c; KABC::Addressee addressee = (*it); @@ -209,16 +210,18 @@ bool ResourceQtopia::save( Ticket *ticket ) else { qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1()); } } // mAccess->addressBookUpdated(); + mDirWatch.startScan(); + delete ticket; unlock( fileName() ); return true; } bool ResourceQtopia::lock( const QString &lockfileName ) { 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 @@ -192,16 +192,17 @@ bool ResourceSharpDTM::load() return true; } bool ResourceSharpDTM::save( Ticket *ticket ) { qDebug("ResourceSharpDTM::save: %s", fileName().latin1()); + mDirWatch.stopScan(); KABC::AddressBook::Iterator it; bool res; for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { CardId id = 0; // 0 means new card KABC::Addressee addressee = (*it); @@ -225,16 +226,17 @@ bool ResourceSharpDTM::save( Ticket *ticket ) { qDebug("Unable to add new card. Addressee: %s", addressee.formattedName().latin1()); } } //US mAccess->save(); + mDirWatch.startScan(); delete ticket; unlock( fileName() ); return true; } bool ResourceSharpDTM::lock( const QString &lockfileName ) { |