summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/qtopia/qtopiaconverter.cpp
Side-by-side diff
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
@@ -291,9 +291,12 @@ bool QtopiaConverter::qtopiaToAddressee( const QDomElement& el, Addressee &adr )
adr.insertCustom( "opie", "HomeWebPage", el.attribute( "HomeWebPage" ) );
if ( !el.attribute( "Spouse" ).isEmpty() )
adr.insertCustom( "KADDRESSBOOK", "X-SpousesName", el.attribute( "Spouse" ) );
- if ( !el.attribute( "Gender" ).isEmpty() )
- adr.insertCustom( "opie", "Gender", el.attribute( "Gender" ) );
-
+ if ( !el.attribute( "Gender" ).isEmpty() ) {
+ if ( el.attribute( "Gender" ) == "1" )
+ adr.insertCustom( "KADDRESSBOOK", "X-Gender", "male" );
+ else if ( el.attribute( "Gender" ) == "2" )
+ adr.insertCustom( "KADDRESSBOOK", "X-Gender", "female" );
+ }
QDate ann = dateFromString( el.attribute( "Anniversary" ) );
if ( ann.isValid() ) {
QString dt = KGlobal::locale()->formatDate(ann, true, KLocale::ISODate);
@@ -301,7 +304,7 @@ bool QtopiaConverter::qtopiaToAddressee( const QDomElement& el, Addressee &adr )
}
if ( !el.attribute( "Children" ).isEmpty() )
- adr.insertCustom("opie", "Children", el.attribute("Children") );
+ adr.insertCustom("KADDRESSBOOK", "X-Children", el.attribute("Children") );
if ( !el.attribute( "Office" ).isEmpty() )
adr.insertCustom("KADDRESSBOOK", "X-Office", el.attribute("Office") );
if ( !el.attribute( "Profession" ).isEmpty() )
@@ -384,15 +387,16 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &ab, QTextStream *strea
*stream << "HomeWebPage=\"" << escape( ab.custom( "opie", "HomeWebPage" ) ) << "\" ";
*stream << "Spouse=\"" << escape( ab.custom( "KADDRESSBOOK", "X-SpousesName") ) << "\" ";
- *stream << "Gender=\"" << escape( ab.custom( "opie", "Gender") ) << "\" ";
+ QString gen = "0";
+ if ( ab.custom( "KADDRESSBOOK", "X-Gender") == "male" )
+ gen = "1";
+ else if ( ab.custom( "KADDRESSBOOK", "X-Gender") == "female" )
+ gen = "2";
+ *stream << "Gender=\"" << escape( gen ) << "\" ";
if ( ab.birthday().date().isValid() )
*stream << "Birthday=\"" << escape( dateToString(ab.birthday().date() ) ) << "\" ";
- /*
- * Anniversary block again
- * Go from ISO -> QDate -> toString and then escape
- */
{
QDate ann = KGlobal::locale()->readDate( ab.custom("KADDRESSBOOK", "X-Anniversary" ),
"%Y-%m-%d");
@@ -401,7 +405,7 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &ab, QTextStream *strea
}
}
*stream << "Nickname=\"" << escape( ab.nickName() ) << "\" ";
- *stream << "Children=\"" << escape( ab.custom("opie", "Children" ) ) << "\" ";
+ *stream << "Children=\"" << escape( ab.custom("KADDRESSBOOK", "X-Children" ) ) << "\" ";
*stream << "Notes=\"" << escape( ab.note() ) << "\" ";
*stream << "Categories=\"" << categoriesToNumber( ab.categories(), "Contacts") << "\" ";