summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/sharpdtm/sharpdtmconverter.cpp
Side-by-side diff
Diffstat (limited to 'kabc/plugins/sharpdtm/sharpdtmconverter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/sharpdtm/sharpdtmconverter.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/kabc/plugins/sharpdtm/sharpdtmconverter.cpp b/kabc/plugins/sharpdtm/sharpdtmconverter.cpp
index f3bf2c5..fccf625 100644
--- a/kabc/plugins/sharpdtm/sharpdtmconverter.cpp
+++ b/kabc/plugins/sharpdtm/sharpdtmconverter.cpp
@@ -286,8 +286,19 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, SlZDataBase* da
database->writeField(ZdbAdrs::Suffix, addr.suffix());
//qDebug("SharpDTMConverter::addresseeToSharp check if the fileAs transformation works!!\n%s",addr.formattedName().latin1() );
- database->writeField(ZdbAdrs::FileAs, addr.formattedName());
- database->writeField(ZdbAdrs::FullName, addr.formattedName());
+ QString formattedName = addr.formattedName();
+ if ( formattedName.isEmpty() ) {
+ if ( !addr.familyName().isEmpty() ) {
+ formattedName = addr.familyName();
+ if ( !addr.givenName().isEmpty() ) {
+ formattedName += ", ";
+ formattedName += addr.givenName();
+ }
+ } else
+ formattedName = addr.givenName();
+ }
+ database->writeField(ZdbAdrs::FileAs, formattedName);
+ database->writeField(ZdbAdrs::FullName, formattedName);
// email
//qDebug("SharpDTMConverter::addresseeToSharp check which seperator we need here for the emails!!");
@@ -349,7 +360,7 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, SlZDataBase* da
database->writeField(ZdbAdrs::BusinessMobile, businessmobile.number());
}
PhoneNumber mobile = addr.phoneNumber( PhoneNumber::Cell );
- if (!businessmobile.number().isEmpty()) {
+ if (! mobile.number().isEmpty()) {
if ( ! cellHome )
database->writeField(ZdbAdrs::HomeMobile, mobile.number());
else if (! cellWork )