author | ulf69 <ulf69> | 2004-08-02 18:32:08 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-02 18:32:08 (UTC) |
commit | 863c4c3678e59ef125c08c00e9532ded5b540f67 (patch) (side-by-side diff) | |
tree | 449428c45689ffe10ff1ce4caa18f959c4dfe402 /kabc/plugins/sharpdtm | |
parent | 983127ce46c9ff6663d08dedd450da3fe7dd549b (diff) | |
download | kdepimpi-863c4c3678e59ef125c08c00e9532ded5b540f67.zip kdepimpi-863c4c3678e59ef125c08c00e9532ded5b540f67.tar.gz kdepimpi-863c4c3678e59ef125c08c00e9532ded5b540f67.tar.bz2 |
added support for syncprofiles for resources and export/import capabilities
-rw-r--r-- | kabc/plugins/sharpdtm/resourcesharpdtm.cpp | 35 | ||||
-rw-r--r-- | kabc/plugins/sharpdtm/resourcesharpdtm.h | 32 | ||||
-rw-r--r-- | kabc/plugins/sharpdtm/sharpdtmE.pro | 2 |
3 files changed, 49 insertions, 20 deletions
diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp index 31b99ca..7b909de 100644 --- a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp +++ b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp @@ -1,11 +1,11 @@ /* This file is part of libkabc. - Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2004 Ulf Schenk This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -57,27 +57,27 @@ using namespace KABC; extern "C" { void *init_microkabc_sharpdtm() { return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig>(); } } -ResourceSharpDTM::ResourceSharpDTM( const KConfig *config ) - : Resource( config ), mConverter (0) +ResourceSharpDTM::ResourceSharpDTM( const KConfig *config, bool syncable ) + : Resource( config, syncable ), mConverter (0) { // we can not choose the filename. Therefore use the default to display QString fileName = SlZDataBase::addressbookFileName(); init( fileName ); } -ResourceSharpDTM::ResourceSharpDTM( const QString &fileName ) - : Resource( 0 ) +ResourceSharpDTM::ResourceSharpDTM( const QString &fileName, bool syncable ) + : Resource( 0, syncable ) { // qDebug("ResourceFile::ResourceSharpDTM : 3 %s, %s", fileName.latin1(), formatName.latin1()); init( fileName ); } void ResourceSharpDTM::init( const QString &fileName ) { @@ -350,8 +350,33 @@ void ResourceSharpDTM::removeAddressee( const Addressee &addr ) { } void ResourceSharpDTM::cleanUp() { unlock( mFileName ); } +/** + * This method returns the number of elements that are currently in the resource. + */ +int ResourceSharpDTM::count() const +{ + if (mAccess != 0) + return mAccess->count(); + else + return 0; +} + + +/** + * This method removes all elements from the resource!! (Not from the addressbook) + */ +bool ResourceSharpDTM::clear() +{ + if (mAccess != 0) + return mAccess->deleteCard(0, SlZDataBase::AllCard ); + else + return false; +} + + + diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.h b/kabc/plugins/sharpdtm/resourcesharpdtm.h index d2e2a52..f495e9d 100644 --- a/kabc/plugins/sharpdtm/resourcesharpdtm.h +++ b/kabc/plugins/sharpdtm/resourcesharpdtm.h @@ -1,11 +1,11 @@ /* This file is part of libkabc. - Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2004 Ulf Schenk This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -51,22 +51,22 @@ class ResourceSharpDTM : public Resource public: /** Constructor. @param cfg The config object where custom resource settings are stored. */ - ResourceSharpDTM( const KConfig *cfg ); + ResourceSharpDTM( const KConfig *cfg, bool syncable ); /** Construct file resource on file @arg fileName using format @arg formatName. */ - ResourceSharpDTM( const QString &fileName ); + ResourceSharpDTM( const QString &fileName, bool syncable ); /** * Destructor. */ ~ResourceSharpDTM(); /** Writes the config back. @@ -99,51 +99,55 @@ public: * Saves all addresses from address book to file. * Returns true if all addressees could be saved otherwise false. * * @param ticket The ticket returned by @ref requestSaveTicket() */ virtual bool save( Ticket *ticket ); /** + * Remove a addressee from its source. + * This method is mainly called by KABC::AddressBook. + */ + virtual void removeAddressee( const Addressee& addr ); + + /** * Set name of file to be used for saving. */ - void setFileName( const QString & ); + virtual void setFileName( const QString & ); /** - * Return name of file used for loading and saving the address book. + * This method is called by an error handler if the application + * crashed */ - QString fileName() const; + virtual void cleanUp(); /** - * Remove a addressee from its source. - * This method is mainly called by KABC::AddressBook. + * This method returns the number of elements that are currently in the resource. */ - virtual void removeAddressee( const Addressee& addr ); + virtual int count() const; /** - * This method is called by an error handler if the application - * crashed + * This method removes all elements from the resource!! (Not from the addressbook) */ - virtual void cleanUp(); + virtual bool clear(); + protected slots: void fileChanged(); protected: void init( const QString &fileName ); bool lock( const QString &fileName ); void unlock( const QString &fileName ); private: SharpDTMConverter* mConverter; - QString mFileName; - QString mLockUniqueName; KDirWatch mDirWatch; }; } #endif diff --git a/kabc/plugins/sharpdtm/sharpdtmE.pro b/kabc/plugins/sharpdtm/sharpdtmE.pro index 54ef083..52bc10f 100644 --- a/kabc/plugins/sharpdtm/sharpdtmE.pro +++ b/kabc/plugins/sharpdtm/sharpdtmE.pro @@ -1,13 +1,13 @@ TEMPLATE = lib CONFIG += qt warn_on TARGET = microkabc_sharpdtm -INCLUDEPATH += ../.. $(SHARPDTMSDK)/include ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../qtcompat $(QPEDIR)/include +INCLUDEPATH += ../.. $(SHARPDTMSDK)/include ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources ../../../qtcompat $(QPEDIR)/include OBJECTS_DIR = obj/$(PLATFORM) MOC_DIR = moc/$(PLATFORM) DESTDIR = $(QPEDIR)/lib LIBS += -lmicrokde LIBS += -lmicrokabc LIBS += -L$(QPEDIR)/lib |