-rw-r--r-- | kabc/converter/qtopia/qtopiaconverter.cpp | 98 |
1 files changed, 50 insertions, 48 deletions
diff --git a/kabc/converter/qtopia/qtopiaconverter.cpp b/kabc/converter/qtopia/qtopiaconverter.cpp index 498e89e..ac513b6 100644 --- a/kabc/converter/qtopia/qtopiaconverter.cpp +++ b/kabc/converter/qtopia/qtopiaconverter.cpp @@ -51,6 +51,6 @@ bool QtopiaConverter::init() catDB = new Categories(); - - if (!catDB) + + if (!catDB) return false; - + catDB->load( categoryFileName() ); @@ -61,3 +61,3 @@ void QtopiaConverter::deinit() { - if (catDB) + if (catDB) { @@ -67,3 +67,3 @@ void QtopiaConverter::deinit() } - + bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &addr ) @@ -77,4 +77,4 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a addr.setSuffix( contact.suffix() ); - - + + // email @@ -85,5 +85,5 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a - if (!contact.defaultEmail().isEmpty()) + if (!contact.defaultEmail().isEmpty()) addr.insertEmail(contact.defaultEmail(), true); - + // home @@ -104,6 +104,6 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a homeaddress.setCountry( contact.homeCountry() ); - + addr.insertAddress( homeaddress ); } - + if (!contact.homePhone().isEmpty()) @@ -115,3 +115,3 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a } - + if (!contact.homeFax().isEmpty()) @@ -123,3 +123,3 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a } - + if (!contact.homeMobile().isEmpty()) @@ -131,5 +131,5 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a } - + addr.setUrl( contact.homeWebpage() ); - + @@ -151,7 +151,7 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a businessaddress.setCountry( contact.businessCountry() ); - + addr.insertAddress( businessaddress ); } - - + + if (!contact.businessPhone().isEmpty()) @@ -163,3 +163,3 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a } - + if (!contact.businessFax().isEmpty()) @@ -171,3 +171,3 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a } - + if (!contact.businessMobile().isEmpty()) @@ -187,3 +187,3 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a } - + addr.setRole( contact.jobTitle() ); //? @@ -204,6 +204,6 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a addr.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); - + if (contact.anniversary().isValid()) { QString dt = KGlobal::locale()->formatDate(contact.anniversary(), true, KLocale::ISODate); -//US +//US // qDebug("QtopiaConverter::qtopiaToAddressee found:%s", dt.latin1()); @@ -211,3 +211,3 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a } - + addr.insertCustom( "KADDRESSBOOK", "X-Children", contact.children() ); @@ -215,3 +215,3 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a addr.setBirthday( contact.birthday() ); - + addr.setNickName( contact.nickname() ); @@ -222,10 +222,10 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a notes += "\nBusinessWebPage: " + contact.businessWebpage() + "\n"; - + addr.setNote( contact.notes() ); - - + + //US QString groups() const { return find( Qtopia::Groups ); } //US QStringList groupList() const; - + QArray<int> catArray = contact.categories(); @@ -235,6 +235,8 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a cat = catDB->label("contact", catArray[i]); - if ( !cat.isEmpty() ) + if ( cat.isEmpty() ) + addr.insertCategory(QString::number(catArray[i])); + else addr.insertCategory( cat ); } - + return true; @@ -251,4 +253,4 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont contact.setFileAs(); - - + + // email @@ -259,3 +261,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont contact.setDefaultEmail( addr.preferredEmail() ); - + @@ -274,3 +276,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont contact.setHomePhone(homephone.number()); - + PhoneNumber homefax = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ); @@ -278,3 +280,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont contact.setHomeFax(homefax.number()); - + PhoneNumber homemobile = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Cell ); @@ -282,5 +284,5 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont contact.setHomeMobile(homemobile.number()); - + contact.setHomeWebpage(addr.url().url()); - + @@ -299,3 +301,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont contact.setBusinessPhone(businessphone.number()); - + PhoneNumber businessfax = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ); @@ -303,3 +305,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont contact.setBusinessFax(businessfax.number()); - + PhoneNumber businessmobile = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Cell ); @@ -307,3 +309,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont contact.setBusinessMobile(businessmobile.number()); - + PhoneNumber businesspager = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Pager ); @@ -333,9 +335,9 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont - - QDate dt = KGlobal::locale()->readDate( + + QDate dt = KGlobal::locale()->readDate( addr.custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); // = Qt::ISODate contact.setAnniversary( dt ); - + contact.setChildren(addr.custom( "KADDRESSBOOK", "X-Children" )); - + contact.setBirthday(addr.birthday().date()); @@ -345,3 +347,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont contact.setNotes(addr.note()); - + //US QString groups() const { return find( Qtopia::Groups ); } @@ -351,3 +353,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont QStringList cats = addr.categories(); - + QArray<int> iar; @@ -357,3 +359,3 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont } - + return true; |