-rw-r--r-- | kabc/plugins/dir/resourcedir.cpp | 3 | ||||
-rw-r--r-- | kabc/plugins/file/resourcefile.cpp | 9 | ||||
-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, 16 insertions, 5 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 @@ -207,12 +207,14 @@ 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 ) ) { @@ -224,12 +226,13 @@ bool ResourceDir::save( Ticket *ticket ) // mark as unchanged (*it).setChanged( false ); file.close(); } + mDirWatch.startScan(); delete ticket; unlock( mPath ); return ok; } 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 @@ -201,13 +201,13 @@ bool ResourceFile::load() return mFormat->loadAll( addressBook(), this, &file ); } 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 QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() ); /*US we use a simpler method to create a backupfile @@ -222,12 +222,14 @@ bool ResourceFile::save( Ticket *ticket ) 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 ); @@ -238,19 +240,18 @@ 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 @@ -208,13 +208,13 @@ bool ResourceOpie::load() } 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; @@ -232,12 +232,14 @@ bool ResourceOpie::save( Ticket *ticket ) qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1()); } } mAccess->save(); + mDirWatch.startScan(); + delete ticket; unlock( fileName() ); return true; } 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 @@ -188,12 +188,13 @@ bool ResourceQtopia::load() } 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; @@ -211,12 +212,14 @@ bool ResourceQtopia::save( Ticket *ticket ) qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1()); } } // mAccess->addressBookUpdated(); + mDirWatch.startScan(); + delete ticket; unlock( fileName() ); return true; } 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 @@ -194,12 +194,13 @@ bool ResourceSharpDTM::load() } 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 @@ -227,12 +228,13 @@ bool ResourceSharpDTM::save( Ticket *ticket ) } } //US mAccess->save(); + mDirWatch.startScan(); delete ticket; unlock( fileName() ); return true; } |