summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/qtopia
authorulf69 <ulf69>2004-08-03 20:49:15 (UTC)
committer ulf69 <ulf69>2004-08-03 20:49:15 (UTC)
commitbe52d7d03e57620919b23cb0cbb33ac22d0920e0 (patch) (side-by-side diff)
tree34e8e29a221c828424126694f865d702c7635f97 /kabc/plugins/qtopia
parentd5358380edce9a2c39f3eea4df741a148338880c (diff)
downloadkdepimpi-be52d7d03e57620919b23cb0cbb33ac22d0920e0.zip
kdepimpi-be52d7d03e57620919b23cb0cbb33ac22d0920e0.tar.gz
kdepimpi-be52d7d03e57620919b23cb0cbb33ac22d0920e0.tar.bz2
hopefully last modifications of resource based export/import functionality
for opie, qtopia and sharpdtm
Diffstat (limited to 'kabc/plugins/qtopia') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/qtopia/resourceqtopia.cpp49
-rw-r--r--kabc/plugins/qtopia/resourceqtopia.h10
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
@@ -224,25 +224,29 @@ bool ResourceQtopia::lock( const QString &lockfileName )
{
qDebug("ResourceQtopia::lock: %s", fileName().latin1());
kdDebug(5700) << "ResourceQtopia::lock()" << endl;
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;
// Create unique file
QFile file( mLockUniqueName );
file.open( IO_WriteOnly );
@@ -303,56 +307,13 @@ void ResourceQtopia::fileChanged()
}
}
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
@@ -113,34 +113,24 @@ public:
/**
* Set name of file to be used for saving.
*/
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 );
private:
AddressBookAccess* mAccess;
QtopiaConverter* mConverter;