phonebookui/pbkcommonui/src/cnteditviewitembuilder.cpp
changeset 46 efe85016a067
parent 40 b46a585f6909
child 47 7cbcb2896f0e
--- a/phonebookui/pbkcommonui/src/cnteditviewitembuilder.cpp	Fri Jun 11 13:29:23 2010 +0300
+++ b/phonebookui/pbkcommonui/src/cnteditviewitembuilder.cpp	Wed Jun 23 18:02:44 2010 +0300
@@ -19,6 +19,7 @@
 #include "cnteditviewdetailitem.h"
 #include "cntviewparams.h"
 #include "cntstringmapper.h"
+#include "cntdetailorderinghelper.h"
 #include <hbnumbergrouping.h>
 
 CntEditViewItemBuilder::CntEditViewItemBuilder() :
@@ -34,7 +35,7 @@
 QList<CntEditViewItem*> CntEditViewItemBuilder::phoneNumberItems(QContact& aContact)
 {
     QList<CntEditViewItem*> list;
-    QList<QContactPhoneNumber> numbers = aContact.details<QContactPhoneNumber>();
+    QList<QContactPhoneNumber> numbers = CntDetailOrderingHelper::getOrderedSupportedPhoneNumbers(aContact);
     // template for editor launcher
     if ( numbers.isEmpty() ) 
     {
@@ -52,16 +53,14 @@
     {
         foreach ( QContactPhoneNumber number, numbers )
         {
-            if ( !number.subTypes().isEmpty() )
-            {
             QString context = number.contexts().isEmpty() ? "" : number.contexts().first();
             QString subtype = number.subTypes().first();
-            
+
             CntEditViewDetailItem* detailItem = new CntEditViewDetailItem(
                     number,
                     QContactPhoneNumber::FieldNumber,
                     phoneNumberEditorView);
-            
+
             detailItem->addIcon( mMap->getContactEditorIconString(subtype, context) );
             detailItem->addText( mMap->getContactEditorLocString(subtype, context) );
             /*
@@ -71,11 +70,10 @@
             //detailItem->addText( HbNumberGrouping::formatPhoneNumber(number.number())); 
             detailItem->addText( number.number());
             list.append( detailItem );
-            }
         }
     }
     
-    QList<QContactOnlineAccount> urls = aContact.details<QContactOnlineAccount>();
+    QList<QContactOnlineAccount> urls = CntDetailOrderingHelper::getOrderedSupportedOnlineAccounts(aContact);
     // template for editor launcher
     if ( !urls.isEmpty() ) 
     {
@@ -113,6 +111,7 @@
                 else
                 {
                     /* Other subtypes of QContactOnlineAccount are not supported by UI */
+                    delete detailItem;
                 }
             }
         }
@@ -124,7 +123,7 @@
 QList<CntEditViewItem*> CntEditViewItemBuilder::emailAddressItems(QContact& aContact)
 {
     QList<CntEditViewItem*> list;
-    QList<QContactEmailAddress> emails = aContact.details<QContactEmailAddress>();
+    QList<QContactEmailAddress> emails = CntDetailOrderingHelper::getOrderedEmailAccounts(aContact);
     // template for editor launcher
     if ( emails.isEmpty() ) 
     {
@@ -190,7 +189,7 @@
 QList<CntEditViewItem*> CntEditViewItemBuilder::urlItems(QContact& aContact)
 {
     QList<CntEditViewItem*> list;
-    QList<QContactUrl> urls = aContact.details<QContactUrl>();
+    QList<QContactUrl> urls = CntDetailOrderingHelper::getOrderedUrls(aContact);
     // template for editor launcher
     if ( urls.isEmpty() ) 
     {