summaryrefslogtreecommitdiff
path: root/lib-phone/ph-speeddial/src/PhSpeedDialItem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib-phone/ph-speeddial/src/PhSpeedDialItem.cpp')
-rw-r--r--lib-phone/ph-speeddial/src/PhSpeedDialItem.cpp36
1 files changed, 7 insertions, 29 deletions
diff --git a/lib-phone/ph-speeddial/src/PhSpeedDialItem.cpp b/lib-phone/ph-speeddial/src/PhSpeedDialItem.cpp
index f8e6f93..da6338c 100644
--- a/lib-phone/ph-speeddial/src/PhSpeedDialItem.cpp
+++ b/lib-phone/ph-speeddial/src/PhSpeedDialItem.cpp
@@ -35,15 +35,10 @@ namespace
}
PhSpeedDialItem::PhSpeedDialItem(int number)
- : m_Number(number), m_Chooser(nullptr)
+ : m_Number(number)
{
}
-PhSpeedDialItem::~PhSpeedDialItem()
-{
- closeChooser();
-}
-
void PhSpeedDialItem::setData(contacts_record_h record)
{
if (record) {
@@ -115,27 +110,18 @@ void PhSpeedDialItem::fetchData()
contacts_record_destroy(record, true);
}
-void PhSpeedDialItem::closeChooser()
-{
- if (m_Chooser) {
- app_control_send_terminate_request(m_Chooser);
- app_control_destroy(m_Chooser);
- m_Chooser = nullptr;
- }
-}
-
void PhSpeedDialItem::onPickResult(app_control_h request, app_control_h reply,
app_control_result_e result, void *data)
{
PhSpeedDialItem *item = (PhSpeedDialItem*) data;
- char **numberIds = nullptr;
- int count = 0;
- int err = app_control_get_extra_data_array(reply, APP_CONTROL_DATA_SELECTED, &numberIds, &count);
+ char *value = nullptr;
+ int err = app_control_get_extra_data(reply, APP_CONTROL_DATA_SELECTED, &value);
WPRET_M(err != APP_CONTROL_ERROR_NONE, "app_control_get_extra_data() failed(%d)", err);
- if (numberIds && numberIds[0]) {
- int numberId = atoi(numberIds[0]);
+ if (value) {
+ int numberId = atoi(value);
+ free(value);
if (PhCommon::addSpeedDialNumber(item->m_Number, numberId)) {
item->fetchData();
@@ -143,20 +129,12 @@ void PhSpeedDialItem::onPickResult(app_control_h request, app_control_h reply,
notification_status_message_post(PAT_("IDS_PB_POP_ALREADY_EXISTS_LC"));
}
}
-
- for (int i = 0; i < count; ++i) {
- free(numberIds[i]);
- }
- free(numberIds);
}
void PhSpeedDialItem::onItemPressed(void *data, Evas_Object *obj, void *event_info)
{
- PhSpeedDialItem *item = (PhSpeedDialItem*) data;
- item->closeChooser();
-
int err = launchContactPick(APP_CONTROL_DATA_SELECTION_MODE_SINGLE, APP_CONTROL_DATA_TYPE_PHONE,
- &PhSpeedDialItem::onPickResult, data, true, &item->m_Chooser);
+ &PhSpeedDialItem::onPickResult, data);
WPWARN(err != APP_CONTROL_ERROR_NONE, "launchContactPick() failed(%d)", err);
}