17 #include "cnteditviewitembuilder.h" |
17 #include "cnteditviewitembuilder.h" |
18 #include "cnteditviewlistmodel.h" |
18 #include "cnteditviewlistmodel.h" |
19 #include "cnteditviewdetailitem.h" |
19 #include "cnteditviewdetailitem.h" |
20 #include "cntviewparams.h" |
20 #include "cntviewparams.h" |
21 #include "cntstringmapper.h" |
21 #include "cntstringmapper.h" |
|
22 #include "cntdetailorderinghelper.h" |
22 #include <hbnumbergrouping.h> |
23 #include <hbnumbergrouping.h> |
23 |
24 |
24 CntEditViewItemBuilder::CntEditViewItemBuilder() : |
25 CntEditViewItemBuilder::CntEditViewItemBuilder() : |
25 mMap( new CntStringMapper() ) |
26 mMap( new CntStringMapper() ) |
26 { |
27 { |
32 } |
33 } |
33 |
34 |
34 QList<CntEditViewItem*> CntEditViewItemBuilder::phoneNumberItems(QContact& aContact) |
35 QList<CntEditViewItem*> CntEditViewItemBuilder::phoneNumberItems(QContact& aContact) |
35 { |
36 { |
36 QList<CntEditViewItem*> list; |
37 QList<CntEditViewItem*> list; |
37 QList<QContactPhoneNumber> numbers = aContact.details<QContactPhoneNumber>(); |
38 QList<QContactPhoneNumber> numbers = CntDetailOrderingHelper::getOrderedSupportedPhoneNumbers(aContact); |
38 // template for editor launcher |
39 // template for editor launcher |
39 if ( numbers.isEmpty() ) |
40 if ( numbers.isEmpty() ) |
40 { |
41 { |
41 QContactPhoneNumber number; |
42 QContactPhoneNumber number; |
42 CntEditViewDetailItem* detailItem = new CntEditViewDetailItem( |
43 CntEditViewDetailItem* detailItem = new CntEditViewDetailItem( |
50 // existing phonenumber(s) |
51 // existing phonenumber(s) |
51 else |
52 else |
52 { |
53 { |
53 foreach ( QContactPhoneNumber number, numbers ) |
54 foreach ( QContactPhoneNumber number, numbers ) |
54 { |
55 { |
55 if ( !number.subTypes().isEmpty() ) |
|
56 { |
|
57 QString context = number.contexts().isEmpty() ? "" : number.contexts().first(); |
56 QString context = number.contexts().isEmpty() ? "" : number.contexts().first(); |
58 QString subtype = number.subTypes().first(); |
57 QString subtype = number.subTypes().first(); |
59 |
58 |
60 CntEditViewDetailItem* detailItem = new CntEditViewDetailItem( |
59 CntEditViewDetailItem* detailItem = new CntEditViewDetailItem( |
61 number, |
60 number, |
62 QContactPhoneNumber::FieldNumber, |
61 QContactPhoneNumber::FieldNumber, |
63 phoneNumberEditorView); |
62 phoneNumberEditorView); |
64 |
63 |
65 detailItem->addIcon( mMap->getContactEditorIconString(subtype, context) ); |
64 detailItem->addIcon( mMap->getContactEditorIconString(subtype, context) ); |
66 detailItem->addText( mMap->getContactEditorLocString(subtype, context) ); |
65 detailItem->addText( mMap->getContactEditorLocString(subtype, context) ); |
67 /* |
66 /* |
68 * Internationalization support, activate the following code |
67 * Internationalization support, activate the following code |
69 * when support available from Orbit |
68 * when support available from Orbit |
70 */ |
69 */ |
71 //detailItem->addText( HbNumberGrouping::formatPhoneNumber(number.number())); |
70 //detailItem->addText( HbNumberGrouping::formatPhoneNumber(number.number())); |
72 detailItem->addText( number.number()); |
71 detailItem->addText( number.number()); |
73 list.append( detailItem ); |
72 list.append( detailItem ); |
74 } |
|
75 } |
73 } |
76 } |
74 } |
77 |
75 |
78 QList<QContactOnlineAccount> urls = aContact.details<QContactOnlineAccount>(); |
76 QList<QContactOnlineAccount> urls = CntDetailOrderingHelper::getOrderedSupportedOnlineAccounts(aContact); |
79 // template for editor launcher |
77 // template for editor launcher |
80 if ( !urls.isEmpty() ) |
78 if ( !urls.isEmpty() ) |
81 { |
79 { |
82 foreach ( QContactOnlineAccount number, urls ) |
80 foreach ( QContactOnlineAccount number, urls ) |
83 { |
81 { |
122 } |
121 } |
123 |
122 |
124 QList<CntEditViewItem*> CntEditViewItemBuilder::emailAddressItems(QContact& aContact) |
123 QList<CntEditViewItem*> CntEditViewItemBuilder::emailAddressItems(QContact& aContact) |
125 { |
124 { |
126 QList<CntEditViewItem*> list; |
125 QList<CntEditViewItem*> list; |
127 QList<QContactEmailAddress> emails = aContact.details<QContactEmailAddress>(); |
126 QList<QContactEmailAddress> emails = CntDetailOrderingHelper::getOrderedEmailAccounts(aContact); |
128 // template for editor launcher |
127 // template for editor launcher |
129 if ( emails.isEmpty() ) |
128 if ( emails.isEmpty() ) |
130 { |
129 { |
131 QContactEmailAddress email; |
130 QContactEmailAddress email; |
132 CntEditViewDetailItem* detailItem = new CntEditViewDetailItem( |
131 CntEditViewDetailItem* detailItem = new CntEditViewDetailItem( |
188 } |
187 } |
189 |
188 |
190 QList<CntEditViewItem*> CntEditViewItemBuilder::urlItems(QContact& aContact) |
189 QList<CntEditViewItem*> CntEditViewItemBuilder::urlItems(QContact& aContact) |
191 { |
190 { |
192 QList<CntEditViewItem*> list; |
191 QList<CntEditViewItem*> list; |
193 QList<QContactUrl> urls = aContact.details<QContactUrl>(); |
192 QList<QContactUrl> urls = CntDetailOrderingHelper::getOrderedUrls(aContact); |
194 // template for editor launcher |
193 // template for editor launcher |
195 if ( urls.isEmpty() ) |
194 if ( urls.isEmpty() ) |
196 { |
195 { |
197 QContactUrl url; |
196 QContactUrl url; |
198 CntEditViewDetailItem* detailItem = new CntEditViewDetailItem( |
197 CntEditViewDetailItem* detailItem = new CntEditViewDetailItem( |