summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryunju06lee <yunju06.lee@samsung.com>2013-04-23 05:38:41 (GMT)
committeryunju06lee <yunju06.lee@samsung.com>2013-04-23 05:38:41 (GMT)
commit359e8479f41d09d5ecfb311a01a2e58be4345aa4 (patch)
tree52d7a104e06e75bdd32bc87538eb9bf55145fde2
parent5217346640ac68b46c829d5a89c7b417bfe33e50 (diff)
downloadphone-contacts-359e8479f41d09d5ecfb311a01a2e58be4345aa4.zip
phone-contacts-359e8479f41d09d5ecfb311a01a2e58be4345aa4.tar.gz
phone-contacts-359e8479f41d09d5ecfb311a01a2e58be4345aa4.tar.bz2
Change-Id: Ib2fa3e9cb827298906abaf0521e9dd41a14502c7
-rwxr-xr-xlib/common/include/phone-common.h4
-rwxr-xr-xlib/common/ph-common.c28
-rwxr-xr-xlib/details/ct-detail-main.c66
-rwxr-xr-xlib/details/ct-input-utils.c4
-rwxr-xr-xlib/list/ct-list-main.c33
-rwxr-xr-xlib/list/ct-list-view-ug.c14
6 files changed, 82 insertions, 67 deletions
diff --git a/lib/common/include/phone-common.h b/lib/common/include/phone-common.h
index 7747a1f..e99f9d3 100755
--- a/lib/common/include/phone-common.h
+++ b/lib/common/include/phone-common.h
@@ -96,7 +96,7 @@ ph_startT = ph_set_start_time();
#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_SELECTION_MODE "http://tizen.org/appcontrol/data/selection_mode"
#define CT_OPERATION_ITEM_TYPE_PERSON "person"
#define CT_OPERATION_ITEM_TYPE_CONTACT "contact"
@@ -701,7 +701,7 @@ void phone_list_ug_return_ids(ui_gadget_h ug, int *result_list, int cnt, const c
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_value(service_h service, int ct_id, int num_id, int email_id, int result_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);
diff --git a/lib/common/ph-common.c b/lib/common/ph-common.c
index fc5ba6c..21ba393 100755
--- a/lib/common/ph-common.c
+++ b/lib/common/ph-common.c
@@ -1029,7 +1029,7 @@ 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)
+void phone_ug_return_value(service_h service, int person_id, int num_id, int email_id, int result_id)
{
service_h reply;
char buf[16];
@@ -1055,6 +1055,8 @@ void phone_ug_return_value(service_h service, int person_id, int num_id, int ema
free(result_array[0]);
free(result_array);
+
+ return;
}
if (num_id) {
@@ -1082,6 +1084,8 @@ void phone_ug_return_value(service_h service, int person_id, int num_id, int ema
free(result_array[0]);
free(result_array);
+
+ return;
}
if (email_id) {
@@ -1109,6 +1113,21 @@ void phone_ug_return_value(service_h service, int person_id, int num_id, int ema
free(result_array[0]);
free(result_array);
+
+ return;
+ }
+
+ if (result_id) {
+ snprintf(buf, sizeof(buf), "%d", person_id);
+ PH_DBG("person id %s", buf);
+
+ service_add_extra_data(reply, CT_OPERATION_ITEM_ID, buf);
+
+ service_reply_to_launch_request(reply, service, SERVICE_RESULT_SUCCEEDED);
+
+ service_destroy(reply);
+
+ return;
}
}
@@ -1116,21 +1135,16 @@ void phone_ug_return_value(service_h service, int person_id, int num_id, int ema
void phone_ug_operation_return_vcard(service_h service, int ct_id, char *vcard)
{
service_h reply;
- char **result_array = NULL;
- result_array = calloc(1, sizeof(char *));
service_create(&reply);
if (vcard) {
- result_array[0] = vcard;
- service_add_extra_data_array(reply, CT_OPERATION_PATH, (const char **)result_array, 1);
+ service_add_extra_data(reply, CT_OPERATION_PATH, vcard);
}
service_reply_to_launch_request(reply, service, SERVICE_RESULT_SUCCEEDED);
service_destroy(reply);
-
- free(result_array);
}
void phone_ug_return_vcard(ui_gadget_h ug, int ct_id, char *vcard)
diff --git a/lib/details/ct-detail-main.c b/lib/details/ct-detail-main.c
index d91ea66..9d05c66 100755
--- a/lib/details/ct-detail-main.c
+++ b/lib/details/ct-detail-main.c
@@ -123,7 +123,6 @@ static int __detail_parse_bundle_by_operation(service_h service, char* operation
free(val);
return -1;
}
-
free(val);
val = NULL;
@@ -160,8 +159,8 @@ static int __detail_parse_bundle_by_operation(service_h service, char* operation
return -1;
}
- service_get_extra_data(service, CT_OPERATION_PHONE, &val);
- if(val)
+ service_get_extra_data(service, CT_OPERATION_PHONE, &val1);
+ if(val1)
{
if (NULL == cdetail_d->contact) {
err = contacts_record_create(_contacts_contact._uri, &(cdetail_d->contact));
@@ -171,13 +170,14 @@ static int __detail_parse_bundle_by_operation(service_h service, char* operation
}
}
- __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_PHONE, val);
+ __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_PHONE, val1);
- free(val);
- val = NULL;
+ free(val1);
+ val1 = NULL;
}
- service_get_extra_data(service, CT_OPERATION_EMAIL, &val);
- if(val)
+
+ service_get_extra_data(service, CT_OPERATION_EMAIL, &val1);
+ if(val1)
{
if (NULL == cdetail_d->contact) {
err = contacts_record_create(_contacts_contact._uri, &(cdetail_d->contact));
@@ -187,13 +187,14 @@ static int __detail_parse_bundle_by_operation(service_h service, char* operation
}
}
- __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_EMAIL, val);
+ __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_EMAIL, val1);
- free(val);
- val = NULL;
+ free(val1);
+ val1 = NULL;
}
- service_get_extra_data(service, CT_OPERATION_URL, &val);
- if(val)
+
+ service_get_extra_data(service, CT_OPERATION_URL, &val1);
+ if(val1)
{
if (NULL == cdetail_d->contact) {
err = contacts_record_create(_contacts_contact._uri, &(cdetail_d->contact));
@@ -202,10 +203,10 @@ static int __detail_parse_bundle_by_operation(service_h service, char* operation
return -1;
}
}
- __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_URL, val);
+ __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_URL, val1);
- free(val);
- val = NULL;
+ free(val1);
+ val1 = NULL;
}
return CT_UG_REQUEST_ADD;
@@ -224,6 +225,7 @@ static int __detail_parse_bundle_by_operation(service_h service, char* operation
PH_DBG("person id %s", val1);
cdetail_d->person_id = atoi(val1);
free(val1);
+ val1 = NULL;
if (cdetail_d->person_id) { // From OSP
Eina_List *list_contact = ctui_person_get_writable_contact_list(cdetail_d->person_id);
@@ -246,29 +248,31 @@ static int __detail_parse_bundle_by_operation(service_h service, char* operation
return -1;
}
- service_get_extra_data(service, CT_OPERATION_PHONE, &val);
- if(val)
+ service_get_extra_data(service, CT_OPERATION_PHONE, &val1);
+ if(val1)
{
- __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_PHONE, val);
+ __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_PHONE, val1);
- free(val);
- val = NULL;
+ free(val1);
+ val1 = NULL;
}
- service_get_extra_data(service, CT_OPERATION_EMAIL, &val);
- if(val)
+
+ service_get_extra_data(service, CT_OPERATION_EMAIL, &val1);
+ if(val1)
{
- __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_EMAIL, val);
+ __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_EMAIL, val1);
- free(val);
- val = NULL;
+ free(val1);
+ val1 = NULL;
}
- service_get_extra_data(service, CT_OPERATION_URL, &val);
- if(val)
+
+ service_get_extra_data(service, CT_OPERATION_URL, &val1);
+ if(val1)
{
- __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_URL, val);
+ __detail_set_contact_data(cdetail_d->contact, CT_OPERATION_URL, val1);
- free(val);
- val = NULL;
+ free(val1);
+ val1 = NULL;
}
return CT_UG_REQUEST_EDIT;
}
diff --git a/lib/details/ct-input-utils.c b/lib/details/ct-input-utils.c
index 925ee56..4297e0d 100755
--- a/lib/details/ct-input-utils.c
+++ b/lib/details/ct-input-utils.c
@@ -555,7 +555,7 @@ void ct_input_save_cb(void *data, Evas_Object *obj, void *event_info)
else {
cinput_d->saved = true;
if(cdetail_d->service_operation)
- phone_ug_return_value(cdetail_d->service_operation, cdetail_d->person_id, 0, 0);
+ phone_ug_return_value(cdetail_d->service_operation, 0, 0, 0, cdetail_d->person_id);
}
}
else {
@@ -571,7 +571,7 @@ void ct_input_save_cb(void *data, Evas_Object *obj, void *event_info)
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);
+ phone_ug_return_value(cdetail_d->service_operation, 0, 0, 0, ret_id);
}
}
diff --git a/lib/list/ct-list-main.c b/lib/list/ct-list-main.c
index c746788..9cdc8cc 100755
--- a/lib/list/ct-list-main.c
+++ b/lib/list/ct-list-main.c
@@ -150,36 +150,29 @@ static int __list_parse_bundle_by_operation(service_h service, ct_list_data* cli
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) {
+ service_get_extra_data(service, CT_OPERATION_PHONE, &val1);
+ if(val1) {
clist_d->ug_request = CT_UG_REQUEST_UPDATE_WITH_NUM;
- clist_d->ug_data = val;
+ clist_d->ug_data = val1;
return 1;
}
- service_get_extra_data(service, CT_OPERATION_EMAIL, &val);
- if(val) {
+
+ service_get_extra_data(service, CT_OPERATION_EMAIL, &val1);
+ if(val1) {
clist_d->ug_request = CT_UG_REQUEST_UPDATE_WITH_EMAIL;
- clist_d->ug_data = val;
+ clist_d->ug_data = val1;
return 1;
}
- service_get_extra_data(service, CT_OPERATION_URL, &val);
- if(val) {
+
+ service_get_extra_data(service, CT_OPERATION_URL, &val1);
+ if(val1) {
clist_d->ug_request = CT_UG_REQUEST_UPDATE_WITH_WEB;
- clist_d->ug_data = val;
+ clist_d->ug_data = val1;
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);
@@ -267,6 +260,10 @@ static int __list_parse_bundle_by_operation(service_h service, ct_list_data* cli
}
free(val);
}
+ else {
+ ERR("CT_OPERATION_SELECTION_MODE is mandatory");
+ return -1;
+ }
}
else {
ERR("operation wrong");
diff --git a/lib/list/ct-list-view-ug.c b/lib/list/ct-list-view-ug.c
index 516af1f..2da2cfc 100755
--- a/lib/list/ct-list-view-ug.c
+++ b/lib/list/ct-list-view-ug.c
@@ -59,7 +59,7 @@ static void list_ug_nums_popup_sel(void *data, Evas_Object *obj, void *event_inf
}
else {
if(clist_d->service_operation)
- phone_ug_return_value(clist_d->service_operation, 0, (int)data, 0);
+ phone_ug_return_value(clist_d->service_operation, 0, (int)data, 0, 0);
else
phone_ug_return_id(clist_d->ug, person_id, (int)data, 0);
ug_destroy_me(clist_d->ug);
@@ -90,7 +90,7 @@ static void list_ug_emails_popup_sel(void *data, Evas_Object *obj, void *event_i
}
else {
if(clist_d->service_operation)
- phone_ug_return_value(clist_d->service_operation, 0, 0, (int)data);
+ phone_ug_return_value(clist_d->service_operation, 0, 0, (int)data, 0);
else
phone_ug_return_id(clist_d->ug, contact_id, 0, (int)data);
@@ -212,7 +212,7 @@ static inline void list_ug_handle_select_number(ct_list_data *clist_d, ct_person
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);
if(clist_d->service_operation)
- phone_ug_return_value(clist_d->service_operation, 0, number_id, 0);
+ phone_ug_return_value(clist_d->service_operation, 0, number_id, 0, 0);
else
phone_ug_return_id(clist_d->ug, person_info->id, number_id, 0);
ug_destroy_me(clist_d->ug);
@@ -245,7 +245,7 @@ static inline void list_ug_handle_select_email(ct_list_data *clist_d, ct_person_
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);
if(clist_d->service_operation)
- phone_ug_return_value(clist_d->service_operation, 0, 0, email_id);
+ phone_ug_return_value(clist_d->service_operation, 0, 0, email_id, 0);
else
phone_ug_return_id(clist_d->ug, person_info->id, 0, email_id);
ug_destroy_me(clist_d->ug);
@@ -290,7 +290,7 @@ static inline void list_ug_handle_select_number_or_email(ct_list_data *clist_d,
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);
if(clist_d->service_operation)
- phone_ug_return_value(clist_d->service_operation, 0, number_id, 0);
+ phone_ug_return_value(clist_d->service_operation, 0, number_id, 0, 0);
else
phone_ug_return_id(clist_d->ug, person_info->id, number_id, 0);
ug_destroy_me(clist_d->ug);
@@ -300,7 +300,7 @@ static inline void list_ug_handle_select_number_or_email(ct_list_data *clist_d,
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);
if(clist_d->service_operation)
- phone_ug_return_value(clist_d->service_operation, 0, 0, email_id);
+ phone_ug_return_value(clist_d->service_operation, 0, 0, email_id, 0);
else
phone_ug_return_id(clist_d->ug, person_info->id, 0, email_id);
ug_destroy_me(clist_d->ug);
@@ -648,7 +648,7 @@ void ct_list_ug_gl_sel(void *data, Evas_Object *obj, void *event_info)
case CT_UG_REQUEST_SELECT_PERSON:
if (clist_d->ug) {
if(clist_d->service_operation)
- phone_ug_return_value(clist_d->service_operation, person_info->id, 0, 0);
+ phone_ug_return_value(clist_d->service_operation, person_info->id, 0, 0, 0);
else
phone_ug_return_id(clist_d->ug, person_info->id, 0, 0);
ug_destroy_me(clist_d->ug);