phonebookui/pbkcommonui/src/cnteditviewitembuilder.cpp
changeset 61 d30183af6ca6
parent 47 7cbcb2896f0e
child 66 554fe4dbbb59
--- a/phonebookui/pbkcommonui/src/cnteditviewitembuilder.cpp	Wed Aug 11 09:06:35 2010 +0300
+++ b/phonebookui/pbkcommonui/src/cnteditviewitembuilder.cpp	Mon Aug 23 16:06:28 2010 +0300
@@ -172,7 +172,7 @@
     if ( addresses.isEmpty() )
     {
         QStringList fieldList;
-        fieldList << QContactAddress::FieldStreet << QContactAddress::FieldPostcode << QContactAddress::FieldPostOfficeBox;
+        fieldList << QContactAddress::FieldStreet << QContactAddress::FieldPostcode;
         fieldList << QContactAddress::FieldLocality << QContactAddress::FieldRegion << QContactAddress::FieldCountry;
               
         QContactAddress addr;
@@ -234,19 +234,23 @@
 {
     QList<CntEditViewItem*> list;
     // Address 
-    foreach( QContactAddress addr, aContact.details<QContactAddress>() )
+    foreach( QContactAddress addr, CntDetailOrderingHelper::getOrderedAddresses(aContact) )
     {
         QStringList fieldList;
-        fieldList << QContactAddress::FieldStreet << QContactAddress::FieldPostcode << QContactAddress::FieldPostOfficeBox;
+        fieldList << QContactAddress::FieldStreet << QContactAddress::FieldPostcode;
         fieldList << QContactAddress::FieldLocality << QContactAddress::FieldRegion << QContactAddress::FieldCountry;
         
         QStringList valueList;
         foreach ( QString str, fieldList )
         {
-            valueList << addr.value( str );
+            QString value = addr.value( str );
+            if ( !value.isEmpty() )
+            {
+                valueList << addr.value( str );
+            }
         }
             
-        QString address = valueList.join(" ").trimmed();
+        QString address = valueList.join(", ").trimmed();
         if ( !address.isEmpty() )
         {
             QString context = addr.contexts().isEmpty() ? "" : addr.contexts().first();
@@ -275,11 +279,14 @@
     // Company
     QContactOrganization org = aContact.detail<QContactOrganization>();
     QStringList detailList;
-    detailList << org.title();
-    detailList << org.name();
-    detailList << org.department().join(" ").trimmed();
+    if ( !org.title().isEmpty())
+        detailList << org.title();
+    if ( !org.name().isEmpty())
+        detailList << org.name();
+    if ( !org.department().isEmpty())
+        detailList << org.department().join(", ").trimmed();
 
-    QString company = detailList.join(" ").trimmed(); 
+    QString company = detailList.join(", ").trimmed(); 
     if ( !company.isEmpty() )
     {
         QStringList fields;