author | ulf69 <ulf69> | 2004-10-13 21:27:10 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-10-13 21:27:10 (UTC) |
commit | 737183a5abd7d7b02048e8a939bafd0a8e803918 (patch) (unidiff) | |
tree | ddacf864a06a6669911b1d48862e564399eeb33b /kaddressbook | |
parent | 7bb6c5f55d29ad4632b1f5c7361eee4c0d8b7cb0 (diff) | |
download | kdepimpi-737183a5abd7d7b02048e8a939bafd0a8e803918.zip kdepimpi-737183a5abd7d7b02048e8a939bafd0a8e803918.tar.gz kdepimpi-737183a5abd7d7b02048e8a939bafd0a8e803918.tar.bz2 |
removal of syncresources
-rw-r--r-- | kaddressbook/xxportobject.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kaddressbook/xxportobject.cpp b/kaddressbook/xxportobject.cpp index 4351753..67e8406 100644 --- a/kaddressbook/xxportobject.cpp +++ b/kaddressbook/xxportobject.cpp | |||
@@ -155,49 +155,49 @@ void XXPortObject::slotImportActivated( const QString &data ) | |||
155 | *******************************************************************/ | 155 | *******************************************************************/ |
156 | 156 | ||
157 | 157 | ||
158 | XXPortResourceObject::XXPortResourceObject( KABC::AddressBook *ab, QWidget *parent, | 158 | XXPortResourceObject::XXPortResourceObject( KABC::AddressBook *ab, QWidget *parent, |
159 | const char *name ) | 159 | const char *name ) |
160 | : XXPortObject( ab, parent, name ), mFactory(0) | 160 | : XXPortObject( ab, parent, name ), mFactory(0) |
161 | { | 161 | { |
162 | mFactory = KRES::Factory::self( "tmpcontact" ); | 162 | mFactory = KRES::Factory::self( "tmpcontact" ); |
163 | } | 163 | } |
164 | 164 | ||
165 | XXPortResourceObject::~XXPortResourceObject() | 165 | XXPortResourceObject::~XXPortResourceObject() |
166 | { | 166 | { |
167 | //do not delete the factory. It is a singleton, and selfcontained | 167 | //do not delete the factory. It is a singleton, and selfcontained |
168 | } | 168 | } |
169 | 169 | ||
170 | bool XXPortResourceObject::isAvailable() | 170 | 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 | ||
188 | KABC::TmpAddressBook tmpAB; | 188 | KABC::TmpAddressBook tmpAB; |
189 | 189 | ||
190 | bool res = tmpAB.addResource( mResource ); | 190 | bool res = tmpAB.addResource( mResource ); |
191 | if (res == false) | 191 | if (res == false) |
192 | { | 192 | { |
193 | delete mResource; | 193 | delete mResource; |
194 | return false; | 194 | return false; |
195 | } | 195 | } |
196 | 196 | ||
197 | res = tmpAB.load(); | 197 | res = tmpAB.load(); |
198 | if (res == false) | 198 | if (res == false) |
199 | { | 199 | { |
200 | //removeResource deletes also the resource object, if the linkcount is 0 | 200 | //removeResource deletes also the resource object, if the linkcount is 0 |
201 | tmpAB.removeResource( mResource ); | 201 | tmpAB.removeResource( mResource ); |
202 | return false; | 202 | return false; |
203 | } | 203 | } |
@@ -215,49 +215,49 @@ bool XXPortResourceObject::_exportContacts( const KABC::AddresseeList &list, con | |||
215 | 215 | ||
216 | 216 | ||
217 | KABC::Addressee::List::ConstIterator it; | 217 | KABC::Addressee::List::ConstIterator it; |
218 | for ( it = list.begin(); it != list.end(); ++it ) { | 218 | for ( it = list.begin(); it != list.end(); ++it ) { |
219 | tmpAB.insertAddressee(*it); | 219 | tmpAB.insertAddressee(*it); |
220 | } | 220 | } |
221 | 221 | ||
222 | KABC::Ticket * ticket = tmpAB.requestSaveTicket(mResource); | 222 | KABC::Ticket * ticket = tmpAB.requestSaveTicket(mResource); |
223 | 223 | ||
224 | res = false; | 224 | res = false; |
225 | if (ticket != 0) | 225 | if (ticket != 0) |
226 | res = tmpAB.save( ticket ); | 226 | res = tmpAB.save( ticket ); |
227 | 227 | ||
228 | //removeResource deletes also the resource object, if the linkcount is 0 | 228 | //removeResource deletes also the resource object, if the linkcount is 0 |
229 | tmpAB.removeResource( mResource ); | 229 | tmpAB.removeResource( mResource ); |
230 | 230 | ||
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 ); |
248 | 248 | ||
249 | 249 | ||
250 | KABC::TmpAddressBook tmpAB; | 250 | KABC::TmpAddressBook tmpAB; |
251 | 251 | ||
252 | bool res = tmpAB.addResource( mResource ); | 252 | bool res = tmpAB.addResource( mResource ); |
253 | if (res == false) | 253 | if (res == false) |
254 | { | 254 | { |
255 | delete mResource; | 255 | delete mResource; |
256 | return KABC::AddresseeList(); | 256 | return KABC::AddresseeList(); |
257 | } | 257 | } |
258 | 258 | ||
259 | res = tmpAB.load(); | 259 | res = tmpAB.load(); |
260 | 260 | ||
261 | adrlst = tmpAB.allAddressees(); | 261 | adrlst = tmpAB.allAddressees(); |
262 | 262 | ||
263 | //remove resource deletes also the Resourceobject, if the linkcount is 0 | 263 | //remove resource deletes also the Resourceobject, if the linkcount is 0 |