author | ulf69 <ulf69> | 2004-08-03 20:49:15 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-03 20:49:15 (UTC) |
commit | be52d7d03e57620919b23cb0cbb33ac22d0920e0 (patch) (side-by-side diff) | |
tree | 34e8e29a221c828424126694f865d702c7635f97 /kabc/plugins/qtopia | |
parent | d5358380edce9a2c39f3eea4df741a148338880c (diff) | |
download | kdepimpi-be52d7d03e57620919b23cb0cbb33ac22d0920e0.zip kdepimpi-be52d7d03e57620919b23cb0cbb33ac22d0920e0.tar.gz kdepimpi-be52d7d03e57620919b23cb0cbb33ac22d0920e0.tar.bz2 |
hopefully last modifications of resource based export/import functionality
for opie, qtopia and sharpdtm
-rw-r--r-- | kabc/plugins/qtopia/resourceqtopia.cpp | 49 | ||||
-rw-r--r-- | kabc/plugins/qtopia/resourceqtopia.h | 10 |
2 files changed, 5 insertions, 54 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 @@ -228,17 +228,21 @@ bool ResourceQtopia::lock( const QString &lockfileName ) QString fn = 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()); + return false; + } QString lockUniqueName; lockUniqueName = fn + KApplication::randomString( 8 ); url = lockUniqueName; //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; @@ -307,52 +311,9 @@ void ResourceQtopia::removeAddressee( const Addressee &addr ) { } void ResourceQtopia::cleanUp() { unlock( fileName() ); } - - -/** - * This method returns the number of elements that are currently in the resource. - */ -int ResourceQtopia::count() const -{ - if (mAccess != 0) - { - int counter = 0; - AddressBookIterator it2(*mAccess); - for (it2.toFirst(); it2.current(); ++it2) { - counter++; - } - - return counter; - } - else - return 0; -} - - -/** - * This method removes all elements from the resource!! (Not from the addressbook) - */ -bool ResourceQtopia::clear() -{ - if (mAccess != 0) - { - AddressBookIterator it2(*mAccess); - for (it2.toFirst(); it2.current(); ++it2) { - mAccess->removeContact(*it2.current()); - } - return true; - } - else - return false; -} - - - - - //US #include "resourceqtopia.moc" diff --git a/kabc/plugins/qtopia/resourceqtopia.h b/kabc/plugins/qtopia/resourceqtopia.h index 90ab1f4..eace280 100644 --- a/kabc/plugins/qtopia/resourceqtopia.h +++ b/kabc/plugins/qtopia/resourceqtopia.h @@ -117,26 +117,16 @@ public: virtual void setFileName( const QString & ); /** * This method is called by an error handler if the application * crashed */ virtual void cleanUp(); - /** - * This method returns the number of elements that are currently in the resource. - */ - virtual int count() const; - - /** - * This method removes all elements from the resource!! (Not from the addressbook) - */ - virtual bool clear(); - protected slots: void fileChanged(); protected: void init( const QString &fileName ); bool lock( const QString &fileName ); void unlock( const QString &fileName ); |