author | ulf69 <ulf69> | 2004-10-13 21:27:10 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-10-13 21:27:10 (UTC) |
commit | 737183a5abd7d7b02048e8a939bafd0a8e803918 (patch) (side-by-side diff) | |
tree | ddacf864a06a6669911b1d48862e564399eeb33b /kabc | |
parent | 7bb6c5f55d29ad4632b1f5c7361eee4c0d8b7cb0 (diff) | |
download | kdepimpi-737183a5abd7d7b02048e8a939bafd0a8e803918.zip kdepimpi-737183a5abd7d7b02048e8a939bafd0a8e803918.tar.gz kdepimpi-737183a5abd7d7b02048e8a939bafd0a8e803918.tar.bz2 |
removal of syncresources
-rw-r--r-- | kabc/addressbook.cpp | 2 | ||||
-rw-r--r-- | kabc/kabcE.pro | 2 | ||||
-rw-r--r-- | kabc/plugins/dir/resourcedir.cpp | 7 | ||||
-rw-r--r-- | kabc/plugins/dir/resourcedir.h | 2 | ||||
-rw-r--r-- | kabc/plugins/file/resourcefile.cpp | 16 | ||||
-rw-r--r-- | kabc/plugins/file/resourcefile.h | 4 | ||||
-rw-r--r-- | kabc/plugins/ldap/resourceldap.cpp | 7 | ||||
-rw-r--r-- | kabc/plugins/ldap/resourceldap.h | 2 | ||||
-rw-r--r-- | kabc/plugins/opie/resourceopie.cpp | 11 | ||||
-rw-r--r-- | kabc/plugins/opie/resourceopie.h | 4 | ||||
-rw-r--r-- | kabc/plugins/qtopia/resourceqtopia.cpp | 11 | ||||
-rw-r--r-- | kabc/plugins/qtopia/resourceqtopia.h | 4 | ||||
-rw-r--r-- | kabc/plugins/sharpdtm/resourcesharpdtm.cpp | 8 | ||||
-rw-r--r-- | kabc/plugins/sharpdtm/resourcesharpdtm.h | 4 | ||||
-rw-r--r-- | kabc/resource.cpp | 32 | ||||
-rw-r--r-- | kabc/resource.h | 16 |
16 files changed, 39 insertions, 93 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 592d78d..c584c35 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -232,97 +232,97 @@ AddressBook::AddressBook( const QString &config ) init(config, "contact"); } AddressBook::AddressBook( const QString &config, const QString &family ) { init(config, family); } // the default family is "contact" void AddressBook::init(const QString &config, const QString &family ) { blockLSEchange = false; d = new AddressBookData; QString fami = family; if (config != 0) { if ( family == "syncContact" ) { qDebug("creating sync config "); fami = "contact"; KConfig* con = new KConfig( locateLocal("config", "syncContactrc") ); con->setGroup( "General" ); con->writeEntry( "ResourceKeys", QString("sync") ); con->writeEntry( "Standard", QString("sync") ); con->setGroup( "Resource_sync" ); con->writeEntry( "FileName", config ); con->writeEntry( "FileFormat", QString("vcard") ); con->writeEntry( "ResourceIdentifier", QString("sync") ); con->writeEntry( "ResourceName", QString("sync_res") ); if ( config.right(4) == ".xml" ) con->writeEntry( "ResourceType", QString("qtopia") ); else if ( config == "sharp" ) { con->writeEntry( "ResourceType", QString("sharp") ); } else { con->writeEntry( "ResourceType", QString("file") ); } //con->sync(); d->mConfig = con; } else d->mConfig = new KConfig( locateLocal("config", config) ); // qDebug("AddressBook::init 1 config=%s",config.latin1() ); } else { d->mConfig = 0; // qDebug("AddressBook::init 1 config=0"); } //US d->mErrorHandler = 0; - d->mManager = new KRES::Manager<Resource>( fami, false ); + d->mManager = new KRES::Manager<Resource>( fami ); d->mManager->readConfig( d->mConfig ); if ( family == "syncContact" ) { KRES::Manager<Resource> *manager = d->mManager; KRES::Manager<Resource>::ActiveIterator it; for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { (*it)->setAddressBook( this ); if ( !(*it)->open() ) error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); } Resource *res = standardResource(); if ( !res ) { qDebug("ERROR: no standard resource"); res = manager->createResource( "file" ); if ( res ) { addResource( res ); } else qDebug(" No resource available!!!"); } setStandardResource( res ); manager->writeConfig(); } addCustomField( i18n( "Department" ), KABC::Field::Organization, "X-Department", "KADDRESSBOOK" ); addCustomField( i18n( "Profession" ), KABC::Field::Organization, "X-Profession", "KADDRESSBOOK" ); addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, "X-AssistantsName", "KADDRESSBOOK" ); addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, "X-ManagersName", "KADDRESSBOOK" ); addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, "X-SpousesName", "KADDRESSBOOK" ); addCustomField( i18n( "Office" ), KABC::Field::Personal, "X-Office", "KADDRESSBOOK" ); addCustomField( i18n( "IM Address" ), KABC::Field::Personal, "X-IMAddress", "KADDRESSBOOK" ); addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, "X-Anniversary", "KADDRESSBOOK" ); //US added this field to become compatible with Opie/qtopia addressbook // values can be "female" or "male" or "". An empty field represents undefined. addCustomField( i18n( "Gender" ), KABC::Field::Personal, "X-Gender", "KADDRESSBOOK" ); addCustomField( i18n( "Children" ), KABC::Field::Personal, "X-Children", "KADDRESSBOOK" ); addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, "X-FreeBusyUrl", "KADDRESSBOOK" ); diff --git a/kabc/kabcE.pro b/kabc/kabcE.pro index 061909b..96fe39e 100644 --- a/kabc/kabcE.pro +++ b/kabc/kabcE.pro @@ -1,92 +1,91 @@ TEMPLATE = lib CONFIG += qt warn_on TARGET = kamicrokabc INCLUDEPATH += . $(KDEPIMDIR) vcard/include vcard/include/generated $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/libkdepim $(KDEPIMDIR)/qtcompat $(QPEDIR)/include OBJECTS_DIR = obj/$(PLATFORM) MOC_DIR = moc/$(PLATFORM) DESTDIR = $(QPEDIR)/lib LIBS += -lmicrokde LIBS += -lmicrokdepim #LIBS += -lldap LIBS += -L$(QPEDIR)/lib DEFINES += KAB_EMBEDDED #enable the following line if you want to get debugoutput while loading adresses #DEFINES += VCARD_DEBUG INTERFACES = \ HEADERS = \ address.h \ addressbook.h \ addressee.h \ addresseedialog.h \ addresseelist.h \ addresseeview.h \ agent.h \ distributionlist.h \ distributionlistdialog.h \ distributionlisteditor.h \ field.h \ formatfactory.h \ formatplugin.h \ geo.h \ key.h \ phonenumber.h \ picture.h \ plugin.h \ resource.h \ secrecy.h \ sound.h \ stdaddressbook.h \ - syncprefwidget.h \ timezone.h \ tmpaddressbook.h \ vcardconverter.h \ vcard21parser.h \ vcardformatimpl.h \ vcardformatplugin.h \ vcardparser/vcardline.h \ vcardparser/vcard.h \ vcardparser/vcardtool.h \ vcardparser/vcardparser.h \ vcard/include/VCardAdrParam.h \ vcard/include/VCardAdrValue.h \ vcard/include/VCardAgentParam.h \ vcard/include/VCardContentLine.h \ vcard/include/VCardDateParam.h \ vcard/include/VCardDateValue.h \ vcard/include/VCardEmailParam.h \ vcard/include/VCardGeoValue.h \ vcard/include/VCardGroup.h \ vcard/include/VCardImageParam.h \ vcard/include/VCardImageValue.h \ vcard/include/VCardLangValue.h \ vcard/include/VCardNValue.h \ vcard/include/VCardParam.h \ vcard/include/VCardPhoneNumberValue.h \ vcard/include/VCardSourceParam.h \ vcard/include/VCardTelParam.h \ vcard/include/VCardTextParam.h \ vcard/include/VCardTextNSParam.h \ vcard/include/VCardTextValue.h \ vcard/include/VCardTextBinParam.h \ vcard/include/VCardURIValue.h \ vcard/include/VCardVCard.h \ vcard/include/VCardEntity.h \ vcard/include/VCardValue.h \ vcard/include/VCardSoundValue.h \ vcard/include/VCardAgentValue.h \ vcard/include/VCardTelValue.h \ vcard/include/VCardTextBinValue.h \ vcard/include/VCardOrgValue.h \ vcard/include/VCardUTCValue.h \ vcard/include/VCardClassValue.h \ vcard/include/VCardFloatValue.h \ vcard/include/VCardTextListValue.h \ vcard/include/generated/AdrParam-generated.h \ vcard/include/generated/AdrValue-generated.h \ vcard/include/generated/AgentParam-generated.h \ vcard/include/generated/ContentLine-generated.h \ @@ -101,97 +100,96 @@ HEADERS = \ vcard/include/generated/NValue-generated.h \ vcard/include/generated/Param-generated.h \ vcard/include/generated/PhoneNumberValue-generated.h \ vcard/include/generated/SourceParam-generated.h \ vcard/include/generated/TelParam-generated.h \ vcard/include/generated/TextParam-generated.h \ vcard/include/generated/TextNSParam-generated.h \ vcard/include/generated/TextValue-generated.h \ vcard/include/generated/TextBinParam-generated.h \ vcard/include/generated/URIValue-generated.h \ vcard/include/generated/VCard-generated.h \ vcard/include/generated/VCardEntity-generated.h \ vcard/include/generated/Value-generated.h \ vcard/include/generated/SoundValue-generated.h \ vcard/include/generated/AgentValue-generated.h \ vcard/include/generated/TelValue-generated.h \ vcard/include/generated/TextBinValue-generated.h \ vcard/include/generated/OrgValue-generated.h \ vcard/include/generated/UTCValue-generated.h \ vcard/include/generated/ClassValue-generated.h \ vcard/include/generated/FloatValue-generated.h \ vcard/include/generated/TextListValue-generated.h SOURCES = \ address.cpp \ addressbook.cpp \ addressee.cpp \ addresseedialog.cpp \ addresseelist.cpp \ addresseeview.cpp \ agent.cpp \ distributionlist.cpp \ distributionlistdialog.cpp \ distributionlisteditor.cpp \ field.cpp \ formatfactory.cpp \ geo.cpp \ key.cpp \ phonenumber.cpp \ picture.cpp \ plugin.cpp \ resource.cpp \ secrecy.cpp \ sound.cpp \ stdaddressbook.cpp \ - syncprefwidget.cpp \ timezone.cpp \ tmpaddressbook.cpp \ vcardconverter.cpp \ vcard21parser.cpp \ vcardformatimpl.cpp \ vcardformatplugin.cpp \ vcardparser/vcardline.cpp \ vcardparser/vcard.cpp \ vcardparser/vcardtool.cpp \ vcardparser/vcardparser.cpp \ vcard/AdrParam.cpp \ vcard/AdrValue.cpp \ vcard/AgentParam.cpp \ vcard/ContentLine.cpp \ vcard/DateParam.cpp \ vcard/DateValue.cpp \ vcard/EmailParam.cpp \ vcard/Entity.cpp \ vcard/Enum.cpp \ vcard/GeoValue.cpp \ vcard/ImageParam.cpp \ vcard/ImageValue.cpp \ vcard/LangValue.cpp \ vcard/NValue.cpp \ vcard/Param.cpp \ vcard/PhoneNumberValue.cpp \ vcard/RToken.cpp \ vcard/SourceParam.cpp \ vcard/TelParam.cpp \ vcard/TextParam.cpp \ vcard/TextValue.cpp \ vcard/TextBinParam.cpp \ vcard/URIValue.cpp \ vcard/VCardv.cpp \ vcard/VCardEntity.cpp \ vcard/Value.cpp \ vcard/SoundValue.cpp \ vcard/AgentValue.cpp \ vcard/TelValue.cpp \ vcard/TextBinValue.cpp \ vcard/OrgValue.cpp \ vcard/UTCValue.cpp \ vcard/ClassValue.cpp \ vcard/FloatValue.cpp \ vcard/TextListValue.cpp # plugins/ldap/resourceldap.cpp \ diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp index e58e4f7..e2b7b08 100644 --- a/kabc/plugins/dir/resourcedir.cpp +++ b/kabc/plugins/dir/resourcedir.cpp @@ -13,120 +13,119 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include <sys/types.h> #include <sys/stat.h> #ifndef _WIN32_ #include <unistd.h> #endif #include <qregexp.h> #include <qtimer.h> #include <qwidget.h> #include <kapplication.h> #include <kconfig.h> #include <kdebug.h> //US #include <kgenericfactory.h> #include <kglobal.h> #include <klocale.h> #include <kstandarddirs.h> #include <kurlrequester.h> #include <kmessagebox.h> #include "addressbook.h" #include "formatfactory.h" #include "resourcedirconfig.h" #include "stdaddressbook.h" //US #include <qdir.h> #define NO_DIRWATCH #include "resourcedir.h" -#include "syncprefwidget.h" //#define ALLOW_LOCKING using namespace KABC; extern "C" #ifdef _WIN32_ __declspec(dllexport) #else { #endif //US void *init_kabc_dir() void *init_microkabc_dir() { - return new KRES::PluginFactory<ResourceDir,ResourceDirConfig, SyncPrefWidgetContainer>(); + return new KRES::PluginFactory<ResourceDir,ResourceDirConfig>(); } #ifndef _WIN32_ } #endif -ResourceDir::ResourceDir( const KConfig *config, bool syncable ) - : Resource( config, syncable ) +ResourceDir::ResourceDir( const KConfig *config ) + : Resource( config ) { QString path; KConfig *cfg = (KConfig *)config; if ( cfg ) { //US path = config->readEntry( "FilePath" ); path = cfg->readEntry( "FilePath", StdAddressBook::directoryName() ); //US mFormatName = config->readEntry( "FileFormat" ); mFormatName = cfg->readEntry( "FileFormat", "vcard" ); } else { path = StdAddressBook::directoryName(); mFormatName = "vcard"; } FormatFactory *factory = FormatFactory::self(); mFormat = factory->format( mFormatName ); if ( !mFormat ) { mFormatName = "vcard"; mFormat = factory->format( mFormatName ); } /*US //US qDebug("ResourceDir::ResourceDir initialized with format %s ", mFormatName.latin1()); if (mFormatName == "vcard") mFormat = new VCardFormatPlugin2(); else if (mFormatName == "binary") mFormat = new BinaryFormat(); else qDebug("ResourceFile::init format unknown !!! %s ", mFormatName.latin1()); */ #ifndef NO_DIRWATCH connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( pathChanged() ) ); connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) ); connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) ); #endif setPath( path ); } ResourceDir::~ResourceDir() { delete mFormat; mFormat = 0; } void ResourceDir::writeConfig( KConfig *config ) { diff --git a/kabc/plugins/dir/resourcedir.h b/kabc/plugins/dir/resourcedir.h index 77cd18c..6c1e922 100644 --- a/kabc/plugins/dir/resourcedir.h +++ b/kabc/plugins/dir/resourcedir.h @@ -4,97 +4,97 @@ 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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #ifndef KABC_RESOURCEDIR_H #define KABC_RESOURCEDIR_H #include <kconfig.h> #include <kdirwatch.h> #include <sys/types.h> #include "resource.h" class QTimer; namespace KABC { class FormatPlugin; /** @internal */ class ResourceDir : public Resource { Q_OBJECT public: - ResourceDir( const KConfig*, bool syncable ); + ResourceDir( const KConfig* ); ~ResourceDir(); virtual void writeConfig( KConfig* ); virtual bool doOpen(); virtual void doClose(); virtual Ticket *requestSaveTicket(); virtual bool load(); virtual bool save( Ticket * ); /** * Set path to be used for saving. */ void setPath( const QString & ); /** * Return path used for loading and saving the address book. */ QString path() const; /** * Set the format by name. */ void setFormat( const QString &format ); /** * Returns the format name. */ QString format() const; /** * Remove a addressee from its source. * This method is mainly called by KABC::AddressBook. */ virtual void removeAddressee( const Addressee& addr ); /** * This method is called by an error handler if the application * crashed */ virtual void cleanUp(); protected slots: void pathChanged(); protected: diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp index 163f2b4..dc5932f 100644 --- a/kabc/plugins/file/resourcefile.cpp +++ b/kabc/plugins/file/resourcefile.cpp @@ -6,145 +6,141 @@ 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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include <sys/types.h> #include <sys/stat.h> #ifndef _WIN32_ #include <unistd.h> #endif #include <qfile.h> #include <qfileinfo.h> #include <qregexp.h> #include <qtimer.h> #include <kapplication.h> #include <kconfig.h> #include <kdebug.h> #include <klocale.h> //US #include <ksavefile.h> #include <kstandarddirs.h> #include <kmessagebox.h> #include "formatfactory.h" #include "resource.h" #include "resourcefileconfig.h" #include "stdaddressbook.h" #define NO_DIRWATCH #include "resourcefile.h" -#include "syncprefwidget.h" //#define ALLOW_LOCKING using namespace KABC; extern "C" #ifdef _WIN32_ __declspec(dllexport) #else { #endif //US void *init_kabc_file() void *init_microkabc_file() { - return new KRES::PluginFactory<ResourceFile,ResourceFileConfig, SyncPrefWidgetContainer>(); + return new KRES::PluginFactory<ResourceFile,ResourceFileConfig>(); } #ifndef _WIN32_ } #endif -ResourceFile::ResourceFile( const KConfig *config, bool syncable ) - : Resource( config, syncable ) , mFormat( 0 ) +ResourceFile::ResourceFile( const KConfig *config ) + : Resource( config ) , mFormat( 0 ) { QString fileName, formatName, default_fileName; - if (syncable == true) - default_fileName = "/home/polo/kdepim/apps/kabc/localfile.vcf"; - else - default_fileName = StdAddressBook::fileName(); + default_fileName = StdAddressBook::fileName(); KConfig *cfg = (KConfig *)config; if ( cfg ) { fileName = cfg->readEntry( "FileName", default_fileName ); formatName = cfg->readEntry( "FileFormat", "vcard" ); } else { fileName = default_fileName; formatName = "vcard"; } init( fileName, formatName ); } -ResourceFile::ResourceFile( const QString &fileName, bool syncable , +ResourceFile::ResourceFile( const QString &fileName , const QString &formatName ) - : Resource( 0, syncable ) + : Resource( 0 ) { // qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1()); init( fileName, formatName ); } void ResourceFile::init( const QString &fileName, const QString &formatName ) { mFormatName = formatName; FormatFactory *factory = FormatFactory::self(); mFormat = factory->format( mFormatName ); if ( !mFormat ) { mFormatName = "vcard"; mFormat = factory->format( mFormatName ); } #ifndef NO_DIRWATCH connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); #endif setFileName( fileName ); } ResourceFile::~ResourceFile() { delete mFormat; mFormat = 0; } void ResourceFile::writeConfig( KConfig *config ) { config->setGroup( "Resource_" + identifier() ); Resource::writeConfig( config ); config->writeEntry( "FileName", mFileName ); config->writeEntry( "FileFormat", mFormatName ); // qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); } Ticket *ResourceFile::requestSaveTicket() { kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl; diff --git a/kabc/plugins/file/resourcefile.h b/kabc/plugins/file/resourcefile.h index 8339340..b4421b2 100644 --- a/kabc/plugins/file/resourcefile.h +++ b/kabc/plugins/file/resourcefile.h @@ -13,102 +13,102 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #ifndef KABC_RESOURCEFILE_H #define KABC_RESOURCEFILE_H #include <kconfig.h> #include <kdirwatch.h> #include <sys/types.h> #include <resource.h> class QTimer; class FormatPlugin; namespace KABC { //US class FormatPlugin; class ResourceConfigWidget; /** @internal */ class ResourceFile : public Resource { Q_OBJECT public: /** Constructor. @param cfg The config object where custom resource settings are stored. */ - ResourceFile( const KConfig *cfg, bool syncable ); + ResourceFile( const KConfig *cfg ); /** Construct file resource on file @arg fileName using format @arg formatName. */ - ResourceFile( const QString &fileName, bool syncable , const QString &formatName = "vcard" ); + ResourceFile( const QString &fileName , const QString &formatName = "vcard" ); /** * Destructor. */ ~ResourceFile(); /** Writes the config back. */ virtual void writeConfig( KConfig *cfg ); /** * Tries to open the file and checks for the proper format. * This method should be called before @ref load(). */ virtual bool doOpen(); /** * Closes the file again. */ virtual void doClose(); /** * Requests a save ticket, that is used by @ref save() */ virtual Ticket *requestSaveTicket(); /** * Loads all addressees from file to the address book. * Returns true if all addressees could be loaded otherwise false. */ virtual bool load(); /** * 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 ); /** * Set name of file to be used for saving. */ void setFileName( const QString & ); /** * Return name of file used for loading and saving the address book. diff --git a/kabc/plugins/ldap/resourceldap.cpp b/kabc/plugins/ldap/resourceldap.cpp index 17f115d..55c43af 100644 --- a/kabc/plugins/ldap/resourceldap.cpp +++ b/kabc/plugins/ldap/resourceldap.cpp @@ -1,104 +1,103 @@ /* This file is part of libkabc. Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include <kdebug.h> #include <kglobal.h> #include <klineedit.h> #include <klocale.h> #include <kconfig.h> #include <kstringhandler.h> #include <stdlib.h> #include "resourceldap.h" #include "resourceldapconfig.h" -#include "syncprefwidget.h" using namespace KABC; extern "C" { //US void *init_kabc_ldap() void *init_microkabc_ldap() { - return new KRES::PluginFactory<ResourceLDAP,ResourceLDAPConfig, SyncPrefWidgetContainer>(); + return new KRES::PluginFactory<ResourceLDAP,ResourceLDAPConfig>(); } } void addModOp( LDAPMod ***pmods, const QString &attr, const QString &value ); -ResourceLDAP::ResourceLDAP( const KConfig *config, bool syncable ) - : Resource( config, syncable ), mPort( 389 ), mLdap( 0 ) +ResourceLDAP::ResourceLDAP( const KConfig *config ) + : Resource( config ), mPort( 389 ), mLdap( 0 ) { KConfig *cfg = (KConfig *)config; if ( cfg ) { mUser = cfg->readEntry( "LdapUser" ); mPassword = KStringHandler::obscure( cfg->readEntry( "LdapPassword" ) ); mDn = cfg->readEntry( "LdapDn" ); mHost = cfg->readEntry( "LdapHost" ); mPort = cfg->readNumEntry( "LdapPort", 389 ); mFilter = cfg->readEntry( "LdapFilter" ); mAnonymous = cfg->readBoolEntry( "LdapAnonymous" ); QStringList attributes = cfg->readListEntry( "LdapAttributes" ); for ( uint pos = 0; pos < attributes.count(); pos += 2 ) mAttributes.insert( attributes[ pos ], attributes[ pos + 1 ] ); } /** If you want to add new attributes, append them here, add a translation string in the ctor of AttributesDialog and handle them in the load() method below. These are the default values from */ if ( mAttributes.count() == 0 ) { mAttributes.insert( "commonName", "cn" ); mAttributes.insert( "formattedName", "displayName" ); mAttributes.insert( "familyName", "sn" ); mAttributes.insert( "givenName", "givenName" ); mAttributes.insert( "mail", "mail" ); mAttributes.insert( "mailAlias", "" ); mAttributes.insert( "phoneNumber", "telephoneNumber" ); mAttributes.insert( "uid", "uid" ); } } void ResourceLDAP::writeConfig( KConfig *config ) { Resource::writeConfig( config ); config->writeEntry( "LdapUser", mUser ); config->writeEntry( "LdapPassword", KStringHandler::obscure( mPassword ) ); config->writeEntry( "LdapDn", mDn ); config->writeEntry( "LdapHost", mHost ); config->writeEntry( "LdapPort", mPort ); config->writeEntry( "LdapFilter", mFilter ); config->writeEntry( "LdapAnonymous", mAnonymous ); QStringList attributes; QMap<QString, QString>::Iterator it; diff --git a/kabc/plugins/ldap/resourceldap.h b/kabc/plugins/ldap/resourceldap.h index 0aad3c1..0625f30 100644 --- a/kabc/plugins/ldap/resourceldap.h +++ b/kabc/plugins/ldap/resourceldap.h @@ -1,94 +1,94 @@ /* This file is part of libkabc. Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #ifndef KABC_RESOURCELDAP_H #define KABC_RESOURCELDAP_H #include <lber.h> #include <ldap.h> #include "addressbook.h" #include "resource.h" class KConfig; namespace KABC { class ResourceLDAP : public Resource { public: - ResourceLDAP( const KConfig*, bool syncable ); + ResourceLDAP( const KConfig* ); virtual void writeConfig( KConfig* ); virtual bool doOpen(); virtual void doClose(); virtual Ticket *requestSaveTicket(); virtual bool load(); virtual bool save( Ticket * ); virtual void removeAddressee( const Addressee& addr ); void setUser( const QString &user ); QString user() const; void setPassword( const QString &password ); QString password() const; void setDn( const QString &dn ); QString dn() const; void setHost( const QString &host ); QString host() const; void setPort( int port ); int port() const; void setFilter( const QString &filter ); QString filter() const; void setIsAnonymous( bool value ); bool isAnonymous() const; void setAttributes( const QMap<QString, QString> &attributes ); QMap<QString, QString> attributes() const; private: QString mUser; QString mPassword; QString mDn; QString mHost; QString mFilter; int mPort; bool mAnonymous; QMap<QString, QString> mAttributes; LDAP *mLdap; diff --git a/kabc/plugins/opie/resourceopie.cpp b/kabc/plugins/opie/resourceopie.cpp index 22237dc..f610b38 100644 --- a/kabc/plugins/opie/resourceopie.cpp +++ b/kabc/plugins/opie/resourceopie.cpp @@ -5,127 +5,126 @@ 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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <qdir.h> #include <qfile.h> #include <qfileinfo.h> #include <qregexp.h> #include <kapplication.h> #include <kconfig.h> #include <kdebug.h> #include <klocale.h> //US #include <ksavefile.h> #include <kstandarddirs.h> #include <kmessagebox.h> //US #include "formatfactory.h" //US #include <qpe/qpeapplication.h> #include <opie/ocontactaccess.h> #include <opie/ocontactaccessbackend_xml.h> #include "resourceopieconfig.h" #include "stdaddressbook.h" -#include "syncprefwidget.h" #include "opieconverter.h" #include "resourceopie.h" using namespace KABC; extern "C" { void *init_microkabc_opie() { - return new KRES::PluginFactory<ResourceOpie,ResourceOpieConfig, SyncPrefWidgetContainer>(); + return new KRES::PluginFactory<ResourceOpie,ResourceOpieConfig>(); } } -ResourceOpie::ResourceOpie( const KConfig *config, bool syncable ) - : Resource( config, syncable ), mAccess(0), mConverter (0) +ResourceOpie::ResourceOpie( const KConfig *config ) + : Resource( config ), mAccess(0), mConverter (0) { QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; KConfig *cfg = (KConfig *)config; if ( cfg ) { fileName = cfg->readEntry( "FileName", fileName ); } init( fileName ); } -ResourceOpie::ResourceOpie( const QString &fileName, bool syncable ) - : Resource( 0, syncable ) +ResourceOpie::ResourceOpie( const QString &fileName ) + : Resource( 0 ) { 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 ); } ResourceOpie::~ResourceOpie() { if (mConverter != 0) delete mConverter; if(mAccess != 0) delete mAccess; } void ResourceOpie::writeConfig( KConfig *config ) { Resource::writeConfig( config ); config->writeEntry( "FileName", fileName() ); } Ticket *ResourceOpie::requestSaveTicket() { kdDebug(5700) << "ResourceOpie::requestSaveTicket()" << endl; qDebug("ResourceOpie::requestSaveTicket: %s", fileName().latin1()); if ( !addressBook() ) return 0; if ( !lock( fileName() ) ) { kdDebug(5700) << "ResourceOpie::requestSaveTicket(): Unable to lock file '" << fileName() << "'" << endl; return 0; } return createTicket( this ); } diff --git a/kabc/plugins/opie/resourceopie.h b/kabc/plugins/opie/resourceopie.h index d5b4ebd..9d05c70 100644 --- a/kabc/plugins/opie/resourceopie.h +++ b/kabc/plugins/opie/resourceopie.h @@ -12,102 +12,102 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #ifndef KABC_RESOURCEOPIE_H #define KABC_RESOURCEOPIE_H #include <kconfig.h> #include <kdirwatch.h> #include <sys/types.h> #include "resource.h" class OContactAccess; namespace KABC { class ResourceConfigWidget; class OpieConverter; /** @internal */ class ResourceOpie : public Resource { Q_OBJECT public: /** Constructor. @param cfg The config object where custom resource settings are stored. */ - ResourceOpie( const KConfig *cfg, bool syncable ); + ResourceOpie( const KConfig *cfg ); /** Construct file resource on file @arg fileName using format @arg formatName. */ - ResourceOpie( const QString &fileName, bool syncable ); + ResourceOpie( const QString &fileName ); /** * Destructor. */ ~ResourceOpie(); /** Writes the config back. */ virtual void writeConfig( KConfig *cfg ); /** * Tries to open the file and checks for the proper format. * This method should be called before @ref load(). */ virtual bool doOpen(); /** * Closes the file again. */ virtual void doClose(); /** * Requests a save ticket, that is used by @ref save() */ virtual Ticket *requestSaveTicket(); /** * Loads all addressees from file to the address book. * Returns true if all addressees could be loaded otherwise false. */ virtual bool load(); /** * 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 ); diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp index f9cabcb..deb218b 100644 --- a/kabc/plugins/qtopia/resourceqtopia.cpp +++ b/kabc/plugins/qtopia/resourceqtopia.cpp @@ -4,119 +4,118 @@ 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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <qdir.h> #include <qfile.h> #include <qfileinfo.h> #include <qregexp.h> //US #include <qtimer.h> #include <kapplication.h> #include <kconfig.h> #include <kdebug.h> #include <klocale.h> //US #include <ksavefile.h> #include <kstandarddirs.h> #include <kmessagebox.h> #include <qpe/pim/addressbookaccess.h> #include "resourceqtopiaconfig.h" #include "stdaddressbook.h" #include "qtopiaconverter.h" -#include "syncprefwidget.h" #include "resourceqtopia.h" using namespace KABC; extern "C" { void *init_microkabc_qtopia() { - return new KRES::PluginFactory<ResourceQtopia,ResourceQtopiaConfig, SyncPrefWidgetContainer>(); + return new KRES::PluginFactory<ResourceQtopia,ResourceQtopiaConfig>(); } } -ResourceQtopia::ResourceQtopia( const KConfig *config, bool syncable ) - : Resource( config, syncable ), mConverter (0) +ResourceQtopia::ResourceQtopia( const KConfig *config ) + : Resource( config ), mConverter (0) { // we can not choose the filename. Therefore use the default to display QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; init( fileName ); } -ResourceQtopia::ResourceQtopia( const QString &fileName, bool syncable ) - : Resource( 0, syncable ) +ResourceQtopia::ResourceQtopia( const QString &fileName ) + : Resource( 0 ) { init( fileName ); } void ResourceQtopia::init( const QString &fileName ) { 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 ); } ResourceQtopia::~ResourceQtopia() { if (mConverter != 0) delete mConverter; if(mAccess != 0) delete mAccess; } void ResourceQtopia::writeConfig( KConfig *config ) { Resource::writeConfig( config ); } Ticket *ResourceQtopia::requestSaveTicket() { kdDebug(5700) << "ResourceQtopia::requestSaveTicket()" << endl; qDebug("ResourceQtopia::requestSaveTicket: %s", fileName().latin1()); if ( !addressBook() ) return 0; if ( !lock( fileName() ) ) { kdDebug(5700) << "ResourceQtopia::requestSaveTicket(): Unable to lock file '" << fileName() << "'" << endl; return 0; } return createTicket( this ); } bool ResourceQtopia::doOpen() { qDebug("ResourceQtopia::doOpen(): %s", fileName().latin1()); diff --git a/kabc/plugins/qtopia/resourceqtopia.h b/kabc/plugins/qtopia/resourceqtopia.h index eace280..ff6350d 100644 --- a/kabc/plugins/qtopia/resourceqtopia.h +++ b/kabc/plugins/qtopia/resourceqtopia.h @@ -13,102 +13,102 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #ifndef KABC_RESOURCEOPIE_H #define KABC_RESOURCEOPIE_H #include <kconfig.h> #include <kdirwatch.h> #include <sys/types.h> #include "resource.h" class AddressBookAccess; namespace KABC { //US class FormatPlugin; class ResourceConfigWidget; class QtopiaConverter; /** @internal */ class ResourceQtopia : public Resource { Q_OBJECT public: /** Constructor. @param cfg The config object where custom resource settings are stored. */ - ResourceQtopia( const KConfig *cfg, bool syncable ); + ResourceQtopia( const KConfig *cfg ); /** Construct file resource on file @arg fileName using format @arg formatName. */ - ResourceQtopia( const QString &fileName, bool syncable ); + ResourceQtopia( const QString &fileName ); /** * Destructor. */ ~ResourceQtopia(); /** Writes the config back. */ virtual void writeConfig( KConfig *cfg ); /** * Tries to open the file and checks for the proper format. * This method should be called before @ref load(). */ virtual bool doOpen(); /** * Closes the file again. */ virtual void doClose(); /** * Requests a save ticket, that is used by @ref save() */ virtual Ticket *requestSaveTicket(); /** * Loads all addressees from file to the address book. * Returns true if all addressees could be loaded otherwise false. */ virtual bool load(); /** * 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 ); /** diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp index c013f52..2cdf4bf 100644 --- a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp +++ b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp @@ -5,113 +5,111 @@ 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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <qdir.h> #include <qfile.h> #include <qfileinfo.h> #include <qregexp.h> //US #include <qtimer.h> #include <kapplication.h> #include <kconfig.h> #include <kdebug.h> #include <klocale.h> //US #include <ksavefile.h> #include <kstandarddirs.h> #include <kmessagebox.h> #include <sl/slzdb.h> #include <libkdepim/ksyncprofile.h> #include "resourcesharpdtmconfig.h" #include "resourcesharpdtm.h" -#include "syncprefwidget.h" - #include "stdaddressbook.h" #include "sharpdtmconverter.h" //#define ALLOW_LOCKING using namespace KABC; extern "C" { void *init_microkabc_sharpdtm() { - return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig,SyncPrefWidgetContainer>(); + return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig>(); } } -ResourceSharpDTM::ResourceSharpDTM( const KConfig *config, bool syncable ) - : Resource( config, syncable ), mConverter (0) +ResourceSharpDTM::ResourceSharpDTM( const KConfig *config ) + : Resource( config ), 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, bool syncable ) : Resource( 0, syncable ) { init( fileName ); } void ResourceSharpDTM::init( const QString &fileName ) { 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 ); } ResourceSharpDTM::~ResourceSharpDTM() { if (mConverter != 0) delete mConverter; if(mAccess != 0) delete mAccess; } void ResourceSharpDTM::writeConfig( KConfig *config ) { Resource::writeConfig( config ); } Ticket *ResourceSharpDTM::requestSaveTicket() { qDebug("ResourceSharpDTM::requestSaveTicket: %s", fileName().latin1()); if ( !addressBook() ) return 0; #ifdef ALLOW_LOCKING if ( !lock( fileName() ) ) { qDebug("ResourceSharpDTM::requestSaveTicket(): Unable to lock file "); diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.h b/kabc/plugins/sharpdtm/resourcesharpdtm.h index f386e69..64d06f9 100644 --- a/kabc/plugins/sharpdtm/resourcesharpdtm.h +++ b/kabc/plugins/sharpdtm/resourcesharpdtm.h @@ -13,102 +13,102 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #ifndef KABC_RESOURCESHARPDTM_H #define KABC_RESOURCESHARPDTM_H #include <kconfig.h> #include <kdirwatch.h> #include <sys/types.h> #include "resource.h" class SlZDataBase; namespace KABC { class ResourceConfigWidget; class SharpDTMConverter; /** @internal */ class ResourceSharpDTM : public Resource { Q_OBJECT public: /** Constructor. @param cfg The config object where custom resource settings are stored. */ - ResourceSharpDTM( const KConfig *cfg, bool syncable ); + ResourceSharpDTM( const KConfig *cfg ); /** Construct file resource on file @arg fileName using format @arg formatName. */ - ResourceSharpDTM( const QString &fileName, bool syncable ); + ResourceSharpDTM( const QString &fileName ); /** * Destructor. */ ~ResourceSharpDTM(); /** Writes the config back. */ virtual void writeConfig( KConfig *cfg ); /** * Tries to open the file and checks for the proper format. * This method should be called before @ref load(). */ virtual bool doOpen(); /** * Closes the file again. */ virtual void doClose(); /** * Requests a save ticket, that is used by @ref save() */ virtual Ticket *requestSaveTicket(); /** * Loads all addressees from file to the address book. * Returns true if all addressees could be loaded otherwise false. */ virtual bool load(); /** * 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 ); /** diff --git a/kabc/resource.cpp b/kabc/resource.cpp index 7b91239..267cdaf 100644 --- a/kabc/resource.cpp +++ b/kabc/resource.cpp @@ -1,144 +1,116 @@ /* This file is part of libkabc. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include <kdebug.h> -#include <ksyncprofile.h> - #include "resource.h" using namespace KABC; -Resource::Resource( const KConfig *config, bool syncable ) - : KRES::Resource( config ), mAddressBook( 0 ), mSyncProfile( 0 ) +Resource::Resource( const KConfig *config ) + : KRES::Resource( config ), mAddressBook( 0 ) { - if(syncable == true) { - mSyncProfile = new KSyncProfile( ); - mSyncProfile->setName("pending" /*resourceName()*/); - mSyncProfile->readConfig( (KConfig *)config ); - } } Resource::~Resource() { - if (mSyncProfile != 0) { - delete mSyncProfile; - } } void Resource::writeConfig( KConfig *config ) { KRES::Resource::writeConfig( config ); - - if(mSyncProfile != 0) - mSyncProfile->writeConfig( config ); } void Resource::setAddressBook( AddressBook *ab ) { mAddressBook = ab; } AddressBook *Resource::addressBook() { return mAddressBook; } bool Resource::doOpen() { return true; } void Resource::doClose() { } Ticket *Resource::requestSaveTicket() { return 0; } bool Resource::load() { return true; } bool Resource::save( Ticket * ) { return false; } Ticket *Resource::createTicket( Resource *resource ) { return new Ticket( resource ); } void Resource::removeAddressee( const Addressee& ) { // do nothing } void Resource::cleanUp() { // do nothing } -bool Resource::isSyncable() const -{ - return (mSyncProfile != 0); -} - -KSyncProfile* Resource::getSyncProfile() -{ - return mSyncProfile; -} - - QString Resource::fileName() const { return mFileName; } void Resource::setFileName( const QString &fileName ) { mFileName = fileName; } /** * Set the name of resource.You can override this method, * but also remember to call Resource::setResourceName(). */ void Resource::setResourceName( const QString &name ) { KRES::Resource::setResourceName(name); - if(mSyncProfile != 0) { - mSyncProfile->setName( name ); - } - } diff --git a/kabc/resource.h b/kabc/resource.h index 2024d2d..e5f0d5d 100644 --- a/kabc/resource.h +++ b/kabc/resource.h @@ -1,171 +1,157 @@ /* This file is part of libkabc. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #ifndef KABC_RESOURCE_H #define KABC_RESOURCE_H #include <kresources/resource.h> #include "addressbook.h" -class KSyncProfile; - namespace KABC { /** * @short Helper class for handling coordinated save of address books. * * This class is used as helper class for saving address book. * @see requestSaveTicket(), save(). */ class Ticket { friend class Resource; public: Resource *resource() { return mResource; } private: Ticket( Resource *resource ) : mResource( resource ) {} Resource *mResource; }; /** * @internal */ class Resource : public KRES::Resource { -private: - /** - * make this constructor private to force everybody to use the other one - */ - Resource( const KConfig *config); - public: /** * Constructor */ - Resource( const KConfig *config, bool syncable ); + Resource( const KConfig *config ); /** * Destructor. */ virtual ~Resource(); /** * Sets the address book of the resource. */ void setAddressBook( AddressBook* ); /** * Returns a pointer to the addressbook. */ AddressBook *addressBook(); /** * Writes the resource specific config to file. */ virtual void writeConfig( KConfig *config ); /** * Open the resource and returns if it was successfully */ virtual bool doOpen(); /** * Request a ticket, you have to pass through @ref save() to * allow locking. */ virtual Ticket *requestSaveTicket(); /** * Load all addressees to the addressbook */ virtual bool load(); /** * Save all addressees to the addressbook. * * @param ticket The ticket you get by @ref requestSaveTicket() */ virtual bool save( Ticket *ticket ); /** * Removes a addressee from resource. This method is mainly * used by record-based resources like LDAP or SQL. */ virtual void removeAddressee( const Addressee& addr ); /** * This method is called by an error handler if the application * crashed */ virtual void cleanUp(); /** * Set name of file to be used for saving. */ virtual void setFileName( const QString & ); /** * Return name of file used for loading and saving the address book. */ virtual QString fileName() const; - - virtual bool isSyncable() const; - - virtual KSyncProfile* getSyncProfile(); - /** * Set the name of resource.You can override this method, * but also remember to call Resource::setResourceName(). */ virtual void setResourceName( const QString &name ); protected: Ticket *createTicket( Resource * ); virtual void doClose(); private: AddressBook *mAddressBook; - KSyncProfile *mSyncProfile; QString mFileName; }; } #endif |