56 createCallAction( *menu, aContact ); |
56 createCallAction( *menu, aContact ); |
57 } |
57 } |
58 |
58 |
59 if ( actions.contains("message", Qt::CaseInsensitive) ) |
59 if ( actions.contains("message", Qt::CaseInsensitive) ) |
60 { |
60 { |
61 createSmsAction( *menu, aContact ); |
61 createMessageAction( *menu, aContact ); |
62 } |
62 } |
63 |
63 |
64 if ( actions.contains("email", Qt::CaseInsensitive) ) |
64 if ( actions.contains("email", Qt::CaseInsensitive) ) |
65 { |
65 { |
66 createEmailAction( *menu, aContact ); |
66 createEmailAction( *menu, aContact ); |
78 menu->addAction(hbTrId("txt_common_menu_delete_contact"), this, SLOT(emitDeleteContact())); |
78 menu->addAction(hbTrId("txt_common_menu_delete_contact"), this, SLOT(emitDeleteContact())); |
79 } |
79 } |
80 return menu; |
80 return menu; |
81 } |
81 } |
82 |
82 |
83 void CntActionMenuBuilder::execActionMenu( QContact& aContact, QPointF aPoint ) |
83 HbMenu* CntActionMenuBuilder::actionMenu( QContact& aContact ) |
84 { |
84 { |
85 mContact = new QContact( aContact ); |
85 mContact = new QContact( aContact ); |
86 HbMenu* menu = buildActionMenu( aContact ); |
86 return buildActionMenu( aContact ); |
87 menu->exec( aPoint ); |
|
88 delete menu; |
|
89 } |
87 } |
90 |
88 |
91 void CntActionMenuBuilder::emitOpenContact() |
89 void CntActionMenuBuilder::emitOpenContact() |
92 { |
90 { |
93 emit openContact( *mContact ); |
91 emit openContact( *mContact ); |
121 void CntActionMenuBuilder::createCallAction( HbMenu& aMenu, QContact& aContact ) |
119 void CntActionMenuBuilder::createCallAction( HbMenu& aMenu, QContact& aContact ) |
122 { |
120 { |
123 // Create call action |
121 // Create call action |
124 QContactDetail detail = aContact.preferredDetail("call"); |
122 QContactDetail detail = aContact.preferredDetail("call"); |
125 QContactPhoneNumber number = detail.isEmpty() ? aContact.detail<QContactPhoneNumber>() : detail; |
123 QContactPhoneNumber number = detail.isEmpty() ? aContact.detail<QContactPhoneNumber>() : detail; |
126 |
124 QString context = number.contexts().isEmpty() ? QString() : number.contexts().first(); |
127 QString detailName = mMap->getMappedDetail( number.subTypes().first() ); |
125 QString subtype = number.subTypes().isEmpty() ? number.definitionName() : number.subTypes().first(); |
128 if (!number.contexts().isEmpty()) |
126 |
129 { |
127 aMenu.addAction( mMap->getItemSpecificMenuLocString( subtype, context ), this, SLOT(emitCallContact()) ); |
130 detailName += hbTrId(" %1").arg(mMap->getMappedDetail( number.contexts().first()) ); |
|
131 } |
|
132 aMenu.addAction( hbTrId("Call %1").arg(detailName), this, SLOT(emitCallContact()) ); |
|
133 } |
128 } |
134 |
129 |
135 void CntActionMenuBuilder::createEmailAction( HbMenu& aMenu, QContact& aContact ) |
130 void CntActionMenuBuilder::createEmailAction( HbMenu& aMenu, QContact& aContact ) |
136 { |
131 { |
|
132 // Create email action |
137 QContactDetail detail = aContact.preferredDetail("email"); |
133 QContactDetail detail = aContact.preferredDetail("email"); |
138 QContactEmailAddress email = detail.isEmpty() ? aContact.detail<QContactEmailAddress>() : detail; |
134 QContactEmailAddress email = detail.isEmpty() ? aContact.detail<QContactEmailAddress>() : detail; |
139 |
135 QString context = email.contexts().isEmpty() ? QString() : email.contexts().first(); |
140 QString detailName = hbTrId("txt_phob_menu_email"); |
136 |
141 if (!email.contexts().isEmpty()) |
137 aMenu.addAction( mMap->getItemSpecificMenuLocString( email.definitionName(), context), this, SLOT(emitMailContact()) ); |
142 { |
|
143 detailName += hbTrId(" %1").arg(mMap->getMappedDetail(email.contexts().first())); |
|
144 } |
|
145 aMenu.addAction(hbTrId("Mail %1").arg(detailName), this, SLOT(emitMailContact())); |
|
146 } |
138 } |
147 |
139 |
148 void CntActionMenuBuilder::createSmsAction( HbMenu& aMenu, QContact& aContact ) |
140 void CntActionMenuBuilder::createMessageAction( HbMenu& aMenu, QContact& aContact ) |
149 { |
141 { |
150 Q_UNUSED( aContact ) |
142 Q_UNUSED( aContact ); |
|
143 |
151 aMenu.addAction(hbTrId("txt_phob_menu_send_message"), this, SLOT(emitSmsContact())); |
144 aMenu.addAction(hbTrId("txt_phob_menu_send_message"), this, SLOT(emitSmsContact())); |
152 } |
145 } |
153 |
146 |
154 // End of File |
147 // End of File |