28 files changed, 78 insertions, 304 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) | ||
84 | default_fileName = "/home/polo/kdepim/apps/kabc/localfile.vcf"; | ||
85 | else | ||
86 | default_fileName = StdAddressBook::fileName(); | 82 | 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 | ||
diff --git a/kaddressbook/xxportobject.cpp b/kaddressbook/xxportobject.cpp index 4351753..67e8406 100644 --- a/kaddressbook/xxportobject.cpp +++ b/kaddressbook/xxportobject.cpp | |||
@@ -171,17 +171,17 @@ bool XXPortResourceObject::isAvailable() | |||
171 | { | 171 | { |
172 | return (mFactory != 0); | 172 | return (mFactory != 0); |
173 | } | 173 | } |
174 | 174 | ||
175 | 175 | ||
176 | bool XXPortResourceObject::_exportContacts( const KABC::AddresseeList &list, const QString& identifier, const QString& fileName ) | 176 | bool XXPortResourceObject::_exportContacts( const KABC::AddresseeList &list, const QString& identifier, const QString& fileName ) |
177 | { | 177 | { |
178 | //create new resource | 178 | //create new resource |
179 | KABC::Resource* mResource = (KABC::Resource*)(mFactory->resource( this->identifier(), 0, false )); | 179 | KABC::Resource* mResource = (KABC::Resource*)(mFactory->resource( this->identifier(), 0 )); |
180 | 180 | ||
181 | if (mResource == 0) | 181 | if (mResource == 0) |
182 | return false; | 182 | return false; |
183 | 183 | ||
184 | if (fileName != QString::null) | 184 | if (fileName != QString::null) |
185 | mResource->setFileName( fileName ); | 185 | mResource->setFileName( fileName ); |
186 | 186 | ||
187 | 187 | ||
@@ -231,17 +231,17 @@ bool XXPortResourceObject::_exportContacts( const KABC::AddresseeList &list, con | |||
231 | return res; | 231 | return res; |
232 | } | 232 | } |
233 | 233 | ||
234 | 234 | ||
235 | KABC::AddresseeList XXPortResourceObject::_importContacts( const QString& identifier, const QString& fileName ) const | 235 | KABC::AddresseeList XXPortResourceObject::_importContacts( const QString& identifier, const QString& fileName ) const |
236 | { | 236 | { |
237 | 237 | ||
238 | 238 | ||
239 | KABC::Resource* mResource = (KABC::Resource*)(mFactory->resource( this->identifier(), 0, false )); | 239 | KABC::Resource* mResource = (KABC::Resource*)(mFactory->resource( this->identifier(), 0 )); |
240 | 240 | ||
241 | if (mResource == 0) | 241 | if (mResource == 0) |
242 | return KABC::AddresseeList(); | 242 | return KABC::AddresseeList(); |
243 | 243 | ||
244 | KABC::AddresseeList adrlst; | 244 | KABC::AddresseeList adrlst; |
245 | 245 | ||
246 | if (fileName != QString::null) | 246 | if (fileName != QString::null) |
247 | mResource->setFileName( fileName ); | 247 | mResource->setFileName( fileName ); |
diff --git a/microkde/kresources/configdialog.cpp b/microkde/kresources/configdialog.cpp index 030b547..24e82bc 100644 --- a/microkde/kresources/configdialog.cpp +++ b/microkde/kresources/configdialog.cpp | |||
@@ -36,57 +36,52 @@ | |||
36 | 36 | ||
37 | #include <kbuttonbox.h> | 37 | #include <kbuttonbox.h> |
38 | #include <kdialog.h> | 38 | #include <kdialog.h> |
39 | #include <klineedit.h> | 39 | #include <klineedit.h> |
40 | 40 | ||
41 | #include "factory.h" | 41 | #include "factory.h" |
42 | #include "configwidget.h" | 42 | #include "configwidget.h" |
43 | #include "configdialog.h" | 43 | #include "configdialog.h" |
44 | #include "syncwidget.h" | ||
45 | 44 | ||
46 | using namespace KRES; | 45 | using namespace KRES; |
47 | 46 | ||
48 | ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, | 47 | ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, |
49 | Resource* resource, const char *name ) | 48 | Resource* resource, const char *name ) |
50 | : KDialogBase( parent, name, true, resource->isSyncable()?i18n( "Sync Profile Configuration" ):i18n( "Resource Configuration" ), | 49 | : KDialogBase( parent, name, true, i18n( "Resource Configuration" ), |
51 | Ok|Cancel, Ok, true )/*, mConfig( config )*/, mSyncWidget_Settings(0), mSyncWidget_Conflicts(0),mSyncWidget_Remote(0), mResource( resource ), mPersistentReadOnly(false) | 50 | Ok|Cancel, Ok, true )/*, mConfig( config )*/, mResource( resource ), mPersistentReadOnly(false) |
52 | { | 51 | { |
53 | 52 | ||
54 | Factory *factory = Factory::self( resourceFamily ); | 53 | Factory *factory = Factory::self( resourceFamily ); |
55 | 54 | ||
56 | //US resize( 250, 240 ); | 55 | //US resize( 250, 240 ); |
57 | resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240)); | 56 | resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240)); |
58 | 57 | ||
59 | QFrame *main; | 58 | QFrame *main; |
60 | 59 | ||
61 | if (!mResource->isSyncable()) | ||
62 | main = plainPage(); | 60 | main = plainPage(); |
63 | else | ||
64 | main = addPage("Profile"); | ||
65 | 61 | ||
66 | QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() ); | 62 | QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() ); |
67 | 63 | ||
68 | 64 | ||
69 | QGroupBox *generalGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); | 65 | QGroupBox *generalGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); |
70 | generalGroupBox->layout()->setSpacing( spacingHint() ); | 66 | generalGroupBox->layout()->setSpacing( spacingHint() ); |
71 | generalGroupBox->setTitle( i18n( "General Settings" ) ); | 67 | generalGroupBox->setTitle( i18n( "General Settings" ) ); |
72 | 68 | ||
73 | new QLabel( mResource->isSyncable()?i18n( "Profile Name:" ):i18n( "Name:" ), generalGroupBox ); | 69 | new QLabel( i18n( "Name:" ), generalGroupBox ); |
74 | 70 | ||
75 | mName = new KLineEdit( generalGroupBox ); | 71 | mName = new KLineEdit( generalGroupBox ); |
76 | 72 | ||
77 | if (!mResource->isSyncable()) { | ||
78 | new QLabel("", generalGroupBox ); | 73 | new QLabel("", generalGroupBox ); |
79 | mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox ); | 74 | mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox ); |
80 | mReadOnly->setChecked( mResource->readOnly() ); | 75 | mReadOnly->setChecked( mResource->readOnly() ); |
76 | |||
81 | new QLabel("", generalGroupBox ); | 77 | new QLabel("", generalGroupBox ); |
82 | mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox ); | 78 | mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox ); |
83 | mIncludeInSync->setChecked( mResource->includeInSync() ); | 79 | mIncludeInSync->setChecked( mResource->includeInSync() ); |
84 | } | ||
85 | 80 | ||
86 | mName->setText( mResource->resourceName() ); | 81 | mName->setText( mResource->resourceName() ); |
87 | 82 | ||
88 | mainLayout->addWidget( generalGroupBox ); | 83 | mainLayout->addWidget( generalGroupBox ); |
89 | 84 | ||
90 | QGroupBox *resourceGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); | 85 | QGroupBox *resourceGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); |
91 | resourceGroupBox->layout()->setSpacing( spacingHint()); | 86 | resourceGroupBox->layout()->setSpacing( spacingHint()); |
92 | resourceGroupBox->setTitle( i18n( "%1 Resource Settings" ) | 87 | resourceGroupBox->setTitle( i18n( "%1 Resource Settings" ) |
@@ -94,153 +89,91 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, | |||
94 | mainLayout->addWidget( resourceGroupBox ); | 89 | mainLayout->addWidget( resourceGroupBox ); |
95 | 90 | ||
96 | mainLayout->addStretch(); | 91 | mainLayout->addStretch(); |
97 | 92 | ||
98 | mConfigWidget = factory->configWidget( resource->type(), resourceGroupBox ); | 93 | mConfigWidget = factory->configWidget( resource->type(), resourceGroupBox ); |
99 | if ( mConfigWidget ) { | 94 | if ( mConfigWidget ) { |
100 | connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ), | 95 | connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ), |
101 | SLOT( setReadOnly( bool ) ) ); | 96 | SLOT( setReadOnly( bool ) ) ); |
97 | connect( mConfigWidget, SIGNAL( setIncludeInSync( bool ) ), | ||
98 | SLOT( setIncludeInSync( bool ) ) ); | ||
102 | connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ), | 99 | connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ), |
103 | SLOT( setPersistentReadOnly( bool ) ) ); | 100 | SLOT( setPersistentReadOnly( bool ) ) ); |
104 | mConfigWidget->setInEditMode( false ); | 101 | mConfigWidget->setInEditMode( false ); |
105 | mConfigWidget->loadSettings( mResource ); | 102 | mConfigWidget->loadSettings( mResource ); |
106 | mConfigWidget->show(); | 103 | mConfigWidget->show(); |
107 | 104 | ||
108 | } | 105 | } |
109 | 106 | ||
110 | if (mResource->isSyncable()) | ||
111 | { | ||
112 | SyncWidgetContainer* c = factory->syncWidgetContainer( resource->type() ); | ||
113 | |||
114 | QFrame* syncPage = addPage("Settings"); | ||
115 | QVBoxLayout *syncLayout = new QVBoxLayout( syncPage, 0, spacingHint() ); | ||
116 | mSyncWidget_Settings = c->generateSettingsTab(syncPage); | ||
117 | syncLayout->addWidget( mSyncWidget_Settings ); | ||
118 | |||
119 | syncPage = addPage("Conflicts"); | ||
120 | syncLayout = new QVBoxLayout( syncPage, 0, spacingHint() ); | ||
121 | mSyncWidget_Conflicts = c->generateConflictsTab(syncPage); | ||
122 | syncLayout->addWidget( mSyncWidget_Conflicts ); | ||
123 | |||
124 | syncPage = addPage("Remote"); | ||
125 | syncLayout = new QVBoxLayout( syncPage, 0, spacingHint() ); | ||
126 | mSyncWidget_Remote = c->generateRemoteTab(syncPage); | ||
127 | syncLayout->addWidget( mSyncWidget_Remote ); | ||
128 | |||
129 | |||
130 | mSyncWidget_Settings->setInEditMode( false ); | ||
131 | mSyncWidget_Settings->loadSettings( mResource ); | ||
132 | mSyncWidget_Settings->show(); | ||
133 | |||
134 | mSyncWidget_Conflicts->setInEditMode( false ); | ||
135 | mSyncWidget_Conflicts->loadSettings( mResource ); | ||
136 | mSyncWidget_Conflicts->show(); | ||
137 | |||
138 | mSyncWidget_Remote->setInEditMode( false ); | ||
139 | mSyncWidget_Remote->loadSettings( mResource ); | ||
140 | mSyncWidget_Remote->show(); | ||
141 | |||
142 | delete c; | ||
143 | |||
144 | // QGroupBox *syncGroupBox = new QGroupBox( 2, Qt::Horizontal, syncPage ); | ||
145 | // syncGroupBox->layout()->setSpacing( spacingHint()); | ||
146 | // syncGroupBox->setTitle( i18n( "Syncronize Preferences" ) ); | ||
147 | // syncLayout->addWidget( syncGroupBox ); | ||
148 | |||
149 | // syncLayout->addStretch(); | ||
150 | /*US | ||
151 | mSyncWidget = factory->syncWidget( resource->type(), syncPage ); | ||
152 | syncLayout->addWidget( mSyncWidget ); | ||
153 | if ( mSyncWidget ) { | ||
154 | mSyncWidget->setInEditMode( false ); | ||
155 | mSyncWidget->loadSettings( mResource ); | ||
156 | mSyncWidget->show(); | ||
157 | } | ||
158 | */ | ||
159 | } | ||
160 | |||
161 | |||
162 | |||
163 | 107 | ||
164 | connect( mName, SIGNAL( textChanged(const QString &)), | 108 | connect( mName, SIGNAL( textChanged(const QString &)), |
165 | SLOT( slotNameChanged(const QString &))); | 109 | SLOT( slotNameChanged(const QString &))); |
166 | 110 | ||
167 | slotNameChanged( mName->text() ); | 111 | slotNameChanged( mName->text() ); |
168 | 112 | ||
169 | //US setMinimumSize( 400, 250 ); | 113 | //US setMinimumSize( 400, 250 ); |
170 | setMinimumSize( KMIN(KGlobal::getDesktopWidth(), 400), KMIN(KGlobal::getDesktopHeight(), 250)); | 114 | setMinimumSize( KMIN(KGlobal::getDesktopWidth(), 400), KMIN(KGlobal::getDesktopHeight(), 250)); |
171 | 115 | ||
172 | } | 116 | } |
173 | 117 | ||
174 | void ConfigDialog::setInEditMode( bool value ) | 118 | void ConfigDialog::setInEditMode( bool value ) |
175 | { | 119 | { |
176 | if ( mConfigWidget ) | 120 | if ( mConfigWidget ) |
177 | mConfigWidget->setInEditMode( value ); | 121 | mConfigWidget->setInEditMode( value ); |
178 | |||
179 | if ( mSyncWidget_Settings ) | ||
180 | mSyncWidget_Settings->setInEditMode( value ); | ||
181 | if ( mSyncWidget_Conflicts ) | ||
182 | mSyncWidget_Conflicts->setInEditMode( value ); | ||
183 | if ( mSyncWidget_Remote ) | ||
184 | mSyncWidget_Remote->setInEditMode( value ); | ||
185 | |||
186 | } | 122 | } |
187 | 123 | ||
188 | void ConfigDialog::slotNameChanged( const QString &text) | 124 | void ConfigDialog::slotNameChanged( const QString &text) |
189 | { | 125 | { |
190 | enableButtonOK( !text.isEmpty() ); | 126 | enableButtonOK( !text.isEmpty() ); |
191 | } | 127 | } |
192 | 128 | ||
193 | void ConfigDialog::setReadOnly( bool value ) | 129 | void ConfigDialog::setReadOnly( bool value ) |
194 | { | 130 | { |
195 | if (!mResource->isSyncable()) { | ||
196 | |||
197 | if (mPersistentReadOnly == false) | 131 | if (mPersistentReadOnly == false) |
198 | mReadOnly->setChecked( value ); | 132 | mReadOnly->setChecked( value ); |
199 | else | 133 | else |
200 | mReadOnly->setChecked( true ); | 134 | mReadOnly->setChecked( true ); |
201 | } | 135 | } |
136 | |||
137 | void ConfigDialog::setIncludeInSync( bool value ) | ||
138 | { | ||
139 | if (mPersistentReadOnly == false) | ||
140 | mIncludeInSync->setChecked( value ); | ||
141 | else | ||
142 | mIncludeInSync->setChecked( true ); | ||
202 | } | 143 | } |
203 | 144 | ||
204 | void ConfigDialog::setPersistentReadOnly( bool value ) | 145 | void ConfigDialog::setPersistentReadOnly( bool value ) |
205 | { | 146 | { |
206 | if (!mResource->isSyncable()) { | ||
207 | |||
208 | mPersistentReadOnly = value; | 147 | mPersistentReadOnly = value; |
209 | 148 | ||
210 | if (value == true) | 149 | if (value == true) { |
211 | setReadOnly( true ); | 150 | setReadOnly( true ); |
151 | setIncludeInSync( true ); | ||
152 | } | ||
212 | 153 | ||
213 | mReadOnly->setEnabled( !value ); | 154 | mReadOnly->setEnabled( !value ); |
155 | mIncludeInSync->setEnabled (!value ); | ||
214 | } | 156 | } |
215 | } | 157 | |
216 | 158 | ||
217 | void ConfigDialog::accept() | 159 | void ConfigDialog::accept() |
218 | { | 160 | { |
219 | if ( mName->text().isEmpty() ) { | 161 | if ( mName->text().isEmpty() ) { |
220 | KMessageBox::sorry( this, mResource->isSyncable()?i18n( "Please enter a profile name" ):i18n( "Please enter a resource name" ) ); | 162 | KMessageBox::sorry( this, i18n( "Please enter a resource name" ) ); |
221 | return; | 163 | return; |
222 | } | 164 | } |
223 | 165 | ||
224 | mResource->setResourceName( mName->text() ); | 166 | mResource->setResourceName( mName->text() ); |
225 | if (!mResource->isSyncable()) | ||
226 | mResource->setReadOnly( mReadOnly->isChecked() ); | 167 | mResource->setReadOnly( mReadOnly->isChecked() ); |
227 | mResource->setIncludeInSync( mIncludeInSync->isChecked() ); | 168 | mResource->setIncludeInSync( mIncludeInSync->isChecked() ); |
228 | 169 | ||
229 | if ( mConfigWidget ) { | 170 | if ( mConfigWidget ) { |
230 | // First save generic information | 171 | // First save generic information |
231 | // Also save setting of specific resource type | 172 | // Also save setting of specific resource type |
232 | mConfigWidget->saveSettings( mResource ); | 173 | mConfigWidget->saveSettings( mResource ); |
233 | } | 174 | } |
234 | 175 | ||
235 | if ( mSyncWidget_Settings ) | ||
236 | mSyncWidget_Settings->saveSettings( mResource ); | ||
237 | if ( mSyncWidget_Conflicts ) | ||
238 | mSyncWidget_Conflicts->saveSettings( mResource ); | ||
239 | if ( mSyncWidget_Remote ) | ||
240 | mSyncWidget_Remote->saveSettings( mResource ); | ||
241 | |||
242 | |||
243 | KDialog::accept(); | 176 | KDialog::accept(); |
244 | } | 177 | } |
245 | 178 | ||
246 | //US #include "configdialog.moc" | 179 | //US #include "configdialog.moc" |
diff --git a/microkde/kresources/configdialog.h b/microkde/kresources/configdialog.h index ed3ecab..b205975 100644 --- a/microkde/kresources/configdialog.h +++ b/microkde/kresources/configdialog.h | |||
@@ -26,39 +26,36 @@ | |||
26 | 26 | ||
27 | class KLineEdit; | 27 | class KLineEdit; |
28 | class QCheckBox; | 28 | class QCheckBox; |
29 | class KButtonBox; | 29 | class KButtonBox; |
30 | 30 | ||
31 | namespace KRES { | 31 | namespace KRES { |
32 | class Resource; | 32 | class Resource; |
33 | class ConfigWidget; | 33 | class ConfigWidget; |
34 | class SyncWidget; | ||
35 | 34 | ||
36 | class ConfigDialog : public KDialogBase | 35 | class ConfigDialog : public KDialogBase |
37 | { | 36 | { |
38 | Q_OBJECT | 37 | Q_OBJECT |
39 | public: | 38 | public: |
40 | // Resource=0: create new resource | 39 | // Resource=0: create new resource |
41 | ConfigDialog( QWidget *parent, const QString& resourceFamily, | 40 | ConfigDialog( QWidget *parent, const QString& resourceFamily, |
42 | Resource* resource, const char *name = 0); | 41 | Resource* resource, const char *name = 0); |
43 | 42 | ||
44 | void setInEditMode( bool value ); | 43 | void setInEditMode( bool value ); |
45 | 44 | ||
46 | protected slots: | 45 | protected slots: |
47 | void accept(); | 46 | void accept(); |
48 | void setReadOnly( bool value ); | 47 | void setReadOnly( bool value ); |
48 | void setIncludeInSync( bool value ); | ||
49 | void setPersistentReadOnly( bool value ); | 49 | void setPersistentReadOnly( bool value ); |
50 | void slotNameChanged( const QString &text); | 50 | void slotNameChanged( const QString &text); |
51 | 51 | ||
52 | private: | 52 | private: |
53 | ConfigWidget *mConfigWidget; | 53 | ConfigWidget *mConfigWidget; |
54 | SyncWidget *mSyncWidget_Settings; | ||
55 | SyncWidget *mSyncWidget_Conflicts; | ||
56 | SyncWidget *mSyncWidget_Remote; | ||
57 | Resource* mResource; | 54 | Resource* mResource; |
58 | 55 | ||
59 | KLineEdit *mName; | 56 | KLineEdit *mName; |
60 | QCheckBox *mReadOnly; | 57 | QCheckBox *mReadOnly; |
61 | QCheckBox *mIncludeInSync; | 58 | QCheckBox *mIncludeInSync; |
62 | //US add a persistent readonly flag. We need that for opie and qtopia addressbooks. | 59 | //US add a persistent readonly flag. We need that for opie and qtopia addressbooks. |
63 | bool mPersistentReadOnly; | 60 | bool mPersistentReadOnly; |
64 | }; | 61 | }; |
diff --git a/microkde/kresources/configpage.cpp b/microkde/kresources/configpage.cpp index 02c5fb1..533be51 100644 --- a/microkde/kresources/configpage.cpp +++ b/microkde/kresources/configpage.cpp | |||
@@ -52,19 +52,16 @@ $Id$ | |||
52 | 52 | ||
53 | //US | 53 | //US |
54 | #include <qpushbutton.h> | 54 | #include <qpushbutton.h> |
55 | #include <qfile.h> | 55 | #include <qfile.h> |
56 | #include <kglobal.h> | 56 | #include <kglobal.h> |
57 | 57 | ||
58 | using namespace KRES; | 58 | using namespace KRES; |
59 | 59 | ||
60 | const QString ConfigPage::syncfamily = "syncprofiles"; | ||
61 | |||
62 | |||
63 | class ConfigViewItem : public QCheckListItem | 60 | class ConfigViewItem : public QCheckListItem |
64 | { | 61 | { |
65 | public: | 62 | public: |
66 | ConfigViewItem( QListView *parent, Resource* resource ) : | 63 | ConfigViewItem( QListView *parent, Resource* resource ) : |
67 | QCheckListItem( parent, resource->resourceName(), CheckBox ), | 64 | QCheckListItem( parent, resource->resourceName(), CheckBox ), |
68 | mResource( resource ), | 65 | mResource( resource ), |
69 | mIsStandard( false ) | 66 | mIsStandard( false ) |
70 | { | 67 | { |
@@ -179,39 +176,37 @@ void ConfigPage::load() | |||
179 | //US we remove the dynamic pluginloader, and set the one family we need (contact) manually. | 176 | //US we remove the dynamic pluginloader, and set the one family we need (contact) manually. |
180 | 177 | ||
181 | //US KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin" ); | 178 | //US KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin" ); |
182 | //US KTrader::OfferList::ConstIterator it; | 179 | //US KTrader::OfferList::ConstIterator it; |
183 | //US for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 180 | //US for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
184 | //US QVariant tmp = (*it)->property( "X-KDE-ResourceFamily" ); | 181 | //US QVariant tmp = (*it)->property( "X-KDE-ResourceFamily" ); |
185 | //US QString family = tmp.toString(); | 182 | //US QString family = tmp.toString(); |
186 | QStringList families; | 183 | QStringList families; |
187 | families << "contact" << syncfamily; | 184 | families << "contact"; |
188 | 185 | ||
189 | 186 | ||
190 | for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it ) | 187 | for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it ) |
191 | { | 188 | { |
192 | QString family = (*it); | 189 | QString family = (*it); |
193 | if ( !family.isEmpty() ) { | 190 | if ( !family.isEmpty() ) { |
194 | if ( !mFamilyMap.contains( family ) ) { | 191 | if ( !mFamilyMap.contains( family ) ) { |
195 | mCurrentManager = new Manager<Resource>( family, (family == syncfamily) ); | 192 | mCurrentManager = new Manager<Resource>( family ); |
196 | if ( mCurrentManager ) { | 193 | if ( mCurrentManager ) { |
197 | mFamilyMap.append( family ); | 194 | mFamilyMap.append( family ); |
198 | mCurrentManager->addListener( this ); | 195 | mCurrentManager->addListener( this ); |
199 | 196 | ||
200 | ResourcePageInfo info; | 197 | ResourcePageInfo info; |
201 | info.mManager = mCurrentManager; | 198 | info.mManager = mCurrentManager; |
202 | QString configDir = KGlobal::dirs()->saveLocation( "config" ); | 199 | QString configDir = KGlobal::dirs()->saveLocation( "config" ); |
203 | //QString configDir = KStandardDirs::appDir() + "/config"; | 200 | //QString configDir = KStandardDirs::appDir() + "/config"; |
204 | if ( family == "contact" && QFile::exists( configDir + "/kabcrc" ) ) { | 201 | if ( family == "contact" && QFile::exists( configDir + "/kabcrc" ) ) { |
205 | info.mConfig = new KConfig( locateLocal( "config", "kabcrc" ) ); | 202 | info.mConfig = new KConfig( locateLocal( "config", "kabcrc" ) ); |
206 | } else if ( family == "calendar" && QFile::exists( configDir + "/kcalrc" ) ) { | 203 | } else if ( family == "calendar" && QFile::exists( configDir + "/kcalrc" ) ) { |
207 | info.mConfig = new KConfig( locateLocal( "config", "kcalrc" ) ); | 204 | info.mConfig = new KConfig( locateLocal( "config", "kcalrc" ) ); |
208 | } else if ( family == syncfamily && QFile::exists( configDir + "/kabcsyncrc" ) ) { | ||
209 | info.mConfig = new KConfig( locateLocal( "config", "kabcsyncrc" ) ); | ||
210 | } else { | 205 | } else { |
211 | QString configFile = locateLocal( "config", QString( "kresources/%1/stdrc" ).arg( family ) ); | 206 | QString configFile = locateLocal( "config", QString( "kresources/%1/stdrc" ).arg( family ) ); |
212 | info.mConfig = new KConfig( configFile ); | 207 | info.mConfig = new KConfig( configFile ); |
213 | } | 208 | } |
214 | info.mManager->readConfig( info.mConfig ); | 209 | info.mManager->readConfig( info.mConfig ); |
215 | 210 | ||
216 | mInfoMap.append( info ); | 211 | mInfoMap.append( info ); |
217 | } | 212 | } |
@@ -305,50 +300,34 @@ void ConfigPage::slotAdd() | |||
305 | return; | 300 | return; |
306 | 301 | ||
307 | QStringList types = mCurrentManager->resourceTypeNames(); | 302 | QStringList types = mCurrentManager->resourceTypeNames(); |
308 | QStringList descs = mCurrentManager->resourceTypeDescriptions(); | 303 | QStringList descs = mCurrentManager->resourceTypeDescriptions(); |
309 | bool ok = false; | 304 | bool ok = false; |
310 | 305 | ||
311 | QString desc; | 306 | QString desc; |
312 | 307 | ||
313 | if (mFamily == syncfamily) | ||
314 | { | ||
315 | desc = QInputDialog::getItem( i18n( "Sync Configuration" ), | ||
316 | i18n( "Select resource type for the new sync profile:" ), descs, 0, | ||
317 | false, &ok, this ); | ||
318 | } | ||
319 | else | ||
320 | { | ||
321 | desc = QInputDialog::getItem( i18n( "Resource Configuration" ), | 308 | desc = QInputDialog::getItem( i18n( "Resource Configuration" ), |
322 | i18n( "Select type of the new resource:" ), descs, 0, | 309 | i18n( "Select type of the new resource:" ), descs, 0, |
323 | false, &ok, this ); | 310 | false, &ok, this ); |
324 | } | ||
325 | 311 | ||
326 | if ( !ok ) | 312 | if ( !ok ) |
327 | return; | 313 | return; |
328 | 314 | ||
329 | QString type = types[ descs.findIndex( desc ) ]; | 315 | QString type = types[ descs.findIndex( desc ) ]; |
330 | 316 | ||
331 | // Create new resource | 317 | // Create new resource |
332 | Resource *resource = mCurrentManager->createResource( type ); | 318 | Resource *resource = mCurrentManager->createResource( type ); |
333 | if ( !resource ) { | 319 | if ( !resource ) { |
334 | KMessageBox::error( this, i18n("Unable to create resource of type '%1'.") | 320 | KMessageBox::error( this, i18n("Unable to create resource of type '%1'.") |
335 | .arg( type ) ); | 321 | .arg( type ) ); |
336 | return; | 322 | return; |
337 | } | 323 | } |
338 | 324 | ||
339 | if (mFamily == syncfamily) | ||
340 | { | ||
341 | resource->setResourceName( type + "-syncprofile" ); | ||
342 | } | ||
343 | else | ||
344 | { | ||
345 | resource->setResourceName( type + "-resource" ); | 325 | resource->setResourceName( type + "-resource" ); |
346 | } | ||
347 | 326 | ||
348 | ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" ); | 327 | ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" ); |
349 | 328 | ||
350 | if ( dlg.exec() ) { | 329 | if ( dlg.exec() ) { |
351 | mCurrentManager->add( resource ); | 330 | mCurrentManager->add( resource ); |
352 | 331 | ||
353 | ConfigViewItem *item = new ConfigViewItem( mListView, resource ); | 332 | ConfigViewItem *item = new ConfigViewItem( mListView, resource ); |
354 | 333 | ||
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp index e44fce3..4e4456d 100644 --- a/microkde/kresources/factory.cpp +++ b/microkde/kresources/factory.cpp | |||
@@ -182,50 +182,16 @@ ConfigWidget *Factory::configWidget( const QString& type, QWidget *parent ) | |||
182 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; | 182 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; |
183 | qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); | 183 | qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); |
184 | return 0; | 184 | return 0; |
185 | } | 185 | } |
186 | return wdg; | 186 | return wdg; |
187 | 187 | ||
188 | } | 188 | } |
189 | 189 | ||
190 | SyncWidgetContainer *Factory::syncWidgetContainer( const QString& type ) | ||
191 | { | ||
192 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) | ||
193 | return 0; | ||
194 | |||
195 | //US KService::Ptr ptr = mTypeMap[ type ]; | ||
196 | //US KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() ); | ||
197 | PluginInfo* pi = mTypeMap[ type ]; | ||
198 | KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() ); | ||
199 | if ( !factory ) { | ||
200 | qDebug("KRES::Factory::syncWidget(): Factory creation failed for library %s", pi->library.latin1()); | ||
201 | kdDebug() << "KRES::Factory::syncWidget(): Factory creation failed" << endl; | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); | ||
206 | |||
207 | if ( !pluginFactory ) { | ||
208 | qDebug("KRES::Factory::syncWidget(): no plugin factory for library %s", pi->library.latin1()); | ||
209 | kdDebug() << "KRES::Factory::syncWidget(): no plugin factory." << endl; | ||
210 | return 0; | ||
211 | } | ||
212 | |||
213 | SyncWidgetContainer *wdg = pluginFactory->syncWidgetContainer( ); | ||
214 | if ( !wdg ) { | ||
215 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; | ||
216 | qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); | ||
217 | return 0; | ||
218 | } | ||
219 | return wdg; | ||
220 | |||
221 | } | ||
222 | |||
223 | |||
224 | QString Factory::typeName( const QString &type ) const | 190 | QString Factory::typeName( const QString &type ) const |
225 | { | 191 | { |
226 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) | 192 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) |
227 | return QString(); | 193 | return QString(); |
228 | 194 | ||
229 | 195 | ||
230 | //US KService::Ptr ptr = mTypeMap[ type ]; | 196 | //US KService::Ptr ptr = mTypeMap[ type ]; |
231 | //US return ptr->name(); | 197 | //US return ptr->name(); |
@@ -240,17 +206,17 @@ QString Factory::typeDescription( const QString &type ) const | |||
240 | return QString(); | 206 | return QString(); |
241 | 207 | ||
242 | //US KService::Ptr ptr = mTypeMap[ type ]; | 208 | //US KService::Ptr ptr = mTypeMap[ type ]; |
243 | //US return ptr->comment(); | 209 | //US return ptr->comment(); |
244 | PluginInfo* pi = mTypeMap[ type ]; | 210 | PluginInfo* pi = mTypeMap[ type ]; |
245 | return pi->descriptionLabel; | 211 | return pi->descriptionLabel; |
246 | } | 212 | } |
247 | 213 | ||
248 | Resource *Factory::resource( const QString& type, const KConfig *config, bool syncable ) | 214 | Resource *Factory::resource( const QString& type, const KConfig *config ) |
249 | { | 215 | { |
250 | 216 | ||
251 | 217 | ||
252 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) | 218 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) |
253 | return 0; | 219 | return 0; |
254 | 220 | ||
255 | /*US load the lib not dynamicly. !! | 221 | /*US load the lib not dynamicly. !! |
256 | KService::Ptr ptr = mTypeMap[ type ]; | 222 | KService::Ptr ptr = mTypeMap[ type ]; |
@@ -271,17 +237,17 @@ Resource *Factory::resource( const QString& type, const KConfig *config, bool sy | |||
271 | PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); | 237 | PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); |
272 | 238 | ||
273 | if ( !pluginFactory ) { | 239 | if ( !pluginFactory ) { |
274 | qDebug("KRES::Factory::resource(): no plugin factory for library %s", pi->library.latin1()); | 240 | qDebug("KRES::Factory::resource(): no plugin factory for library %s", pi->library.latin1()); |
275 | kdDebug() << "KRES::Factory::resource(): no plugin factory." << endl; | 241 | kdDebug() << "KRES::Factory::resource(): no plugin factory." << endl; |
276 | return 0; | 242 | return 0; |
277 | } | 243 | } |
278 | 244 | ||
279 | Resource *resource = pluginFactory->resource( config, syncable ); | 245 | Resource *resource = pluginFactory->resource( config ); |
280 | if ( !resource ) { | 246 | if ( !resource ) { |
281 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; | 247 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; |
282 | qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); | 248 | qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); |
283 | return 0; | 249 | return 0; |
284 | } | 250 | } |
285 | 251 | ||
286 | resource->setType( type ); | 252 | resource->setType( type ); |
287 | 253 | ||
diff --git a/microkde/kresources/factory.h b/microkde/kresources/factory.h index 0e4231b..ea01b23 100644 --- a/microkde/kresources/factory.h +++ b/microkde/kresources/factory.h | |||
@@ -29,17 +29,16 @@ | |||
29 | 29 | ||
30 | #include <kconfig.h> | 30 | #include <kconfig.h> |
31 | 31 | ||
32 | 32 | ||
33 | #include "resource.h" | 33 | #include "resource.h" |
34 | 34 | ||
35 | namespace KRES { | 35 | namespace KRES { |
36 | 36 | ||
37 | class SyncWidgetContainer; | ||
38 | class ConfigWidget; | 37 | class ConfigWidget; |
39 | 38 | ||
40 | //US | 39 | //US |
41 | struct PluginInfo | 40 | struct PluginInfo |
42 | { | 41 | { |
43 | QString library; | 42 | QString library; |
44 | QString nameLabel; | 43 | QString nameLabel; |
45 | QString descriptionLabel; | 44 | QString descriptionLabel; |
@@ -82,36 +81,24 @@ class Factory | |||
82 | * | 81 | * |
83 | * @param type The type of the resource, returned by @ref resources() | 82 | * @param type The type of the resource, returned by @ref resources() |
84 | * @param resource The resource to be editted. | 83 | * @param resource The resource to be editted. |
85 | * @param parent The parent widget | 84 | * @param parent The parent widget |
86 | */ | 85 | */ |
87 | ConfigWidget *configWidget( const QString& type, QWidget *parent = 0 ); | 86 | ConfigWidget *configWidget( const QString& type, QWidget *parent = 0 ); |
88 | 87 | ||
89 | /** | 88 | /** |
90 | * Returns the sync widget for the given resource type, | ||
91 | * or a null pointer if resource type doesn't exist, | ||
92 | * or a null pointer if resource does not support syncing. | ||
93 | * | ||
94 | * @param type The type of the resource, returned by @ref resources() | ||
95 | * @param resource The resource to be editted. | ||
96 | * @param parent The parent widget | ||
97 | */ | ||
98 | SyncWidgetContainer *syncWidgetContainer( const QString& type ); | ||
99 | |||
100 | /** | ||
101 | * Returns a pointer to a resource object or a null pointer | 89 | * Returns a pointer to a resource object or a null pointer |
102 | * if resource type doesn't exist. | 90 | * if resource type doesn't exist. |
103 | * | 91 | * |
104 | * @param type The type of the resource, returned by @ref resources() | 92 | * @param type The type of the resource, returned by @ref resources() |
105 | * @param ab The address book, the resource should belong to | 93 | * @param ab The address book, the resource should belong to |
106 | * @param config The config object where the resource get it settings from, or 0 if a new resource should be created. | 94 | * @param config The config object where the resource get it settings from, or 0 if a new resource should be created. |
107 | * @param syncable If the resource should support syncing capabilities. | ||
108 | */ | 95 | */ |
109 | Resource *resource( const QString& type, const KConfig *config, bool syncable ); | 96 | Resource *resource( const QString& type, const KConfig *config); |
110 | 97 | ||
111 | /** | 98 | /** |
112 | * Returns a list of all available resource types. | 99 | * Returns a list of all available resource types. |
113 | */ | 100 | */ |
114 | QStringList typeNames() const; | 101 | QStringList typeNames() const; |
115 | 102 | ||
116 | /** | 103 | /** |
117 | * Returns the name for a special type. | 104 | * Returns the name for a special type. |
diff --git a/microkde/kresources/manager.h b/microkde/kresources/manager.h index 7e9e19a..0e6f838 100644 --- a/microkde/kresources/manager.h +++ b/microkde/kresources/manager.h | |||
@@ -162,27 +162,22 @@ class Manager : private ManagerImplListener | |||
162 | ActiveIterator it; | 162 | ActiveIterator it; |
163 | it.mIt = mImpl->resourceList()->end(); | 163 | it.mIt = mImpl->resourceList()->end(); |
164 | it.mList = mImpl->resourceList(); | 164 | it.mList = mImpl->resourceList(); |
165 | return it; | 165 | return it; |
166 | } | 166 | } |
167 | 167 | ||
168 | bool isEmpty() const { return mImpl->resourceList()->isEmpty(); } | 168 | bool isEmpty() const { return mImpl->resourceList()->isEmpty(); } |
169 | 169 | ||
170 | /** | 170 | Manager( const QString &family ) |
171 | Return true, if the manager manages syncable resources. | ||
172 | */ | ||
173 | bool manageSyncable() { return mImpl->manageSyncable(); } | ||
174 | |||
175 | Manager( const QString &family, bool syncable ) | ||
176 | { | 171 | { |
177 | mFactory = Factory::self( family ); | 172 | mFactory = Factory::self( family ); |
178 | // The managerimpl will use the same Factory object as the manager | 173 | // The managerimpl will use the same Factory object as the manager |
179 | // because of the Factory::self() pattern | 174 | // because of the Factory::self() pattern |
180 | mImpl = new ManagerImpl( family, syncable ); | 175 | mImpl = new ManagerImpl( family ); |
181 | mImpl->setListener( this ); | 176 | mImpl->setListener( this ); |
182 | 177 | ||
183 | mListeners = new QPtrList<ManagerListener<T> >; | 178 | mListeners = new QPtrList<ManagerListener<T> >; |
184 | } | 179 | } |
185 | 180 | ||
186 | virtual ~Manager() | 181 | virtual ~Manager() |
187 | { | 182 | { |
188 | mImpl->setListener( 0 ); | 183 | mImpl->setListener( 0 ); |
@@ -255,21 +250,20 @@ class Manager : private ManagerImplListener | |||
255 | Creates a new resource of type @param type, with default | 250 | Creates a new resource of type @param type, with default |
256 | settings. The resource is | 251 | settings. The resource is |
257 | not added to the manager, the application has to do that. | 252 | not added to the manager, the application has to do that. |
258 | Returns a pointer to a resource object or a null pointer | 253 | Returns a pointer to a resource object or a null pointer |
259 | if resource type doesn't exist. | 254 | if resource type doesn't exist. |
260 | 255 | ||
261 | @param type The type of the resource, one of those returned | 256 | @param type The type of the resource, one of those returned |
262 | by @ref resourceTypeNames() | 257 | by @ref resourceTypeNames() |
263 | * @param syncable If the resource should support syncing capabilities. | ||
264 | */ | 258 | */ |
265 | T *createResource( const QString& type ) | 259 | T *createResource( const QString& type ) |
266 | { | 260 | { |
267 | return (T *)( mFactory->resource( type, 0, mImpl->manageSyncable() ) ); | 261 | return (T *)( mFactory->resource( type, 0 ) ); |
268 | } | 262 | } |
269 | 263 | ||
270 | /** | 264 | /** |
271 | Returns a list of the names of all available resource types. | 265 | Returns a list of the names of all available resource types. |
272 | */ | 266 | */ |
273 | QStringList resourceTypeNames() const | 267 | QStringList resourceTypeNames() const |
274 | { | 268 | { |
275 | return mFactory->typeNames(); | 269 | return mFactory->typeNames(); |
diff --git a/microkde/kresources/managerimpl.cpp b/microkde/kresources/managerimpl.cpp index 3655f50..81bbbec 100644 --- a/microkde/kresources/managerimpl.cpp +++ b/microkde/kresources/managerimpl.cpp | |||
@@ -36,18 +36,18 @@ $Id$ | |||
36 | #include <kstandarddirs.h> | 36 | #include <kstandarddirs.h> |
37 | 37 | ||
38 | #include "resource.h" | 38 | #include "resource.h" |
39 | #include "factory.h" | 39 | #include "factory.h" |
40 | #include "managerimpl.h" | 40 | #include "managerimpl.h" |
41 | 41 | ||
42 | using namespace KRES; | 42 | using namespace KRES; |
43 | 43 | ||
44 | ManagerImpl::ManagerImpl( const QString &family, bool syncable ) | 44 | ManagerImpl::ManagerImpl( const QString &family ) |
45 | : mFamily( family ), mSyncable(syncable), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ), | 45 | : mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ), |
46 | mFactory( 0 ) | 46 | mFactory( 0 ) |
47 | 47 | ||
48 | { | 48 | { |
49 | kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl; | 49 | kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl; |
50 | 50 | ||
51 | 51 | ||
52 | } | 52 | } |
53 | 53 | ||
@@ -263,17 +263,17 @@ Resource* ManagerImpl::readResourceConfig( const QString& identifier, | |||
263 | #ifdef _WIN32_ | 263 | #ifdef _WIN32_ |
264 | // we use plugins on win32. the group is stored in a static variable | 264 | // we use plugins on win32. the group is stored in a static variable |
265 | // such that gourp info not avail on win32 plugins | 265 | // such that gourp info not avail on win32 plugins |
266 | // to fix that, it would be a looooot of work | 266 | // to fix that, it would be a looooot of work |
267 | mConfig->setTempGroup( "Resource_" + identifier ); | 267 | mConfig->setTempGroup( "Resource_" + identifier ); |
268 | #endif | 268 | #endif |
269 | QString type = mConfig->readEntry( "ResourceType" ); | 269 | QString type = mConfig->readEntry( "ResourceType" ); |
270 | QString name = mConfig->readEntry( "ResourceName" ); | 270 | QString name = mConfig->readEntry( "ResourceName" ); |
271 | Resource *resource = mFactory->resource( type, mConfig, mSyncable ); | 271 | Resource *resource = mFactory->resource( type, mConfig ); |
272 | if ( !resource ) { | 272 | if ( !resource ) { |
273 | qDebug("Failed to create resource with id %s ",identifier.latin1() ); | 273 | qDebug("Failed to create resource with id %s ",identifier.latin1() ); |
274 | return 0; | 274 | return 0; |
275 | } | 275 | } |
276 | 276 | ||
277 | if ( resource->identifier().isEmpty() ) | 277 | if ( resource->identifier().isEmpty() ) |
278 | resource->setIdentifier( identifier ); | 278 | resource->setIdentifier( identifier ); |
279 | 279 | ||
@@ -359,16 +359,9 @@ Resource* ManagerImpl::getResource( const QString& identifier ) | |||
359 | Resource::List::ConstIterator it; | 359 | Resource::List::ConstIterator it; |
360 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { | 360 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { |
361 | if ( (*it)->identifier() == identifier ) | 361 | if ( (*it)->identifier() == identifier ) |
362 | return *it; | 362 | return *it; |
363 | } | 363 | } |
364 | return 0; | 364 | return 0; |
365 | } | 365 | } |
366 | 366 | ||
367 | /** | ||
368 | Return true, if the manager manages syncable resources. | ||
369 | */ | ||
370 | bool ManagerImpl::manageSyncable() const | ||
371 | { | ||
372 | return mSyncable; | ||
373 | } | ||
374 | 367 | ||
diff --git a/microkde/kresources/managerimpl.h b/microkde/kresources/managerimpl.h index 0425279..56a2db6 100644 --- a/microkde/kresources/managerimpl.h +++ b/microkde/kresources/managerimpl.h | |||
@@ -60,17 +60,17 @@ class ManagerImplListener | |||
60 | @internal | 60 | @internal |
61 | 61 | ||
62 | Do not use this class directly. Use ResourceManager instead | 62 | Do not use this class directly. Use ResourceManager instead |
63 | */ | 63 | */ |
64 | class ManagerImpl : public QObject | 64 | class ManagerImpl : public QObject |
65 | { | 65 | { |
66 | Q_OBJECT | 66 | Q_OBJECT |
67 | public: | 67 | public: |
68 | ManagerImpl( const QString &family, bool syncable); | 68 | ManagerImpl( const QString &family); |
69 | ~ManagerImpl(); | 69 | ~ManagerImpl(); |
70 | 70 | ||
71 | void readConfig( KConfig * ); | 71 | void readConfig( KConfig * ); |
72 | void writeConfig( KConfig * ); | 72 | void writeConfig( KConfig * ); |
73 | 73 | ||
74 | void add( Resource *resource, bool useDCOP = true ); | 74 | void add( Resource *resource, bool useDCOP = true ); |
75 | void remove( Resource *resource, bool useDCOP = true ); | 75 | void remove( Resource *resource, bool useDCOP = true ); |
76 | 76 | ||
@@ -85,21 +85,16 @@ class ManagerImpl : public QObject | |||
85 | 85 | ||
86 | // Get only active or passive resources | 86 | // Get only active or passive resources |
87 | QPtrList<Resource> resources( bool active ); | 87 | QPtrList<Resource> resources( bool active ); |
88 | 88 | ||
89 | QStringList resourceNames(); | 89 | QStringList resourceNames(); |
90 | 90 | ||
91 | void setListener( ManagerImplListener *listener ); | 91 | void setListener( ManagerImplListener *listener ); |
92 | 92 | ||
93 | /** | ||
94 | Return true, if the manager manages syncable resources. | ||
95 | */ | ||
96 | bool manageSyncable() const; | ||
97 | |||
98 | public slots: | 93 | public slots: |
99 | void resourceChanged( Resource *resource ); | 94 | void resourceChanged( Resource *resource ); |
100 | 95 | ||
101 | private: | 96 | private: |
102 | // dcop calls | 97 | // dcop calls |
103 | 98 | ||
104 | private: | 99 | private: |
105 | void createStandardConfig(); | 100 | void createStandardConfig(); |
@@ -107,17 +102,16 @@ class ManagerImpl : public QObject | |||
107 | Resource *readResourceConfig( const QString& identifier, bool checkActive ); | 102 | Resource *readResourceConfig( const QString& identifier, bool checkActive ); |
108 | void writeResourceConfig( Resource *resource, bool checkActive ); | 103 | void writeResourceConfig( Resource *resource, bool checkActive ); |
109 | 104 | ||
110 | void removeResource( Resource *resource ); | 105 | void removeResource( Resource *resource ); |
111 | Resource *getResource( Resource *resource ); | 106 | Resource *getResource( Resource *resource ); |
112 | Resource *getResource( const QString& identifier ); | 107 | Resource *getResource( const QString& identifier ); |
113 | 108 | ||
114 | QString mFamily; | 109 | QString mFamily; |
115 | bool mSyncable; | ||
116 | KConfig *mConfig; | 110 | KConfig *mConfig; |
117 | KConfig *mStdConfig; | 111 | KConfig *mStdConfig; |
118 | Resource *mStandard; | 112 | Resource *mStandard; |
119 | Factory *mFactory; | 113 | Factory *mFactory; |
120 | Resource::List mResources; | 114 | Resource::List mResources; |
121 | ManagerImplListener *mListener; | 115 | ManagerImplListener *mListener; |
122 | }; | 116 | }; |
123 | 117 | ||
diff --git a/microkde/kresources/resource.cpp b/microkde/kresources/resource.cpp index f79bcd0..cccd485 100644 --- a/microkde/kresources/resource.cpp +++ b/microkde/kresources/resource.cpp | |||
@@ -193,12 +193,13 @@ void Resource::dump() const | |||
193 | { | 193 | { |
194 | qDebug("Resource::dump() "); | 194 | qDebug("Resource::dump() "); |
195 | kdDebug(5650) << "Resource:" << endl; | 195 | kdDebug(5650) << "Resource:" << endl; |
196 | kdDebug(5650) << " Name: " << d->mName << endl; | 196 | kdDebug(5650) << " Name: " << d->mName << endl; |
197 | kdDebug(5650) << " Identifier: " << d->mIdentifier << endl; | 197 | kdDebug(5650) << " Identifier: " << d->mIdentifier << endl; |
198 | kdDebug(5650) << " Type: " << d->mType << endl; | 198 | kdDebug(5650) << " Type: " << d->mType << endl; |
199 | kdDebug(5650) << " OpenCount: " << d->mOpenCount << endl; | 199 | kdDebug(5650) << " OpenCount: " << d->mOpenCount << endl; |
200 | kdDebug(5650) << " ReadOnly: " << ( d->mReadOnly ? "yes" : "no" ) << endl; | 200 | kdDebug(5650) << " ReadOnly: " << ( d->mReadOnly ? "yes" : "no" ) << endl; |
201 | kdDebug(5650) << " IncludeInSync: " << ( d->mIncludeInSync ? "yes" : "no" ) << endl; | ||
201 | kdDebug(5650) << " Active: " << ( d->mActive ? "yes" : "no" ) << endl; | 202 | kdDebug(5650) << " Active: " << ( d->mActive ? "yes" : "no" ) << endl; |
202 | kdDebug(5650) << " IsOpen: " << ( d->mIsOpen ? "yes" : "no" ) << endl; | 203 | kdDebug(5650) << " IsOpen: " << ( d->mIsOpen ? "yes" : "no" ) << endl; |
203 | } | 204 | } |
204 | 205 | ||
diff --git a/microkde/kresources/resource.h b/microkde/kresources/resource.h index 70b5613..ed5af96 100644 --- a/microkde/kresources/resource.h +++ b/microkde/kresources/resource.h | |||
@@ -35,17 +35,16 @@ | |||
35 | 35 | ||
36 | #include <klibloader.h> | 36 | #include <klibloader.h> |
37 | 37 | ||
38 | class KConfig; | 38 | class KConfig; |
39 | 39 | ||
40 | namespace KRES { | 40 | namespace KRES { |
41 | 41 | ||
42 | class ConfigWidget; | 42 | class ConfigWidget; |
43 | class SyncWidgetContainer; | ||
44 | 43 | ||
45 | /** | 44 | /** |
46 | * @internal | 45 | * @internal |
47 | * @libdoc The KDE Resource library | 46 | * @libdoc The KDE Resource library |
48 | * | 47 | * |
49 | * NOTE: this library is NOT (YET?) PUBLIC. Do not publish this | 48 | * NOTE: this library is NOT (YET?) PUBLIC. Do not publish this |
50 | * interface, it is in constant flux. | 49 | * interface, it is in constant flux. |
51 | * | 50 | * |
@@ -227,17 +226,17 @@ link_DATA= resourceexample.desktop | |||
227 | * | 226 | * |
228 | * | 227 | * |
229 | */ | 228 | */ |
230 | 229 | ||
231 | /** | 230 | /** |
232 | * A @ref Resource is a ... | 231 | * A @ref Resource is a ... |
233 | * | 232 | * |
234 | * A subclass should reimplement at least the constructor and the | 233 | * A subclass should reimplement at least the constructor and the |
235 | * @ref writeConfig method. | 234 | k * @ref writeConfig method. |
236 | * | 235 | * |
237 | */ | 236 | */ |
238 | class Resource : public QObject | 237 | class Resource : public QObject |
239 | { | 238 | { |
240 | Q_OBJECT | 239 | Q_OBJECT |
241 | 240 | ||
242 | public: | 241 | public: |
243 | typedef QValueList<Resource *> List; | 242 | typedef QValueList<Resource *> List; |
@@ -318,21 +317,16 @@ class Resource : public QObject | |||
318 | */ | 317 | */ |
319 | virtual void setResourceName( const QString &name ); | 318 | virtual void setResourceName( const QString &name ); |
320 | 319 | ||
321 | /** | 320 | /** |
322 | * Returns the name of resource. | 321 | * Returns the name of resource. |
323 | */ | 322 | */ |
324 | virtual QString resourceName() const; | 323 | virtual QString resourceName() const; |
325 | 324 | ||
326 | |||
327 | |||
328 | virtual bool isSyncable() const = 0; | ||
329 | |||
330 | |||
331 | /** | 325 | /** |
332 | Sets, if the resource is active. | 326 | Sets, if the resource is active. |
333 | */ | 327 | */ |
334 | void setActive( bool active ); | 328 | void setActive( bool active ); |
335 | 329 | ||
336 | /** | 330 | /** |
337 | Return true, if the resource is active. | 331 | Return true, if the resource is active. |
338 | */ | 332 | */ |
@@ -371,48 +365,40 @@ class Resource : public QObject | |||
371 | private: | 365 | private: |
372 | class ResourcePrivate; | 366 | class ResourcePrivate; |
373 | ResourcePrivate *d; | 367 | ResourcePrivate *d; |
374 | }; | 368 | }; |
375 | 369 | ||
376 | class PluginFactoryBase : public KLibFactory | 370 | class PluginFactoryBase : public KLibFactory |
377 | { | 371 | { |
378 | public: | 372 | public: |
379 | virtual Resource *resource( const KConfig *config, bool syncable ) = 0; | 373 | virtual Resource *resource( const KConfig *config) = 0; |
380 | 374 | ||
381 | virtual ConfigWidget *configWidget( QWidget *parent ) = 0; | 375 | virtual ConfigWidget *configWidget( QWidget *parent ) = 0; |
382 | 376 | ||
383 | virtual SyncWidgetContainer *syncWidgetContainer() = 0; | ||
384 | |||
385 | protected: | 377 | protected: |
386 | virtual QObject* createObject( QObject*, const char*, const char*, | 378 | virtual QObject* createObject( QObject*, const char*, const char*, |
387 | const QStringList & ) | 379 | const QStringList & ) |
388 | { | 380 | { |
389 | return 0; | 381 | return 0; |
390 | } | 382 | } |
391 | }; | 383 | }; |
392 | 384 | ||
393 | template<class TR,class TC, class TS> | 385 | template<class TR,class TC> |
394 | class PluginFactory : public PluginFactoryBase | 386 | class PluginFactory : public PluginFactoryBase |
395 | { | 387 | { |
396 | public: | 388 | public: |
397 | Resource *resource( const KConfig *config, bool syncable ) | 389 | Resource *resource( const KConfig *config) |
398 | { | 390 | { |
399 | return new TR( config, syncable ); | 391 | return new TR( config ); |
400 | } | 392 | } |
401 | 393 | ||
402 | ConfigWidget *configWidget( QWidget *parent ) | 394 | ConfigWidget *configWidget( QWidget *parent ) |
403 | { | 395 | { |
404 | return new TC( parent ); | 396 | return new TC( parent ); |
405 | } | 397 | } |
406 | |||
407 | SyncWidgetContainer *syncWidgetContainer() | ||
408 | { | ||
409 | return new TS(); | ||
410 | } | ||
411 | |||
412 | }; | 398 | }; |
413 | 399 | ||
414 | 400 | ||
415 | 401 | ||
416 | } | 402 | } |
417 | 403 | ||
418 | #endif | 404 | #endif |
diff --git a/microkde/microkdeE.pro b/microkde/microkdeE.pro index df914ce..071ceb3 100644 --- a/microkde/microkdeE.pro +++ b/microkde/microkdeE.pro | |||
@@ -84,17 +84,16 @@ osmartpointer.h \ | |||
84 | kresources/factory.h \ | 84 | kresources/factory.h \ |
85 | kresources/managerimpl.h \ | 85 | kresources/managerimpl.h \ |
86 | kresources/manager.h \ | 86 | kresources/manager.h \ |
87 | kresources/selectdialog.h \ | 87 | kresources/selectdialog.h \ |
88 | kresources/configpage.h \ | 88 | kresources/configpage.h \ |
89 | kresources/configwidget.h \ | 89 | kresources/configwidget.h \ |
90 | kresources/configdialog.h \ | 90 | kresources/configdialog.h \ |
91 | kresources/kcmkresources.h \ | 91 | kresources/kcmkresources.h \ |
92 | kresources/syncwidget.h \ | ||
93 | kdecore/kmdcodec.h \ | 92 | kdecore/kmdcodec.h \ |
94 | kdecore/kconfigbase.h \ | 93 | kdecore/kconfigbase.h \ |
95 | kdecore/klocale.h \ | 94 | kdecore/klocale.h \ |
96 | kdecore/klibloader.h \ | 95 | kdecore/klibloader.h \ |
97 | kdecore/kcatalogue.h \ | 96 | kdecore/kcatalogue.h \ |
98 | kdecore/kprefs.h \ | 97 | kdecore/kprefs.h \ |
99 | kdecore/ksharedptr.h \ | 98 | kdecore/ksharedptr.h \ |
100 | kdecore/kshell.h \ | 99 | kdecore/kshell.h \ |
@@ -168,12 +167,11 @@ oprocess.cpp \ | |||
168 | kresources/configpage.cpp \ | 167 | kresources/configpage.cpp \ |
169 | kresources/configdialog.cpp \ | 168 | kresources/configdialog.cpp \ |
170 | kresources/configwidget.cpp \ | 169 | kresources/configwidget.cpp \ |
171 | kresources/factory.cpp \ | 170 | kresources/factory.cpp \ |
172 | kresources/kcmkresources.cpp \ | 171 | kresources/kcmkresources.cpp \ |
173 | kresources/managerimpl.cpp \ | 172 | kresources/managerimpl.cpp \ |
174 | kresources/resource.cpp \ | 173 | kresources/resource.cpp \ |
175 | kresources/selectdialog.cpp \ | 174 | kresources/selectdialog.cpp \ |
176 | kresources/syncwidget.cpp \ | ||
177 | kutils/kcmultidialog.cpp \ | 175 | kutils/kcmultidialog.cpp \ |
178 | kidmanager.cpp | 176 | kidmanager.cpp |
179 | 177 | ||