author | ulf69 <ulf69> | 2004-08-02 18:33:07 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-02 18:33:07 (UTC) |
commit | 60a6886f06be31ec690df34dc8e3b8931c2d3bd7 (patch) (unidiff) | |
tree | c4c7c15cfd3753a3342806a11fb8f5c20bb4f923 /kabc/resource.cpp | |
parent | 863c4c3678e59ef125c08c00e9532ded5b540f67 (diff) | |
download | kdepimpi-60a6886f06be31ec690df34dc8e3b8931c2d3bd7.zip kdepimpi-60a6886f06be31ec690df34dc8e3b8931c2d3bd7.tar.gz kdepimpi-60a6886f06be31ec690df34dc8e3b8931c2d3bd7.tar.bz2 |
added support for syncable resources
-rw-r--r-- | kabc/resource.cpp | 63 |
1 files changed, 61 insertions, 2 deletions
diff --git a/kabc/resource.cpp b/kabc/resource.cpp index 9a1a5f8..9632a3f 100644 --- a/kabc/resource.cpp +++ b/kabc/resource.cpp | |||
@@ -26,26 +26,40 @@ $Id$ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <kdebug.h> | 28 | #include <kdebug.h> |
29 | 29 | ||
30 | #include <ksyncprofile.h> | ||
31 | |||
30 | #include "resource.h" | 32 | #include "resource.h" |
31 | 33 | ||
32 | using namespace KABC; | 34 | using namespace KABC; |
33 | 35 | ||
34 | Resource::Resource( const KConfig *config ) | 36 | Resource::Resource( const KConfig *config, bool syncable ) |
35 | : KRES::Resource( config ), mAddressBook( 0 ) | 37 | : KRES::Resource( config ), mAddressBook( 0 ), mSyncProfile( 0 ) |
36 | { | 38 | { |
39 | if(syncable == true) { | ||
40 | mSyncProfile = new KSyncProfile( identifier() ); | ||
41 | mSyncProfile->setName(resourceName()); | ||
42 | mSyncProfile->readConfig( (KConfig *)config ); | ||
43 | } | ||
37 | } | 44 | } |
38 | 45 | ||
39 | Resource::~Resource() | 46 | Resource::~Resource() |
40 | { | 47 | { |
48 | if (mSyncProfile != 0) { | ||
49 | delete mSyncProfile; | ||
50 | } | ||
41 | } | 51 | } |
42 | 52 | ||
43 | void Resource::writeConfig( KConfig *config ) | 53 | void Resource::writeConfig( KConfig *config ) |
44 | { | 54 | { |
45 | KRES::Resource::writeConfig( config ); | 55 | KRES::Resource::writeConfig( config ); |
56 | |||
57 | if(mSyncProfile != 0) | ||
58 | mSyncProfile->writeConfig( config ); | ||
46 | } | 59 | } |
47 | 60 | ||
61 | |||
48 | void Resource::setAddressBook( AddressBook *ab ) | 62 | void Resource::setAddressBook( AddressBook *ab ) |
49 | { | 63 | { |
50 | mAddressBook = ab; | 64 | mAddressBook = ab; |
51 | } | 65 | } |
@@ -92,4 +106,49 @@ void Resource::removeAddressee( const Addressee& ) | |||
92 | void Resource::cleanUp() | 106 | void Resource::cleanUp() |
93 | { | 107 | { |
94 | // do nothing | 108 | // do nothing |
95 | } | 109 | } |
110 | |||
111 | bool Resource::isSyncable() const | ||
112 | { | ||
113 | return (mSyncProfile != 0); | ||
114 | } | ||
115 | |||
116 | /** | ||
117 | * This method returns the number of elements that are currently in the resource. | ||
118 | */ | ||
119 | int Resource::count() const | ||
120 | { | ||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | /** | ||
125 | * This method removes all elements from the resource!! (Not from the addressbook) | ||
126 | */ | ||
127 | bool Resource::clear() | ||
128 | { | ||
129 | return false; | ||
130 | } | ||
131 | |||
132 | QString Resource::fileName() const | ||
133 | { | ||
134 | return mFileName; | ||
135 | } | ||
136 | |||
137 | void Resource::setFileName( const QString &fileName ) | ||
138 | { | ||
139 | mFileName = fileName; | ||
140 | } | ||
141 | |||
142 | /** | ||
143 | * Set the name of resource.You can override this method, | ||
144 | * but also remember to call Resource::setResourceName(). | ||
145 | */ | ||
146 | void Resource::setResourceName( const QString &name ) | ||
147 | { | ||
148 | KRES::Resource::setResourceName(name); | ||
149 | if(mSyncProfile != 0) { | ||
150 | mSyncProfile->setName( name ); | ||
151 | } | ||
152 | |||
153 | } | ||
154 | |||