summaryrefslogtreecommitdiff
path: root/app-control/ct-detail-app/src/CtDetailApp.cpp
diff options
context:
space:
mode:
authorjk7744.park <jk7744.park@samsung.com>2016-02-24 19:06:30 +0900
committerjk7744.park <jk7744.park@samsung.com>2016-02-24 19:06:30 +0900
commitf9f1d30fcede384eac0b8e065ccb97ce56efe433 (patch)
tree5316605e3f9035ed7f02b918f8ee25786f1462f0 /app-control/ct-detail-app/src/CtDetailApp.cpp
parent2aa01f1ea98ff42e4bfef6da401eb19383f2f4ce (diff)
downloadphone-contacts-f9f1d30fcede384eac0b8e065ccb97ce56efe433.tar.gz
phone-contacts-f9f1d30fcede384eac0b8e065ccb97ce56efe433.tar.bz2
phone-contacts-f9f1d30fcede384eac0b8e065ccb97ce56efe433.zip
Tizen 2.4.0 rev3 SDK Public Releasetizen_2.4
Diffstat (limited to 'app-control/ct-detail-app/src/CtDetailApp.cpp')
-rwxr-xr-xapp-control/ct-detail-app/src/CtDetailApp.cpp46
1 files changed, 28 insertions, 18 deletions
diff --git a/app-control/ct-detail-app/src/CtDetailApp.cpp b/app-control/ct-detail-app/src/CtDetailApp.cpp
index 8afe49b..cc4aee0 100755
--- a/app-control/ct-detail-app/src/CtDetailApp.cpp
+++ b/app-control/ct-detail-app/src/CtDetailApp.cpp
@@ -64,14 +64,7 @@ void CtDetailApp::onAppControl(app_control_h request, bool firstLaunch)
app_control_get_operation(m_Request, &operation);
if (operation) {
- int personId = 0;
-
- char *personIdStr = NULL;
- app_control_get_extra_data(request, APP_CONTROL_DATA_ID, &personIdStr);
- if (personIdStr) {
- personId = atoi(personIdStr);
- free(personIdStr);
- }
+ int personId = getPersonId(m_Request, APP_CONTROL_DATA_ID);
if (strcmp(operation, APP_CONTROL_OPERATION_VIEW) == 0) {
if (personId > 0) {
@@ -81,13 +74,14 @@ void CtDetailApp::onAppControl(app_control_h request, bool firstLaunch)
view = createInputView(personId, m_Request);
} else if(strcmp(operation, APP_CONTROL_OPERATION_EDIT) == 0) {
if (personId == 0) {
- using namespace std::placeholders;
- CtListView *listView = new CtListView(LIST_SELECT_SINGLE, LIST_RESULT_ID, 0);
- listView->setOnSingleResult(std::bind(&CtDetailApp::onContactPick, this, _1, _2));
- view = listView;
- } else {
- view = createInputView(personId, m_Request);
+ launchContactPick(APP_CONTROL_DATA_SELECTION_MODE_SINGLE,
+ APP_CONTROL_DATA_TYPE_ID, &CtDetailApp::onContactPick, this);
+
+ free(operation);
+ return;
}
+
+ view = createInputView(personId, m_Request);
}
free(operation);
@@ -106,17 +100,33 @@ void CtDetailApp::onAppControl(app_control_h request, bool firstLaunch)
WLEAVE();
}
-void CtDetailApp::onContactPick(const char *result, CtListResultType resultType)
+int CtDetailApp::getPersonId(app_control_h request, const char *key)
+{
+ int personId = 0;
+ char *itemId = NULL;
+
+ app_control_get_extra_data(request, key, &itemId);
+ if (itemId) {
+ personId = atoi(itemId);
+ free(itemId);
+ }
+
+ return personId;
+}
+
+void CtDetailApp::onContactPick(app_control_h request, app_control_h reply,
+ app_control_result_e result, void *user_data)
{
WENTER();
- int personId = result ? atoi(result) : 0;
+ int personId = getPersonId(reply, APP_CONTROL_DATA_SELECTED);
if (personId < 1) {
ui_app_exit();
}
- CtInputView *view = createInputView(personId, m_Request);
- m_Naviframe->push(view);
+ CtDetailApp *app = (CtDetailApp*) user_data;
+ CtInputView *view = createInputView(personId, app->m_Request);
+ app->m_Naviframe->push(view);
}
CtInputView * CtDetailApp::createInputView(int personId, app_control_h request)