summaryrefslogtreecommitdiffabout
path: root/kabc
Unidiff
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp2
-rw-r--r--kabc/kabcE.pro2
-rw-r--r--kabc/plugins/dir/resourcedir.cpp7
-rw-r--r--kabc/plugins/dir/resourcedir.h2
-rw-r--r--kabc/plugins/file/resourcefile.cpp16
-rw-r--r--kabc/plugins/file/resourcefile.h4
-rw-r--r--kabc/plugins/ldap/resourceldap.cpp7
-rw-r--r--kabc/plugins/ldap/resourceldap.h2
-rw-r--r--kabc/plugins/opie/resourceopie.cpp11
-rw-r--r--kabc/plugins/opie/resourceopie.h4
-rw-r--r--kabc/plugins/qtopia/resourceqtopia.cpp11
-rw-r--r--kabc/plugins/qtopia/resourceqtopia.h4
-rw-r--r--kabc/plugins/sharpdtm/resourcesharpdtm.cpp8
-rw-r--r--kabc/plugins/sharpdtm/resourcesharpdtm.h4
-rw-r--r--kabc/resource.cpp32
-rw-r--r--kabc/resource.h16
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
@@ -268,25 +268,25 @@ void AddressBook::init(const QString &config, const QString &family )
268 d->mConfig = con; 268 d->mConfig = con;
269 } 269 }
270 else 270 else
271 d->mConfig = new KConfig( locateLocal("config", config) ); 271 d->mConfig = new KConfig( locateLocal("config", config) );
272// qDebug("AddressBook::init 1 config=%s",config.latin1() ); 272// qDebug("AddressBook::init 1 config=%s",config.latin1() );
273 } 273 }
274 else { 274 else {
275 d->mConfig = 0; 275 d->mConfig = 0;
276// qDebug("AddressBook::init 1 config=0"); 276// qDebug("AddressBook::init 1 config=0");
277 } 277 }
278 278
279//US d->mErrorHandler = 0; 279//US d->mErrorHandler = 0;
280 d->mManager = new KRES::Manager<Resource>( fami, false ); 280 d->mManager = new KRES::Manager<Resource>( fami );
281 d->mManager->readConfig( d->mConfig ); 281 d->mManager->readConfig( d->mConfig );
282 if ( family == "syncContact" ) { 282 if ( family == "syncContact" ) {
283 KRES::Manager<Resource> *manager = d->mManager; 283 KRES::Manager<Resource> *manager = d->mManager;
284 KRES::Manager<Resource>::ActiveIterator it; 284 KRES::Manager<Resource>::ActiveIterator it;
285 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { 285 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
286 (*it)->setAddressBook( this ); 286 (*it)->setAddressBook( this );
287 if ( !(*it)->open() ) 287 if ( !(*it)->open() )
288 error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); 288 error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) );
289 } 289 }
290 Resource *res = standardResource(); 290 Resource *res = standardResource();
291 if ( !res ) { 291 if ( !res ) {
292 qDebug("ERROR: no standard resource"); 292 qDebug("ERROR: no standard resource");
diff --git a/kabc/kabcE.pro b/kabc/kabcE.pro
index 061909b..96fe39e 100644
--- a/kabc/kabcE.pro
+++ b/kabc/kabcE.pro
@@ -32,25 +32,24 @@ HEADERS = \
32 field.h \ 32 field.h \
33 formatfactory.h \ 33 formatfactory.h \
34 formatplugin.h \ 34 formatplugin.h \
35 geo.h \ 35 geo.h \
36 key.h \ 36 key.h \
37 phonenumber.h \ 37 phonenumber.h \
38 picture.h \ 38 picture.h \
39 plugin.h \ 39 plugin.h \
40 resource.h \ 40 resource.h \
41 secrecy.h \ 41 secrecy.h \
42 sound.h \ 42 sound.h \
43 stdaddressbook.h \ 43 stdaddressbook.h \
44 syncprefwidget.h \
45 timezone.h \ 44 timezone.h \
46 tmpaddressbook.h \ 45 tmpaddressbook.h \
47 vcardconverter.h \ 46 vcardconverter.h \
48 vcard21parser.h \ 47 vcard21parser.h \
49 vcardformatimpl.h \ 48 vcardformatimpl.h \
50 vcardformatplugin.h \ 49 vcardformatplugin.h \
51 vcardparser/vcardline.h \ 50 vcardparser/vcardline.h \
52 vcardparser/vcard.h \ 51 vcardparser/vcard.h \
53 vcardparser/vcardtool.h \ 52 vcardparser/vcardtool.h \
54 vcardparser/vcardparser.h \ 53 vcardparser/vcardparser.h \
55 vcard/include/VCardAdrParam.h \ 54 vcard/include/VCardAdrParam.h \
56 vcard/include/VCardAdrValue.h \ 55 vcard/include/VCardAdrValue.h \
@@ -137,25 +136,24 @@ SOURCES = \
137 distributionlisteditor.cpp \ 136 distributionlisteditor.cpp \
138 field.cpp \ 137 field.cpp \
139 formatfactory.cpp \ 138 formatfactory.cpp \
140 geo.cpp \ 139 geo.cpp \
141 key.cpp \ 140 key.cpp \
142 phonenumber.cpp \ 141 phonenumber.cpp \
143 picture.cpp \ 142 picture.cpp \
144 plugin.cpp \ 143 plugin.cpp \
145 resource.cpp \ 144 resource.cpp \
146 secrecy.cpp \ 145 secrecy.cpp \
147 sound.cpp \ 146 sound.cpp \
148 stdaddressbook.cpp \ 147 stdaddressbook.cpp \
149 syncprefwidget.cpp \
150 timezone.cpp \ 148 timezone.cpp \
151 tmpaddressbook.cpp \ 149 tmpaddressbook.cpp \
152 vcardconverter.cpp \ 150 vcardconverter.cpp \
153 vcard21parser.cpp \ 151 vcard21parser.cpp \
154 vcardformatimpl.cpp \ 152 vcardformatimpl.cpp \
155 vcardformatplugin.cpp \ 153 vcardformatplugin.cpp \
156 vcardparser/vcardline.cpp \ 154 vcardparser/vcardline.cpp \
157 vcardparser/vcard.cpp \ 155 vcardparser/vcard.cpp \
158 vcardparser/vcardtool.cpp \ 156 vcardparser/vcardtool.cpp \
159 vcardparser/vcardparser.cpp \ 157 vcardparser/vcardparser.cpp \
160vcard/AdrParam.cpp \ 158vcard/AdrParam.cpp \
161vcard/AdrValue.cpp \ 159vcard/AdrValue.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
@@ -49,48 +49,47 @@ $Id$
49#include "addressbook.h" 49#include "addressbook.h"
50 50
51#include "formatfactory.h" 51#include "formatfactory.h"
52 52
53#include "resourcedirconfig.h" 53#include "resourcedirconfig.h"
54#include "stdaddressbook.h" 54#include "stdaddressbook.h"
55 55
56//US 56//US
57#include <qdir.h> 57#include <qdir.h>
58 58
59#define NO_DIRWATCH 59#define NO_DIRWATCH
60#include "resourcedir.h" 60#include "resourcedir.h"
61#include "syncprefwidget.h"
62 61
63//#define ALLOW_LOCKING 62//#define ALLOW_LOCKING
64 63
65using namespace KABC; 64using namespace KABC;
66 65
67extern "C" 66extern "C"
68#ifdef _WIN32_ 67#ifdef _WIN32_
69__declspec(dllexport) 68__declspec(dllexport)
70#else 69#else
71{ 70{
72#endif 71#endif
73 72
74//US void *init_kabc_dir() 73//US void *init_kabc_dir()
75 void *init_microkabc_dir() 74 void *init_microkabc_dir()
76 { 75 {
77 return new KRES::PluginFactory<ResourceDir,ResourceDirConfig, SyncPrefWidgetContainer>(); 76 return new KRES::PluginFactory<ResourceDir,ResourceDirConfig>();
78 } 77 }
79#ifndef _WIN32_ 78#ifndef _WIN32_
80} 79}
81#endif 80#endif
82 81
83ResourceDir::ResourceDir( const KConfig *config, bool syncable ) 82ResourceDir::ResourceDir( const KConfig *config )
84 : Resource( config, syncable ) 83 : Resource( config )
85{ 84{
86 QString path; 85 QString path;
87 86
88 KConfig *cfg = (KConfig *)config; 87 KConfig *cfg = (KConfig *)config;
89 if ( cfg ) { 88 if ( cfg ) {
90//US path = config->readEntry( "FilePath" ); 89//US path = config->readEntry( "FilePath" );
91 path = cfg->readEntry( "FilePath", StdAddressBook::directoryName() ); 90 path = cfg->readEntry( "FilePath", StdAddressBook::directoryName() );
92//US mFormatName = config->readEntry( "FileFormat" ); 91//US mFormatName = config->readEntry( "FileFormat" );
93 mFormatName = cfg->readEntry( "FileFormat", "vcard" ); 92 mFormatName = cfg->readEntry( "FileFormat", "vcard" );
94 } else { 93 } else {
95 path = StdAddressBook::directoryName(); 94 path = StdAddressBook::directoryName();
96 mFormatName = "vcard"; 95 mFormatName = "vcard";
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
@@ -40,25 +40,25 @@ class QTimer;
40namespace KABC { 40namespace KABC {
41 41
42class FormatPlugin; 42class FormatPlugin;
43 43
44/** 44/**
45 @internal 45 @internal
46*/ 46*/
47class ResourceDir : public Resource 47class ResourceDir : public Resource
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 50
51public: 51public:
52 ResourceDir( const KConfig*, bool syncable ); 52 ResourceDir( const KConfig* );
53 ~ResourceDir(); 53 ~ResourceDir();
54 54
55 virtual void writeConfig( KConfig* ); 55 virtual void writeConfig( KConfig* );
56 56
57 virtual bool doOpen(); 57 virtual bool doOpen();
58 virtual void doClose(); 58 virtual void doClose();
59 59
60 virtual Ticket *requestSaveTicket(); 60 virtual Ticket *requestSaveTicket();
61 61
62 virtual bool load(); 62 virtual bool load();
63 virtual bool save( Ticket * ); 63 virtual bool save( Ticket * );
64 64
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
@@ -42,73 +42,69 @@ $Id$
42#include <klocale.h> 42#include <klocale.h>
43//US #include <ksavefile.h> 43//US #include <ksavefile.h>
44#include <kstandarddirs.h> 44#include <kstandarddirs.h>
45#include <kmessagebox.h> 45#include <kmessagebox.h>
46 46
47#include "formatfactory.h" 47#include "formatfactory.h"
48 48
49#include "resource.h" 49#include "resource.h"
50#include "resourcefileconfig.h" 50#include "resourcefileconfig.h"
51#include "stdaddressbook.h" 51#include "stdaddressbook.h"
52#define NO_DIRWATCH 52#define NO_DIRWATCH
53#include "resourcefile.h" 53#include "resourcefile.h"
54#include "syncprefwidget.h"
55 54
56//#define ALLOW_LOCKING 55//#define ALLOW_LOCKING
57 56
58 57
59 58
60using namespace KABC; 59using namespace KABC;
61 60
62extern "C" 61extern "C"
63#ifdef _WIN32_ 62#ifdef _WIN32_
64__declspec(dllexport) 63__declspec(dllexport)
65#else 64#else
66{ 65{
67#endif 66#endif
68 67
69//US void *init_kabc_file() 68//US void *init_kabc_file()
70 void *init_microkabc_file() 69 void *init_microkabc_file()
71 { 70 {
72 return new KRES::PluginFactory<ResourceFile,ResourceFileConfig, SyncPrefWidgetContainer>(); 71 return new KRES::PluginFactory<ResourceFile,ResourceFileConfig>();
73 } 72 }
74#ifndef _WIN32_ 73#ifndef _WIN32_
75} 74}
76#endif 75#endif
77 76
78ResourceFile::ResourceFile( const KConfig *config, bool syncable ) 77ResourceFile::ResourceFile( const KConfig *config )
79 : Resource( config, syncable ) , mFormat( 0 ) 78 : Resource( config ) , mFormat( 0 )
80{ 79{
81 QString fileName, formatName, default_fileName; 80 QString fileName, formatName, default_fileName;
82 81
83 if (syncable == true) 82 default_fileName = StdAddressBook::fileName();
84 default_fileName = "/home/polo/kdepim/apps/kabc/localfile.vcf";
85 else
86 default_fileName = StdAddressBook::fileName();
87 83
88 KConfig *cfg = (KConfig *)config; 84 KConfig *cfg = (KConfig *)config;
89 if ( cfg ) { 85 if ( cfg ) {
90 fileName = cfg->readEntry( "FileName", default_fileName ); 86 fileName = cfg->readEntry( "FileName", default_fileName );
91 formatName = cfg->readEntry( "FileFormat", "vcard" ); 87 formatName = cfg->readEntry( "FileFormat", "vcard" );
92 } else { 88 } else {
93 fileName = default_fileName; 89 fileName = default_fileName;
94 formatName = "vcard"; 90 formatName = "vcard";
95 } 91 }
96 92
97 init( fileName, formatName ); 93 init( fileName, formatName );
98} 94}
99 95
100ResourceFile::ResourceFile( const QString &fileName, bool syncable , 96ResourceFile::ResourceFile( const QString &fileName ,
101 const QString &formatName ) 97 const QString &formatName )
102 : Resource( 0, syncable ) 98 : Resource( 0 )
103{ 99{
104// qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1()); 100// qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1());
105 init( fileName, formatName ); 101 init( fileName, formatName );
106} 102}
107 103
108void ResourceFile::init( const QString &fileName, const QString &formatName ) 104void ResourceFile::init( const QString &fileName, const QString &formatName )
109{ 105{
110 mFormatName = formatName; 106 mFormatName = formatName;
111 107
112 FormatFactory *factory = FormatFactory::self(); 108 FormatFactory *factory = FormatFactory::self();
113 mFormat = factory->format( mFormatName ); 109 mFormat = factory->format( mFormatName );
114 110
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
@@ -49,30 +49,30 @@ class ResourceConfigWidget;
49*/ 49*/
50class ResourceFile : public Resource 50class ResourceFile : public Resource
51{ 51{
52 Q_OBJECT 52 Q_OBJECT
53 53
54public: 54public:
55 55
56 /** 56 /**
57 Constructor. 57 Constructor.
58 58
59 @param cfg The config object where custom resource settings are stored. 59 @param cfg The config object where custom resource settings are stored.
60 */ 60 */
61 ResourceFile( const KConfig *cfg, bool syncable ); 61 ResourceFile( const KConfig *cfg );
62 62
63 /** 63 /**
64 Construct file resource on file @arg fileName using format @arg formatName. 64 Construct file resource on file @arg fileName using format @arg formatName.
65 */ 65 */
66 ResourceFile( const QString &fileName, bool syncable , const QString &formatName = "vcard" ); 66 ResourceFile( const QString &fileName , const QString &formatName = "vcard" );
67 67
68 /** 68 /**
69 * Destructor. 69 * Destructor.
70 */ 70 */
71 ~ResourceFile(); 71 ~ResourceFile();
72 72
73 /** 73 /**
74 Writes the config back. 74 Writes the config back.
75 */ 75 */
76 virtual void writeConfig( KConfig *cfg ); 76 virtual void writeConfig( KConfig *cfg );
77 77
78 /** 78 /**
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
@@ -27,42 +27,41 @@ $Id$
27 27
28#include <kdebug.h> 28#include <kdebug.h>
29#include <kglobal.h> 29#include <kglobal.h>
30#include <klineedit.h> 30#include <klineedit.h>
31#include <klocale.h> 31#include <klocale.h>
32#include <kconfig.h> 32#include <kconfig.h>
33#include <kstringhandler.h> 33#include <kstringhandler.h>
34 34
35#include <stdlib.h> 35#include <stdlib.h>
36 36
37#include "resourceldap.h" 37#include "resourceldap.h"
38#include "resourceldapconfig.h" 38#include "resourceldapconfig.h"
39#include "syncprefwidget.h"
40 39
41using namespace KABC; 40using namespace KABC;
42 41
43extern "C" 42extern "C"
44{ 43{
45//US void *init_kabc_ldap() 44//US void *init_kabc_ldap()
46 void *init_microkabc_ldap() 45 void *init_microkabc_ldap()
47 { 46 {
48 return new KRES::PluginFactory<ResourceLDAP,ResourceLDAPConfig, SyncPrefWidgetContainer>(); 47 return new KRES::PluginFactory<ResourceLDAP,ResourceLDAPConfig>();
49 } 48 }
50} 49}
51 50
52void addModOp( LDAPMod ***pmods, const QString &attr, const QString &value ); 51void addModOp( LDAPMod ***pmods, const QString &attr, const QString &value );
53 52
54 53
55ResourceLDAP::ResourceLDAP( const KConfig *config, bool syncable ) 54ResourceLDAP::ResourceLDAP( const KConfig *config )
56 : Resource( config, syncable ), mPort( 389 ), mLdap( 0 ) 55 : Resource( config ), mPort( 389 ), mLdap( 0 )
57{ 56{
58 KConfig *cfg = (KConfig *)config; 57 KConfig *cfg = (KConfig *)config;
59 if ( cfg ) { 58 if ( cfg ) {
60 mUser = cfg->readEntry( "LdapUser" ); 59 mUser = cfg->readEntry( "LdapUser" );
61 mPassword = KStringHandler::obscure( cfg->readEntry( "LdapPassword" ) ); 60 mPassword = KStringHandler::obscure( cfg->readEntry( "LdapPassword" ) );
62 mDn = cfg->readEntry( "LdapDn" ); 61 mDn = cfg->readEntry( "LdapDn" );
63 mHost = cfg->readEntry( "LdapHost" ); 62 mHost = cfg->readEntry( "LdapHost" );
64 mPort = cfg->readNumEntry( "LdapPort", 389 ); 63 mPort = cfg->readNumEntry( "LdapPort", 389 );
65 mFilter = cfg->readEntry( "LdapFilter" ); 64 mFilter = cfg->readEntry( "LdapFilter" );
66 mAnonymous = cfg->readBoolEntry( "LdapAnonymous" ); 65 mAnonymous = cfg->readBoolEntry( "LdapAnonymous" );
67 66
68 QStringList attributes = cfg->readListEntry( "LdapAttributes" ); 67 QStringList attributes = cfg->readListEntry( "LdapAttributes" );
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
@@ -34,25 +34,25 @@ $Id$
34 34
35#include "addressbook.h" 35#include "addressbook.h"
36#include "resource.h" 36#include "resource.h"
37 37
38class KConfig; 38class KConfig;
39 39
40namespace KABC { 40namespace KABC {
41 41
42class ResourceLDAP : public Resource 42class ResourceLDAP : public Resource
43{ 43{
44public: 44public:
45 45
46 ResourceLDAP( const KConfig*, bool syncable ); 46 ResourceLDAP( const KConfig* );
47 47
48 virtual void writeConfig( KConfig* ); 48 virtual void writeConfig( KConfig* );
49 49
50 virtual bool doOpen(); 50 virtual bool doOpen();
51 virtual void doClose(); 51 virtual void doClose();
52 52
53 virtual Ticket *requestSaveTicket(); 53 virtual Ticket *requestSaveTicket();
54 54
55 virtual bool load(); 55 virtual bool load();
56 virtual bool save( Ticket * ); 56 virtual bool save( Ticket * );
57 57
58 virtual void removeAddressee( const Addressee& addr ); 58 virtual void removeAddressee( const Addressee& addr );
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
@@ -41,55 +41,54 @@ $Id$
41//US #include <ksavefile.h> 41//US #include <ksavefile.h>
42#include <kstandarddirs.h> 42#include <kstandarddirs.h>
43#include <kmessagebox.h> 43#include <kmessagebox.h>
44 44
45//US #include "formatfactory.h" 45//US #include "formatfactory.h"
46//US #include <qpe/qpeapplication.h> 46//US #include <qpe/qpeapplication.h>
47 47
48#include <opie/ocontactaccess.h> 48#include <opie/ocontactaccess.h>
49#include <opie/ocontactaccessbackend_xml.h> 49#include <opie/ocontactaccessbackend_xml.h>
50 50
51#include "resourceopieconfig.h" 51#include "resourceopieconfig.h"
52#include "stdaddressbook.h" 52#include "stdaddressbook.h"
53#include "syncprefwidget.h"
54 53
55#include "opieconverter.h" 54#include "opieconverter.h"
56 55
57#include "resourceopie.h" 56#include "resourceopie.h"
58 57
59using namespace KABC; 58using namespace KABC;
60extern "C" 59extern "C"
61{ 60{
62 void *init_microkabc_opie() 61 void *init_microkabc_opie()
63 { 62 {
64 return new KRES::PluginFactory<ResourceOpie,ResourceOpieConfig, SyncPrefWidgetContainer>(); 63 return new KRES::PluginFactory<ResourceOpie,ResourceOpieConfig>();
65 } 64 }
66} 65}
67 66
68ResourceOpie::ResourceOpie( const KConfig *config, bool syncable ) 67ResourceOpie::ResourceOpie( const KConfig *config )
69 : Resource( config, syncable ), mAccess(0), mConverter (0) 68 : Resource( config ), mAccess(0), mConverter (0)
70{ 69{
71 QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; 70 QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml";
72 71
73 KConfig *cfg = (KConfig *)config; 72 KConfig *cfg = (KConfig *)config;
74 if ( cfg ) { 73 if ( cfg ) {
75 fileName = cfg->readEntry( "FileName", fileName ); 74 fileName = cfg->readEntry( "FileName", fileName );
76 75
77 } 76 }
78 77
79 init( fileName ); 78 init( fileName );
80} 79}
81 80
82ResourceOpie::ResourceOpie( const QString &fileName, bool syncable ) 81ResourceOpie::ResourceOpie( const QString &fileName )
83 : Resource( 0, syncable ) 82 : Resource( 0 )
84{ 83{
85 init( fileName ); 84 init( fileName );
86} 85}
87 86
88void ResourceOpie::init( const QString &fileName ) 87void ResourceOpie::init( const QString &fileName )
89{ 88{
90 qDebug("ResourceOpie::init()"); 89 qDebug("ResourceOpie::init()");
91 90
92 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); 91 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
93 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); 92 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
94 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); 93 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
95 94
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
@@ -48,30 +48,30 @@ class OpieConverter;
48*/ 48*/
49class ResourceOpie : public Resource 49class ResourceOpie : public Resource
50{ 50{
51 Q_OBJECT 51 Q_OBJECT
52 52
53public: 53public:
54 54
55 /** 55 /**
56 Constructor. 56 Constructor.
57 57
58 @param cfg The config object where custom resource settings are stored. 58 @param cfg The config object where custom resource settings are stored.
59 */ 59 */
60 ResourceOpie( const KConfig *cfg, bool syncable ); 60 ResourceOpie( const KConfig *cfg );
61 61
62 /** 62 /**
63 Construct file resource on file @arg fileName using format @arg formatName. 63 Construct file resource on file @arg fileName using format @arg formatName.
64 */ 64 */
65 ResourceOpie( const QString &fileName, bool syncable ); 65 ResourceOpie( const QString &fileName );
66 66
67 /** 67 /**
68 * Destructor. 68 * Destructor.
69 */ 69 */
70 ~ResourceOpie(); 70 ~ResourceOpie();
71 71
72 /** 72 /**
73 Writes the config back. 73 Writes the config back.
74 */ 74 */
75 virtual void writeConfig( KConfig *cfg ); 75 virtual void writeConfig( KConfig *cfg );
76 76
77 /** 77 /**
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
@@ -40,47 +40,46 @@ $Id$
40#include <klocale.h> 40#include <klocale.h>
41//US #include <ksavefile.h> 41//US #include <ksavefile.h>
42#include <kstandarddirs.h> 42#include <kstandarddirs.h>
43#include <kmessagebox.h> 43#include <kmessagebox.h>
44 44
45#include <qpe/pim/addressbookaccess.h> 45#include <qpe/pim/addressbookaccess.h>
46 46
47 47
48#include "resourceqtopiaconfig.h" 48#include "resourceqtopiaconfig.h"
49#include "stdaddressbook.h" 49#include "stdaddressbook.h"
50 50
51#include "qtopiaconverter.h" 51#include "qtopiaconverter.h"
52#include "syncprefwidget.h"
53 52
54#include "resourceqtopia.h" 53#include "resourceqtopia.h"
55 54
56using namespace KABC; 55using namespace KABC;
57extern "C" 56extern "C"
58{ 57{
59 void *init_microkabc_qtopia() 58 void *init_microkabc_qtopia()
60 { 59 {
61 return new KRES::PluginFactory<ResourceQtopia,ResourceQtopiaConfig, SyncPrefWidgetContainer>(); 60 return new KRES::PluginFactory<ResourceQtopia,ResourceQtopiaConfig>();
62 } 61 }
63} 62}
64 63
65ResourceQtopia::ResourceQtopia( const KConfig *config, bool syncable ) 64ResourceQtopia::ResourceQtopia( const KConfig *config )
66 : Resource( config, syncable ), mConverter (0) 65 : Resource( config ), mConverter (0)
67{ 66{
68 // we can not choose the filename. Therefore use the default to display 67 // we can not choose the filename. Therefore use the default to display
69 QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; 68 QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml";
70 init( fileName ); 69 init( fileName );
71} 70}
72 71
73ResourceQtopia::ResourceQtopia( const QString &fileName, bool syncable ) 72ResourceQtopia::ResourceQtopia( const QString &fileName )
74 : Resource( 0, syncable ) 73 : Resource( 0 )
75{ 74{
76 init( fileName ); 75 init( fileName );
77} 76}
78 77
79void ResourceQtopia::init( const QString &fileName ) 78void ResourceQtopia::init( const QString &fileName )
80{ 79{
81 80
82 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); 81 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
83 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); 82 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
84 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); 83 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
85 84
86 setFileName( fileName ); 85 setFileName( fileName );
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
@@ -49,30 +49,30 @@ class QtopiaConverter;
49*/ 49*/
50class ResourceQtopia : public Resource 50class ResourceQtopia : public Resource
51{ 51{
52 Q_OBJECT 52 Q_OBJECT
53 53
54public: 54public:
55 55
56 /** 56 /**
57 Constructor. 57 Constructor.
58 58
59 @param cfg The config object where custom resource settings are stored. 59 @param cfg The config object where custom resource settings are stored.
60 */ 60 */
61 ResourceQtopia( const KConfig *cfg, bool syncable ); 61 ResourceQtopia( const KConfig *cfg );
62 62
63 /** 63 /**
64 Construct file resource on file @arg fileName using format @arg formatName. 64 Construct file resource on file @arg fileName using format @arg formatName.
65 */ 65 */
66 ResourceQtopia( const QString &fileName, bool syncable ); 66 ResourceQtopia( const QString &fileName );
67 67
68 /** 68 /**
69 * Destructor. 69 * Destructor.
70 */ 70 */
71 ~ResourceQtopia(); 71 ~ResourceQtopia();
72 72
73 /** 73 /**
74 Writes the config back. 74 Writes the config back.
75 */ 75 */
76 virtual void writeConfig( KConfig *cfg ); 76 virtual void writeConfig( KConfig *cfg );
77 77
78 /** 78 /**
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
@@ -41,41 +41,39 @@ $Id$
41#include <klocale.h> 41#include <klocale.h>
42//US #include <ksavefile.h> 42//US #include <ksavefile.h>
43#include <kstandarddirs.h> 43#include <kstandarddirs.h>
44#include <kmessagebox.h> 44#include <kmessagebox.h>
45 45
46#include <sl/slzdb.h> 46#include <sl/slzdb.h>
47 47
48#include <libkdepim/ksyncprofile.h> 48#include <libkdepim/ksyncprofile.h>
49 49
50#include "resourcesharpdtmconfig.h" 50#include "resourcesharpdtmconfig.h"
51#include "resourcesharpdtm.h" 51#include "resourcesharpdtm.h"
52 52
53#include "syncprefwidget.h"
54
55#include "stdaddressbook.h" 53#include "stdaddressbook.h"
56 54
57#include "sharpdtmconverter.h" 55#include "sharpdtmconverter.h"
58//#define ALLOW_LOCKING 56//#define ALLOW_LOCKING
59using namespace KABC; 57using namespace KABC;
60extern "C" 58extern "C"
61{ 59{
62 void *init_microkabc_sharpdtm() 60 void *init_microkabc_sharpdtm()
63 { 61 {
64 return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig,SyncPrefWidgetContainer>(); 62 return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig>();
65 } 63 }
66} 64}
67 65
68ResourceSharpDTM::ResourceSharpDTM( const KConfig *config, bool syncable ) 66ResourceSharpDTM::ResourceSharpDTM( const KConfig *config )
69 : Resource( config, syncable ), mConverter (0) 67 : Resource( config ), mConverter (0)
70{ 68{
71 // we can not choose the filename. Therefore use the default to display 69 // we can not choose the filename. Therefore use the default to display
72 70
73 QString fileName = SlZDataBase::addressbookFileName(); 71 QString fileName = SlZDataBase::addressbookFileName();
74 init( fileName ); 72 init( fileName );
75} 73}
76 74
77ResourceSharpDTM::ResourceSharpDTM( const QString &fileName, bool syncable ) 75ResourceSharpDTM::ResourceSharpDTM( const QString &fileName, bool syncable )
78 : Resource( 0, syncable ) 76 : Resource( 0, syncable )
79{ 77{
80 init( fileName ); 78 init( fileName );
81} 79}
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
@@ -49,30 +49,30 @@ class SharpDTMConverter;
49*/ 49*/
50class ResourceSharpDTM : public Resource 50class ResourceSharpDTM : public Resource
51{ 51{
52 Q_OBJECT 52 Q_OBJECT
53 53
54public: 54public:
55 55
56 /** 56 /**
57 Constructor. 57 Constructor.
58 58
59 @param cfg The config object where custom resource settings are stored. 59 @param cfg The config object where custom resource settings are stored.
60 */ 60 */
61 ResourceSharpDTM( const KConfig *cfg, bool syncable ); 61 ResourceSharpDTM( const KConfig *cfg );
62 62
63 /** 63 /**
64 Construct file resource on file @arg fileName using format @arg formatName. 64 Construct file resource on file @arg fileName using format @arg formatName.
65 */ 65 */
66 ResourceSharpDTM( const QString &fileName, bool syncable ); 66 ResourceSharpDTM( const QString &fileName );
67 67
68 /** 68 /**
69 * Destructor. 69 * Destructor.
70 */ 70 */
71 ~ResourceSharpDTM(); 71 ~ResourceSharpDTM();
72 72
73 /** 73 /**
74 Writes the config back. 74 Writes the config back.
75 */ 75 */
76 virtual void writeConfig( KConfig *cfg ); 76 virtual void writeConfig( KConfig *cfg );
77 77
78 /** 78 /**
diff --git a/kabc/resource.cpp b/kabc/resource.cpp
index 7b91239..267cdaf 100644
--- a/kabc/resource.cpp
+++ b/kabc/resource.cpp
@@ -18,53 +18,40 @@
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/* 21/*
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28#include <kdebug.h> 28#include <kdebug.h>
29 29
30#include <ksyncprofile.h>
31
32#include "resource.h" 30#include "resource.h"
33 31
34using namespace KABC; 32using namespace KABC;
35 33
36Resource::Resource( const KConfig *config, bool syncable ) 34Resource::Resource( const KConfig *config )
37 : KRES::Resource( config ), mAddressBook( 0 ), mSyncProfile( 0 ) 35 : KRES::Resource( config ), mAddressBook( 0 )
38{ 36{
39 if(syncable == true) {
40 mSyncProfile = new KSyncProfile( );
41 mSyncProfile->setName("pending" /*resourceName()*/);
42 mSyncProfile->readConfig( (KConfig *)config );
43 }
44} 37}
45 38
46Resource::~Resource() 39Resource::~Resource()
47{ 40{
48 if (mSyncProfile != 0) {
49 delete mSyncProfile;
50 }
51} 41}
52 42
53void Resource::writeConfig( KConfig *config ) 43void Resource::writeConfig( KConfig *config )
54{ 44{
55 KRES::Resource::writeConfig( config ); 45 KRES::Resource::writeConfig( config );
56
57 if(mSyncProfile != 0)
58 mSyncProfile->writeConfig( config );
59} 46}
60 47
61 48
62void Resource::setAddressBook( AddressBook *ab ) 49void Resource::setAddressBook( AddressBook *ab )
63{ 50{
64 mAddressBook = ab; 51 mAddressBook = ab;
65} 52}
66 53
67AddressBook *Resource::addressBook() 54AddressBook *Resource::addressBook()
68{ 55{
69 return mAddressBook; 56 return mAddressBook;
70} 57}
@@ -99,46 +86,31 @@ Ticket *Resource::createTicket( Resource *resource )
99} 86}
100 87
101void Resource::removeAddressee( const Addressee& ) 88void Resource::removeAddressee( const Addressee& )
102{ 89{
103 // do nothing 90 // do nothing
104} 91}
105 92
106void Resource::cleanUp() 93void Resource::cleanUp()
107{ 94{
108 // do nothing 95 // do nothing
109} 96}
110 97
111bool Resource::isSyncable() const
112{
113 return (mSyncProfile != 0);
114}
115
116KSyncProfile* Resource::getSyncProfile()
117{
118 return mSyncProfile;
119}
120
121
122QString Resource::fileName() const 98QString Resource::fileName() const
123{ 99{
124 return mFileName; 100 return mFileName;
125} 101}
126 102
127void Resource::setFileName( const QString &fileName ) 103void Resource::setFileName( const QString &fileName )
128{ 104{
129 mFileName = fileName; 105 mFileName = fileName;
130} 106}
131 107
132/** 108/**
133 * Set the name of resource.You can override this method, 109 * Set the name of resource.You can override this method,
134 * but also remember to call Resource::setResourceName(). 110 * but also remember to call Resource::setResourceName().
135 */ 111 */
136void Resource::setResourceName( const QString &name ) 112void Resource::setResourceName( const QString &name )
137{ 113{
138 KRES::Resource::setResourceName(name); 114 KRES::Resource::setResourceName(name);
139 if(mSyncProfile != 0) {
140 mSyncProfile->setName( name );
141 }
142
143} 115}
144 116
diff --git a/kabc/resource.h b/kabc/resource.h
index 2024d2d..e5f0d5d 100644
--- a/kabc/resource.h
+++ b/kabc/resource.h
@@ -24,26 +24,24 @@ Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28#ifndef KABC_RESOURCE_H 28#ifndef KABC_RESOURCE_H
29#define KABC_RESOURCE_H 29#define KABC_RESOURCE_H
30 30
31#include <kresources/resource.h> 31#include <kresources/resource.h>
32 32
33 33
34#include "addressbook.h" 34#include "addressbook.h"
35 35
36class KSyncProfile;
37
38namespace KABC { 36namespace KABC {
39 37
40/** 38/**
41 * @short Helper class for handling coordinated save of address books. 39 * @short Helper class for handling coordinated save of address books.
42 * 40 *
43 * This class is used as helper class for saving address book. 41 * This class is used as helper class for saving address book.
44 * @see requestSaveTicket(), save(). 42 * @see requestSaveTicket(), save().
45 */ 43 */
46class Ticket 44class Ticket
47{ 45{
48 friend class Resource; 46 friend class Resource;
49 public: 47 public:
@@ -51,35 +49,29 @@ class Ticket
51 49
52 private: 50 private:
53 Ticket( Resource *resource ) : mResource( resource ) {} 51 Ticket( Resource *resource ) : mResource( resource ) {}
54 52
55 Resource *mResource; 53 Resource *mResource;
56}; 54};
57 55
58/** 56/**
59 * @internal 57 * @internal
60 */ 58 */
61class Resource : public KRES::Resource 59class Resource : public KRES::Resource
62{ 60{
63private:
64 /**
65 * make this constructor private to force everybody to use the other one
66 */
67 Resource( const KConfig *config);
68
69public: 61public:
70 /** 62 /**
71 * Constructor 63 * Constructor
72 */ 64 */
73 Resource( const KConfig *config, bool syncable ); 65 Resource( const KConfig *config );
74 66
75 /** 67 /**
76 * Destructor. 68 * Destructor.
77 */ 69 */
78 virtual ~Resource(); 70 virtual ~Resource();
79 71
80 /** 72 /**
81 * Sets the address book of the resource. 73 * Sets the address book of the resource.
82 */ 74 */
83 void setAddressBook( AddressBook* ); 75 void setAddressBook( AddressBook* );
84 76
85 /** 77 /**
@@ -130,42 +122,36 @@ public:
130 virtual void cleanUp(); 122 virtual void cleanUp();
131 123
132 /** 124 /**
133 * Set name of file to be used for saving. 125 * Set name of file to be used for saving.
134 */ 126 */
135 virtual void setFileName( const QString & ); 127 virtual void setFileName( const QString & );
136 128
137 /** 129 /**
138 * Return name of file used for loading and saving the address book. 130 * Return name of file used for loading and saving the address book.
139 */ 131 */
140 virtual QString fileName() const; 132 virtual QString fileName() const;
141 133
142
143 virtual bool isSyncable() const;
144
145 virtual KSyncProfile* getSyncProfile();
146
147 /** 134 /**
148 * Set the name of resource.You can override this method, 135 * Set the name of resource.You can override this method,
149 * but also remember to call Resource::setResourceName(). 136 * but also remember to call Resource::setResourceName().
150 */ 137 */
151 virtual void setResourceName( const QString &name ); 138 virtual void setResourceName( const QString &name );
152 139
153 140
154 141
155protected: 142protected:
156 Ticket *createTicket( Resource * ); 143 Ticket *createTicket( Resource * );
157 virtual void doClose(); 144 virtual void doClose();
158 145
159private: 146private:
160 AddressBook *mAddressBook; 147 AddressBook *mAddressBook;
161 KSyncProfile *mSyncProfile;
162 QString mFileName; 148 QString mFileName;
163 149
164}; 150};
165 151
166 152
167} 153}
168 154
169 155
170 156
171#endif 157#endif