summaryrefslogtreecommitdiffabout
path: root/kabc
Side-by-side diff
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/converter/qtopia/qtopiaconverter.cpp98
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
@@ -50,8 +50,8 @@ bool QtopiaConverter::init()
{
catDB = new Categories();
-
- if (!catDB)
+
+ if (!catDB)
return false;
-
+
catDB->load( categoryFileName() );
return true;
@@ -60,5 +60,5 @@ bool QtopiaConverter::init()
void QtopiaConverter::deinit()
{
- if (catDB)
+ if (catDB)
{
delete catDB;
@@ -66,5 +66,5 @@ void QtopiaConverter::deinit()
}
}
-
+
bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &addr )
{
@@ -76,6 +76,6 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
addr.setPrefix( contact.nameTitle() );
addr.setSuffix( contact.suffix() );
-
-
+
+
// email
QStringList emails = contact.emailList();
@@ -84,7 +84,7 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
}
- if (!contact.defaultEmail().isEmpty())
+ if (!contact.defaultEmail().isEmpty())
addr.insertEmail(contact.defaultEmail(), true);
-
+
// home
if ((!contact.homeStreet().isEmpty()) ||
@@ -103,8 +103,8 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
homeaddress.setPostalCode( contact.homeZip() );
homeaddress.setCountry( contact.homeCountry() );
-
+
addr.insertAddress( homeaddress );
}
-
+
if (!contact.homePhone().isEmpty())
{
@@ -114,5 +114,5 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
addr.insertPhoneNumber( homephone );
}
-
+
if (!contact.homeFax().isEmpty())
{
@@ -122,5 +122,5 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
addr.insertPhoneNumber( homefax );
}
-
+
if (!contact.homeMobile().isEmpty())
{
@@ -130,7 +130,7 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
addr.insertPhoneNumber( homemobile );
}
-
+
addr.setUrl( contact.homeWebpage() );
-
+
// business
@@ -150,9 +150,9 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
businessaddress.setPostalCode( contact.businessZip() );
businessaddress.setCountry( contact.businessCountry() );
-
+
addr.insertAddress( businessaddress );
}
-
-
+
+
if (!contact.businessPhone().isEmpty())
{
@@ -162,5 +162,5 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
addr.insertPhoneNumber( businessphone );
}
-
+
if (!contact.businessFax().isEmpty())
{
@@ -170,5 +170,5 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
addr.insertPhoneNumber( businessfax );
}
-
+
if (!contact.businessMobile().isEmpty())
{
@@ -186,5 +186,5 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
addr.insertPhoneNumber( businesspager );
}
-
+
addr.setRole( contact.jobTitle() ); //?
addr.setOrganization( contact.company() );
@@ -203,16 +203,16 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
else if (contact.gender() == PimContact::Female)
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());
addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
}
-
+
addr.insertCustom( "KADDRESSBOOK", "X-Children", contact.children() );
if (contact.birthday().isValid())
addr.setBirthday( contact.birthday() );
-
+
addr.setNickName( contact.nickname() );
@@ -221,12 +221,12 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
QString notes = contact.notes();
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();
QString cat;
@@ -234,8 +234,10 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
for ( unsigned int i=0; i < catArray.size(); i++ ) {
cat = catDB->label("contact", catArray[i]);
- if ( !cat.isEmpty() )
+ if ( cat.isEmpty() )
+ addr.insertCategory(QString::number(catArray[i]));
+ else
addr.insertCategory( cat );
}
-
+
return true;
}
@@ -250,6 +252,6 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont
contact.setSuffix(addr.suffix());
contact.setFileAs();
-
-
+
+
// email
QStringList emails = addr.emails();
@@ -258,5 +260,5 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont
}
contact.setDefaultEmail( addr.preferredEmail() );
-
+
// home
@@ -273,15 +275,15 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont
if (!homephone.number().isEmpty())
contact.setHomePhone(homephone.number());
-
+
PhoneNumber homefax = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax );
if (!homefax.number().isEmpty())
contact.setHomeFax(homefax.number());
-
+
PhoneNumber homemobile = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Cell );
if (!homemobile.number().isEmpty())
contact.setHomeMobile(homemobile.number());
-
+
contact.setHomeWebpage(addr.url().url());
-
+
// business
@@ -298,13 +300,13 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont
if (!businessphone.number().isEmpty())
contact.setBusinessPhone(businessphone.number());
-
+
PhoneNumber businessfax = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax );
if (!businessfax.number().isEmpty())
contact.setBusinessFax(businessfax.number());
-
+
PhoneNumber businessmobile = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Cell );
if (!businessmobile.number().isEmpty())
contact.setBusinessMobile(businessmobile.number());
-
+
PhoneNumber businesspager = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Pager );
if (!businesspager.number().isEmpty())
@@ -332,11 +334,11 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont
contact.setGender(PimContact::UnspecifiedGender);
-
- 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());
contact.setNickname(addr.nickName());
@@ -344,5 +346,5 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont
// other
contact.setNotes(addr.note());
-
+
//US QString groups() const { return find( Qtopia::Groups ); }
//US QStringList groupList() const;
@@ -350,5 +352,5 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont
QStringList cats = addr.categories();
-
+
QArray<int> iar;
if ( !cats.isEmpty() ) {
@@ -356,5 +358,5 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont
contact.setCategories(iar);
}
-
+
return true;
}