author | ulf69 <ulf69> | 2004-08-20 19:53:52 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-20 19:53:52 (UTC) |
commit | a3083042bb9c69193cc43105e6c9d045bd79e8b2 (patch) (unidiff) | |
tree | 6d89eb16d0661b03316117aca6f919339ef5df1d /kabc/plugins/sharpdtm | |
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/sharpdtm/resourcesharpdtm.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
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 | |||
@@ -176,81 +176,83 @@ bool ResourceSharpDTM::load() | |||
176 | CardId id; | 176 | CardId id; |
177 | 177 | ||
178 | for (bool res=mAccess->first(); res == true; res=mAccess->next()) | 178 | for (bool res=mAccess->first(); res == true; res=mAccess->next()) |
179 | { | 179 | { |
180 | id = mAccess->cardId(); | 180 | id = mAccess->cardId(); |
181 | 181 | ||
182 | KABC::Addressee addressee; | 182 | KABC::Addressee addressee; |
183 | 183 | ||
184 | res = mConverter->sharpToAddressee( id, mAccess, addressee ); | 184 | res = mConverter->sharpToAddressee( id, mAccess, addressee ); |
185 | 185 | ||
186 | if ( !addressee.isEmpty() && res ) | 186 | if ( !addressee.isEmpty() && res ) |
187 | { | 187 | { |
188 | addressee.setResource( this ); | 188 | addressee.setResource( this ); |
189 | addressBook()->insertAddressee( addressee ); | 189 | addressBook()->insertAddressee( addressee ); |
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
193 | return true; | 193 | return true; |
194 | } | 194 | } |
195 | 195 | ||
196 | bool ResourceSharpDTM::save( Ticket *ticket ) | 196 | bool ResourceSharpDTM::save( Ticket *ticket ) |
197 | { | 197 | { |
198 | qDebug("ResourceSharpDTM::save: %s", fileName().latin1()); | 198 | qDebug("ResourceSharpDTM::save: %s", fileName().latin1()); |
199 | 199 | ||
200 | mDirWatch.stopScan(); | ||
200 | 201 | ||
201 | KABC::AddressBook::Iterator it; | 202 | KABC::AddressBook::Iterator it; |
202 | bool res; | 203 | bool res; |
203 | 204 | ||
204 | for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { | 205 | for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { |
205 | CardId id = 0;// 0 means new card | 206 | CardId id = 0;// 0 means new card |
206 | KABC::Addressee addressee = (*it); | 207 | KABC::Addressee addressee = (*it); |
207 | 208 | ||
208 | res = mAccess->startEditCard(id); | 209 | res = mAccess->startEditCard(id); |
209 | if (res == true) | 210 | if (res == true) |
210 | { | 211 | { |
211 | res = mConverter->addresseeToSharp( *it, mAccess, id ); | 212 | res = mConverter->addresseeToSharp( *it, mAccess, id ); |
212 | if (res == true) | 213 | if (res == true) |
213 | { | 214 | { |
214 | res = mAccess->finishEditCard(&id); | 215 | res = mAccess->finishEditCard(&id); |
215 | if (res == false) | 216 | if (res == false) |
216 | qDebug("Unable to append Contact: %s", addressee.formattedName().latin1()); | 217 | qDebug("Unable to append Contact: %s", addressee.formattedName().latin1()); |
217 | } | 218 | } |
218 | else | 219 | else |
219 | { | 220 | { |
220 | qDebug("Unable to convert Addressee: %s", addressee.formattedName().latin1()); | 221 | qDebug("Unable to convert Addressee: %s", addressee.formattedName().latin1()); |
221 | mAccess->cancelEditCard(); | 222 | mAccess->cancelEditCard(); |
222 | } | 223 | } |
223 | } | 224 | } |
224 | else | 225 | else |
225 | { | 226 | { |
226 | qDebug("Unable to add new card. Addressee: %s", addressee.formattedName().latin1()); | 227 | qDebug("Unable to add new card. Addressee: %s", addressee.formattedName().latin1()); |
227 | } | 228 | } |
228 | 229 | ||
229 | } | 230 | } |
230 | 231 | ||
231 | //US mAccess->save(); | 232 | //US mAccess->save(); |
232 | 233 | ||
234 | mDirWatch.startScan(); | ||
233 | delete ticket; | 235 | delete ticket; |
234 | unlock( fileName() ); | 236 | unlock( fileName() ); |
235 | 237 | ||
236 | return true; | 238 | return true; |
237 | } | 239 | } |
238 | 240 | ||
239 | bool ResourceSharpDTM::lock( const QString &lockfileName ) | 241 | bool ResourceSharpDTM::lock( const QString &lockfileName ) |
240 | { | 242 | { |
241 | qDebug("ResourceSharpDTM::lock: %s", fileName().latin1()); | 243 | qDebug("ResourceSharpDTM::lock: %s", fileName().latin1()); |
242 | 244 | ||
243 | kdDebug(5700) << "ResourceSharpDTM::lock()" << endl; | 245 | kdDebug(5700) << "ResourceSharpDTM::lock()" << endl; |
244 | 246 | ||
245 | QString fn = lockfileName; | 247 | QString fn = lockfileName; |
246 | 248 | ||
247 | KURL url(fn); | 249 | KURL url(fn); |
248 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); | 250 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); |
249 | 251 | ||
250 | kdDebug(5700) << "-- lock name: " << lockName << endl; | 252 | kdDebug(5700) << "-- lock name: " << lockName << endl; |
251 | 253 | ||
252 | if (QFile::exists( lockName )) | 254 | if (QFile::exists( lockName )) |
253 | { | 255 | { |
254 | qDebug("ResourceSharpDTM::lock: lockfile %s already exists. (Delete it before continuing if nobody else is accessing the resourcefile %s)", lockName.latin1(), fileName()); | 256 | qDebug("ResourceSharpDTM::lock: lockfile %s already exists. (Delete it before continuing if nobody else is accessing the resourcefile %s)", lockName.latin1(), fileName()); |
255 | return false; | 257 | return false; |
256 | } | 258 | } |