summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/converter/sharpdtm/sharpdtmconverter.cpp98
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
@@ -4,359 +4,359 @@
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/* 21/*
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28#include "kglobal.h" 28#include "kglobal.h"
29 29
30 30
31#include "sharpdtmconverter.h" 31#include "sharpdtmconverter.h"
32 32
33#include <sl/slcategories.h> 33#include <sl/slcategories.h>
34//US #include <qpe/categoryselect.h> 34//US #include <qpe/categoryselect.h>
35 35
36 36
37using namespace KABC; 37using namespace KABC;
38using namespace SlCategory; 38using namespace SlCategory;
39 39
40SharpDTMConverter::SharpDTMConverter() : catDB(0) 40SharpDTMConverter::SharpDTMConverter() : catDB(0)
41{ 41{
42} 42}
43 43
44SharpDTMConverter::~SharpDTMConverter() 44SharpDTMConverter::~SharpDTMConverter()
45{ 45{
46 deinit(); 46 deinit();
47} 47}
48 48
49bool SharpDTMConverter::init() 49bool 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;
58} 58}
59 59
60void SharpDTMConverter::deinit() 60void SharpDTMConverter::deinit()
61{ 61{
62 if (catDB) 62 if (catDB)
63 { 63 {
64 delete catDB; 64 delete catDB;
65 catDB = 0; 65 catDB = 0;
66 } 66 }
67} 67}
68 68
69bool SharpDTMConverter::sharpToAddressee( const PimContact &contact, Addressee &addr ) 69bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBase* database, Addressee &addr )
70{ 70{
71/*US 71/*US
72 // name 72 // name
73 addr.setFormattedName(contact.fileAs()); 73 addr.setFormattedName(contact.fileAs());
74 addr.setFamilyName( contact.lastName() ); 74 addr.setFamilyName( contact.lastName() );
75 addr.setGivenName( contact.firstName() ); 75 addr.setGivenName( contact.firstName() );
76 addr.setAdditionalName( contact.middleName() ); 76 addr.setAdditionalName( contact.middleName() );
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 // email 81 // email
82 QStringList emails = contact.emailList(); 82 QStringList emails = contact.emailList();
83 for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { 83 for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) {
84 addr.insertEmail( *it, ((*it) == contact.defaultEmail()) ); 84 addr.insertEmail( *it, ((*it) == contact.defaultEmail()) );
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()) ||
92 (!contact.homeCity().isEmpty()) || 92 (!contact.homeCity().isEmpty()) ||
93 (!contact.homeState().isEmpty()) || 93 (!contact.homeState().isEmpty()) ||
94 (!contact.homeZip().isEmpty()) || 94 (!contact.homeZip().isEmpty()) ||
95 (!contact.homeCountry().isEmpty())) 95 (!contact.homeCountry().isEmpty()))
96 { 96 {
97 Address homeaddress; 97 Address homeaddress;
98 homeaddress.setType(Address::Home); 98 homeaddress.setType(Address::Home);
99//US homeaddress.setPostOfficeBox( "" ); 99//US homeaddress.setPostOfficeBox( "" );
100//US homeaddress.setExtended( "" ); 100//US homeaddress.setExtended( "" );
101 homeaddress.setStreet( contact.homeStreet() ); 101 homeaddress.setStreet( contact.homeStreet() );
102 homeaddress.setLocality( contact.homeCity() ); 102 homeaddress.setLocality( contact.homeCity() );
103 homeaddress.setRegion( contact.homeState() ); 103 homeaddress.setRegion( contact.homeState() );
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 {
112 PhoneNumber homephone; 112 PhoneNumber homephone;
113 homephone.setType( PhoneNumber::Home ); 113 homephone.setType( PhoneNumber::Home );
114 homephone.setNumber( contact.homePhone() ); 114 homephone.setNumber( contact.homePhone() );
115 addr.insertPhoneNumber( homephone ); 115 addr.insertPhoneNumber( homephone );
116 } 116 }
117 117
118 if (!contact.homeFax().isEmpty()) 118 if (!contact.homeFax().isEmpty())
119 { 119 {
120 PhoneNumber homefax; 120 PhoneNumber homefax;
121 homefax.setType( PhoneNumber::Home | PhoneNumber::Fax ); 121 homefax.setType( PhoneNumber::Home | PhoneNumber::Fax );
122 homefax.setNumber( contact.homeFax() ); 122 homefax.setNumber( contact.homeFax() );
123 addr.insertPhoneNumber( homefax ); 123 addr.insertPhoneNumber( homefax );
124 } 124 }
125 125
126 if (!contact.homeMobile().isEmpty()) 126 if (!contact.homeMobile().isEmpty())
127 { 127 {
128 PhoneNumber homemobile; 128 PhoneNumber homemobile;
129 homemobile.setType( PhoneNumber::Home | PhoneNumber::Cell ); 129 homemobile.setType( PhoneNumber::Home | PhoneNumber::Cell );
130 homemobile.setNumber( contact.homeMobile() ); 130 homemobile.setNumber( contact.homeMobile() );
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
138 if ((!contact.businessStreet().isEmpty()) || 138 if ((!contact.businessStreet().isEmpty()) ||
139 (!contact.businessCity().isEmpty()) || 139 (!contact.businessCity().isEmpty()) ||
140 (!contact.businessState().isEmpty()) || 140 (!contact.businessState().isEmpty()) ||
141 (!contact.businessZip().isEmpty()) || 141 (!contact.businessZip().isEmpty()) ||
142 (!contact.businessCountry().isEmpty())) 142 (!contact.businessCountry().isEmpty()))
143 { 143 {
144 Address businessaddress; 144 Address businessaddress;
145 businessaddress.setType(Address::Work); 145 businessaddress.setType(Address::Work);
146//US businessaddress.setPostOfficeBox( "" ); 146//US businessaddress.setPostOfficeBox( "" );
147//US businessaddress.setExtended( "" ); 147//US businessaddress.setExtended( "" );
148 businessaddress.setStreet( contact.businessStreet() ); 148 businessaddress.setStreet( contact.businessStreet() );
149 businessaddress.setLocality( contact.businessCity() ); 149 businessaddress.setLocality( contact.businessCity() );
150 businessaddress.setRegion( contact.businessState() ); 150 businessaddress.setRegion( contact.businessState() );
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 {
160 PhoneNumber businessphone; 160 PhoneNumber businessphone;
161 businessphone.setType( PhoneNumber::Work ); 161 businessphone.setType( PhoneNumber::Work );
162 businessphone.setNumber( contact.businessPhone() ); 162 businessphone.setNumber( contact.businessPhone() );
163 addr.insertPhoneNumber( businessphone ); 163 addr.insertPhoneNumber( businessphone );
164 } 164 }
165 165
166 if (!contact.businessFax().isEmpty()) 166 if (!contact.businessFax().isEmpty())
167 { 167 {
168 PhoneNumber businessfax; 168 PhoneNumber businessfax;
169 businessfax.setType( PhoneNumber::Work | PhoneNumber::Fax ); 169 businessfax.setType( PhoneNumber::Work | PhoneNumber::Fax );
170 businessfax.setNumber( contact.businessFax() ); 170 businessfax.setNumber( contact.businessFax() );
171 addr.insertPhoneNumber( businessfax ); 171 addr.insertPhoneNumber( businessfax );
172 } 172 }
173 173
174 if (!contact.businessMobile().isEmpty()) 174 if (!contact.businessMobile().isEmpty())
175 { 175 {
176 PhoneNumber businessmobile; 176 PhoneNumber businessmobile;
177 businessmobile.setType( PhoneNumber::Work | PhoneNumber::Cell ); 177 businessmobile.setType( PhoneNumber::Work | PhoneNumber::Cell );
178 businessmobile.setNumber( contact.businessMobile() ); 178 businessmobile.setNumber( contact.businessMobile() );
179 addr.insertPhoneNumber( businessmobile ); 179 addr.insertPhoneNumber( businessmobile );
180 } 180 }
181 181
182 if (!contact.businessPager().isEmpty()) 182 if (!contact.businessPager().isEmpty())
183 { 183 {
184 PhoneNumber businesspager; 184 PhoneNumber businesspager;
185 businesspager.setType( PhoneNumber::Work | PhoneNumber::Pager ); 185 businesspager.setType( PhoneNumber::Work | PhoneNumber::Pager );
186 businesspager.setNumber( contact.businessPager() ); 186 businesspager.setNumber( contact.businessPager() );
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() );
192 addr.insertCustom( "KADDRESSBOOK", "X-Profession", contact.profession() ); 192 addr.insertCustom( "KADDRESSBOOK", "X-Profession", contact.profession() );
193 addr.insertCustom( "KADDRESSBOOK", "X-AssistantsName", contact.assistant() ); 193 addr.insertCustom( "KADDRESSBOOK", "X-AssistantsName", contact.assistant() );
194 addr.insertCustom( "KADDRESSBOOK", "X-Department", contact.department() ); 194 addr.insertCustom( "KADDRESSBOOK", "X-Department", contact.department() );
195 addr.insertCustom( "KADDRESSBOOK", "X-ManagersName", contact.manager() ); 195 addr.insertCustom( "KADDRESSBOOK", "X-ManagersName", contact.manager() );
196 addr.insertCustom( "KADDRESSBOOK", "X-Office", contact.office() ); 196 addr.insertCustom( "KADDRESSBOOK", "X-Office", contact.office() );
197 197
198 //personal 198 //personal
199 addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", contact.spouse() ); 199 addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", contact.spouse() );
200 // qtopia uses this categorization: 200 // qtopia uses this categorization:
201 // enum GenderType { UnspecifiedGender=0, Male, Female }; 201 // enum GenderType { UnspecifiedGender=0, Male, Female };
202 if (contact.gender() == PimContact::Male) 202 if (contact.gender() == PimContact::Male)
203 addr.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); 203 addr.insertCustom( "KADDRESSBOOK", "X-Gender", "male");
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
220 // others 220 // others
221 //US I put opies BusinessWebPage into Ka/Pi's notes block, because no other native field is available. 221 //US I put opies BusinessWebPage into Ka/Pi's notes block, because no other native field is available.
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;
234 234
235 for ( unsigned int i=0; i < catArray.size(); i++ ) { 235 for ( unsigned int i=0; i < catArray.size(); i++ ) {
236 cat = catDB->label("contact", catArray[i]); 236 cat = catDB->label("contact", catArray[i]);
237 if ( !cat.isEmpty() ) 237 if ( !cat.isEmpty() )
238 addr.insertCategory( cat ); 238 addr.insertCategory( cat );
239 } 239 }
240*/ 240*/
241 return true; 241 return true;
242} 242}
243 243
244bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, PimContact &contact ) 244bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, const SlZDataBase* database , const CardId &contact )
245{ 245{
246/*US 246/*US
247 // name 247 // name
248 contact.setLastName(addr.familyName()); 248 contact.setLastName(addr.familyName());
249 contact.setFirstName(addr.givenName()); 249 contact.setFirstName(addr.givenName());
250 contact.setMiddleName(addr.additionalName()); 250 contact.setMiddleName(addr.additionalName());
251 contact.setNameTitle(addr.prefix()); 251 contact.setNameTitle(addr.prefix());
252 contact.setSuffix(addr.suffix()); 252 contact.setSuffix(addr.suffix());
253 contact.setFileAs(); 253 contact.setFileAs();
254 254
255 255
256 // email 256 // email
257 QStringList emails = addr.emails(); 257 QStringList emails = addr.emails();
258 for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { 258 for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) {
259 contact.insertEmail(*it); 259 contact.insertEmail(*it);
260 } 260 }
261 contact.setDefaultEmail( addr.preferredEmail() ); 261 contact.setDefaultEmail( addr.preferredEmail() );
262 262
263 263
264 // home 264 // home
265 const Address homeaddress = addr.address(Address::Home); 265 const Address homeaddress = addr.address(Address::Home);
266 if (!homeaddress.isEmpty()) { 266 if (!homeaddress.isEmpty()) {
267 contact.setHomeStreet(homeaddress.street()); 267 contact.setHomeStreet(homeaddress.street());
268 contact.setHomeCity(homeaddress.locality()); 268 contact.setHomeCity(homeaddress.locality());
269 contact.setHomeState(homeaddress.region()); 269 contact.setHomeState(homeaddress.region());
270 contact.setHomeZip(homeaddress.postalCode()); 270 contact.setHomeZip(homeaddress.postalCode());
271 contact.setHomeCountry(homeaddress.country()); 271 contact.setHomeCountry(homeaddress.country());
272 } 272 }
273 273
274 PhoneNumber homephone = addr.phoneNumber( PhoneNumber::Home ); 274 PhoneNumber homephone = addr.phoneNumber( PhoneNumber::Home );
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
290 const Address businessaddress = addr.address(Address::Work); 290 const Address businessaddress = addr.address(Address::Work);
291 if (!businessaddress.isEmpty()) { 291 if (!businessaddress.isEmpty()) {
292 contact.setBusinessStreet(businessaddress.street()); 292 contact.setBusinessStreet(businessaddress.street());
293 contact.setBusinessCity(businessaddress.locality()); 293 contact.setBusinessCity(businessaddress.locality());
294 contact.setBusinessState(businessaddress.region()); 294 contact.setBusinessState(businessaddress.region());
295 contact.setBusinessZip(businessaddress.postalCode()); 295 contact.setBusinessZip(businessaddress.postalCode());
296 contact.setBusinessCountry(businessaddress.country()); 296 contact.setBusinessCountry(businessaddress.country());
297 } 297 }
298 298
299 PhoneNumber businessphone = addr.phoneNumber( PhoneNumber::Work ); 299 PhoneNumber businessphone = addr.phoneNumber( PhoneNumber::Work );
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())
313 contact.setBusinessPager(businesspager.number()); 313 contact.setBusinessPager(businesspager.number());
314 314
315 contact.setJobTitle(addr.role()); 315 contact.setJobTitle(addr.role());
316 contact.setCompany(addr.organization()); 316 contact.setCompany(addr.organization());
317 317
318 contact.setProfession(addr.custom( "KADDRESSBOOK", "X-Profession" )); 318 contact.setProfession(addr.custom( "KADDRESSBOOK", "X-Profession" ));
319 contact.setAssistant(addr.custom( "KADDRESSBOOK", "X-AssistantsName" )); 319 contact.setAssistant(addr.custom( "KADDRESSBOOK", "X-AssistantsName" ));
320 contact.setDepartment(addr.custom( "KADDRESSBOOK", "X-Department" )); 320 contact.setDepartment(addr.custom( "KADDRESSBOOK", "X-Department" ));
321 contact.setManager(addr.custom( "KADDRESSBOOK", "X-ManagersName" )); 321 contact.setManager(addr.custom( "KADDRESSBOOK", "X-ManagersName" ));
322 contact.setOffice(addr.custom( "KADDRESSBOOK", "X-Office" )); 322 contact.setOffice(addr.custom( "KADDRESSBOOK", "X-Office" ));
323 323
324 //personal 324 //personal
325 contact.setSpouse(addr.custom( "KADDRESSBOOK", "X-Spouse" )); 325 contact.setSpouse(addr.custom( "KADDRESSBOOK", "X-Spouse" ));
326 // qtopia uses this categorization: 326 // qtopia uses this categorization:
327 // enum GenderType { UnspecifiedGender=0, Male, Female }; 327 // enum GenderType { UnspecifiedGender=0, Male, Female };
328 QString gt = addr.custom( "KADDRESSBOOK", "X-Gender" ); 328 QString gt = addr.custom( "KADDRESSBOOK", "X-Gender" );
329 if (gt = "male") 329 if (gt = "male")
330 contact.setGender(PimContact::Male); 330 contact.setGender(PimContact::Male);
331 else if (gt = "female") 331 else if (gt = "female")
332 contact.setGender(PimContact::Female); 332 contact.setGender(PimContact::Female);
333 else 333 else
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());
345 345
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;
351 351
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() ) {
357 QArray<int> iar = catDB->ids("contact", cats); 357 QArray<int> iar = catDB->ids("contact", cats);
358 contact.setCategories(iar); 358 contact.setCategories(iar);
359 } 359 }
360*/ 360*/
361 return true; 361 return true;
362} 362}