summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/converter/sharpdtm/sharpdtmconverter.cpp270
-rw-r--r--kabc/converter/sharpdtm/sharpdtmconverter.h2
2 files changed, 147 insertions, 125 deletions
diff --git a/kabc/converter/sharpdtm/sharpdtmconverter.cpp b/kabc/converter/sharpdtm/sharpdtmconverter.cpp
index 4cf2eb3..8f8334e 100644
--- a/kabc/converter/sharpdtm/sharpdtmconverter.cpp
+++ b/kabc/converter/sharpdtm/sharpdtmconverter.cpp
@@ -70,10 +70,12 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
70{ 70{
71/*US 71 SlZDataBase* db = (SlZDataBase*)database;
72 // name 72 // name
73 addr.setFormattedName(contact.fileAs()); 73 qDebug("SharpDTMConverter::sharpToAddressee check if the fileAs transformation works!!");
74 addr.setFamilyName( contact.lastName() ); 74 addr.setFormattedName(db->readField(ZdbAdrs::FileAs));
75 addr.setGivenName( contact.firstName() ); 75
76 addr.setAdditionalName( contact.middleName() ); 76 addr.setFamilyName( db->readField(ZdbAdrs::LastName) );
77 addr.setPrefix( contact.nameTitle() ); 77 addr.setGivenName( db->readField(ZdbAdrs::FirstName) );
78 addr.setSuffix( contact.suffix() ); 78 addr.setAdditionalName( db->readField(ZdbAdrs::MiddleName) );
79 addr.setPrefix( db->readField(ZdbAdrs::Title) );
80 addr.setSuffix( db->readField(ZdbAdrs::Suffix) );
79 81
@@ -81,16 +83,19 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
81 // email 83 // email
82 QStringList emails = contact.emailList(); 84 QString emailstr = db->readField(ZdbAdrs::Emails);
85 qDebug("SharpDTMConverter::sharpToAddressee whats the character to seperate the emailadresses? %s ", emailstr.latin1());
86 QStringList emails = QStringList::split(",", emailstr);
87
83 for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { 88 for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) {
84 addr.insertEmail( *it, ((*it) == contact.defaultEmail()) ); 89 addr.insertEmail( *it, ((*it) == db->readField(ZdbAdrs::DefaultEmail)) );
85 } 90 }
86 91
87 if (!contact.defaultEmail().isEmpty()) 92 if (!db->readField(ZdbAdrs::DefaultEmail).isEmpty())
88 addr.insertEmail(contact.defaultEmail(), true); 93 addr.insertEmail(db->readField(ZdbAdrs::DefaultEmail), true);
89 94
90 // home 95 // home
91 if ((!contact.homeStreet().isEmpty()) || 96 if ((!db->readField(ZdbAdrs::HomeStreet).isEmpty()) ||
92 (!contact.homeCity().isEmpty()) || 97 (!db->readField(ZdbAdrs::HomeCity).isEmpty()) ||
93 (!contact.homeState().isEmpty()) || 98 (!db->readField(ZdbAdrs::HomeState).isEmpty()) ||
94 (!contact.homeZip().isEmpty()) || 99 (!db->readField(ZdbAdrs::HomeZip).isEmpty()) ||
95 (!contact.homeCountry().isEmpty())) 100 (!db->readField(ZdbAdrs::HomeCountry).isEmpty()))
96 { 101 {
@@ -100,7 +105,7 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
100//US homeaddress.setExtended( "" ); 105//US homeaddress.setExtended( "" );
101 homeaddress.setStreet( contact.homeStreet() ); 106 homeaddress.setStreet( db->readField(ZdbAdrs::HomeStreet) );
102 homeaddress.setLocality( contact.homeCity() ); 107 homeaddress.setLocality( db->readField(ZdbAdrs::HomeCity) );
103 homeaddress.setRegion( contact.homeState() ); 108 homeaddress.setRegion( db->readField(ZdbAdrs::HomeState) );
104 homeaddress.setPostalCode( contact.homeZip() ); 109 homeaddress.setPostalCode( db->readField(ZdbAdrs::HomeZip) );
105 homeaddress.setCountry( contact.homeCountry() ); 110 homeaddress.setCountry( db->readField(ZdbAdrs::HomeCountry) );
106 111
@@ -109,3 +114,3 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
109 114
110 if (!contact.homePhone().isEmpty()) 115 if (!db->readField(ZdbAdrs::HomePhone).isEmpty())
111 { 116 {
@@ -113,3 +118,3 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
113 homephone.setType( PhoneNumber::Home ); 118 homephone.setType( PhoneNumber::Home );
114 homephone.setNumber( contact.homePhone() ); 119 homephone.setNumber( db->readField(ZdbAdrs::HomePhone) );
115 addr.insertPhoneNumber( homephone ); 120 addr.insertPhoneNumber( homephone );
@@ -117,3 +122,3 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
117 122
118 if (!contact.homeFax().isEmpty()) 123 if (!db->readField(ZdbAdrs::HomeFax).isEmpty())
119 { 124 {
@@ -121,3 +126,3 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
121 homefax.setType( PhoneNumber::Home | PhoneNumber::Fax ); 126 homefax.setType( PhoneNumber::Home | PhoneNumber::Fax );
122 homefax.setNumber( contact.homeFax() ); 127 homefax.setNumber( db->readField(ZdbAdrs::HomeFax) );
123 addr.insertPhoneNumber( homefax ); 128 addr.insertPhoneNumber( homefax );
@@ -125,3 +130,3 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
125 130
126 if (!contact.homeMobile().isEmpty()) 131 if (!db->readField(ZdbAdrs::HomeMobile).isEmpty())
127 { 132 {
@@ -129,3 +134,3 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
129 homemobile.setType( PhoneNumber::Home | PhoneNumber::Cell ); 134 homemobile.setType( PhoneNumber::Home | PhoneNumber::Cell );
130 homemobile.setNumber( contact.homeMobile() ); 135 homemobile.setNumber( db->readField(ZdbAdrs::HomeMobile) );
131 addr.insertPhoneNumber( homemobile ); 136 addr.insertPhoneNumber( homemobile );
@@ -133,3 +138,3 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
133 138
134 addr.setUrl( contact.homeWebpage() ); 139 addr.setUrl( db->readField(ZdbAdrs::HomeWebPage) );
135 140
@@ -137,7 +142,7 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
137 // business 142 // business
138 if ((!contact.businessStreet().isEmpty()) || 143 if ((!db->readField(ZdbAdrs::BusinessStreet).isEmpty()) ||
139 (!contact.businessCity().isEmpty()) || 144 (!db->readField(ZdbAdrs::BusinessCity).isEmpty()) ||
140 (!contact.businessState().isEmpty()) || 145 (!db->readField(ZdbAdrs::BusinessState).isEmpty()) ||
141 (!contact.businessZip().isEmpty()) || 146 (!db->readField(ZdbAdrs::BusinessZip).isEmpty()) ||
142 (!contact.businessCountry().isEmpty())) 147 (!db->readField(ZdbAdrs::BusinessCountry).isEmpty()))
143 { 148 {
@@ -147,7 +152,7 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
147//US businessaddress.setExtended( "" ); 152//US businessaddress.setExtended( "" );
148 businessaddress.setStreet( contact.businessStreet() ); 153 businessaddress.setStreet( db->readField(ZdbAdrs::BusinessStreet) );
149 businessaddress.setLocality( contact.businessCity() ); 154 businessaddress.setLocality( db->readField(ZdbAdrs::BusinessCity) );
150 businessaddress.setRegion( contact.businessState() ); 155 businessaddress.setRegion( db->readField(ZdbAdrs::BusinessState) );
151 businessaddress.setPostalCode( contact.businessZip() ); 156 businessaddress.setPostalCode( db->readField(ZdbAdrs::BusinessZip) );
152 businessaddress.setCountry( contact.businessCountry() ); 157 businessaddress.setCountry( db->readField(ZdbAdrs::BusinessCountry) );
153 158
@@ -157,3 +162,3 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
157 162
158 if (!contact.businessPhone().isEmpty()) 163 if (!db->readField(ZdbAdrs::BusinessPhone).isEmpty())
159 { 164 {
@@ -161,3 +166,3 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
161 businessphone.setType( PhoneNumber::Work ); 166 businessphone.setType( PhoneNumber::Work );
162 businessphone.setNumber( contact.businessPhone() ); 167 businessphone.setNumber( db->readField(ZdbAdrs::BusinessPhone) );
163 addr.insertPhoneNumber( businessphone ); 168 addr.insertPhoneNumber( businessphone );
@@ -165,3 +170,3 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
165 170
166 if (!contact.businessFax().isEmpty()) 171 if (!db->readField(ZdbAdrs::BusinessFax).isEmpty())
167 { 172 {
@@ -169,3 +174,3 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
169 businessfax.setType( PhoneNumber::Work | PhoneNumber::Fax ); 174 businessfax.setType( PhoneNumber::Work | PhoneNumber::Fax );
170 businessfax.setNumber( contact.businessFax() ); 175 businessfax.setNumber( db->readField(ZdbAdrs::BusinessFax) );
171 addr.insertPhoneNumber( businessfax ); 176 addr.insertPhoneNumber( businessfax );
@@ -173,3 +178,3 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
173 178
174 if (!contact.businessMobile().isEmpty()) 179 if (!db->readField(ZdbAdrs::BusinessMobile).isEmpty())
175 { 180 {
@@ -177,3 +182,3 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
177 businessmobile.setType( PhoneNumber::Work | PhoneNumber::Cell ); 182 businessmobile.setType( PhoneNumber::Work | PhoneNumber::Cell );
178 businessmobile.setNumber( contact.businessMobile() ); 183 businessmobile.setNumber( db->readField(ZdbAdrs::BusinessMobile) );
179 addr.insertPhoneNumber( businessmobile ); 184 addr.insertPhoneNumber( businessmobile );
@@ -181,3 +186,3 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
181 186
182 if (!contact.businessPager().isEmpty()) 187 if (!db->readField(ZdbAdrs::BusinessPager).isEmpty())
183 { 188 {
@@ -185,3 +190,3 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
185 businesspager.setType( PhoneNumber::Work | PhoneNumber::Pager ); 190 businesspager.setType( PhoneNumber::Work | PhoneNumber::Pager );
186 businesspager.setNumber( contact.businessPager() ); 191 businesspager.setNumber( db->readField(ZdbAdrs::BusinessPager) );
187 addr.insertPhoneNumber( businesspager ); 192 addr.insertPhoneNumber( businesspager );
@@ -189,21 +194,27 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
189 194
190 addr.setRole( contact.jobTitle() ); //? 195 addr.setRole( db->readField(ZdbAdrs::JobTitle) ); //?
191 addr.setOrganization( contact.company() ); 196 addr.setOrganization( db->readField(ZdbAdrs::Company) );
192 addr.insertCustom( "KADDRESSBOOK", "X-Profession", contact.profession() ); 197 addr.insertCustom( "KADDRESSBOOK", "X-Profession", db->readField(ZdbAdrs::Profession) );
193 addr.insertCustom( "KADDRESSBOOK", "X-AssistantsName", contact.assistant() ); 198 addr.insertCustom( "KADDRESSBOOK", "X-AssistantsName", db->readField(ZdbAdrs::Assistant) );
194 addr.insertCustom( "KADDRESSBOOK", "X-Department", contact.department() ); 199 addr.insertCustom( "KADDRESSBOOK", "X-Department", db->readField(ZdbAdrs::Department) );
195 addr.insertCustom( "KADDRESSBOOK", "X-ManagersName", contact.manager() ); 200 addr.insertCustom( "KADDRESSBOOK", "X-ManagersName", db->readField(ZdbAdrs::Manager) );
196 addr.insertCustom( "KADDRESSBOOK", "X-Office", contact.office() ); 201 addr.insertCustom( "KADDRESSBOOK", "X-Office", db->readField(ZdbAdrs::Office) );
197 202
198 //personal 203 //personal
199 addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", contact.spouse() ); 204 addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", db->readField(ZdbAdrs::Spouse) );
200 // qtopia uses this categorization: 205
201 // enum GenderType { UnspecifiedGender=0, Male, Female }; 206 QString gen = db->readField(ZdbAdrs::Gender);
202 if (contact.gender() == PimContact::Male) 207 qDebug("SharpDTMConverter::sharpToAddressee pleas check that gender works!! : Gender: %s", gen.latin1());
208 qDebug("SharpDTMConverter::sharpToAddressee: may be int db->readUshortField(\"ZdbAdrs::Gender\") is here better suited");
209
210 if (gen == "male")
203 addr.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); 211 addr.insertCustom( "KADDRESSBOOK", "X-Gender", "male");
204 else if (contact.gender() == PimContact::Female) 212 else if (gen == "female")
205 addr.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); 213 addr.insertCustom( "KADDRESSBOOK", "X-Gender", "female");
206 214
207 if (contact.anniversary().isValid()) { 215
208 QString dt = KGlobal::locale()->formatDate(contact.anniversary(), true, KLocale::ISODate); 216 QDate ann = db->readDateField(ZdbAdrs::Anniversary);
217
218 if (ann.isValid()) {
219 QString dt = KGlobal::locale()->formatDate(ann, true, KLocale::ISODate);
209//US 220//US
@@ -213,7 +224,10 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
213 224
214 addr.insertCustom( "KADDRESSBOOK", "X-Children", contact.children() ); 225 addr.insertCustom( "KADDRESSBOOK", "X-Children", db->readField(ZdbAdrs::Children) );
215 if (contact.birthday().isValid()) 226
216 addr.setBirthday( contact.birthday() ); 227
228 QDate birthd = db->readDateField(ZdbAdrs::Birthday);
229 if (birthd.isValid())
230 addr.setBirthday( birthd );
217 231
218 addr.setNickName( contact.nickname() ); 232 addr.setNickName( db->readField(ZdbAdrs::Nickname) );
219 233
@@ -221,6 +235,6 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
221 //US I put opies BusinessWebPage into Ka/Pi's notes block, because no other native field is available. 235 //US I put opies BusinessWebPage into Ka/Pi's notes block, because no other native field is available.
222 QString notes = contact.notes(); 236 QString notes = db->readField(ZdbAdrs::Notes);
223 notes += "\nBusinessWebPage: " + contact.businessWebpage() + "\n"; 237 notes += "\nBusinessWebPage: " + db->readField(ZdbAdrs::BusinessWebPage) + "\n";
224 238
225 addr.setNote( contact.notes() ); 239 addr.setNote( db->readField(ZdbAdrs::Notes) );
226 240
@@ -231,3 +245,4 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
231 245
232 QArray<int> catArray = contact.categories(); 246 qDebug("SharpDTMConverter::sharpToAddressee please check that the categories will be converted" );
247 QArray<int> catArray = db->readCategories();
233 QString cat; 248 QString cat;
@@ -235,7 +250,9 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
235 for ( unsigned int i=0; i < catArray.size(); i++ ) { 250 for ( unsigned int i=0; i < catArray.size(); i++ ) {
236 cat = catDB->label("contact", catArray[i]); 251 cat = catDB->label(catArray[i]);
237 if ( !cat.isEmpty() ) 252 if ( cat.isEmpty() )
253 addr.insertCategory(QString::number(catArray[i]));
254 else
238 addr.insertCategory( cat ); 255 addr.insertCategory( cat );
239 } 256 }
240*/ 257
241 return true; 258 return true;
@@ -243,12 +260,13 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
243 260
244bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, const SlZDataBase* database , const CardId &contact ) 261bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, SlZDataBase* database , const CardId &contact )
245{ 262{
246/*US
247 // name 263 // name
248 contact.setLastName(addr.familyName()); 264 database->writeField(ZdbAdrs::LastName, addr.familyName());
249 contact.setFirstName(addr.givenName()); 265 database->writeField(ZdbAdrs::FirstName, addr.givenName());
250 contact.setMiddleName(addr.additionalName()); 266 database->writeField(ZdbAdrs::MiddleName, addr.additionalName());
251 contact.setNameTitle(addr.prefix()); 267 database->writeField(ZdbAdrs::Title, addr.prefix());
252 contact.setSuffix(addr.suffix()); 268 database->writeField(ZdbAdrs::Suffix, addr.suffix());
253 contact.setFileAs(); 269
270 qDebug("SharpDTMConverter::addresseeToSharp check if the fileAs transformation works!!");
271 database->writeField(ZdbAdrs::FileAs, addr.formattedName());
254 272
@@ -256,7 +274,8 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, const SlZDataBa
256 // email 274 // email
257 QStringList emails = addr.emails(); 275 qDebug("SharpDTMConverter::addresseeToSharp check which seperator we need here for the emails!!");
258 for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { 276 qDebug("SharpDTMConverter::addresseeToSharp its probably the same from sharpToAddressee");
259 contact.insertEmail(*it); 277 QString emails = addr.emails().join(",");
260 } 278 database->writeField(ZdbAdrs::Emails, emails );
261 contact.setDefaultEmail( addr.preferredEmail() ); 279
280 database->writeField(ZdbAdrs::DefaultEmail, addr.preferredEmail() );
262 281
@@ -266,7 +285,7 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, const SlZDataBa
266 if (!homeaddress.isEmpty()) { 285 if (!homeaddress.isEmpty()) {
267 contact.setHomeStreet(homeaddress.street()); 286 database->writeField(ZdbAdrs::HomeStreet, homeaddress.street());
268 contact.setHomeCity(homeaddress.locality()); 287 database->writeField(ZdbAdrs::HomeCity, homeaddress.locality());
269 contact.setHomeState(homeaddress.region()); 288 database->writeField(ZdbAdrs::HomeState, homeaddress.region());
270 contact.setHomeZip(homeaddress.postalCode()); 289 database->writeField(ZdbAdrs::HomeZip, homeaddress.postalCode());
271 contact.setHomeCountry(homeaddress.country()); 290 database->writeField(ZdbAdrs::HomeCountry, homeaddress.country());
272 } 291 }
@@ -275,3 +294,3 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, const SlZDataBa
275 if (!homephone.number().isEmpty()) 294 if (!homephone.number().isEmpty())
276 contact.setHomePhone(homephone.number()); 295 database->writeField(ZdbAdrs::HomePhone, homephone.number());
277 296
@@ -279,3 +298,3 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, const SlZDataBa
279 if (!homefax.number().isEmpty()) 298 if (!homefax.number().isEmpty())
280 contact.setHomeFax(homefax.number()); 299 database->writeField(ZdbAdrs::HomeFax, homefax.number());
281 300
@@ -283,5 +302,5 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, const SlZDataBa
283 if (!homemobile.number().isEmpty()) 302 if (!homemobile.number().isEmpty())
284 contact.setHomeMobile(homemobile.number()); 303 database->writeField(ZdbAdrs::HomeMobile, homemobile.number());
285 304
286 contact.setHomeWebpage(addr.url().url()); 305 database->writeField(ZdbAdrs::HomeWebPage, addr.url().url());
287 306
@@ -291,7 +310,7 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, const SlZDataBa
291 if (!businessaddress.isEmpty()) { 310 if (!businessaddress.isEmpty()) {
292 contact.setBusinessStreet(businessaddress.street()); 311 database->writeField(ZdbAdrs::BusinessStreet, businessaddress.street());
293 contact.setBusinessCity(businessaddress.locality()); 312 database->writeField(ZdbAdrs::BusinessCity, businessaddress.locality());
294 contact.setBusinessState(businessaddress.region()); 313 database->writeField(ZdbAdrs::BusinessState, businessaddress.region());
295 contact.setBusinessZip(businessaddress.postalCode()); 314 database->writeField(ZdbAdrs::BusinessZip, businessaddress.postalCode());
296 contact.setBusinessCountry(businessaddress.country()); 315 database->writeField(ZdbAdrs::BusinessCountry, businessaddress.country());
297 } 316 }
@@ -300,3 +319,3 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, const SlZDataBa
300 if (!businessphone.number().isEmpty()) 319 if (!businessphone.number().isEmpty())
301 contact.setBusinessPhone(businessphone.number()); 320 database->writeField(ZdbAdrs::BusinessPhone, businessphone.number());
302 321
@@ -304,3 +323,3 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, const SlZDataBa
304 if (!businessfax.number().isEmpty()) 323 if (!businessfax.number().isEmpty())
305 contact.setBusinessFax(businessfax.number()); 324 database->writeField(ZdbAdrs::BusinessFax, businessfax.number());
306 325
@@ -308,3 +327,3 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, const SlZDataBa
308 if (!businessmobile.number().isEmpty()) 327 if (!businessmobile.number().isEmpty())
309 contact.setBusinessMobile(businessmobile.number()); 328 database->writeField(ZdbAdrs::BusinessMobile, businessmobile.number());
310 329
@@ -312,24 +331,26 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, const SlZDataBa
312 if (!businesspager.number().isEmpty()) 331 if (!businesspager.number().isEmpty())
313 contact.setBusinessPager(businesspager.number()); 332 database->writeField(ZdbAdrs::BusinessPager, businesspager.number());
314 333
315 contact.setJobTitle(addr.role()); 334 database->writeField(ZdbAdrs::JobTitle, addr.role());
316 contact.setCompany(addr.organization()); 335 database->writeField(ZdbAdrs::Company, addr.organization());
317 336
318 contact.setProfession(addr.custom( "KADDRESSBOOK", "X-Profession" )); 337 database->writeField(ZdbAdrs::Profession, addr.custom( "KADDRESSBOOK", "X-Profession" ));
319 contact.setAssistant(addr.custom( "KADDRESSBOOK", "X-AssistantsName" )); 338 database->writeField(ZdbAdrs::Assistant, addr.custom( "KADDRESSBOOK", "X-AssistantsName" ));
320 contact.setDepartment(addr.custom( "KADDRESSBOOK", "X-Department" )); 339 database->writeField(ZdbAdrs::Department, addr.custom( "KADDRESSBOOK", "X-Department" ));
321 contact.setManager(addr.custom( "KADDRESSBOOK", "X-ManagersName" )); 340 database->writeField(ZdbAdrs::Manager, addr.custom( "KADDRESSBOOK", "X-ManagersName" ));
322 contact.setOffice(addr.custom( "KADDRESSBOOK", "X-Office" )); 341 database->writeField(ZdbAdrs::Office, addr.custom( "KADDRESSBOOK", "X-Office" ));
323 342
324 //personal 343 //personal
325 contact.setSpouse(addr.custom( "KADDRESSBOOK", "X-Spouse" )); 344 database->writeField(ZdbAdrs::Spouse, addr.custom( "KADDRESSBOOK", "X-Spouse" ));
326 // qtopia uses this categorization: 345
327 // enum GenderType { UnspecifiedGender=0, Male, Female };
328 QString gt = addr.custom( "KADDRESSBOOK", "X-Gender" ); 346 QString gt = addr.custom( "KADDRESSBOOK", "X-Gender" );
347 qDebug("SharpDTMConverter::addresseeToSharp please check that gender works!! : Gender: %s", gt.latin1());
348 qDebug("SharpDTMConverter::addresseeToSharp: may be writeField(\"ZdbAdrs::Gender\", ushort) is here better suited?");
349 qDebug("SharpDTMConverter::addresseeToSharp: check also the reverse functionality in sharpToAddressee");
329 if (gt = "male") 350 if (gt = "male")
330 contact.setGender(PimContact::Male); 351 database->writeField(ZdbAdrs::Gender, "male");
331 else if (gt = "female") 352 else if (gt = "female")
332 contact.setGender(PimContact::Female); 353 database->writeField(ZdbAdrs::Gender, "female");
333 else 354 else
334 contact.setGender(PimContact::UnspecifiedGender); 355 database->writeField(ZdbAdrs::Gender, "");
335 356
@@ -338,11 +359,11 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, const SlZDataBa
338 addr.custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); // = Qt::ISODate 359 addr.custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); // = Qt::ISODate
339 contact.setAnniversary( dt ); 360 database->writeField(ZdbAdrs::Anniversary, dt );
340 361
341 contact.setChildren(addr.custom( "KADDRESSBOOK", "X-Children" )); 362 database->writeField(ZdbAdrs::Children, addr.custom( "KADDRESSBOOK", "X-Children" ));
342 363
343 contact.setBirthday(addr.birthday().date()); 364 database->writeField(ZdbAdrs::Birthday, addr.birthday().date());
344 contact.setNickname(addr.nickName()); 365 database->writeField(ZdbAdrs::Nickname, addr.nickName());
345 366
346 // other 367 // other
347 contact.setNotes(addr.note()); 368 database->writeField(ZdbAdrs::Notes, addr.note());
348 369
@@ -352,10 +373,11 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, const SlZDataBa
352 373
353 QStringList cats = addr.categories(); 374 qDebug("SharpDTMConverter::addresseeToSharp please check if category transformation works");
354 375
376 QStringList cats = addr.categories();
355 QArray<int> iar; 377 QArray<int> iar;
356 if ( !cats.isEmpty() ) { 378 if ( !cats.isEmpty() ) {
357 QArray<int> iar = catDB->ids("contact", cats); 379 QArray<int> iar = catDB->ids(cats);
358 contact.setCategories(iar); 380 database->updateCategories(contact, iar);
359 } 381 }
360*/ 382
361 return true; 383 return true;
diff --git a/kabc/converter/sharpdtm/sharpdtmconverter.h b/kabc/converter/sharpdtm/sharpdtmconverter.h
index 6a55431..99e0413 100644
--- a/kabc/converter/sharpdtm/sharpdtmconverter.h
+++ b/kabc/converter/sharpdtm/sharpdtmconverter.h
@@ -76,3 +76,3 @@ public:
76 */ 76 */
77 bool addresseeToSharp( const Addressee &addr, const SlZDataBase* database , const CardId &contact ); 77 bool addresseeToSharp( const Addressee &addr, SlZDataBase* database , const CardId &contact );
78 78