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 | |
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 | |||
@@ -156,35 +156,45 @@ bool OpieConverter::opieToAddressee( OContact &contact, Addressee &addr ) | |||
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() ); |
@@ -311,15 +321,18 @@ bool OpieConverter::addresseeToOpie( const Addressee &addr, OContact &contact ) | |||
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 | } |