summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/qtopia/qtopiaconverter.cpp
authorzautrix <zautrix>2004-10-20 21:49:51 (UTC)
committer zautrix <zautrix>2004-10-20 21:49:51 (UTC)
commitbb235c5a639b914574e1e247d2de6e479517585f (patch) (unidiff)
tree0f074ec87d93b6f5fb81b6893f0174cabc52c1df /kabc/plugins/qtopia/qtopiaconverter.cpp
parent8e00329a4a5f0b66d26d20f067ab6aefca17f17a (diff)
downloadkdepimpi-bb235c5a639b914574e1e247d2de6e479517585f.zip
kdepimpi-bb235c5a639b914574e1e247d2de6e479517585f.tar.gz
kdepimpi-bb235c5a639b914574e1e247d2de6e479517585f.tar.bz2
qtopia resource fixes
Diffstat (limited to 'kabc/plugins/qtopia/qtopiaconverter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/qtopia/qtopiaconverter.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/kabc/plugins/qtopia/qtopiaconverter.cpp b/kabc/plugins/qtopia/qtopiaconverter.cpp
index 040226c..106596f 100644
--- a/kabc/plugins/qtopia/qtopiaconverter.cpp
+++ b/kabc/plugins/qtopia/qtopiaconverter.cpp
@@ -290,19 +290,22 @@ bool QtopiaConverter::qtopiaToAddressee( const QDomElement& el, Addressee &adr )
290 if ( !el.attribute( "HomeWebPage" ).isEmpty() ) 290 if ( !el.attribute( "HomeWebPage" ).isEmpty() )
291 adr.insertCustom( "opie", "HomeWebPage", el.attribute( "HomeWebPage" ) ); 291 adr.insertCustom( "opie", "HomeWebPage", el.attribute( "HomeWebPage" ) );
292 if ( !el.attribute( "Spouse" ).isEmpty() ) 292 if ( !el.attribute( "Spouse" ).isEmpty() )
293 adr.insertCustom( "KADDRESSBOOK", "X-SpousesName", el.attribute( "Spouse" ) ); 293 adr.insertCustom( "KADDRESSBOOK", "X-SpousesName", el.attribute( "Spouse" ) );
294 if ( !el.attribute( "Gender" ).isEmpty() ) 294 if ( !el.attribute( "Gender" ).isEmpty() ) {
295 adr.insertCustom( "opie", "Gender", el.attribute( "Gender" ) ); 295 if ( el.attribute( "Gender" ) == "1" )
296 296 adr.insertCustom( "KADDRESSBOOK", "X-Gender", "male" );
297 else if ( el.attribute( "Gender" ) == "2" )
298 adr.insertCustom( "KADDRESSBOOK", "X-Gender", "female" );
299 }
297 QDate ann = dateFromString( el.attribute( "Anniversary" ) ); 300 QDate ann = dateFromString( el.attribute( "Anniversary" ) );
298 if ( ann.isValid() ) { 301 if ( ann.isValid() ) {
299 QString dt = KGlobal::locale()->formatDate(ann, true, KLocale::ISODate); 302 QString dt = KGlobal::locale()->formatDate(ann, true, KLocale::ISODate);
300 adr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt ); 303 adr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt );
301 } 304 }
302 305
303 if ( !el.attribute( "Children" ).isEmpty() ) 306 if ( !el.attribute( "Children" ).isEmpty() )
304 adr.insertCustom("opie", "Children", el.attribute("Children") ); 307 adr.insertCustom("KADDRESSBOOK", "X-Children", el.attribute("Children") );
305 if ( !el.attribute( "Office" ).isEmpty() ) 308 if ( !el.attribute( "Office" ).isEmpty() )
306 adr.insertCustom("KADDRESSBOOK", "X-Office", el.attribute("Office") ); 309 adr.insertCustom("KADDRESSBOOK", "X-Office", el.attribute("Office") );
307 if ( !el.attribute( "Profession" ).isEmpty() ) 310 if ( !el.attribute( "Profession" ).isEmpty() )
308 adr.insertCustom("KADDRESSBOOK", "X-Profession", el.attribute("Profession") ); 311 adr.insertCustom("KADDRESSBOOK", "X-Profession", el.attribute("Profession") );
@@ -383,26 +386,27 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &ab, QTextStream *strea
383 *stream << "HomeCountry=\"" << escape( home.country() ) << "\" "; 386 *stream << "HomeCountry=\"" << escape( home.country() ) << "\" ";
384 387
385 *stream << "HomeWebPage=\"" << escape( ab.custom( "opie", "HomeWebPage" ) ) << "\" "; 388 *stream << "HomeWebPage=\"" << escape( ab.custom( "opie", "HomeWebPage" ) ) << "\" ";
386 *stream << "Spouse=\"" << escape( ab.custom( "KADDRESSBOOK", "X-SpousesName") ) << "\" "; 389 *stream << "Spouse=\"" << escape( ab.custom( "KADDRESSBOOK", "X-SpousesName") ) << "\" ";
387 *stream << "Gender=\"" << escape( ab.custom( "opie", "Gender") ) << "\" "; 390 QString gen = "0";
391 if ( ab.custom( "KADDRESSBOOK", "X-Gender") == "male" )
392 gen = "1";
393 else if ( ab.custom( "KADDRESSBOOK", "X-Gender") == "female" )
394 gen = "2";
395 *stream << "Gender=\"" << escape( gen ) << "\" ";
388 396
389 if ( ab.birthday().date().isValid() ) 397 if ( ab.birthday().date().isValid() )
390 *stream << "Birthday=\"" << escape( dateToString(ab.birthday().date() ) ) << "\" "; 398 *stream << "Birthday=\"" << escape( dateToString(ab.birthday().date() ) ) << "\" ";
391 399
392 /*
393 * Anniversary block again
394 * Go from ISO -> QDate -> toString and then escape
395 */
396 { 400 {
397 QDate ann = KGlobal::locale()->readDate( ab.custom("KADDRESSBOOK", "X-Anniversary" ), 401 QDate ann = KGlobal::locale()->readDate( ab.custom("KADDRESSBOOK", "X-Anniversary" ),
398 "%Y-%m-%d"); 402 "%Y-%m-%d");
399 if (ann.isValid() ) { 403 if (ann.isValid() ) {
400 *stream << "Anniversary=\"" << escape( dateToString( ann ) ) << "\" "; 404 *stream << "Anniversary=\"" << escape( dateToString( ann ) ) << "\" ";
401 } 405 }
402 } 406 }
403 *stream << "Nickname=\"" << escape( ab.nickName() ) << "\" "; 407 *stream << "Nickname=\"" << escape( ab.nickName() ) << "\" ";
404 *stream << "Children=\"" << escape( ab.custom("opie", "Children" ) ) << "\" "; 408 *stream << "Children=\"" << escape( ab.custom("KADDRESSBOOK", "X-Children" ) ) << "\" ";
405 *stream << "Notes=\"" << escape( ab.note() ) << "\" "; 409 *stream << "Notes=\"" << escape( ab.note() ) << "\" ";
406 *stream << "Categories=\"" << categoriesToNumber( ab.categories(), "Contacts") << "\" "; 410 *stream << "Categories=\"" << categoriesToNumber( ab.categories(), "Contacts") << "\" ";
407 411
408 QString uid = ab.uid(); 412 QString uid = ab.uid();