-rw-r--r-- | kabc/converter/qtopia/qtopiaconverter.cpp | 98 |
1 files changed, 50 insertions, 48 deletions
diff --git a/kabc/converter/qtopia/qtopiaconverter.cpp b/kabc/converter/qtopia/qtopiaconverter.cpp index 498e89e..ac513b6 100644 --- a/kabc/converter/qtopia/qtopiaconverter.cpp +++ b/kabc/converter/qtopia/qtopiaconverter.cpp | |||
@@ -51,6 +51,6 @@ bool QtopiaConverter::init() | |||
51 | catDB = new Categories(); | 51 | catDB = new Categories(); |
52 | 52 | ||
53 | if (!catDB) | 53 | if (!catDB) |
54 | return false; | 54 | return false; |
55 | 55 | ||
56 | catDB->load( categoryFileName() ); | 56 | catDB->load( categoryFileName() ); |
@@ -61,3 +61,3 @@ void QtopiaConverter::deinit() | |||
61 | { | 61 | { |
62 | if (catDB) | 62 | if (catDB) |
63 | { | 63 | { |
@@ -67,3 +67,3 @@ void QtopiaConverter::deinit() | |||
67 | } | 67 | } |
68 | 68 | ||
69 | bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &addr ) | 69 | bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &addr ) |
@@ -77,4 +77,4 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a | |||
77 | addr.setSuffix( contact.suffix() ); | 77 | addr.setSuffix( contact.suffix() ); |
78 | 78 | ||
79 | 79 | ||
80 | 80 | ||
@@ -85,5 +85,5 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a | |||
85 | 85 | ||
86 | if (!contact.defaultEmail().isEmpty()) | 86 | if (!contact.defaultEmail().isEmpty()) |
87 | addr.insertEmail(contact.defaultEmail(), true); | 87 | addr.insertEmail(contact.defaultEmail(), true); |
88 | 88 | ||
89 | // home | 89 | // home |
@@ -104,6 +104,6 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a | |||
104 | homeaddress.setCountry( contact.homeCountry() ); | 104 | homeaddress.setCountry( contact.homeCountry() ); |
105 | 105 | ||
106 | addr.insertAddress( homeaddress ); | 106 | addr.insertAddress( homeaddress ); |
107 | } | 107 | } |
108 | 108 | ||
109 | if (!contact.homePhone().isEmpty()) | 109 | if (!contact.homePhone().isEmpty()) |
@@ -115,3 +115,3 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a | |||
115 | } | 115 | } |
116 | 116 | ||
117 | if (!contact.homeFax().isEmpty()) | 117 | if (!contact.homeFax().isEmpty()) |
@@ -123,3 +123,3 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a | |||
123 | } | 123 | } |
124 | 124 | ||
125 | if (!contact.homeMobile().isEmpty()) | 125 | if (!contact.homeMobile().isEmpty()) |
@@ -131,5 +131,5 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a | |||
131 | } | 131 | } |
132 | 132 | ||
133 | addr.setUrl( contact.homeWebpage() ); | 133 | addr.setUrl( contact.homeWebpage() ); |
134 | 134 | ||
135 | 135 | ||
@@ -151,7 +151,7 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a | |||
151 | businessaddress.setCountry( contact.businessCountry() ); | 151 | businessaddress.setCountry( contact.businessCountry() ); |
152 | 152 | ||
153 | addr.insertAddress( businessaddress ); | 153 | addr.insertAddress( businessaddress ); |
154 | } | 154 | } |
155 | 155 | ||
156 | 156 | ||
157 | if (!contact.businessPhone().isEmpty()) | 157 | if (!contact.businessPhone().isEmpty()) |
@@ -163,3 +163,3 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a | |||
163 | } | 163 | } |
164 | 164 | ||
165 | if (!contact.businessFax().isEmpty()) | 165 | if (!contact.businessFax().isEmpty()) |
@@ -171,3 +171,3 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a | |||
171 | } | 171 | } |
172 | 172 | ||
173 | if (!contact.businessMobile().isEmpty()) | 173 | if (!contact.businessMobile().isEmpty()) |
@@ -187,3 +187,3 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a | |||
187 | } | 187 | } |
188 | 188 | ||
189 | addr.setRole( contact.jobTitle() ); //? | 189 | addr.setRole( contact.jobTitle() ); //? |
@@ -204,6 +204,6 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a | |||
204 | addr.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); | 204 | addr.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); |
205 | 205 | ||
206 | if (contact.anniversary().isValid()) { | 206 | if (contact.anniversary().isValid()) { |
207 | QString dt = KGlobal::locale()->formatDate(contact.anniversary(), true, KLocale::ISODate); | 207 | QString dt = KGlobal::locale()->formatDate(contact.anniversary(), true, KLocale::ISODate); |
208 | //US | 208 | //US |
209 | // qDebug("QtopiaConverter::qtopiaToAddressee found:%s", dt.latin1()); | 209 | // qDebug("QtopiaConverter::qtopiaToAddressee found:%s", dt.latin1()); |
@@ -211,3 +211,3 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a | |||
211 | } | 211 | } |
212 | 212 | ||
213 | addr.insertCustom( "KADDRESSBOOK", "X-Children", contact.children() ); | 213 | addr.insertCustom( "KADDRESSBOOK", "X-Children", contact.children() ); |
@@ -215,3 +215,3 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a | |||
215 | addr.setBirthday( contact.birthday() ); | 215 | addr.setBirthday( contact.birthday() ); |
216 | 216 | ||
217 | addr.setNickName( contact.nickname() ); | 217 | addr.setNickName( contact.nickname() ); |
@@ -222,10 +222,10 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a | |||
222 | notes += "\nBusinessWebPage: " + contact.businessWebpage() + "\n"; | 222 | notes += "\nBusinessWebPage: " + contact.businessWebpage() + "\n"; |
223 | 223 | ||
224 | addr.setNote( contact.notes() ); | 224 | addr.setNote( contact.notes() ); |
225 | 225 | ||
226 | 226 | ||
227 | 227 | ||
228 | //US QString groups() const { return find( Qtopia::Groups ); } | 228 | //US QString groups() const { return find( Qtopia::Groups ); } |
229 | //US QStringList groupList() const; | 229 | //US QStringList groupList() const; |
230 | 230 | ||
231 | QArray<int> catArray = contact.categories(); | 231 | QArray<int> catArray = contact.categories(); |
@@ -235,6 +235,8 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a | |||
235 | cat = catDB->label("contact", catArray[i]); | 235 | cat = catDB->label("contact", catArray[i]); |
236 | if ( !cat.isEmpty() ) | 236 | if ( cat.isEmpty() ) |
237 | addr.insertCategory(QString::number(catArray[i])); | ||
238 | else | ||
237 | addr.insertCategory( cat ); | 239 | addr.insertCategory( cat ); |
238 | } | 240 | } |
239 | 241 | ||
240 | return true; | 242 | return true; |
@@ -251,4 +253,4 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont | |||
251 | contact.setFileAs(); | 253 | contact.setFileAs(); |
252 | 254 | ||
253 | 255 | ||
254 | 256 | ||
@@ -259,3 +261,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont | |||
259 | contact.setDefaultEmail( addr.preferredEmail() ); | 261 | contact.setDefaultEmail( addr.preferredEmail() ); |
260 | 262 | ||
261 | 263 | ||
@@ -274,3 +276,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont | |||
274 | contact.setHomePhone(homephone.number()); | 276 | contact.setHomePhone(homephone.number()); |
275 | 277 | ||
276 | PhoneNumber homefax = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ); | 278 | PhoneNumber homefax = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ); |
@@ -278,3 +280,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont | |||
278 | contact.setHomeFax(homefax.number()); | 280 | contact.setHomeFax(homefax.number()); |
279 | 281 | ||
280 | PhoneNumber homemobile = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Cell ); | 282 | PhoneNumber homemobile = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Cell ); |
@@ -282,5 +284,5 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont | |||
282 | contact.setHomeMobile(homemobile.number()); | 284 | contact.setHomeMobile(homemobile.number()); |
283 | 285 | ||
284 | contact.setHomeWebpage(addr.url().url()); | 286 | contact.setHomeWebpage(addr.url().url()); |
285 | 287 | ||
286 | 288 | ||
@@ -299,3 +301,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont | |||
299 | contact.setBusinessPhone(businessphone.number()); | 301 | contact.setBusinessPhone(businessphone.number()); |
300 | 302 | ||
301 | PhoneNumber businessfax = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ); | 303 | PhoneNumber businessfax = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ); |
@@ -303,3 +305,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont | |||
303 | contact.setBusinessFax(businessfax.number()); | 305 | contact.setBusinessFax(businessfax.number()); |
304 | 306 | ||
305 | PhoneNumber businessmobile = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Cell ); | 307 | PhoneNumber businessmobile = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Cell ); |
@@ -307,3 +309,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont | |||
307 | contact.setBusinessMobile(businessmobile.number()); | 309 | contact.setBusinessMobile(businessmobile.number()); |
308 | 310 | ||
309 | PhoneNumber businesspager = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Pager ); | 311 | PhoneNumber businesspager = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Pager ); |
@@ -333,9 +335,9 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont | |||
333 | 335 | ||
334 | 336 | ||
335 | QDate dt = KGlobal::locale()->readDate( | 337 | QDate dt = KGlobal::locale()->readDate( |
336 | addr.custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); // = Qt::ISODate | 338 | addr.custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); // = Qt::ISODate |
337 | contact.setAnniversary( dt ); | 339 | contact.setAnniversary( dt ); |
338 | 340 | ||
339 | contact.setChildren(addr.custom( "KADDRESSBOOK", "X-Children" )); | 341 | contact.setChildren(addr.custom( "KADDRESSBOOK", "X-Children" )); |
340 | 342 | ||
341 | contact.setBirthday(addr.birthday().date()); | 343 | contact.setBirthday(addr.birthday().date()); |
@@ -345,3 +347,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont | |||
345 | contact.setNotes(addr.note()); | 347 | contact.setNotes(addr.note()); |
346 | 348 | ||
347 | //US QString groups() const { return find( Qtopia::Groups ); } | 349 | //US QString groups() const { return find( Qtopia::Groups ); } |
@@ -351,3 +353,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont | |||
351 | QStringList cats = addr.categories(); | 353 | QStringList cats = addr.categories(); |
352 | 354 | ||
353 | QArray<int> iar; | 355 | QArray<int> iar; |
@@ -357,3 +359,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont | |||
357 | } | 359 | } |
358 | 360 | ||
359 | return true; | 361 | return true; |