author | ulf69 <ulf69> | 2004-07-02 15:36:32 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-07-02 15:36:32 (UTC) |
commit | ead0dcba2c607297137e2b47418eb17864e0caaa (patch) (unidiff) | |
tree | f222147cf9f591188853ba22adf981c7a6139ca1 /kabc | |
parent | b21b6754c93e5aaa53638a060e26f4efea755d37 (diff) | |
download | kdepimpi-ead0dcba2c607297137e2b47418eb17864e0caaa.zip kdepimpi-ead0dcba2c607297137e2b47418eb17864e0caaa.tar.gz kdepimpi-ead0dcba2c607297137e2b47418eb17864e0caaa.tar.bz2 |
improved conversion
-rw-r--r-- | kabc/converter/opie/opieconverter.cpp | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/kabc/converter/opie/opieconverter.cpp b/kabc/converter/opie/opieconverter.cpp index cfbe5c0..d785fbc 100644 --- a/kabc/converter/opie/opieconverter.cpp +++ b/kabc/converter/opie/opieconverter.cpp | |||
@@ -147,53 +147,63 @@ bool OpieConverter::opieToAddressee( OContact &contact, Addressee &addr ) | |||
147 | businesspager.setNumber( contact.businessPager() ); | 147 | businesspager.setNumber( contact.businessPager() ); |
148 | addr.insertPhoneNumber( businesspager ); | 148 | addr.insertPhoneNumber( businesspager ); |
149 | } | 149 | } |
150 | 150 | ||
151 | addr.setRole( contact.jobTitle() ); //? | 151 | addr.setRole( contact.jobTitle() ); //? |
152 | addr.setOrganization( contact.company() ); | 152 | addr.setOrganization( contact.company() ); |
153 | addr.insertCustom( "KADDRESSBOOK", "X-Profession", contact.profession() ); | 153 | addr.insertCustom( "KADDRESSBOOK", "X-Profession", contact.profession() ); |
154 | addr.insertCustom( "KADDRESSBOOK", "X-AssistantsName", contact.assistant() ); | 154 | addr.insertCustom( "KADDRESSBOOK", "X-AssistantsName", contact.assistant() ); |
155 | addr.insertCustom( "KADDRESSBOOK", "X-Department", contact.department() ); | 155 | addr.insertCustom( "KADDRESSBOOK", "X-Department", contact.department() ); |
156 | addr.insertCustom( "KADDRESSBOOK", "X-ManagersName", contact.manager() ); | 156 | addr.insertCustom( "KADDRESSBOOK", "X-ManagersName", contact.manager() ); |
157 | addr.insertCustom( "KADDRESSBOOK", "X-Office", contact.office() ); | 157 | addr.insertCustom( "KADDRESSBOOK", "X-Office", contact.office() ); |
158 | 158 | ||
159 | //??? | ||
160 | //US QString businessWebpage() const { return find( Qtopia::BusinessWebPage ); } | ||
161 | |||
162 | //personal | 159 | //personal |
163 | addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", contact.spouse() ); | 160 | addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", contact.spouse() ); |
164 | addr.insertCustom( "KADDRESSBOOK", "X-Gender", contact.gender() ); | 161 | addr.insertCustom( "KADDRESSBOOK", "X-Gender", contact.gender() ); |
165 | 162 | ||
166 | int orgformat = KGlobal::locale()->getIntDateFormat(); | 163 | if (contact.anniversary().isValid()) { |
167 | KGlobal::locale()->setIntDateFormat( 2 ); // = Qt::ISODate | 164 | int orgformat = KGlobal::locale()->getIntDateFormat(); |
168 | QString dt = KGlobal::locale()->formatDate(contact.anniversary(), true); | 165 | KGlobal::locale()->setIntDateFormat( 2 ); // = Qt::ISODate |
169 | KGlobal::locale()->setIntDateFormat(orgformat ); | 166 | QString dt = KGlobal::locale()->formatDate(contact.anniversary(), true); |
170 | addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); | 167 | //US |
168 | qDebug("OpieConverter::opieToAddressee found:%s", dt.latin1()); | ||
169 | KGlobal::locale()->setIntDateFormat(orgformat ); | ||
170 | addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); | ||
171 | } | ||
171 | 172 | ||
172 | addr.insertCustom( "KADDRESSBOOK", "X-Children", contact.children() ); | 173 | addr.insertCustom( "KADDRESSBOOK", "X-Children", contact.children() ); |
173 | addr.setBirthday( contact.birthday() ); | 174 | if (contact.birthday().isValid()) |
175 | addr.setBirthday( contact.birthday() ); | ||
176 | |||
174 | addr.setNickName( contact.nickname() ); | 177 | addr.setNickName( contact.nickname() ); |
175 | 178 | ||
176 | // other | 179 | // others |
180 | //US I put opies BusinessWebPage into Ka/Pi's notes block, because no other native field is available. | ||
181 | QString notes = contact.notes(); | ||
182 | notes += "\nBusinessWebPage: " + contact.businessWebpage() + "\n"; | ||
183 | |||
177 | addr.setNote( contact.notes() ); | 184 | addr.setNote( contact.notes() ); |
185 | |||
178 | 186 | ||
187 | |||
179 | //US QString groups() const { return find( Qtopia::Groups ); } | 188 | //US QString groups() const { return find( Qtopia::Groups ); } |
180 | //US QStringList groupList() const; | 189 | //US QStringList groupList() const; |
181 | 190 | ||
182 | /*US | 191 | |
183 | QStringList cats = contact.categoryNames("Contacts"); | 192 | QStringList cats = contact.categoryNames("Contacts"); |
184 | for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) { | 193 | for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) { |
185 | qDebug("Cat: %s", (*it).latin1()); | 194 | qDebug("Cat: %s", (*it).latin1()); |
186 | } | 195 | } |
187 | */ | 196 | |
197 | |||
188 | addr.setCategories( contact.categoryNames("Contacts") ); | 198 | addr.setCategories( contact.categoryNames("Contacts") ); |
189 | // qDebug("Groups: %s", contact.groups().latin1()); | 199 | // qDebug("Groups: %s", contact.groups().latin1()); |
190 | // addr.setCategories( contact.groupList() ); | 200 | // addr.setCategories( contact.groupList() ); |
191 | 201 | ||
192 | 202 | ||
193 | return true; | 203 | return true; |
194 | } | 204 | } |
195 | 205 | ||
196 | bool OpieConverter::addresseeToOpie( const Addressee &addr, OContact &contact ) | 206 | bool OpieConverter::addresseeToOpie( const Addressee &addr, OContact &contact ) |
197 | { | 207 | { |
198 | // name | 208 | // name |
199 | contact.setLastName(addr.familyName()); | 209 | contact.setLastName(addr.familyName()); |
@@ -302,24 +312,27 @@ bool OpieConverter::addresseeToOpie( const Addressee &addr, OContact &contact ) | |||
302 | // contact.categoryNames("Contacts"); | 312 | // contact.categoryNames("Contacts"); |
303 | // contact.setCategoryNames(addr.categories()); | 313 | // contact.setCategoryNames(addr.categories()); |
304 | 314 | ||
305 | /*US | 315 | /*US |
306 | QStringList cats = addr.categories(); | 316 | QStringList cats = addr.categories(); |
307 | QArray<int> cat(cats.count()); | 317 | QArray<int> cat(cats.count()); |
308 | int counter = 0; | 318 | int counter = 0; |
309 | for ( QStringList::ConstIterator it = cats.begin(); it != cats.end(); ++it ) | 319 | for ( QStringList::ConstIterator it = cats.begin(); it != cats.end(); ++it ) |
310 | cat[counter] = (*it).toInt(); | 320 | cat[counter] = (*it).toInt(); |
311 | 321 | ||
312 | contact.setCategories( cat ); | 322 | contact.setCategories( cat ); |
313 | */ | 323 | */ |
314 | /*US | 324 | |
315 | Categories catDB; | 325 | Categories catDB; |
316 | catDB.load( contact.categoryFileName() ); | 326 | catDB.dump(); |
327 | //US catDB.load( contact.categoryFileName() ); | ||
328 | catDB.load( "contact" ); | ||
317 | 329 | ||
318 | QStringList cats = addr.categories(); | 330 | QStringList cats = addr.categories(); |
319 | for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) { | 331 | for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) { |
320 | contact.setCategories(catDB.id(*it)); | 332 | qDebug("categories: %s", (*it).latin1()); |
333 | // contact.setCategories(catDB.id(*it)); | ||
321 | } | 334 | } |
322 | */ | 335 | |
323 | 336 | ||
324 | return true; | 337 | return true; |
325 | } | 338 | } |