summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/converter/opie/opieconverter.cpp33
-rw-r--r--kabc/converter/opie/opieconverter.h2
2 files changed, 4 insertions, 31 deletions
diff --git a/kabc/converter/opie/opieconverter.cpp b/kabc/converter/opie/opieconverter.cpp
index b4e9f1c..0b6a55e 100644
--- a/kabc/converter/opie/opieconverter.cpp
+++ b/kabc/converter/opie/opieconverter.cpp
@@ -61,25 +61,25 @@ bool OpieConverter::init()
61 61
62} 62}
63 63
64void OpieConverter::deinit() 64void OpieConverter::deinit()
65{ 65{
66 if (catDB) 66 if (catDB)
67 { 67 {
68 delete catDB; 68 delete catDB;
69 catDB = 0; 69 catDB = 0;
70 } 70 }
71} 71}
72 72
73bool OpieConverter::opieToAddressee( OContact &contact, Addressee &addr ) 73bool OpieConverter::opieToAddressee( const OContact &contact, Addressee &addr )
74{ 74{
75 // name 75 // name
76 addr.setFormattedName(contact.fileAs()); 76 addr.setFormattedName(contact.fileAs());
77 addr.setFamilyName( contact.lastName() ); 77 addr.setFamilyName( contact.lastName() );
78 addr.setGivenName( contact.firstName() ); 78 addr.setGivenName( contact.firstName() );
79 addr.setAdditionalName( contact.middleName() ); 79 addr.setAdditionalName( contact.middleName() );
80 addr.setPrefix( contact.title() ); 80 addr.setPrefix( contact.title() );
81 addr.setSuffix( contact.suffix() ); 81 addr.setSuffix( contact.suffix() );
82 82
83 83
84 // email 84 // email
85 QStringList emails = contact.emailList(); 85 QStringList emails = contact.emailList();
@@ -220,33 +220,29 @@ bool OpieConverter::opieToAddressee( OContact &contact, Addressee &addr )
220 QString notes = contact.notes(); 220 QString notes = contact.notes();
221 notes += "\nBusinessWebPage: " + contact.businessWebpage() + "\n"; 221 notes += "\nBusinessWebPage: " + contact.businessWebpage() + "\n";
222 222
223 addr.setNote( contact.notes() ); 223 addr.setNote( contact.notes() );
224 224
225 225
226 226
227//US QString groups() const { return find( Qtopia::Groups ); } 227//US QString groups() const { return find( Qtopia::Groups ); }
228//US QStringList groupList() const; 228//US QStringList groupList() const;
229 229
230 230
231 QStringList cats = contact.categoryNames("Contacts"); 231 QStringList cats = contact.categoryNames("Contacts");
232 addr.setCategories( cats );
232// for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) { 233// for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) {
233// qDebug("Cat: %s", (*it).latin1()); 234// qDebug("Cat: %s", (*it).latin1());
234// } 235// }
235
236 236
237 addr.setCategories( contact.categoryNames("Contacts") );
238// qDebug("Groups: %s", contact.groups().latin1());
239// addr.setCategories( contact.groupList() );
240
241 237
242 return true; 238 return true;
243} 239}
244 240
245bool OpieConverter::addresseeToOpie( const Addressee &addr, OContact &contact ) 241bool OpieConverter::addresseeToOpie( const Addressee &addr, OContact &contact )
246{ 242{
247 // name 243 // name
248 contact.setLastName(addr.familyName()); 244 contact.setLastName(addr.familyName());
249 contact.setFirstName(addr.givenName()); 245 contact.setFirstName(addr.givenName());
250 contact.setMiddleName(addr.additionalName()); 246 contact.setMiddleName(addr.additionalName());
251 contact.setTitle(addr.prefix()); 247 contact.setTitle(addr.prefix());
252 contact.setSuffix(addr.suffix()); 248 contact.setSuffix(addr.suffix());
@@ -331,45 +327,22 @@ bool OpieConverter::addresseeToOpie( const Addressee &addr, OContact &contact )
331 327
332 contact.setChildren(addr.custom( "KADDRESSBOOK", "X-Children" )); 328 contact.setChildren(addr.custom( "KADDRESSBOOK", "X-Children" ));
333 329
334 contact.setBirthday(addr.birthday().date()); 330 contact.setBirthday(addr.birthday().date());
335 contact.setNickname(addr.nickName()); 331 contact.setNickname(addr.nickName());
336 332
337 // other 333 // other
338 contact.setNotes(addr.note()); 334 contact.setNotes(addr.note());
339 335
340//US QString groups() const { return find( Qtopia::Groups ); } 336//US QString groups() const { return find( Qtopia::Groups ); }
341//US QStringList groupList() const; 337//US QStringList groupList() const;
342 338
343/*US
344 QStringList cats = contact.categoryNames("Contacts");
345 for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) {
346 qDebug("Cat: %s", (*it).latin1());
347 }
348*/
349
350// addr.setCategories( contact.categoryNames("Contacts") );
351// contact.categoryNames("Contacts");
352// contact.setCategoryNames(addr.categories());
353
354/*US
355 QStringList cats = addr.categories();
356 QArray<int> cat(cats.count());
357 int counter = 0;
358 for ( QStringList::ConstIterator it = cats.begin(); it != cats.end(); ++it )
359 cat[counter] = (*it).toInt();
360
361 contact.setCategories( cat );
362*/
363
364 Categories catDB;
365 catDB.load( categoryFileName() );
366 QStringList cats = addr.categories(); 339 QStringList cats = addr.categories();
367 340
368 QArray<int> iar; 341 QArray<int> iar;
369 if ( !cats.isEmpty() ) { 342 if ( !cats.isEmpty() ) {
370 QArray<int> iar = catDB.ids("contact", cats); 343 QArray<int> iar = catDB->ids("contact", cats);
371 contact.setCategories(iar); 344 contact.setCategories(iar);
372 } 345 }
373 346
374 return true; 347 return true;
375} 348}
diff --git a/kabc/converter/opie/opieconverter.h b/kabc/converter/opie/opieconverter.h
index 7d2ad85..c7e691f 100644
--- a/kabc/converter/opie/opieconverter.h
+++ b/kabc/converter/opie/opieconverter.h
@@ -51,25 +51,25 @@ public:
51 */ 51 */
52 virtual ~OpieConverter(); 52 virtual ~OpieConverter();
53 53
54 virtual bool init(); 54 virtual bool init();
55 virtual void deinit(); 55 virtual void deinit();
56 56
57 /** 57 /**
58 * Converts a vcard string to an addressee. 58 * Converts a vcard string to an addressee.
59 * 59 *
60 * @param contact The opie contact. 60 * @param contact The opie contact.
61 * @param addr The addressee. 61 * @param addr The addressee.
62 */ 62 */
63 bool opieToAddressee( OContact &contact, Addressee &addr ); 63 bool opieToAddressee( const OContact &contact, Addressee &addr );
64 64
65 /** 65 /**
66 * Converts an addressee to a vcard string. 66 * Converts an addressee to a vcard string.
67 * 67 *
68 * @param addr The addressee. 68 * @param addr The addressee.
69 * @param contact The opie contact. 69 * @param contact The opie contact.
70 */ 70 */
71 bool addresseeToOpie( const Addressee &addr, OContact &contact ); 71 bool addresseeToOpie( const Addressee &addr, OContact &contact );
72 72
73 private: 73 private:
74 Categories* catDB; 74 Categories* catDB;
75 75