-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 | |||
@@ -272,17 +272,17 @@ void AddressBook::init(const QString &config, const QString &family ) | |||
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() ) ); |
diff --git a/kabc/kabcE.pro b/kabc/kabcE.pro index 061909b..96fe39e 100644 --- a/kabc/kabcE.pro +++ b/kabc/kabcE.pro | |||
@@ -36,17 +36,16 @@ HEADERS = \ | |||
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 \ |
@@ -141,17 +140,16 @@ SOURCES = \ | |||
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 \ |
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 | |||
@@ -53,40 +53,39 @@ $Id$ | |||
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 | ||
65 | using namespace KABC; | 64 | using namespace KABC; |
66 | 65 | ||
67 | extern "C" | 66 | extern "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 | ||
83 | ResourceDir::ResourceDir( const KConfig *config, bool syncable ) | 82 | ResourceDir::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" ); |
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 | |||
@@ -44,17 +44,17 @@ class FormatPlugin; | |||
44 | /** | 44 | /** |
45 | @internal | 45 | @internal |
46 | */ | 46 | */ |
47 | class ResourceDir : public Resource | 47 | class ResourceDir : public Resource |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | 50 | ||
51 | public: | 51 | public: |
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(); |
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 | |||
@@ -46,17 +46,16 @@ $Id$ | |||
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 | ||
60 | using namespace KABC; | 59 | using namespace KABC; |
61 | 60 | ||
62 | extern "C" | 61 | extern "C" |
@@ -64,47 +63,44 @@ extern "C" | |||
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 | ||
78 | ResourceFile::ResourceFile( const KConfig *config, bool syncable ) | 77 | ResourceFile::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 | ||
100 | ResourceFile::ResourceFile( const QString &fileName, bool syncable , | 96 | ResourceFile::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 | ||
108 | void ResourceFile::init( const QString &fileName, const QString &formatName ) | 104 | void ResourceFile::init( const QString &fileName, const QString &formatName ) |
109 | { | 105 | { |
110 | mFormatName = formatName; | 106 | mFormatName = formatName; |
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 | |||
@@ -53,22 +53,22 @@ class ResourceFile : public Resource | |||
53 | 53 | ||
54 | public: | 54 | public: |
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. |
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 | |||
@@ -31,34 +31,33 @@ $Id$ | |||
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 | ||
41 | using namespace KABC; | 40 | using namespace KABC; |
42 | 41 | ||
43 | extern "C" | 42 | extern "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 | ||
52 | void addModOp( LDAPMod ***pmods, const QString &attr, const QString &value ); | 51 | void addModOp( LDAPMod ***pmods, const QString &attr, const QString &value ); |
53 | 52 | ||
54 | 53 | ||
55 | ResourceLDAP::ResourceLDAP( const KConfig *config, bool syncable ) | 54 | ResourceLDAP::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 ); |
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 | |||
@@ -38,17 +38,17 @@ $Id$ | |||
38 | class KConfig; | 38 | class KConfig; |
39 | 39 | ||
40 | namespace KABC { | 40 | namespace KABC { |
41 | 41 | ||
42 | class ResourceLDAP : public Resource | 42 | class ResourceLDAP : public Resource |
43 | { | 43 | { |
44 | public: | 44 | public: |
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 | ||
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 | |||
@@ -45,47 +45,46 @@ $Id$ | |||
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 | ||
59 | using namespace KABC; | 58 | using namespace KABC; |
60 | extern "C" | 59 | extern "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 | ||
68 | ResourceOpie::ResourceOpie( const KConfig *config, bool syncable ) | 67 | ResourceOpie::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 | ||
82 | ResourceOpie::ResourceOpie( const QString &fileName, bool syncable ) | 81 | ResourceOpie::ResourceOpie( const QString &fileName ) |
83 | : Resource( 0, syncable ) | 82 | : Resource( 0 ) |
84 | { | 83 | { |
85 | init( fileName ); | 84 | init( fileName ); |
86 | } | 85 | } |
87 | 86 | ||
88 | void ResourceOpie::init( const QString &fileName ) | 87 | void ResourceOpie::init( const QString &fileName ) |
89 | { | 88 | { |
90 | qDebug("ResourceOpie::init()"); | 89 | qDebug("ResourceOpie::init()"); |
91 | 90 | ||
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 | |||
@@ -52,22 +52,22 @@ class ResourceOpie : public Resource | |||
52 | 52 | ||
53 | public: | 53 | public: |
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. |
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 | |||
@@ -44,39 +44,38 @@ $Id$ | |||
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 | ||
56 | using namespace KABC; | 55 | using namespace KABC; |
57 | extern "C" | 56 | extern "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 | ||
65 | ResourceQtopia::ResourceQtopia( const KConfig *config, bool syncable ) | 64 | ResourceQtopia::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 | ||
73 | ResourceQtopia::ResourceQtopia( const QString &fileName, bool syncable ) | 72 | ResourceQtopia::ResourceQtopia( const QString &fileName ) |
74 | : Resource( 0, syncable ) | 73 | : Resource( 0 ) |
75 | { | 74 | { |
76 | init( fileName ); | 75 | init( fileName ); |
77 | } | 76 | } |
78 | 77 | ||
79 | void ResourceQtopia::init( const QString &fileName ) | 78 | void 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() ) ); |
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 | |||
@@ -53,22 +53,22 @@ class ResourceQtopia : public Resource | |||
53 | 53 | ||
54 | public: | 54 | public: |
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. |
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 | |||
@@ -45,33 +45,31 @@ $Id$ | |||
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 |
59 | using namespace KABC; | 57 | using namespace KABC; |
60 | extern "C" | 58 | extern "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 | ||
68 | ResourceSharpDTM::ResourceSharpDTM( const KConfig *config, bool syncable ) | 66 | ResourceSharpDTM::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 | ||
77 | ResourceSharpDTM::ResourceSharpDTM( const QString &fileName, bool syncable ) | 75 | ResourceSharpDTM::ResourceSharpDTM( const QString &fileName, bool syncable ) |
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 | |||
@@ -53,22 +53,22 @@ class ResourceSharpDTM : public Resource | |||
53 | 53 | ||
54 | public: | 54 | public: |
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. |
diff --git a/kabc/resource.cpp b/kabc/resource.cpp index 7b91239..267cdaf 100644 --- a/kabc/resource.cpp +++ b/kabc/resource.cpp | |||
@@ -22,45 +22,32 @@ | |||
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (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 | ||
34 | using namespace KABC; | 32 | using namespace KABC; |
35 | 33 | ||
36 | Resource::Resource( const KConfig *config, bool syncable ) | 34 | Resource::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 | ||
46 | Resource::~Resource() | 39 | Resource::~Resource() |
47 | { | 40 | { |
48 | if (mSyncProfile != 0) { | ||
49 | delete mSyncProfile; | ||
50 | } | ||
51 | } | 41 | } |
52 | 42 | ||
53 | void Resource::writeConfig( KConfig *config ) | 43 | void 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 | ||
62 | void Resource::setAddressBook( AddressBook *ab ) | 49 | void Resource::setAddressBook( AddressBook *ab ) |
63 | { | 50 | { |
64 | mAddressBook = ab; | 51 | mAddressBook = ab; |
65 | } | 52 | } |
66 | 53 | ||
@@ -103,27 +90,16 @@ void Resource::removeAddressee( const Addressee& ) | |||
103 | // do nothing | 90 | // do nothing |
104 | } | 91 | } |
105 | 92 | ||
106 | void Resource::cleanUp() | 93 | void Resource::cleanUp() |
107 | { | 94 | { |
108 | // do nothing | 95 | // do nothing |
109 | } | 96 | } |
110 | 97 | ||
111 | bool Resource::isSyncable() const | ||
112 | { | ||
113 | return (mSyncProfile != 0); | ||
114 | } | ||
115 | |||
116 | KSyncProfile* Resource::getSyncProfile() | ||
117 | { | ||
118 | return mSyncProfile; | ||
119 | } | ||
120 | |||
121 | |||
122 | QString Resource::fileName() const | 98 | QString Resource::fileName() const |
123 | { | 99 | { |
124 | return mFileName; | 100 | return mFileName; |
125 | } | 101 | } |
126 | 102 | ||
127 | void Resource::setFileName( const QString &fileName ) | 103 | void Resource::setFileName( const QString &fileName ) |
128 | { | 104 | { |
129 | mFileName = fileName; | 105 | mFileName = fileName; |
@@ -131,14 +107,10 @@ void Resource::setFileName( const QString &fileName ) | |||
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 | */ |
136 | void Resource::setResourceName( const QString &name ) | 112 | void 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 | |||
@@ -28,18 +28,16 @@ $Id$ | |||
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 | ||
36 | class KSyncProfile; | ||
37 | |||
38 | namespace KABC { | 36 | namespace 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 | */ |
@@ -55,27 +53,21 @@ class Ticket | |||
55 | Resource *mResource; | 53 | Resource *mResource; |
56 | }; | 54 | }; |
57 | 55 | ||
58 | /** | 56 | /** |
59 | * @internal | 57 | * @internal |
60 | */ | 58 | */ |
61 | class Resource : public KRES::Resource | 59 | class Resource : public KRES::Resource |
62 | { | 60 | { |
63 | private: | ||
64 | /** | ||
65 | * make this constructor private to force everybody to use the other one | ||
66 | */ | ||
67 | Resource( const KConfig *config); | ||
68 | |||
69 | public: | 61 | public: |
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. |
@@ -134,36 +126,30 @@ public: | |||
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 | ||
155 | protected: | 142 | protected: |
156 | Ticket *createTicket( Resource * ); | 143 | Ticket *createTicket( Resource * ); |
157 | virtual void doClose(); | 144 | virtual void doClose(); |
158 | 145 | ||
159 | private: | 146 | private: |
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 | ||