summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/opie/resourceopie.cpp
Side-by-side diff
Diffstat (limited to 'kabc/plugins/opie/resourceopie.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/opie/resourceopie.cpp39
1 files changed, 6 insertions, 33 deletions
diff --git a/kabc/plugins/opie/resourceopie.cpp b/kabc/plugins/opie/resourceopie.cpp
index 5559827..9dfd473 100644
--- a/kabc/plugins/opie/resourceopie.cpp
+++ b/kabc/plugins/opie/resourceopie.cpp
@@ -84,12 +84,13 @@ ResourceOpie::ResourceOpie( const QString &fileName, bool syncable )
{
init( fileName );
}
void ResourceOpie::init( const QString &fileName )
{
+ qDebug("ResourceOpie::init()");
connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
setFileName( fileName );
@@ -251,13 +252,17 @@ bool ResourceOpie::lock( const QString &lockfileName )
KURL url(fn);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
kdDebug(5700) << "-- lock name: " << lockName << endl;
- if (QFile::exists( lockName )) return false;
+ if (QFile::exists( lockName ))
+ {
+ qDebug("ResourceOpie::lock: lockfile %s already exists. (Delete it before continuing if nobody else is accessing the resourcefile %s)", lockName.latin1(), fileName().latin1());
+ return false;
+ }
QString lockUniqueName;
lockUniqueName = fn + KApplication::randomString( 8 );
url = lockUniqueName;
//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName );
@@ -337,39 +342,7 @@ void ResourceOpie::cleanUp()
// qDebug("ResourceOpie::cleanup() %s", mFileName.latin1());
unlock( fileName() );
}
-/**
- * This method returns the number of elements that are currently in the resource.
- */
-int ResourceOpie::count() const
-{
- qDebug("ResourceOpie::count: %x", mAccess);
-
- if (mAccess != 0)
- {
- OContactAccess::List contactList = mAccess->allRecords();
- return contactList.count();
- }
- else
- return 0;
-}
-
-
-/**
- * This method removes all elements from the resource!! (Not from the addressbook)
- */
-bool ResourceOpie::clear()
-{
- if (mAccess != 0) {
- mAccess->clear();
- return true;
- }
- else
- return false;
-}
-
-
-
//US #include "resourceopie.moc"