summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/qtopia/resourceqtopia.cpp
Unidiff
Diffstat (limited to 'kabc/plugins/qtopia/resourceqtopia.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kabc/plugins/qtopia/resourceqtopia.cpp49
1 files changed, 5 insertions, 44 deletions
diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp
index 4a35f19..242e0c6 100644
--- a/kabc/plugins/qtopia/resourceqtopia.cpp
+++ b/kabc/plugins/qtopia/resourceqtopia.cpp
@@ -233,7 +233,11 @@ bool ResourceQtopia::lock( const QString &lockfileName )
233 233
234 kdDebug(5700) << "-- lock name: " << lockName << endl; 234 kdDebug(5700) << "-- lock name: " << lockName << endl;
235 235
236 if (QFile::exists( lockName )) return false; 236 if (QFile::exists( lockName ))
237 {
238 qDebug("ResourceOpie::lock: lockfile %s already exists. (Delete it before continuing if nobody else is accessing the resourcefile %s)", lockName.latin1(), fileName());
239 return false;
240 }
237 241
238 QString lockUniqueName; 242 QString lockUniqueName;
239 lockUniqueName = fn + KApplication::randomString( 8 ); 243 lockUniqueName = fn + KApplication::randomString( 8 );
@@ -312,47 +316,4 @@ void ResourceQtopia::cleanUp()
312 unlock( fileName() ); 316 unlock( fileName() );
313} 317}
314 318
315
316
317/**
318 * This method returns the number of elements that are currently in the resource.
319 */
320int ResourceQtopia::count() const
321{
322 if (mAccess != 0)
323 {
324 int counter = 0;
325 AddressBookIterator it2(*mAccess);
326 for (it2.toFirst(); it2.current(); ++it2) {
327 counter++;
328 }
329
330 return counter;
331 }
332 else
333 return 0;
334}
335
336
337/**
338 * This method removes all elements from the resource!! (Not from the addressbook)
339 */
340bool ResourceQtopia::clear()
341{
342 if (mAccess != 0)
343 {
344 AddressBookIterator it2(*mAccess);
345 for (it2.toFirst(); it2.current(); ++it2) {
346 mAccess->removeContact(*it2.current());
347 }
348 return true;
349 }
350 else
351 return false;
352}
353
354
355
356
357
358//US #include "resourceqtopia.moc" 319//US #include "resourceqtopia.moc"