author | ulf69 <ulf69> | 2004-08-20 19:53:52 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-20 19:53:52 (UTC) |
commit | a3083042bb9c69193cc43105e6c9d045bd79e8b2 (patch) (side-by-side diff) | |
tree | 6d89eb16d0661b03316117aca6f919339ef5df1d /kabc/plugins | |
parent | b42c4af4200c67802ee0cc57e10e1464903736b7 (diff) | |
download | kdepimpi-a3083042bb9c69193cc43105e6c9d045bd79e8b2.zip kdepimpi-a3083042bb9c69193cc43105e6c9d045bd79e8b2.tar.gz kdepimpi-a3083042bb9c69193cc43105e6c9d045bd79e8b2.tar.bz2 |
merged bugfix from KDE Head: Don't KDirWatch for own changes
-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 @@ -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 @@ -199,17 +199,17 @@ bool ResourceFile::load() // qDebug("ResourceFile::load format %s, %s", mFileName.latin1(), mFormatName.latin1()); 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 (void) KSaveFile::backupFile( mFileName, QString::null @@ -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 ) { |