-rw-r--r-- | kabc/converter/sharpdtm/sharpdtmconverter.cpp | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/kabc/converter/sharpdtm/sharpdtmconverter.cpp b/kabc/converter/sharpdtm/sharpdtmconverter.cpp index b3e2ee1..4cf2eb3 100644 --- a/kabc/converter/sharpdtm/sharpdtmconverter.cpp +++ b/kabc/converter/sharpdtm/sharpdtmconverter.cpp | |||
@@ -50,8 +50,8 @@ bool SharpDTMConverter::init() | |||
50 | { | 50 | { |
51 | catDB = new SlCategory::SlCategories(); | 51 | catDB = new SlCategory::SlCategories(); |
52 | 52 | ||
53 | if (!catDB) | 53 | if (!catDB) |
54 | return false; | 54 | return false; |
55 | 55 | ||
56 | // catDB->load( categoryFileName() ); | 56 | // catDB->load( categoryFileName() ); |
57 | return true; | 57 | return true; |
@@ -60,5 +60,5 @@ bool SharpDTMConverter::init() | |||
60 | void SharpDTMConverter::deinit() | 60 | void SharpDTMConverter::deinit() |
61 | { | 61 | { |
62 | if (catDB) | 62 | if (catDB) |
63 | { | 63 | { |
64 | delete catDB; | 64 | delete catDB; |
@@ -66,6 +66,6 @@ void SharpDTMConverter::deinit() | |||
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | bool SharpDTMConverter::sharpToAddressee( const PimContact &contact, Addressee &addr ) | 69 | bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBase* database, Addressee &addr ) |
70 | { | 70 | { |
71 | /*US | 71 | /*US |
@@ -77,6 +77,6 @@ bool SharpDTMConverter::sharpToAddressee( const PimContact &contact, Addressee & | |||
77 | addr.setPrefix( contact.nameTitle() ); | 77 | addr.setPrefix( contact.nameTitle() ); |
78 | addr.setSuffix( contact.suffix() ); | 78 | addr.setSuffix( contact.suffix() ); |
79 | 79 | ||
80 | 80 | ||
81 | 81 | ||
82 | QStringList emails = contact.emailList(); | 82 | QStringList emails = contact.emailList(); |
@@ -85,7 +85,7 @@ bool SharpDTMConverter::sharpToAddressee( const PimContact &contact, Addressee & | |||
85 | } | 85 | } |
86 | 86 | ||
87 | if (!contact.defaultEmail().isEmpty()) | 87 | if (!contact.defaultEmail().isEmpty()) |
88 | addr.insertEmail(contact.defaultEmail(), true); | 88 | addr.insertEmail(contact.defaultEmail(), true); |
89 | 89 | ||
90 | // home | 90 | // home |
91 | if ((!contact.homeStreet().isEmpty()) || | 91 | if ((!contact.homeStreet().isEmpty()) || |
@@ -104,8 +104,8 @@ bool SharpDTMConverter::sharpToAddressee( const PimContact &contact, Addressee & | |||
104 | homeaddress.setPostalCode( contact.homeZip() ); | 104 | homeaddress.setPostalCode( contact.homeZip() ); |
105 | homeaddress.setCountry( contact.homeCountry() ); | 105 | homeaddress.setCountry( contact.homeCountry() ); |
106 | 106 | ||
107 | addr.insertAddress( homeaddress ); | 107 | addr.insertAddress( homeaddress ); |
108 | } | 108 | } |
109 | 109 | ||
110 | if (!contact.homePhone().isEmpty()) | 110 | if (!contact.homePhone().isEmpty()) |
111 | { | 111 | { |
@@ -115,5 +115,5 @@ bool SharpDTMConverter::sharpToAddressee( const PimContact &contact, Addressee & | |||
115 | addr.insertPhoneNumber( homephone ); | 115 | addr.insertPhoneNumber( homephone ); |
116 | } | 116 | } |
117 | 117 | ||
118 | if (!contact.homeFax().isEmpty()) | 118 | if (!contact.homeFax().isEmpty()) |
119 | { | 119 | { |
@@ -123,5 +123,5 @@ bool SharpDTMConverter::sharpToAddressee( const PimContact &contact, Addressee & | |||
123 | addr.insertPhoneNumber( homefax ); | 123 | addr.insertPhoneNumber( homefax ); |
124 | } | 124 | } |
125 | 125 | ||
126 | if (!contact.homeMobile().isEmpty()) | 126 | if (!contact.homeMobile().isEmpty()) |
127 | { | 127 | { |
@@ -131,7 +131,7 @@ bool SharpDTMConverter::sharpToAddressee( const PimContact &contact, Addressee & | |||
131 | addr.insertPhoneNumber( homemobile ); | 131 | addr.insertPhoneNumber( homemobile ); |
132 | } | 132 | } |
133 | 133 | ||
134 | addr.setUrl( contact.homeWebpage() ); | 134 | addr.setUrl( contact.homeWebpage() ); |
135 | 135 | ||
136 | 136 | ||
137 | // business | 137 | // business |
@@ -151,9 +151,9 @@ bool SharpDTMConverter::sharpToAddressee( const PimContact &contact, Addressee & | |||
151 | businessaddress.setPostalCode( contact.businessZip() ); | 151 | businessaddress.setPostalCode( contact.businessZip() ); |
152 | businessaddress.setCountry( contact.businessCountry() ); | 152 | businessaddress.setCountry( contact.businessCountry() ); |
153 | 153 | ||
154 | addr.insertAddress( businessaddress ); | 154 | addr.insertAddress( businessaddress ); |
155 | } | 155 | } |
156 | 156 | ||
157 | 157 | ||
158 | if (!contact.businessPhone().isEmpty()) | 158 | if (!contact.businessPhone().isEmpty()) |
159 | { | 159 | { |
@@ -163,5 +163,5 @@ bool SharpDTMConverter::sharpToAddressee( const PimContact &contact, Addressee & | |||
163 | addr.insertPhoneNumber( businessphone ); | 163 | addr.insertPhoneNumber( businessphone ); |
164 | } | 164 | } |
165 | 165 | ||
166 | if (!contact.businessFax().isEmpty()) | 166 | if (!contact.businessFax().isEmpty()) |
167 | { | 167 | { |
@@ -171,5 +171,5 @@ bool SharpDTMConverter::sharpToAddressee( const PimContact &contact, Addressee & | |||
171 | addr.insertPhoneNumber( businessfax ); | 171 | addr.insertPhoneNumber( businessfax ); |
172 | } | 172 | } |
173 | 173 | ||
174 | if (!contact.businessMobile().isEmpty()) | 174 | if (!contact.businessMobile().isEmpty()) |
175 | { | 175 | { |
@@ -187,5 +187,5 @@ bool SharpDTMConverter::sharpToAddressee( const PimContact &contact, Addressee & | |||
187 | addr.insertPhoneNumber( businesspager ); | 187 | addr.insertPhoneNumber( businesspager ); |
188 | } | 188 | } |
189 | 189 | ||
190 | addr.setRole( contact.jobTitle() ); //? | 190 | addr.setRole( contact.jobTitle() ); //? |
191 | addr.setOrganization( contact.company() ); | 191 | addr.setOrganization( contact.company() ); |
@@ -204,16 +204,16 @@ bool SharpDTMConverter::sharpToAddressee( const PimContact &contact, Addressee & | |||
204 | else if (contact.gender() == PimContact::Female) | 204 | else if (contact.gender() == PimContact::Female) |
205 | addr.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); | 205 | addr.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); |
206 | 206 | ||
207 | if (contact.anniversary().isValid()) { | 207 | if (contact.anniversary().isValid()) { |
208 | QString dt = KGlobal::locale()->formatDate(contact.anniversary(), true, KLocale::ISODate); | 208 | QString dt = KGlobal::locale()->formatDate(contact.anniversary(), true, KLocale::ISODate); |
209 | //US | 209 | //US |
210 | // qDebug("QtopiaConverter::qtopiaToAddressee found:%s", dt.latin1()); | 210 | // qDebug("QtopiaConverter::qtopiaToAddressee found:%s", dt.latin1()); |
211 | addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); | 211 | addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); |
212 | } | 212 | } |
213 | 213 | ||
214 | addr.insertCustom( "KADDRESSBOOK", "X-Children", contact.children() ); | 214 | addr.insertCustom( "KADDRESSBOOK", "X-Children", contact.children() ); |
215 | if (contact.birthday().isValid()) | 215 | if (contact.birthday().isValid()) |
216 | addr.setBirthday( contact.birthday() ); | 216 | addr.setBirthday( contact.birthday() ); |
217 | 217 | ||
218 | addr.setNickName( contact.nickname() ); | 218 | addr.setNickName( contact.nickname() ); |
219 | 219 | ||
@@ -222,12 +222,12 @@ bool SharpDTMConverter::sharpToAddressee( const PimContact &contact, Addressee & | |||
222 | QString notes = contact.notes(); | 222 | QString notes = contact.notes(); |
223 | notes += "\nBusinessWebPage: " + contact.businessWebpage() + "\n"; | 223 | notes += "\nBusinessWebPage: " + contact.businessWebpage() + "\n"; |
224 | 224 | ||
225 | addr.setNote( contact.notes() ); | 225 | addr.setNote( contact.notes() ); |
226 | 226 | ||
227 | 227 | ||
228 | 228 | ||
229 | //US QString groups() const { return find( Qtopia::Groups ); } | 229 | //US QString groups() const { return find( Qtopia::Groups ); } |
230 | //US QStringList groupList() const; | 230 | //US QStringList groupList() const; |
231 | 231 | ||
232 | QArray<int> catArray = contact.categories(); | 232 | QArray<int> catArray = contact.categories(); |
233 | QString cat; | 233 | QString cat; |
@@ -238,9 +238,9 @@ bool SharpDTMConverter::sharpToAddressee( const PimContact &contact, Addressee & | |||
238 | addr.insertCategory( cat ); | 238 | addr.insertCategory( cat ); |
239 | } | 239 | } |
240 | */ | 240 | */ |
241 | return true; | 241 | return true; |
242 | } | 242 | } |
243 | 243 | ||
244 | bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, PimContact &contact ) | 244 | bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, const SlZDataBase* database , const CardId &contact ) |
245 | { | 245 | { |
246 | /*US | 246 | /*US |
@@ -252,6 +252,6 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, PimContact &con | |||
252 | contact.setSuffix(addr.suffix()); | 252 | contact.setSuffix(addr.suffix()); |
253 | contact.setFileAs(); | 253 | contact.setFileAs(); |
254 | 254 | ||
255 | 255 | ||
256 | 256 | ||
257 | QStringList emails = addr.emails(); | 257 | QStringList emails = addr.emails(); |
@@ -260,5 +260,5 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, PimContact &con | |||
260 | } | 260 | } |
261 | contact.setDefaultEmail( addr.preferredEmail() ); | 261 | contact.setDefaultEmail( addr.preferredEmail() ); |
262 | 262 | ||
263 | 263 | ||
264 | // home | 264 | // home |
@@ -275,15 +275,15 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, PimContact &con | |||
275 | if (!homephone.number().isEmpty()) | 275 | if (!homephone.number().isEmpty()) |
276 | contact.setHomePhone(homephone.number()); | 276 | contact.setHomePhone(homephone.number()); |
277 | 277 | ||
278 | PhoneNumber homefax = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ); | 278 | PhoneNumber homefax = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ); |
279 | if (!homefax.number().isEmpty()) | 279 | if (!homefax.number().isEmpty()) |
280 | contact.setHomeFax(homefax.number()); | 280 | contact.setHomeFax(homefax.number()); |
281 | 281 | ||
282 | PhoneNumber homemobile = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Cell ); | 282 | PhoneNumber homemobile = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Cell ); |
283 | if (!homemobile.number().isEmpty()) | 283 | if (!homemobile.number().isEmpty()) |
284 | contact.setHomeMobile(homemobile.number()); | 284 | contact.setHomeMobile(homemobile.number()); |
285 | 285 | ||
286 | contact.setHomeWebpage(addr.url().url()); | 286 | contact.setHomeWebpage(addr.url().url()); |
287 | 287 | ||
288 | 288 | ||
289 | // business | 289 | // business |
@@ -300,13 +300,13 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, PimContact &con | |||
300 | if (!businessphone.number().isEmpty()) | 300 | if (!businessphone.number().isEmpty()) |
301 | contact.setBusinessPhone(businessphone.number()); | 301 | contact.setBusinessPhone(businessphone.number()); |
302 | 302 | ||
303 | PhoneNumber businessfax = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ); | 303 | PhoneNumber businessfax = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ); |
304 | if (!businessfax.number().isEmpty()) | 304 | if (!businessfax.number().isEmpty()) |
305 | contact.setBusinessFax(businessfax.number()); | 305 | contact.setBusinessFax(businessfax.number()); |
306 | 306 | ||
307 | PhoneNumber businessmobile = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Cell ); | 307 | PhoneNumber businessmobile = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Cell ); |
308 | if (!businessmobile.number().isEmpty()) | 308 | if (!businessmobile.number().isEmpty()) |
309 | contact.setBusinessMobile(businessmobile.number()); | 309 | contact.setBusinessMobile(businessmobile.number()); |
310 | 310 | ||
311 | PhoneNumber businesspager = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Pager ); | 311 | PhoneNumber businesspager = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Pager ); |
312 | if (!businesspager.number().isEmpty()) | 312 | if (!businesspager.number().isEmpty()) |
@@ -334,11 +334,11 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, PimContact &con | |||
334 | contact.setGender(PimContact::UnspecifiedGender); | 334 | contact.setGender(PimContact::UnspecifiedGender); |
335 | 335 | ||
336 | 336 | ||
337 | QDate dt = KGlobal::locale()->readDate( | 337 | QDate dt = KGlobal::locale()->readDate( |
338 | addr.custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); // = Qt::ISODate | 338 | addr.custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); // = Qt::ISODate |
339 | contact.setAnniversary( dt ); | 339 | contact.setAnniversary( dt ); |
340 | 340 | ||
341 | contact.setChildren(addr.custom( "KADDRESSBOOK", "X-Children" )); | 341 | contact.setChildren(addr.custom( "KADDRESSBOOK", "X-Children" )); |
342 | 342 | ||
343 | contact.setBirthday(addr.birthday().date()); | 343 | contact.setBirthday(addr.birthday().date()); |
344 | contact.setNickname(addr.nickName()); | 344 | contact.setNickname(addr.nickName()); |
@@ -346,5 +346,5 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, PimContact &con | |||
346 | // other | 346 | // other |
347 | contact.setNotes(addr.note()); | 347 | contact.setNotes(addr.note()); |
348 | 348 | ||
349 | //US QString groups() const { return find( Qtopia::Groups ); } | 349 | //US QString groups() const { return find( Qtopia::Groups ); } |
350 | //US QStringList groupList() const; | 350 | //US QStringList groupList() const; |
@@ -352,5 +352,5 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, PimContact &con | |||
352 | 352 | ||
353 | QStringList cats = addr.categories(); | 353 | QStringList cats = addr.categories(); |
354 | 354 | ||
355 | QArray<int> iar; | 355 | QArray<int> iar; |
356 | if ( !cats.isEmpty() ) { | 356 | if ( !cats.isEmpty() ) { |
@@ -358,5 +358,5 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, PimContact &con | |||
358 | contact.setCategories(iar); | 358 | contact.setCategories(iar); |
359 | } | 359 | } |
360 | */ | 360 | */ |
361 | return true; | 361 | return true; |
362 | } | 362 | } |