Diffstat (limited to 'kabc/plugins/opie/resourceopie.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kabc/plugins/opie/resourceopie.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/kabc/plugins/opie/resourceopie.cpp b/kabc/plugins/opie/resourceopie.cpp index f992301..a4f8d8a 100644 --- a/kabc/plugins/opie/resourceopie.cpp +++ b/kabc/plugins/opie/resourceopie.cpp | |||
@@ -37,24 +37,25 @@ $Id$ | |||
37 | 37 | ||
38 | #include <kapplication.h> | 38 | #include <kapplication.h> |
39 | #include <kconfig.h> | 39 | #include <kconfig.h> |
40 | #include <kdebug.h> | 40 | #include <kdebug.h> |
41 | #include <klocale.h> | 41 | #include <klocale.h> |
42 | //US #include <ksavefile.h> | 42 | //US #include <ksavefile.h> |
43 | #include <kstandarddirs.h> | 43 | #include <kstandarddirs.h> |
44 | 44 | ||
45 | //US #include "formatfactory.h" | 45 | //US #include "formatfactory.h" |
46 | //US #include <qpe/qpeapplication.h> | 46 | //US #include <qpe/qpeapplication.h> |
47 | 47 | ||
48 | #include <opie/ocontactaccess.h> | 48 | #include <opie/ocontactaccess.h> |
49 | #include <opie/ocontactaccessbackend_xml.h> | ||
49 | 50 | ||
50 | #include "resource.h" | 51 | #include "resource.h" |
51 | #include "resourceopieconfig.h" | 52 | #include "resourceopieconfig.h" |
52 | #include "stdaddressbook.h" | 53 | #include "stdaddressbook.h" |
53 | 54 | ||
54 | #include "opieconverter.h" | 55 | #include "opieconverter.h" |
55 | 56 | ||
56 | #include "resourceopie.h" | 57 | #include "resourceopie.h" |
57 | 58 | ||
58 | using namespace KABC; | 59 | using namespace KABC; |
59 | extern "C" | 60 | extern "C" |
60 | { | 61 | { |
@@ -170,26 +171,29 @@ bool ResourceOpie::doOpen() | |||
170 | return true; | 171 | return true; |
171 | } | 172 | } |
172 | 173 | ||
173 | void ResourceOpie::doClose() | 174 | void ResourceOpie::doClose() |
174 | { | 175 | { |
175 | // qDebug("ResourceOpie::doClose() %s", mFileName.latin1()); | 176 | // qDebug("ResourceOpie::doClose() %s", mFileName.latin1()); |
176 | } | 177 | } |
177 | 178 | ||
178 | bool ResourceOpie::load() | 179 | bool ResourceOpie::load() |
179 | { | 180 | { |
180 | // qDebug("ResourceOpie::load() %s", mFileName.latin1()); | 181 | // qDebug("ResourceOpie::load() %s", mFileName.latin1()); |
181 | kdDebug(5700) << "ResourceOpie::load(): '" << mFileName << "'" << endl; | 182 | kdDebug(5700) << "ResourceOpie::load(): '" << mFileName << "'" << endl; |
182 | 183 | ||
183 | OContactAccess* access = new OContactAccess("KDEPim/Pi", mFileName, 0l, false); | 184 | qDebug("ResourceOpie::load: Try to load file() %s", mFileName.latin1()); |
185 | |||
186 | OContactAccessBackend_XML* backend = new OContactAccessBackend_XML( "KDEPim/Pi", mFileName ); | ||
187 | OContactAccess* access = new OContactAccess("KDEPim/Pi", 0l, backend, false); | ||
184 | 188 | ||
185 | if ( !access ) { | 189 | if ( !access ) { |
186 | qDebug("Unable to load file() %s", mFileName.latin1()); | 190 | qDebug("Unable to load file() %s", mFileName.latin1()); |
187 | addressBook()->error( i18n( "Unable to load file '%1'." ).arg( mFileName ) ); | 191 | addressBook()->error( i18n( "Unable to load file '%1'." ).arg( mFileName ) ); |
188 | return false; | 192 | return false; |
189 | } | 193 | } |
190 | 194 | ||
191 | access -> setReadAhead( 32 ); // Use ReadAhead-Cache if available | 195 | access -> setReadAhead( 32 ); // Use ReadAhead-Cache if available |
192 | 196 | ||
193 | if (mConverter == 0) | 197 | if (mConverter == 0) |
194 | mConverter = new OpieConverter(); | 198 | mConverter = new OpieConverter(); |
195 | 199 | ||
@@ -206,24 +210,25 @@ bool ResourceOpie::load() | |||
206 | res = mConverter->opieToAddressee( c, addressee ); | 210 | res = mConverter->opieToAddressee( c, addressee ); |
207 | 211 | ||
208 | if ( !addressee.isEmpty() && res ) | 212 | if ( !addressee.isEmpty() && res ) |
209 | { | 213 | { |
210 | addressee.setResource( this ); | 214 | addressee.setResource( this ); |
211 | addressBook()->insertAddressee( addressee ); | 215 | addressBook()->insertAddressee( addressee ); |
212 | } | 216 | } |
213 | 217 | ||
214 | // qDebug("found %s", c.fullName().latin1()); | 218 | // qDebug("found %s", c.fullName().latin1()); |
215 | } | 219 | } |
216 | 220 | ||
217 | delete access; | 221 | delete access; |
222 | delete backend; | ||
218 | 223 | ||
219 | return true; | 224 | return true; |
220 | } | 225 | } |
221 | 226 | ||
222 | bool ResourceOpie::save( Ticket *ticket ) | 227 | bool ResourceOpie::save( Ticket *ticket ) |
223 | { | 228 | { |
224 | qDebug("ResourceOpie::save() has to be fixed - %s", mFileName.latin1()); | 229 | qDebug("ResourceOpie::save() has to be fixed - %s", mFileName.latin1()); |
225 | /*US | 230 | /*US |
226 | 231 | ||
227 | qDebug("ResourceOpie::save %s", mFileName.latin1()); | 232 | qDebug("ResourceOpie::save %s", mFileName.latin1()); |
228 | kdDebug(5700) << "ResourceOpie::save()" << endl; | 233 | kdDebug(5700) << "ResourceOpie::save()" << endl; |
229 | 234 | ||