summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryunju06lee <yunju06.lee@samsung.com>2013-04-04 13:04:42 +0900
committeryunju06lee <yunju06.lee@samsung.com>2013-04-04 16:16:57 +0900
commit646d14a8ffeb9a88be70883e1cd20a9160a1a178 (patch)
tree61c47434fdeae30d91d021194731fa9a9752c352
parent6488cc4fa4fec33a7bafa79c234ff2aa87588f0c (diff)
downloadphone-contacts-646d14a8ffeb9a88be70883e1cd20a9160a1a178.tar.gz
phone-contacts-646d14a8ffeb9a88be70883e1cd20a9160a1a178.tar.bz2
phone-contacts-646d14a8ffeb9a88be70883e1cd20a9160a1a178.zip
add tizen 2.1 appcontrol
Change-Id: I28b9063f4370d834e2a2e61603f9c83c68a3e69d
-rwxr-xr-xlib/common/include/phone-common.h31
-rwxr-xr-xlib/common/ph-common.c164
-rw-r--r--lib/details/contacts-details-efl.xml9
-rwxr-xr-xlib/details/ct-detail-main.c236
-rwxr-xr-xlib/details/ct-input-utils.c11
-rwxr-xr-xlib/details/ct-input-view.c14
-rw-r--r--lib/list/contacts-list-efl.xml6
-rwxr-xr-xlib/list/ct-list-contact-view.c14
-rwxr-xr-xlib/list/ct-list-edit-view.c41
-rwxr-xr-xlib/list/ct-list-main.c178
-rwxr-xr-xlib/list/ct-list-view-ug.c41
11 files changed, 716 insertions, 29 deletions
diff --git a/lib/common/include/phone-common.h b/lib/common/include/phone-common.h
index d48d10b..cc70200 100755
--- a/lib/common/include/phone-common.h
+++ b/lib/common/include/phone-common.h
@@ -81,6 +81,31 @@ ph_startT = ph_set_start_time();
#define SETTING_MFC_PATH "/opt/usr/ug/data/ug-phone/mfc_option"
#define VIEW_MODE_PATH "/opt/usr/ug/data/ug-phone/view_mode"
+#define CT_OPERATION_SOCIAL_ADD "http://tizen.org/appcontrol/operation/social/add"
+#define CT_OPERATION_SOCIAL_EDIT "http://tizen.org/appcontrol/operation/social/edit"
+#define CT_OPERATION_SOCIAL_CHOOSE "http://tizen.org/appcontrol/operation/social/choose"
+#define CT_OPERATION_SOCIAL_PICK "http://tizen.org/appcontrol/operation/social/pick"
+#define CT_OPERATION_SOCIAL_VIEW "http://tizen.org/appcontrol/operation/social/view"
+#define CT_OPERATION_VIEW "http://tizen.org/appcontrol/operation/view"
+
+#define CT_OPERATION_ITEM_TYPE "http://tizen.org/appcontrol/data/social/item_type"
+#define CT_OPERATION_PHONE "http://tizen.org/appcontrol/data/social/phone"
+#define CT_OPERATION_EMAIL "http://tizen.org/appcontrol/data/social/email"
+#define CT_OPERATION_URL "http://tizen.org/appcontrol/data/social/url"
+#define CT_OPERATION_ITEM_ID "http://tizen.org/appcontrol/data/social/item_id"
+#define CT_OPERATION_RESULT_TYPE "http://tizen.org/appcontrol/data/social/result_type"
+#define CT_OPERATION_PATH "http://tizen.org/appcontrol/data/path"
+#define CT_OPERATION_RETURN_RESULT "http://tizen.org/appcontrol/data/social/return_result"
+#define CT_OPERATION_SELECTION_MODE "http://tizen.org/appcontrol/data/social/selection_mode"
+
+#define CT_OPERATION_ITEM_TYPE_PERSON "person"
+#define CT_OPERATION_ITEM_TYPE_CONTACT "contact"
+#define CT_OPERATION_SELECTION_MODE_SINGLE "single"
+#define CT_OPERATION_SELECTION_MODE_MULTIPLE "multiple"
+#define CT_OPERATION_RESULT_TYPE_PHONE "phone"
+#define CT_OPERATION_RESULT_TYPE_EMAIL "email"
+#define CT_OPERATION_RESULT_TYPE_ITEM_ID "item_id"
+#define CT_OPERATION_RESULT_TYPE_VCARD "vcard"
typedef enum date_style{
PH_LOG_TIME_ONLY,
@@ -362,6 +387,7 @@ typedef struct {
char *ug_data;
void *ug;
void *child_ug;
+ service_h service_operation;
bool updating;
bool is_background;
@@ -465,6 +491,7 @@ typedef struct {
void *child_ug;
int ug_request;
int view_create_version;
+ service_h service_operation;
int person_id;
contacts_record_h person;
@@ -667,10 +694,14 @@ void phone_navi_item_clear(Elm_Object_Item *navi_item);
void phone_set_view_info(ph_view_info *view_info, Evas_Object *win, Evas_Object *navi,
void *ug, int ug_request, int cnt_max, char *ug_data);
+void phone_service_reply_simple(service_h service, service_result_e result);
void phone_list_ug_return_ids(ui_gadget_h ug, int *result_list, int cnt, const char *bd_key);
+void phone_list_ug_return_values(service_h service, int *result_list, int cnt, const char *result_type);
void phone_list_ug_return_number_email_ids(ui_gadget_h ug, int *result_number_list, int number_list_count, int *result_email_list, int email_list_count);
void phone_ug_return_id(ui_gadget_h ug, int ct_id, int num_id, int email_id);
+void phone_ug_return_value(service_h service, int ct_id, int num_id, int email_id);
void phone_ug_return_vcard(ui_gadget_h ug, int ct_id, char *vcard);
+void phone_ug_operation_return_vcard(service_h service, int ct_id, char *vcard);
Evas_Object* phone_create_nocontents(Evas_Object *parent, const char* label);
void phone_toolbar_disabled_item_append(Evas_Object *toolbar, int cnt);
diff --git a/lib/common/ph-common.c b/lib/common/ph-common.c
index 92d88f0..adbc85d 100755
--- a/lib/common/ph-common.c
+++ b/lib/common/ph-common.c
@@ -887,6 +887,91 @@ void phone_list_ug_return_ids(ui_gadget_h ug, int *result_list, int cnt, const c
service_destroy(service);
}
+void phone_list_ug_return_values(service_h service, int *result_list, int cnt, const char *result_type)
+{
+ gchar *encoded_str = NULL;
+ service_h reply;
+ Eina_List *list = NULL;
+ int ct_ret;
+ int i = 0, j = 0;
+ char **result_array = NULL;
+ service_result_e result = SERVICE_RESULT_SUCCEEDED;
+
+ p_retm_if(result_list == NULL || cnt < 1 || result_type == NULL, "invalid input param");
+
+ service_create(&reply);
+ result_array = calloc(cnt, sizeof(char *));
+
+ if(strcmp(CT_OPERATION_RESULT_TYPE_PHONE, result_type) == 0) {
+ for (i = 0; i < cnt; i++) {
+ contacts_record_h number_record = NULL;
+ char *number = NULL;
+ ct_ret = contacts_db_get_record(_contacts_number._uri, result_list[i], &number_record);
+ if (ct_ret != CONTACTS_ERROR_NONE) {
+ ERR("contacts_db_get_record number failed id %d", result_list[i]);
+ continue;
+ }
+
+ contacts_record_get_str_p(number_record, _contacts_number.number, &number);
+ result_array[i] = strdup(number);
+ PH_DBG("number %s", result_array[i]);
+ contacts_record_destroy(number_record, TRUE);
+ }
+
+ service_add_extra_data_array(reply, CT_OPERATION_PHONE, result_array, i);
+ }
+ else if(strcmp(CT_OPERATION_RESULT_TYPE_EMAIL, result_type) == 0) {
+ for (i = 0; i < cnt; i++) {
+ contacts_record_h email_record = NULL;
+ char *email = NULL;
+ ct_ret = contacts_db_get_record(_contacts_email._uri, result_list[i], &email_record);
+ if (ct_ret != CONTACTS_ERROR_NONE) {
+ ERR("contacts_db_get_record email faile id %d", result_list[i]);
+ continue;
+ }
+
+ contacts_record_get_str_p(email_record, _contacts_email.email, &email);
+ result_array[i] = strdup(email);
+ PH_DBG("email %s", result_array[i]);
+ contacts_record_destroy(email_record, TRUE);
+ }
+
+ service_add_extra_data_array(reply, CT_OPERATION_EMAIL, result_array, i);
+
+ }
+ else if(strcmp(CT_OPERATION_RESULT_TYPE_ITEM_ID, result_type) == 0) {
+ for (i = 0; i < cnt; i++) {
+ char buf[4];
+ snprintf(buf, sizeof(buf), "%d", result_list[i]);
+ result_array[i] = strdup(buf);
+ PH_DBG("person id %s", result_array[i]);
+ }
+
+ service_add_extra_data_array(reply, CT_OPERATION_ITEM_ID, result_array, cnt);
+
+ }
+ else {
+ ERR("wrong result type %s", result_type);
+ result = SERVICE_RESULT_FAILED;
+ }
+
+ service_reply_to_launch_request(reply, service, result);
+ service_destroy(reply);
+
+ for (j = 0; j < i; j++) {
+ free(result_array[j]);
+ }
+ free(result_array);
+}
+
+void phone_service_reply_simple(service_h service, service_result_e result)
+{
+ service_h reply;
+ service_create(&reply);
+ service_reply_to_launch_request(reply, service, result);
+ service_destroy(reply);
+}
+
void phone_list_ug_return_number_email_ids(ui_gadget_h ug, int *result_number_list, int number_list_count, int *result_email_list, int email_list_count)
{
gchar *encoded_str;
@@ -946,6 +1031,85 @@ void phone_ug_return_id(ui_gadget_h ug, int ct_id, int num_id, int email_id)
service_destroy(service);
}
+void phone_ug_return_value(service_h service, int person_id, int num_id, int email_id)
+{
+ service_h reply;
+ char buf[16];
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h number_record = NULL;
+ contacts_record_h email_record = NULL;
+
+ service_create(&reply);
+
+ if (person_id) {
+ snprintf(buf, sizeof(buf), "%d", person_id);
+ PH_DBG("person id %s", buf);
+ service_add_extra_data(reply, CT_OPERATION_RESULT_TYPE_ITEM_ID, buf);
+
+ service_reply_to_launch_request(reply, service, SERVICE_RESULT_SUCCEEDED);
+
+ service_destroy(reply);
+ }
+
+ if (num_id) {
+ const char *number = NULL;
+ err = contacts_db_get_record(_contacts_number._uri, num_id, &number_record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+
+ err = contacts_record_get_str_p(number_record, _contacts_number.number, (char**)&number);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ PH_DBG("number=%d", number);
+
+ service_add_extra_data(reply, CT_OPERATION_RESULT_TYPE_PHONE, number);
+
+ //ug_send_result(ug, service);
+ service_reply_to_launch_request(reply, service, SERVICE_RESULT_SUCCEEDED);
+
+ err = contacts_record_destroy(number_record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ service_destroy(reply);
+ }
+
+ if (email_id) {
+ const char *email = NULL;
+ err = contacts_db_get_record(_contacts_email._uri, email_id, &email_record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+
+ err = contacts_record_get_str_p(email_record, _contacts_email.email, (char**)&email);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+
+ PH_DBG("email=%d", email);
+
+ service_add_extra_data(reply, CT_OPERATION_RESULT_TYPE_EMAIL, email);
+
+ service_reply_to_launch_request(reply, service, SERVICE_RESULT_SUCCEEDED);
+
+ err = contacts_record_destroy(email_record, true);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+
+ service_destroy(reply);
+ }
+
+}
+
+void phone_ug_operation_return_vcard(service_h service, int ct_id, char *vcard)
+{
+ service_h reply;
+ char buf[16];
+
+ service_create(&reply);
+
+ if (vcard) {
+ service_add_extra_data(reply, CT_OPERATION_PATH, vcard);
+ }
+
+ service_reply_to_launch_request(reply, service, SERVICE_RESULT_SUCCEEDED);
+
+ service_destroy(reply);
+}
+
void phone_ug_return_vcard(ui_gadget_h ug, int ct_id, char *vcard)
{
service_h service;
diff --git a/lib/details/contacts-details-efl.xml b/lib/details/contacts-details-efl.xml
index 1896de3..1c4fb6e 100644
--- a/lib/details/contacts-details-efl.xml
+++ b/lib/details/contacts-details-efl.xml
@@ -25,5 +25,14 @@
<application-service>
<operation name="http://tizen.org/ns/packages"/>
</application-service>
+ <application-service>
+ <operation name="http://tizen.org/appcontrol/operation/social/view"/>
+ </application-service>
+ <application-service>
+ <operation name="http://tizen.org/appcontrol/operation/social/add"/>
+ </application-service>
+ <application-service>
+ <operation name="http://tizen.org/appcontrol/operation/social/edit"/>
+ </application-service>
</ui-application>
</manifest>
diff --git a/lib/details/ct-detail-main.c b/lib/details/ct-detail-main.c
index f20c3ee..6f5d616 100755
--- a/lib/details/ct-detail-main.c
+++ b/lib/details/ct-detail-main.c
@@ -65,19 +65,232 @@ static int create_ug_detail_view(Evas_Object *base, int request, ct_detail_data
return TRUE;
}
+static int __detail_set_contact_data(contacts_record_h contact, char *data_type, char *value)
+{
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ PH_DBG("data_type %s value %s", data_type, value);
+
+ if(strcmp(CT_OPERATION_PHONE, data_type) == 0) {
+ err = contacts_record_create(_contacts_number._uri, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_int(record, _contacts_number.type, CONTACTS_NUMBER_TYPE_HOME | CONTACTS_NUMBER_TYPE_CELL);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_record_set_str(record, _contacts_number.number, value);
+ contacts_record_add_child_record(contact, _contacts_contact.number, record);
+ }
+ else if(strcmp(CT_OPERATION_EMAIL, data_type) == 0) {
+ err = contacts_record_create(_contacts_email._uri, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_int(record, _contacts_email.type, CONTACTS_EMAIL_TYPE_HOME);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_record_set_str(record, _contacts_email.email, value);
+ contacts_record_add_child_record(contact, _contacts_contact.email, record);
+ }
+ else if(strcmp(CT_OPERATION_URL, data_type) == 0) {
+ err = contacts_record_create(_contacts_url._uri, &record);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_create() Failed(%d)", err);
+
+ err = contacts_record_set_int(record, _contacts_url.type, CONTACTS_URL_TYPE_HOME);
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_set_int() Failed(%d)", err);
+
+ err = contacts_record_set_str(record, _contacts_url.url, value);
+ contacts_record_add_child_record(contact, _contacts_contact.url, record);
+ }
+
+ return 0;
+}
+
+
+static int __detail_parse_bundle_by_operation(service_h service, char* operation, ct_detail_data *cdetail_d)
+{
+ char* val = NULL;
+ char* val1 = NULL;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+
+ PH_DBG("operaion = %s", operation);
+ cdetail_d->service_operation = service;
+
+ if(strcmp(operation, CT_OPERATION_SOCIAL_VIEW) == 0) {
+ service_get_extra_data(service, CT_OPERATION_ITEM_TYPE, &val);
+ if(val) {
+ if(strcmp(val, CT_OPERATION_ITEM_TYPE_PERSON) != 0) {
+ ERR("CT_OPERATION_ITEM_TYPE_PERSON is not matched %s", val);
+ free(val);
+ return -1;
+ }
+
+ free(val);
+ val = NULL;
+
+ service_get_extra_data(service, CT_OPERATION_ITEM_ID, &val1);
+ if(val1) {
+ cdetail_d->person_id = atoi(val1);
+ free(val1);
+ return CT_UG_REQUEST_DETAIL;
+ }
+ else {
+ ERR("CT_OPERATION_ITEM_ID is mandatory");
+ return -1;
+ }
+
+ }
+ else {
+ ERR("CT_OPERATION_ITEM_TYPE is mandatory");
+ return -1;
+ }
+ }
+ else if(strcmp(operation, CT_OPERATION_SOCIAL_ADD) == 0) {
+ service_get_extra_data(service, CT_OPERATION_ITEM_TYPE, &val);
+ if(val) {
+ if(strcmp(val, CT_OPERATION_ITEM_TYPE_CONTACT) != 0) {
+ ERR("CT_OPERATION_ITEM_TYPE_CONTACT is not matched %s", val);
+ free(val);
+ return -1;
+ }
+ free(val);
+ val = NULL;
+ }
+ else {
+ ERR("CT_OPERATION_ITEM_TYPE is mandatory");
+ return -1;
+ }
+
+ service_get_extra_data(service, CT_OPERATION_PHONE, &val);
+ if(val)
+ {
+ if (NULL == cdetail_d->contact) {
+ err = contacts_record_create(_contacts_contact._uri, &(cdetail_d->contact));
+ if(CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_create failed %s", err);
+ return -1;
+ }
+ }
+
+ __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_PHONE, val);
+
+ free(val);
+ val = NULL;
+ }
+ service_get_extra_data(service, CT_OPERATION_EMAIL, &val);
+ if(val)
+ {
+ if (NULL == cdetail_d->contact) {
+ err = contacts_record_create(_contacts_contact._uri, &(cdetail_d->contact));
+ if(CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_create failed %s", err);
+ return -1;
+ }
+ }
+
+ __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_EMAIL, val);
+
+ free(val);
+ val = NULL;
+ }
+ service_get_extra_data(service, CT_OPERATION_URL, &val);
+ if(val)
+ {
+ if (NULL == cdetail_d->contact) {
+ err = contacts_record_create(_contacts_contact._uri, &(cdetail_d->contact));
+ if(CONTACTS_ERROR_NONE != err) {
+ ERR("contacts_record_create failed %s", err);
+ return -1;
+ }
+ }
+ __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_URL, val);
+
+ free(val);
+ val = NULL;
+ }
+
+ return CT_UG_REQUEST_ADD;
+ }
+ else if(strcmp(operation, CT_OPERATION_SOCIAL_EDIT) == 0) {
+ service_get_extra_data(service, CT_OPERATION_ITEM_TYPE, &val);
+ if(val) {
+ if(strcmp(val, CT_OPERATION_ITEM_TYPE_PERSON) != 0) {
+ ERR("CT_OPERATION_ITEM_TYPE_CONTACT is not matched %s", val);
+ free(val);
+ return -1;
+ }
+
+ service_get_extra_data(service, CT_OPERATION_ITEM_ID, &val1);
+ if(val1) {
+ cdetail_d->person_id = atoi(val1);
+ free(val1);
+
+ if (cdetail_d->person_id) { // From OSP
+ Eina_List *list_contact = ctui_person_get_writable_contact_list(cdetail_d->person_id);
+ if (list_contact) {
+ cdetail_d->contact = list_contact->data;
+ eina_list_free(list_contact);
+ }
+ }
+ }
+ else {
+ ERR("CT_OPERATION_ITEM_ID is mandatory");
+ free(val);
+ return -1;
+ }
+ free(val);
+ val = NULL;
+ }
+ else {
+ ERR("CT_OPERATION_ITEM_TYPE is mandatory");
+ return -1;
+ }
+
+ service_get_extra_data(service, CT_OPERATION_PHONE, &val);
+ if(val)
+ {
+ __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_PHONE, val);
+
+ free(val);
+ val = NULL;
+ }
+ service_get_extra_data(service, CT_OPERATION_EMAIL, &val);
+ if(val)
+ {
+ __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_EMAIL, val);
+
+ free(val);
+ val = NULL;
+ }
+ service_get_extra_data(service, CT_OPERATION_URL, &val);
+ if(val)
+ {
+ __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_URL, val);
+
+ free(val);
+ val = NULL;
+ }
+ return CT_UG_REQUEST_EDIT;
+ }
+ else {
+ ERR("operation wrong");
+ return -1;
+ }
+}
+
static void *detail_on_create(ui_gadget_h ug, enum ug_mode mode,
service_h service, void *priv)
{
int ret;
- int request;
+ int request = 0;
Evas_Object *bg;
Evas_Object *base;
Evas_Object *parent;
contacts_error_e err;
ct_detail_data *cdetail_d = priv;
+ char *operation = NULL;
+ cdetail_d->base_ab = -1;
- p_retvm_if(NULL == ug || NULL == priv, NULL,
- "The parameter is invalid(ug=%p, priv=%p)", ug, priv);
+ p_retvm_if(NULL == ug || NULL == priv, NULL, "The parameter is invalid(ug=%p, priv=%p)", ug, priv);
cdetail_d->win = ug_get_window();
parent = ug_get_parent_layout(ug);
@@ -90,12 +303,27 @@ static void *detail_on_create(ui_gadget_h ug, enum ug_mode mode,
p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_connect2() Failed(%d)", err);
PH_DBG("contacts_connect()");
+ service_get_operation(service, &operation);
+
+ if(operation) {
+ request = __detail_parse_bundle_by_operation(service, operation, cdetail_d);
+ free(operation);
+ if(request < 0) {
+ ERR("__detail_parse_bundle_by_operation invalid parameter");
+ err = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_disconnect2() Failed(%d)", err);
+ return NULL;
+ }
+ }
+ else
+ request = ct_detail_parse_bundle(service, cdetail_d, &ret);
+
if (UG_MODE_FULLVIEW == mode)
base = phone_create_base_layout(parent, true);
else
base = phone_create_base_layout(parent, false);
+
- request = ct_detail_parse_bundle(service, cdetail_d, &ret);
if (-2 == ret) {
Evas_Object *popup;
popup = elm_popup_add(base);
diff --git a/lib/details/ct-input-utils.c b/lib/details/ct-input-utils.c
index 1146631..311ae68 100755
--- a/lib/details/ct-input-utils.c
+++ b/lib/details/ct-input-utils.c
@@ -548,22 +548,31 @@ void ct_input_save_cb(void *data, Evas_Object *obj, void *event_info)
err = contacts_db_update_record(cinput_d->contact);
if (CONTACTS_ERROR_NONE != err) {
ctui_create_contacts_error_popup(cdetail_d->navi, err);
+ if(cdetail_d->service_operation)
+ phone_service_reply_simple(cdetail_d->service_operation, SERVICE_RESULT_FAILED);
return;
}
else {
cinput_d->saved = true;
+ if(cdetail_d->service_operation)
+ phone_service_reply_simple(cdetail_d->service_operation, SERVICE_RESULT_SUCCEEDED);
}
}
else {
err = contacts_db_insert_record(cinput_d->contact, &ret_id);
if (CONTACTS_ERROR_NONE != err) {
ctui_create_contacts_error_popup(cdetail_d->navi, err);
+ if(cdetail_d->service_operation)
+ phone_service_reply_simple(cdetail_d->service_operation, SERVICE_RESULT_FAILED);
return;
}
cinput_d->saved = true;
input_set_base_ab(cinput_d->base_ab_name);
- if (NULL == cdetail_d->prev_view_data && cdetail_d->ug)
+ if (NULL == cdetail_d->prev_view_data && cdetail_d->ug) {
phone_ug_return_id(cdetail_d->ug, ret_id, 0, 0);
+ if(cdetail_d->service_operation)
+ phone_ug_return_value(cdetail_d->service_operation, ret_id, 0, 0);
+ }
}
/* evas_object_smart_callback_del() func will be deleted */
diff --git a/lib/details/ct-input-view.c b/lib/details/ct-input-view.c
index eb44755..5b3e624 100755
--- a/lib/details/ct-input-view.c
+++ b/lib/details/ct-input-view.c
@@ -3139,6 +3139,18 @@ void ct_input_language_changed(Evas_Object *navi)
input_refresh_layout(cinput_d);
}
+static void __input_ug_destroy_me_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ct_input_data *cinput_d = data;
+
+ if(cinput_d->cdetail_d->service_operation)
+ phone_service_reply_simple(cinput_d->cdetail_d->service_operation, SERVICE_RESULT_FAILED);
+
+ ug_destroy_me(cinput_d->cdetail_d->ug);
+}
+
+
void ct_input_push_navi_content(ct_detail_data *cdetail_d, contacts_record_h contact, int contact_id)
{
PH_FN_CALL;
@@ -3193,7 +3205,7 @@ void ct_input_push_navi_content(ct_detail_data *cdetail_d, contacts_record_h con
if (cinput_d->cdetail_d->ug && NULL == cinput_d->pre_item) {
Evas_Object *close_button = elm_button_add(cinput_d->cdetail_d->navi);
- evas_object_smart_callback_add(close_button, "clicked", phone_ug_destroy_me_cb, cinput_d->cdetail_d->ug);
+ evas_object_smart_callback_add(close_button, "clicked", __input_ug_destroy_me_cb, cinput_d);
elm_object_style_set(close_button, "naviframe/back_btn/default");
elm_object_item_part_content_set(cinput_d->navi_item, "prev_btn", close_button);
}
diff --git a/lib/list/contacts-list-efl.xml b/lib/list/contacts-list-efl.xml
index 8da8ff5..3cef347 100644
--- a/lib/list/contacts-list-efl.xml
+++ b/lib/list/contacts-list-efl.xml
@@ -25,5 +25,11 @@
<application-service>
<operation name="http://tizen.org/ns/packages"/>
</application-service>
+ <application-service>
+ <operation name="http://tizen.org/appcontrol/operation/social/pick"/>
+ </application-service>
+ <application-service>
+ <operation name="http://tizen.org/appcontrol/operation/social/choose"/>
+ </application-service>
</ui-application>
</manifest>
diff --git a/lib/list/ct-list-contact-view.c b/lib/list/ct-list-contact-view.c
index d97ccb7..ef8aab8 100755
--- a/lib/list/ct-list-contact-view.c
+++ b/lib/list/ct-list-contact-view.c
@@ -601,6 +601,16 @@ static void list_more_button_cb(void *data, Evas_Object *obj, void *event_info)
evas_object_show(clist_d->popup);
}
+static void __list_ug_destroy_me_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_list_data *clist_d = data;
+
+ if(clist_d->service_operation)
+ phone_service_reply_simple(clist_d->service_operation, SERVICE_RESULT_FAILED);
+
+ ug_destroy_me(clist_d->ug);
+}
+
static void list_make_navi(ct_list_data *clist_d)
{
PH_FN_CALL;
@@ -686,14 +696,14 @@ static void list_make_navi(ct_list_data *clist_d)
elm_object_style_set(l_btn, "naviframe/back_btn/default");
if (clist_d->ug_request) {
- evas_object_smart_callback_add(l_btn, "clicked", phone_ug_destroy_me_cb, clist_d->ug);
+ evas_object_smart_callback_add(l_btn, "clicked", __list_ug_destroy_me_cb, clist_d);
}
else
evas_object_smart_callback_add(l_btn, "clicked", phone_back_btn_clicked_cb, clist_d->win);
elm_object_item_part_content_set(clist_d->navi_item, "prev_btn", l_btn);
}
else {
- Evas_Object *cancel_btn = phone_create_toolbar_btn(clist_d->navi, S_(PH_SYS_SK_CANCEL), phone_ug_destroy_me_cb, clist_d->ug);
+ Evas_Object *cancel_btn = phone_create_toolbar_btn(clist_d->navi, S_(PH_SYS_SK_CANCEL), __list_ug_destroy_me_cb, clist_d);
elm_object_item_part_content_set(clist_d->navi_item, "toolbar_button2", cancel_btn);
elm_object_style_set(cancel_btn, "naviframe/toolbar/right");
elm_object_style_set(create_button, "naviframe/toolbar/left");
diff --git a/lib/list/ct-list-edit-view.c b/lib/list/ct-list-edit-view.c
index 12de228..874a285 100755
--- a/lib/list/ct-list-edit-view.c
+++ b/lib/list/ct-list-edit-view.c
@@ -407,15 +407,27 @@ static void list_edit_check_done(void *data, Evas_Object *obj, void *event_info)
return;
}
- if (CT_UG_REQUEST_CHECK_FOR_NUMBER == clist_d->ug_request)
- phone_list_ug_return_ids(clist_d->ug, result_list_number, cnt_checked, CT_UG_BUNDLE_RESULT_NUMBER_ID_LIST);
- else if (CT_UG_REQUEST_CHECK_FOR_EMAIL == clist_d->ug_request)
- phone_list_ug_return_ids(clist_d->ug, result_list_email, cnt_checked, CT_UG_BUNDLE_RESULT_EMAIL_ID_LIST);
- else if (CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == clist_d->ug_request)
+ if (CT_UG_REQUEST_CHECK_FOR_NUMBER == clist_d->ug_request) {
+ if(clist_d->service_operation)
+ phone_list_ug_return_values(clist_d->service_operation, result_list_number, cnt_checked, CT_OPERATION_RESULT_TYPE_PHONE);
+ else
+ phone_list_ug_return_ids(clist_d->ug, result_list_number, cnt_checked, CT_UG_BUNDLE_RESULT_NUMBER_ID_LIST);
+ }
+ else if (CT_UG_REQUEST_CHECK_FOR_EMAIL == clist_d->ug_request) {
+ if(clist_d->service_operation)
+ phone_list_ug_return_values(clist_d->service_operation, result_list_email, cnt_checked, CT_OPERATION_RESULT_TYPE_EMAIL);
+ else
+ phone_list_ug_return_ids(clist_d->ug, result_list_email, cnt_checked, CT_UG_BUNDLE_RESULT_EMAIL_ID_LIST);
+ }
+ else if (CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL == clist_d->ug_request) {
phone_list_ug_return_number_email_ids(clist_d->ug, result_list_number, number_count, result_list_email, email_count);
- else
- phone_list_ug_return_ids(clist_d->ug, result_list_person, cnt_checked, CT_UG_BUNDLE_RESULT_PERSON_ID_LIST);
-
+ }
+ else {
+ if(clist_d->service_operation)
+ phone_list_ug_return_values(clist_d->service_operation, result_list_person, cnt_checked, CT_OPERATION_RESULT_TYPE_ITEM_ID);
+ else
+ phone_list_ug_return_ids(clist_d->ug, result_list_person, cnt_checked, CT_UG_BUNDLE_RESULT_PERSON_ID_LIST);
+ }
if(result_list_person)
free(result_list_person);
if(result_list_number)
@@ -433,6 +445,17 @@ static void list_gadd_view_cancel_btn_cb(void *data, Evas_Object *obj, void *eve
elm_naviframe_item_pop_to(evas_object_data_get(data, "navi_it_pop"));
}
+static void __list_edit_ug_destroy_me_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ct_list_data *clist_d = data;
+
+ if(clist_d->service_operation)
+ phone_service_reply_simple(clist_d->service_operation, SERVICE_RESULT_FAILED);
+
+ ug_destroy_me(clist_d->ug);
+}
+
void ct_list_edit_make_edit_navi(ct_list_data *clist_d)
{
PH_FN_CALL;
@@ -472,7 +495,7 @@ void ct_list_edit_make_edit_navi(ct_list_data *clist_d)
}
}
else { // check UG
- l_btn = phone_create_toolbar_btn(clist_d->navi, S_(PH_SYS_SK_CANCEL), phone_ug_destroy_me_cb, clist_d->ug);
+ l_btn = phone_create_toolbar_btn(clist_d->navi, S_(PH_SYS_SK_CANCEL), __list_edit_ug_destroy_me_cb, clist_d);
elm_object_item_part_content_set(clist_d->navi_item, "toolbar_button2", l_btn);
elm_object_style_set(done_button, "naviframe/toolbar/left");
elm_object_style_set(l_btn, "naviframe/toolbar/right");
diff --git a/lib/list/ct-list-main.c b/lib/list/ct-list-main.c
index 6d42602..8e2d3ee 100755
--- a/lib/list/ct-list-main.c
+++ b/lib/list/ct-list-main.c
@@ -121,6 +121,161 @@ static Evas_Object* list_create_vcard_list_view(Evas_Object *base, ct_list_data
return clist_d->navi;
}
+static int __list_parse_bundle_by_operation(service_h service, ct_list_data* clist_d)
+{
+ char* val = NULL;
+ char* val1 = NULL;
+ char *operation = NULL;
+
+ service_get_operation(service, &operation);
+ p_retvm_if(NULL == operation, 0, "operation is NULL");
+ PH_DBG("operaion = %s", operation);
+
+ if(strcmp(operation, CT_OPERATION_SOCIAL_CHOOSE) == 0) {
+ service_get_extra_data(service, CT_OPERATION_ITEM_TYPE, &val);
+ if(val) {
+ if(strcmp(val, CT_OPERATION_ITEM_TYPE_PERSON) != 0) {
+ ERR("CT_OPERATION_ITEM_TYPE_PERSON not matched %s", val);
+ free(val);
+ return -1;
+ }
+ free(val);
+ val = NULL;
+ }
+ else {
+ ERR("CT_OPERATION_ITEM_TYPE is mandatory");
+ return -1;
+ }
+ clist_d->service_operation = service;
+ clist_d->ug_request = CT_UG_REQUEST_UPDATE_CONTACT;
+ clist_d->list_op = CT_GET_LIST_PERSON_OF_WRITABLE_ADDRBOOK_ID;
+
+ service_get_extra_data(service, CT_OPERATION_PHONE, &val);
+ if(val) {
+ clist_d->ug_request = CT_UG_REQUEST_UPDATE_WITH_NUM;
+ clist_d->ug_data = val;
+ return 1;
+ }
+ service_get_extra_data(service, CT_OPERATION_EMAIL, &val);
+ if(val) {
+ clist_d->ug_request = CT_UG_REQUEST_UPDATE_WITH_EMAIL;
+ clist_d->ug_data = val;
+ return 1;
+ }
+ service_get_extra_data(service, CT_OPERATION_URL, &val);
+ if(val) {
+ clist_d->ug_request = CT_UG_REQUEST_UPDATE_WITH_WEB;
+ clist_d->ug_data = val;
+ return 1;
+ }
+ }
+ else if(strcmp(operation, CT_OPERATION_SOCIAL_PICK) == 0) {
+ service_get_extra_data(service, CT_OPERATION_ITEM_TYPE, &val);
+ if(strcmp(val, CT_OPERATION_ITEM_TYPE_PERSON) != 0) {
+ ERR("CT_OPERATION_ITEM_TYPE_PERSON not matched %s", val);
+ free(val);
+ return -1;
+ }
+ free(val);
+ val = NULL;
+
+ service_get_extra_data(service, CT_OPERATION_ITEM_TYPE, &val);
+ if(val) {
+ if(strcmp(val, CT_OPERATION_ITEM_TYPE_PERSON) != 0) {
+ ERR("CT_OPERATION_ITEM_TYPE_PERSON not matched %s", val);
+ free(val);
+ return -1;
+ }
+ free(val);
+ val = NULL;
+ }
+ else {
+ ERR("CT_OPERATION_ITEM_TYPE is mandatory");
+ return -1;
+ }
+
+ service_get_extra_data(service, CT_OPERATION_SELECTION_MODE, &val);
+ if(val) {
+ if(strcmp(val, CT_OPERATION_SELECTION_MODE_SINGLE) == 0) {
+ service_get_extra_data(service, CT_OPERATION_RESULT_TYPE, &val1);
+ if(val1) {
+ if(strcmp(val1, CT_OPERATION_RESULT_TYPE_PHONE) == 0) {
+ clist_d->ug_request = CT_UG_REQUEST_SELECT_NUMBER;
+ clist_d->list_op = CT_GET_LIST_ALL_PERSON_HAD_NUMBER;
+ }
+ else if(strcmp(val1, CT_OPERATION_RESULT_TYPE_EMAIL) == 0) {
+ clist_d->ug_request = CT_UG_REQUEST_SELECT_EMAIL;
+ clist_d->list_op = CT_GET_LIST_ALL_PERSON_HAD_EMAIL;
+ }
+ else if(strcmp(val1, CT_OPERATION_RESULT_TYPE_ITEM_ID) == 0) {
+ clist_d->ug_request = CT_UG_REQUEST_SELECT_PERSON;
+ }
+ else if(strcmp(val1, CT_OPERATION_RESULT_TYPE_VCARD) == 0) {
+ clist_d->ug_request = CT_UG_REQUEST_SELECT_VCARD;
+
+ }
+ else {
+ ERR("CT_OPERATION_RESULT_TYPE is wrong value %s", val1);
+ free(val);
+ free(val1);
+ return -1;
+ }
+ free(val1);
+ clist_d->service_operation = service;
+ }
+ else {
+ ERR("CT_OPERATION_RESULT_TYPE is wrong value %s", val1);
+ free(val);
+ free(val1);
+ return -1;
+ }
+ }
+ else if(strcmp(val, CT_OPERATION_SELECTION_MODE_MULTIPLE) == 0) {
+ service_get_extra_data(service, CT_OPERATION_RESULT_TYPE, &val1);
+ if(val1) {
+ if(strcmp(val1, CT_OPERATION_RESULT_TYPE_PHONE) == 0) {
+ clist_d->ug_request = CT_UG_REQUEST_CHECK_FOR_NUMBER;
+ clist_d->list_op = CT_GET_LIST_ALL_PERSON_HAD_NUMBER;
+ }
+ else if(strcmp(val1, CT_OPERATION_RESULT_TYPE_EMAIL) == 0) {
+ clist_d->ug_request = CT_UG_REQUEST_CHECK_FOR_EMAIL;
+ clist_d->list_op = CT_GET_LIST_ALL_PERSON_HAD_EMAIL;
+ }
+ else if(strcmp(val1, CT_OPERATION_RESULT_TYPE_ITEM_ID) == 0) {
+ clist_d->ug_request = CT_UG_REQUEST_CHECK;
+ }
+ else {
+ ERR("CT_OPERATION_RESULT_TYPE is wrong value %s", val1);
+ free(val);
+ free(val1);
+ return -1;
+ }
+ free(val1);
+ clist_d->service_operation = service;
+ }
+ else {
+ ERR("CT_OPERATION_RESULT_TYPE is wrong value %s", val1);
+ free(val);
+ free(val1);
+ return -1;
+ }
+ }
+ else {
+ ERR("CT_OPERATION_SELECTION_MODE is wrong %s", val);
+ free(val);
+ return -1;
+ }
+ free(val);
+ }
+ }
+ else {
+ ERR("operation wrong");
+ return -1;
+ }
+
+ return 1;
+}
+
static void *list_on_create(ui_gadget_h ug, enum ug_mode mode,
service_h service, void *priv)
{
@@ -129,9 +284,9 @@ static void *list_on_create(ui_gadget_h ug, enum ug_mode mode,
Evas_Object *bg, *base;
Evas_Object *parent;
ct_list_data *clist_d = priv;
+ char *operation = NULL;
- p_retvm_if(NULL == ug || NULL == priv, NULL,
- "The parameter is invalid(ug=%p, priv=%p)", ug, priv);
+ p_retvm_if(NULL == ug || NULL == priv, NULL, "The parameter is invalid(ug=%p, priv=%p)", ug, priv);
clist_d->win = ug_get_window();
parent = ug_get_parent_layout(ug);
@@ -143,12 +298,28 @@ static void *list_on_create(ui_gadget_h ug, enum ug_mode mode,
err = contacts_connect2();
p_retvm_if(CONTACTS_ERROR_NONE != err, NULL, "contacts_connect2() Failed(%d)", err);
+ service_get_operation(service, &operation);
+ if(operation) {
+ ret = __list_parse_bundle_by_operation(service, clist_d);
+ free(operation);
+ if(ret < 0) {
+ ERR("__list_parse_bundle_by_operation invalid parameter");
+ err = contacts_disconnect2();
+ p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_disconnect2() Failed(%d)", err);
+ return NULL;
+ }
+ }
+ else {
+ ret = ct_list_parse_bundle(service, clist_d);
+ }
+
if (UG_MODE_FULLVIEW == mode)
base = phone_create_base_layout(parent, true);
else
base = phone_create_base_layout(parent, false);
- ret = ct_list_parse_bundle(service, clist_d);
+ clist_d->base_ab = -1;
+
if (-2 == ret) {
Evas_Object *popup;
popup = elm_popup_add(base);
@@ -160,7 +331,6 @@ static void *list_on_create(ui_gadget_h ug, enum ug_mode mode,
return base;
}
p_retvm_if(-1 == ret, NULL, "ct_list_parse_bundle() Failed");
- clist_d->base_ab = -1;
bg = phone_create_bg(base);
if (NULL == bg) {
diff --git a/lib/list/ct-list-view-ug.c b/lib/list/ct-list-view-ug.c
index 94bd146..516af1f 100755
--- a/lib/list/ct-list-view-ug.c
+++ b/lib/list/ct-list-view-ug.c
@@ -58,7 +58,10 @@ static void list_ug_nums_popup_sel(void *data, Evas_Object *obj, void *event_inf
phone_launch_voice_call(person_id, number);
}
else {
- phone_ug_return_id(clist_d->ug, person_id, (int)data, 0);
+ if(clist_d->service_operation)
+ phone_ug_return_value(clist_d->service_operation, 0, (int)data, 0);
+ else
+ phone_ug_return_id(clist_d->ug, person_id, (int)data, 0);
ug_destroy_me(clist_d->ug);
}
}
@@ -86,7 +89,11 @@ static void list_ug_emails_popup_sel(void *data, Evas_Object *obj, void *event_i
ct_list_popup_hide_cb(obj, NULL, NULL);
}
else {
- phone_ug_return_id(clist_d->ug, contact_id, 0, (int)data);
+ if(clist_d->service_operation)
+ phone_ug_return_value(clist_d->service_operation, 0, 0, (int)data);
+ else
+ phone_ug_return_id(clist_d->ug, contact_id, 0, (int)data);
+
ug_destroy_me(clist_d->ug);
}
}
@@ -204,7 +211,10 @@ static inline void list_ug_handle_select_number(ct_list_data *clist_d, ct_person
else {
err = contacts_record_get_int(record, _contacts_number.id, &number_id);
p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
- phone_ug_return_id(clist_d->ug, person_info->id, number_id, 0);
+ if(clist_d->service_operation)
+ phone_ug_return_value(clist_d->service_operation, 0, number_id, 0);
+ else
+ phone_ug_return_id(clist_d->ug, person_info->id, number_id, 0);
ug_destroy_me(clist_d->ug);
}
}
@@ -234,7 +244,10 @@ static inline void list_ug_handle_select_email(ct_list_data *clist_d, ct_person_
record = (contacts_record_h)person_info->email_list->data;
err = contacts_record_get_int(record, _contacts_email.id, &email_id);
p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
- phone_ug_return_id(clist_d->ug, person_info->id, 0, email_id);
+ if(clist_d->service_operation)
+ phone_ug_return_value(clist_d->service_operation, 0, 0, email_id);
+ else
+ phone_ug_return_id(clist_d->ug, person_info->id, 0, email_id);
ug_destroy_me(clist_d->ug);
}
else
@@ -276,14 +289,20 @@ static inline void list_ug_handle_select_number_or_email(ct_list_data *clist_d,
record = (contacts_record_h)person_info->number_list->data;
err = contacts_record_get_int(record, _contacts_number.id, &number_id);
p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
- phone_ug_return_id(clist_d->ug, person_info->id, number_id, 0);
+ if(clist_d->service_operation)
+ phone_ug_return_value(clist_d->service_operation, 0, number_id, 0);
+ else
+ phone_ug_return_id(clist_d->ug, person_info->id, number_id, 0);
ug_destroy_me(clist_d->ug);
}
else if (number_list_count == 0 && email_list_count == 1) {
record = (contacts_record_h)person_info->email_list->data;
err = contacts_record_get_int(record, _contacts_email.id, &email_id);
p_warn_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_int() Failed(%d)", err);
- phone_ug_return_id(clist_d->ug, person_info->id, 0, email_id);
+ if(clist_d->service_operation)
+ phone_ug_return_value(clist_d->service_operation, 0, 0, email_id);
+ else
+ phone_ug_return_id(clist_d->ug, person_info->id, 0, email_id);
ug_destroy_me(clist_d->ug);
}
else {
@@ -300,7 +319,10 @@ static inline void ct_list_ug_handle_select_vcard(ct_list_data *clist_d, int per
result = ctui_list_make_vcard(person_id, vcard_path, sizeof(vcard_path));
PH_DBG("%d, %s", person_id, vcard_path);
if(result == true) {
- phone_ug_return_vcard(clist_d->ug, person_id, vcard_path);
+ if(clist_d->service_operation)
+ phone_ug_operation_return_vcard(clist_d->service_operation, person_id, vcard_path);
+ else
+ phone_ug_return_vcard(clist_d->ug, person_id, vcard_path);
ug_destroy_me(clist_d->ug);
}
else {
@@ -625,7 +647,10 @@ void ct_list_ug_gl_sel(void *data, Evas_Object *obj, void *event_info)
break;
case CT_UG_REQUEST_SELECT_PERSON:
if (clist_d->ug) {
- phone_ug_return_id(clist_d->ug, person_info->id, 0, 0);
+ if(clist_d->service_operation)
+ phone_ug_return_value(clist_d->service_operation, person_info->id, 0, 0);
+ else
+ phone_ug_return_id(clist_d->ug, person_info->id, 0, 0);
ug_destroy_me(clist_d->ug);
}
break;