summaryrefslogtreecommitdiff
path: root/lib/common/ct-group-input-view.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common/ct-group-input-view.c')
-rwxr-xr-xlib/common/ct-group-input-view.c1102
1 files changed, 1102 insertions, 0 deletions
diff --git a/lib/common/ct-group-input-view.c b/lib/common/ct-group-input-view.c
new file mode 100755
index 0000000..82bf015
--- /dev/null
+++ b/lib/common/ct-group-input-view.c
@@ -0,0 +1,1102 @@
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#include <vconf.h>
+#include <vconf-keys.h>
+#include <Ecore_X.h>
+#include <app_service.h>
+#include "phone.h"
+#include "phone-common.h"
+
+#include "ct-list.h"
+#include "ct-group.h"
+
+typedef struct {
+ Evas_Object *win;
+ Evas_Object *navi;
+ Evas_Object *popup;
+ Evas_Object *genlist;
+ Evas_Object *entry;
+ Elm_Theme *th;
+ Elm_Object_Item *navi_it;
+ Elm_Object_Item *ab_gen_item;
+ Elm_Object_Item *vibration_gen_item;
+ Elm_Object_Item *ringtone_gen_item;
+ Elm_Object_Item *image_item;
+ Evas_Object *done_button;
+ Evas_Object *navi_it_pop_to;
+ Ecore_Event_Handler *win_prop_change;
+ bool camera_service_launched;
+ ct_group_input_result_cb result_cb;
+ void *result_cb_data;
+ void *ug;
+ void *crop_ug;
+ void *src_ug;
+ void *child_ug;//vibration,ringtone ug
+ int id_ab;
+ char *ab_name;
+ char *gname_old;
+ char *gname;
+ char *img;
+ char *ringtone;
+ char *vibration;
+ int id_grp;
+ bool editgroup;
+ bool err;
+ bool is_read_only;
+ Eina_List *member_list;
+} ct_group_input_data;
+
+enum GINPUT_ITC_TYPE{
+ GINPUT_ITC_GROUP_IMAGE,
+ GINPUT_ITC_GROUP_CREATE,
+ GINPUT_ITC_GROUP_VIBRATION,
+ GINPUT_ITC_GROUP_RINGTON,
+ GINPUT_ITC_ADDRBOOK,
+ GINPUT_ITC_ADDMEM_BUTTON,
+ GINPUT_ITC_LINE,
+};
+
+static Elm_Genlist_Item_Class group_input_itcs[] = {
+ {.item_style="image_layout"},
+ {.item_style="dialogue/1icon"},
+ {.item_style="dialogue/2text.3"},
+ {.item_style="dialogue/2text.3"},
+ {.item_style="dialogue/2text.3"},
+ {.item_style="1icon/with_no_line"},
+ {.item_style="dialogue/separator/1/with_line"},
+};
+
+static int group_input_group_update(ct_group_input_data *cgroup_input_d)
+{
+ PH_FN_CALL;
+ int ret = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+ contacts_record_h group_record = NULL;
+ contacts_list_h group_list = NULL;
+ unsigned int count = 0;
+
+ ret = phone_cts_get_list(_contacts_group._uri, _contacts_group.address_book_id,cgroup_input_d->id_ab, &group_list);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "phone_cts_get_list() Failed(%d)", ret);
+
+ ret = contacts_list_get_count(group_list,&count);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_list_get_count() Failed(%d)", ret);
+ if(count > 0){ //when detault group removed error
+ if(cgroup_input_d->editgroup == false)
+ {
+ ret = contacts_list_get_current_record_p(group_list, &record);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ while (record) {
+ char* group_name;
+ ret = contacts_record_get_str_p(record,_contacts_group.name,&group_name);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_record_get_str_p() Failed(%d)", ret);
+ if(strcmp(cgroup_input_d->gname, group_name) == 0) {
+ ret = -1;
+ contacts_list_destroy(group_list, true);
+ PH_DBG("create group :cgroup_input_d->id_grp =&d",cgroup_input_d->id_grp);
+ return ret;
+ }
+ ret = contacts_list_next(group_list);
+ if(CONTACTS_ERROR_NO_DATA == ret)
+ break;
+ else {
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_list_next() Failed(%d)", ret);
+ }
+ ret = contacts_list_get_current_record_p(group_list, &record);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ }
+ }
+ else{
+ ret = contacts_list_get_current_record_p(group_list, &record);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ while (record) {
+ char* group_name;
+ ret = contacts_record_get_str(record,_contacts_group.name ,&group_name);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_record_get_str() Failed(%d)", ret);
+ if(strcmp(cgroup_input_d->gname, group_name) == 0) {
+ int group_id;
+ ret = contacts_record_get_int(record,_contacts_group.id ,&group_id);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_record_get_int() Failed(%d)", ret);
+ if(group_id != cgroup_input_d->id_grp){
+ ret = -1;
+ contacts_list_destroy(group_list, true);
+ PH_DBG("group id = %d,cgroup_input_d->id_grp =&d",group_id,cgroup_input_d->id_grp);
+ return ret;
+ }
+ }
+ ret = contacts_list_next(group_list);
+ if(CONTACTS_ERROR_NONE != ret) break;
+ ret = contacts_list_get_current_record_p(group_list, &record);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+
+
+ }
+ }
+ }
+ if(cgroup_input_d->editgroup == true){
+ ret = contacts_db_get_record(_contacts_group._uri,cgroup_input_d->id_grp,&group_record);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_db_get_record() Failed(%d)", ret);
+ }
+ else{
+ ret = contacts_record_create(_contacts_group._uri,&group_record);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_record_create() Failed(%d)", ret);
+ }
+
+ ret = contacts_record_set_str(group_record, _contacts_group.name, cgroup_input_d->gname);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_record_set_str() Failed(%d)", ret);
+
+
+ ret = contacts_record_set_str(group_record, _contacts_group.image_path, cgroup_input_d->img);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_record_set_str() Failed(%d)", ret);
+ PH_DBG("cgroup_input_d->img = %s",cgroup_input_d->img);
+
+ ret = contacts_record_set_str(group_record, _contacts_group.ringtone_path, cgroup_input_d->ringtone);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_record_set_str() Failed(%d)", ret);
+
+
+ ret = contacts_record_set_str(group_record, _contacts_group.vibration, cgroup_input_d->vibration);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_record_set_str() Failed(%d)", ret);
+
+ if(cgroup_input_d->editgroup == true){
+ ret = contacts_db_update_record(group_record);
+ PH_DBG("cgroup_input_d->id_grp = %d",cgroup_input_d->id_grp);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_db_update_record() Failed(%d)", ret);
+ }
+ else{
+ ret = contacts_db_insert_record(group_record, &cgroup_input_d->id_grp);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret,ret, "contacts_db_insert_record() Failed(%d)", ret);
+ }
+
+ ret = contacts_record_destroy(group_record, true);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_destroy() Failed(%d)", ret);
+
+ ret = contacts_list_destroy(group_list, true);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_list_destroy() Failed(%d)", ret);
+
+ return ret;
+
+}
+static void group_input_save_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ int ret;
+ Evas_Object *entry;
+ Evas_Object *navi_it_pop_to;
+ char *text;
+ ct_group_input_data *cgroup_input_d = data;
+ char msg[256];
+ entry = cgroup_input_d->entry;
+
+ text = ctui_entry_markup_to_utf8(elm_entry_entry_get(entry));
+ p_retm_if(NULL == text, "ctui_entry_markup_to_utf8() return NULL");
+ cgroup_input_d->gname = SAFE_STRDUP(text);
+
+ ret = group_input_group_update(cgroup_input_d);
+
+ if (ret != CONTACTS_ERROR_NONE) {
+ const char *err_msg;
+ cgroup_input_d->err = true;
+ FREEandSTRDUP(cgroup_input_d->gname_old ,text);
+ switch (ret) {
+ case CONTACTS_ERROR_NO_DATA:
+ err_msg = T_(CT_GET_TEXT_ERR, CTTEXT_ERR_DB_LOCKED);
+ break;
+ case CONTACTS_ERROR_FILE_NO_SPACE:
+ err_msg = S_(CT_SYS_POP_NOT_ENOUGH_MEMORY);
+ break;
+ case -1:
+ err_msg = T_(CT_GET_TEXT_ERR, CTTEXT_ALREADY_EXIST);
+ break;
+ default:
+ err_msg = S_(PH_SYS_POP_FAILED);
+ break;
+ }
+
+ snprintf(msg, sizeof(msg), "<color=#FF0000>%s</>", err_msg);
+ elm_entry_entry_set(entry, msg);
+ ctui_navi_left_btn_disabled_set(cgroup_input_d->navi_it, EINA_TRUE);
+ elm_object_disabled_set(cgroup_input_d->done_button, EINA_TRUE);
+ free(text);
+ return;
+ }
+ free(text);
+
+ navi_it_pop_to = NULL;
+ navi_it_pop_to = evas_object_data_get(cgroup_input_d->navi, "navi_it_pop");
+ if (navi_it_pop_to){ // group - create/edit - assign member
+ if(cgroup_input_d->editgroup == true)
+ {
+ elm_naviframe_item_pop(cgroup_input_d->navi);
+ //ctui_create_gadd_list_select_view(cgroup_input_d->win, cgroup_input_d->navi, cgroup_input_d->id_grp, cgroup_input_d->id_ab, cgroup_input_d->member_list);
+ }
+ else
+ ctui_create_gadd_list_select_view(cgroup_input_d->win, cgroup_input_d->navi, cgroup_input_d->id_grp, cgroup_input_d->id_ab, NULL);
+ }
+ else { // group detail - add member
+ if (cgroup_input_d->result_cb)
+ cgroup_input_d->result_cb(ret, cgroup_input_d->result_cb_data,false);
+ elm_naviframe_item_pop(cgroup_input_d->navi);
+ }
+}
+
+
+static void group_input_popup_hide_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ evas_object_del(cgroup_input_d->popup);
+ cgroup_input_d->popup = NULL;
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_TRUE);
+}
+
+static void group_input_ab_popup_item_sel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ ct_ab_popup_data *ab_popup_data;
+ char account_name[PH_TEXT_MAX_LEN+1];
+ char temp[PH_TEXT_MAX_LEN+1];
+
+ group_input_popup_hide_cb(cgroup_input_d, NULL, NULL);
+
+ ab_popup_data = elm_object_item_data_get(event_info);
+ p_retm_if(NULL == ab_popup_data, "elm_object_item_data_get() return NULL");
+
+ if (cgroup_input_d->id_ab == ab_popup_data->id)
+ return;
+
+ cgroup_input_d->id_ab = ab_popup_data->id;
+
+ if (ab_popup_data->id) {
+ ctui_get_addressbook_name(ab_popup_data->id, account_name, sizeof(account_name));
+ snprintf(temp, sizeof(temp), "%s(%s)", account_name, ab_popup_data->name);
+ }
+ else {
+ snprintf(temp, sizeof(temp), "%s", T_(CT_GET_TEXT_BASIC, CTTEXT_PHONE));
+ }
+ free(cgroup_input_d->ab_name);
+ cgroup_input_d->ab_name = strdup(temp);
+ elm_genlist_item_update(cgroup_input_d->ab_gen_item);
+
+ // FIXME : push contact list view to select contacts added to the created group
+}
+
+static void group_input_gl_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *popup;
+ Evas_Object *btn;
+ ct_group_input_data *cgroup_input_d = data;
+ Elm_Object_Item *item = event_info;
+
+ if (elm_genlist_item_flip_get(item))
+ return;
+
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ popup = ctui_addrbook_popup(cgroup_input_d->win, group_input_ab_popup_item_sel_cb, cgroup_input_d, CT_AB_POPUP_TYPE_GINPUT_VIEW);
+ p_retm_if(NULL == popup, "ctui_addrbook_popup() return NULL");
+ elm_object_part_text_set(popup, "title,text", T_(CT_GET_TEXT_BASE_OP, CTTEXT_SAVE_TO));
+
+ btn = elm_button_add(popup);
+ elm_object_text_set(btn, S_(PH_SYS_POP_CLOSE));
+ elm_object_part_content_set(popup, "button1", btn);
+ elm_object_style_set(btn, "popup_button/default");
+ evas_object_smart_callback_add(btn, "clicked", group_input_popup_hide_cb, cgroup_input_d);
+
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_FALSE);
+ cgroup_input_d->popup = popup;
+}
+static void group_input_setting_ringtone_result(ui_gadget_h ug, service_h service, void *data)
+{
+ PH_FN_CALL;
+ char *val = NULL;
+ ct_group_input_data *cgroup_input_d = data;
+
+ p_retm_if(NULL == ug || NULL == data, "ug or data is NULL");
+
+ if (service) {
+ service_get_extra_data(service, "result", &val);
+ p_retm_if(!val, "return value is NULL");
+ FREEandSTRDUP(cgroup_input_d->ringtone,val);
+ free(val);
+ }
+ elm_genlist_item_update(cgroup_input_d->ringtone_gen_item);
+}
+static void group_input_child_ug_destroy(ui_gadget_h ug, void *priv)
+{
+ PH_FN_CALL;
+ ct_group_input_data *cgroup_input_d = priv;
+
+ p_retm_if(NULL == ug, "ug is NULL");
+
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_TRUE);
+
+ if (cgroup_input_d->child_ug) {
+ ug_destroy(cgroup_input_d->child_ug);
+ cgroup_input_d->child_ug = NULL;
+ }
+}
+
+/*
+static void group_input_gl_vibration_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ //ToDo can not use a setting vibration view yet
+ return;
+}
+*/
+
+static void group_input_gl_ringtone_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ct_group_input_data *cgroup_input_d = data;
+ Elm_Object_Item *item = event_info;
+
+ if (elm_genlist_item_flip_get(item))
+ return;
+
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+ struct ug_cbs cbs = {0};
+
+ service_h service;
+
+ service_create(&service);
+ service_add_extra_data(service, "path", "/opt/share/settings/Ringtones");
+ service_add_extra_data(service, "select_type", "SINGLE_FILE");
+ service_add_extra_data(service, "file_type", "SOUND");
+ if(cgroup_input_d->ringtone)
+ service_add_extra_data(service, "marked_mode", cgroup_input_d->ringtone);
+
+ cbs.result_cb = group_input_setting_ringtone_result;
+ cbs.destroy_cb = group_input_child_ug_destroy;
+ cbs.layout_cb = ug_common_layout_cb;
+ cbs.priv = cgroup_input_d;
+
+ cgroup_input_d->child_ug = ug_create(cgroup_input_d->ug, MYFILES_UG, UG_MODE_FULLVIEW, service, &cbs);
+ p_warn_if(NULL == cgroup_input_d->child_ug, "ug_create() Failed");
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_FALSE);
+ service_destroy(service);
+}
+static void group_input_fill_genlist(ct_group_input_data *cgroup_input_d)
+{
+ Elm_Object_Item *item;
+
+ item = elm_genlist_item_append(cgroup_input_d->genlist, &group_input_itcs[GINPUT_ITC_GROUP_IMAGE], cgroup_input_d, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ cgroup_input_d->image_item = item;
+
+ item = elm_genlist_item_append(cgroup_input_d->genlist, &group_input_itcs[GINPUT_ITC_LINE], cgroup_input_d, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ item = elm_genlist_item_append(cgroup_input_d->genlist, &group_input_itcs[GINPUT_ITC_GROUP_CREATE], cgroup_input_d, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+// item = elm_genlist_item_append(cgroup_input_d->genlist, &group_input_itcs[GINPUT_ITC_GROUP_VIBRATION], cgroup_input_d, NULL,
+// ELM_GENLIST_ITEM_NONE, group_input_gl_sel, cgroup_input_d);
+// cgroup_input_d->vibration_gen_item = item; can not use a setting vibration view yet.
+
+ item = elm_genlist_item_append(cgroup_input_d->genlist, &group_input_itcs[GINPUT_ITC_GROUP_RINGTON], cgroup_input_d, NULL,
+ ELM_GENLIST_ITEM_NONE, group_input_gl_ringtone_sel, cgroup_input_d);
+ cgroup_input_d->ringtone_gen_item = item;
+
+ item = elm_genlist_item_append(cgroup_input_d->genlist, &group_input_itcs[GINPUT_ITC_ADDRBOOK], cgroup_input_d, NULL,
+ ELM_GENLIST_ITEM_NONE, group_input_gl_sel, cgroup_input_d);
+ cgroup_input_d->ab_gen_item = item;
+
+ if(cgroup_input_d->is_read_only == true)
+ elm_object_item_disabled_set(item, EINA_TRUE);
+
+ if(cgroup_input_d->editgroup == true){
+ ctui_genlist_append_separator_20px(cgroup_input_d->genlist);
+ elm_genlist_item_append(cgroup_input_d->genlist, &group_input_itcs[GINPUT_ITC_ADDMEM_BUTTON], cgroup_input_d, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ }
+
+}
+
+static char* group_input_gl_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ const char *display;
+
+ if (!strcmp(part, "elm.text.1"))
+ return strdup(T_(CT_GET_TEXT_BASE_OP, CTTEXT_SAVE_TO));
+ else if (!strcmp(part, "elm.text.2")) {
+ if (cgroup_input_d && 0 == cgroup_input_d->id_ab)
+ display = S_(CT_SYS_BODY_PHONE);
+ else if (cgroup_input_d && cgroup_input_d->ab_name)
+ display = cgroup_input_d->ab_name;
+ else
+ display = S_(PH_SYS_BODY_UNKNOWN);
+ return SAFE_STRDUP(display);
+ }
+ return NULL;
+}
+static char* group_input_gl_vibration_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ PH_FN_CALL;
+ ct_group_input_data *cgroup_input_d = data;
+ const char *display;
+
+ if (!strcmp(part, "elm.text.1"))
+ return strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_VIBRATION_PATTERN));
+ else if (!strcmp(part, "elm.text.2")) {
+ if (cgroup_input_d && 0 == cgroup_input_d->id_ab)
+ display = T_(CT_GET_TEXT_BASIC, CTTEXT_DEFAULT);
+ else if (cgroup_input_d && cgroup_input_d->vibration)
+ display = strrchr(cgroup_input_d->vibration, '/')+1;
+ else
+ display = S_(PH_SYS_BODY_UNKNOWN);
+ return SAFE_STRDUP(display);
+ }
+ return NULL;
+}
+static char* group_input_gl_ringtone_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ const char *display;
+
+ if (!strcmp(part, "elm.text.1"))
+ return strdup(T_(CT_GET_TEXT_BASIC, CTTEXT_RINGTONE));
+ else if (!strcmp(part, "elm.text.2")) {
+ if (cgroup_input_d && cgroup_input_d->ringtone == NULL)
+ display = T_(CT_GET_TEXT_BASIC, CTTEXT_DEFAULT);
+ else if (cgroup_input_d && cgroup_input_d->ringtone){
+ display = strrchr(cgroup_input_d->ringtone, '/')+1;
+ }
+ else
+ display = S_(PH_SYS_BODY_UNKNOWN);
+ return SAFE_STRDUP(display);
+ }
+ return NULL;
+}
+static void group_input_entry_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ char *text;
+ ct_group_input_data *cgroup_input_d = data;
+
+ text = ctui_entry_markup_to_utf8(elm_entry_entry_get(obj));
+ p_retm_if(NULL == text, "ctui_entry_markup_to_utf8() return NULL");
+
+ if (*text) {
+ ctui_navi_left_btn_disabled_set(cgroup_input_d->navi_it, EINA_FALSE);
+ elm_object_disabled_set(cgroup_input_d->done_button, EINA_FALSE);
+ }
+ else {
+ ctui_navi_left_btn_disabled_set(cgroup_input_d->navi_it, EINA_TRUE);
+ elm_object_disabled_set(cgroup_input_d->done_button, EINA_TRUE);
+ }
+ free(text);
+}
+
+static void group_input_err_entry_focused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_group_input_data *cgroup_input_d = data;
+
+ if(NULL!=cgroup_input_d->src_ug)
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_FALSE);
+ p_retm_if(NULL == cgroup_input_d->gname_old, "cgroup_input_d->gname_old is NULL");
+
+ if(cgroup_input_d->err == true) {
+ ctui_entry_entry_set(obj, cgroup_input_d->gname_old);
+ cgroup_input_d->err = false;
+ }
+
+ elm_entry_cursor_end_set(obj);
+}
+
+static void group_input_src_ug_destroy(ui_gadget_h ug, void *priv)
+{
+ ct_group_input_data *cgroup_input_d = priv;
+
+ p_retm_if(NULL == ug, "ug is NULL");
+
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_TRUE);
+
+ if (NULL == cgroup_input_d->crop_ug) {
+ ug_destroy(cgroup_input_d->src_ug);
+ cgroup_input_d->src_ug = NULL;
+ }
+}
+
+static void group_input_crop_ug_destroy(ui_gadget_h ug, void *priv)
+{
+ ct_group_input_data *cgroup_input_d = priv;
+
+ p_retm_if(NULL == ug, "ug is NULL");
+
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_TRUE);
+
+ if (cgroup_input_d->crop_ug) {
+ ug_destroy(ug);
+ cgroup_input_d->crop_ug = NULL;
+ }
+ if (cgroup_input_d->src_ug) {
+ ug_destroy(cgroup_input_d->src_ug);
+ cgroup_input_d->src_ug = NULL;
+ }
+}
+
+static void group_input_image_crop_result(ui_gadget_h ug, service_h service, void *data)
+{
+ char *img = NULL;
+ ct_group_input_data *cgroup_input_d = data;
+
+ p_retm_if(NULL == ug || NULL == data, "ug or data is NULL");
+
+ if (service) {
+ service_get_extra_data(service, "crop_image_path", &img);
+ p_retm_if(!img, "return value is NULL.\n");
+ PH_DBG("img = %s",img);
+ FREEandSTRDUP(cgroup_input_d->img, img);
+ free(img);
+ elm_genlist_item_update(cgroup_input_d->image_item);
+ }
+
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_TRUE);
+}
+
+
+static void group_input_image_delete_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ group_input_popup_hide_cb(cgroup_input_d, NULL, NULL);
+ free(cgroup_input_d->img);
+ cgroup_input_d->img = NULL;
+ elm_genlist_item_update(cgroup_input_d->image_item);
+}
+
+static void group_input_image_gallery_result(ui_gadget_h ug, service_h service, void *data)
+{
+ char *val = NULL;
+ ct_group_input_data *cgroup_input_d = data;
+
+ p_retm_if(NULL == ug || NULL == data, "ug or data is NULL");
+
+ if (service) {
+ struct ug_cbs cbs = {0};
+
+ service_get_extra_data(service, "path", &val);
+ p_retm_if(!val, "return value is NULL.\n");
+
+ cbs.result_cb = group_input_image_crop_result;
+ cbs.destroy_cb = group_input_crop_ug_destroy;
+ cbs.priv = cgroup_input_d;
+ cgroup_input_d->crop_ug = phone_image_crop_ug(cgroup_input_d->ug, val, &cbs);
+ free(val);
+ }
+}
+
+static void group_input_camera_result(service_h service, service_h reply, service_result_e result, void* user_data)
+{
+ char *img = NULL;
+ ct_group_input_data *cgroup_input_d = user_data;
+ cgroup_input_d->camera_service_launched = false;
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_TRUE);
+
+ service_get_extra_data(reply, "crop_image_path", &img);
+ p_retm_if(!img, "return value is NULL.\n");
+
+ FREEandSTRDUP(cgroup_input_d->img, img);
+ free(img);
+ elm_genlist_item_update(cgroup_input_d->image_item);
+}
+
+static void __group_input_gallery(ct_group_input_data *cgroup_input_d)
+{
+ service_h service;
+ struct ug_cbs cbs = {0};
+
+ group_input_popup_hide_cb(cgroup_input_d, NULL, NULL);
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_FALSE);
+
+ service_create(&service);
+ service_add_extra_data(service, "launch-type", "select-one");
+ service_add_extra_data(service, "file-type", "image");
+
+ cbs.result_cb = group_input_image_gallery_result;
+ cbs.destroy_cb = group_input_src_ug_destroy;
+ cbs.layout_cb = ug_common_layout_cb;
+ cbs.priv = cgroup_input_d;
+
+
+ cgroup_input_d->src_ug = ug_create(cgroup_input_d->ug, GALLERY_UG, UG_MODE_FULLVIEW, service, &cbs);
+ p_warn_if(NULL == cgroup_input_d->src_ug, "ug_create() Failed");
+
+ service_destroy(service);
+}
+
+static void __group_input_camera(ct_group_input_data *cgroup_input_d)
+{
+ service_h service;
+ p_ret_if(cgroup_input_d->camera_service_launched);
+ group_input_popup_hide_cb(cgroup_input_d, NULL, NULL);
+ elm_object_tree_focus_allow_set(cgroup_input_d->navi, EINA_FALSE);
+
+ service_create(&service);
+ service_set_window(service, elm_win_xwindow_get(cgroup_input_d->win));
+ service_set_operation(service, SERVICE_OPERATION_CREATE_CONTENT);
+ service_set_mime(service, "image/jpg");
+ service_add_extra_data(service, "CALLER", "contacts");
+ service_send_launch_request(service, group_input_camera_result, cgroup_input_d);
+ cgroup_input_d->camera_service_launched = true;
+ service_destroy(service);
+}
+
+static void __group_input_gallery_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ service_h service;
+ struct ug_cbs cbs = {0};
+ ct_group_input_data *cgroup_input_d = data;
+
+ Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up *)event_info;
+ if(ev == NULL){
+ ERR("ev is null!!!");
+ return;
+ }
+
+ int x, y, w, h;
+
+ if (cgroup_input_d->img && *cgroup_input_d->img) {
+ elm_icon_file_set(obj, cgroup_input_d->img, NULL);
+ }
+ else
+ elm_icon_file_set(obj, CTUI_IMG_INPUT_GALLERY, NULL);
+
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
+ return;
+
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+ if (ev->output.y < y || y + h < ev->output.y)
+ return;
+
+ __group_input_gallery(cgroup_input_d);
+}
+
+static void __group_input_gallery_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ ct_group_input_data *cgroup_input_d = data;
+
+ if (cgroup_input_d->img && *cgroup_input_d->img) {
+ elm_icon_file_set(obj, cgroup_input_d->img, NULL);
+ }
+ else
+ elm_icon_file_set(obj, CTUI_IMG_INPUT_GALLERY_PRESSED, NULL);
+}
+
+static void __group_input_camera_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ int x, y, w, h;
+ service_h service;
+ Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up *)event_info;
+ if(ev == NULL){
+ ERR("ev is null!!!");
+ return;
+ }
+ elm_icon_file_set(obj, CTUI_IMG_INPUT_CAMERA, NULL);
+
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
+ return;
+
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+ if (ev->output.y < y || y + h < ev->output.y)
+ return;
+
+ __group_input_camera(cgroup_input_d);
+
+}
+static void __group_input_camera_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ elm_icon_file_set(obj, CTUI_IMG_INPUT_CAMERA_PRESSED, NULL);
+}
+
+static Evas_Object* group_input_gl_create_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ p_retvm_if(NULL== data, NULL, "The parameter(data) is NULL");
+
+ if (0 == strcmp(part, "elm.icon")) {
+ static Elm_Entry_Filter_Limit_Size limit_filter_data;
+ Evas_Object *edit_field;
+ Evas_Object *entry;
+
+ edit_field = ctui_create_editfield(obj, T_(CT_GET_TEXT_BASIC, CTTEXT_GROUP_NAME), NULL, false);
+ evas_object_propagate_events_set(edit_field, EINA_FALSE);
+
+ entry = elm_object_part_content_get(edit_field, "elm.swallow.content");
+ elm_object_signal_emit(edit_field, "elm,state,guidetext,hide", "elm");
+ evas_object_data_set(obj,"entry", entry);
+ cgroup_input_d->entry = entry;
+
+ limit_filter_data.max_char_count = CT_EDITFIELD_MAX_CHAR;
+ elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &limit_filter_data);
+ evas_object_smart_callback_add(entry, "changed", group_input_entry_changed_cb, cgroup_input_d);
+ evas_object_smart_callback_add(entry, "preedit,changed", group_input_entry_changed_cb, cgroup_input_d);
+ evas_object_smart_callback_add(entry, "focused", group_input_err_entry_focused_cb, cgroup_input_d);
+
+ if(cgroup_input_d->editgroup == true)
+ ctui_entry_entry_set(entry, cgroup_input_d->gname);
+
+ if(cgroup_input_d->is_read_only == true)
+ elm_object_disabled_set(entry,EINA_TRUE);
+
+ evas_object_show(entry);
+
+ return edit_field;
+ }
+ return NULL;
+}
+
+static Evas_Object* group_input_gl_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ p_retvm_if(NULL== data, NULL, "The parameter(data) is NULL");
+
+ if (0 == strcmp(part, "elm.icon")) {
+ Evas_Object *icon;
+ if (cgroup_input_d->img && *cgroup_input_d->img) {
+ PH_DBG("img : %s",cgroup_input_d->img);
+ icon = elm_icon_add(obj);
+ p_retvm_if(NULL == icon, NULL, "elm_icon_add() return NULL");
+ elm_icon_file_set(icon, cgroup_input_d->img, NULL);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_NONE, 1, 1);
+ evas_object_size_hint_align_set(icon, 0.5, EVAS_HINT_FILL);
+ }
+ else {
+ icon = elm_icon_add(obj);
+ p_retvm_if(NULL == icon, NULL, "elm_icon_add() return NULL");
+ elm_icon_file_set(icon, CTUI_IMG_INPUT_GALLERY, NULL);
+ elm_icon_resizable_set(icon, EINA_FALSE, EINA_FALSE);
+ }
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_DOWN, __group_input_gallery_mouse_down, cgroup_input_d);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_UP, __group_input_gallery_mouse_up, cgroup_input_d);
+ return icon;
+ }
+ if (0 == strcmp(part, "elm.icon3")) {
+ Evas_Object *icon = NULL;
+
+ icon = elm_icon_add(obj);
+ p_retvm_if(NULL == icon, NULL, "elm_icon_add() return NULL");
+ elm_icon_file_set(icon, CTUI_IMG_INPUT_CAMERA, NULL);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_NONE, 1, 1);
+ evas_object_size_hint_align_set(icon, 0.5, EVAS_HINT_FILL);
+ evas_object_propagate_events_set(icon, EINA_FALSE);
+ evas_object_color_set(icon, 255, 255, 255, 255);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_DOWN, __group_input_camera_mouse_down, cgroup_input_d);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_UP, __group_input_camera_mouse_up, cgroup_input_d);
+ //evas_object_smart_callback_add(icon, "clicked", group_input_image_camera_cb, cgroup_input_d);
+ return icon;
+ }
+ if (0 == strcmp(part, "elm.icon4")) {
+ Evas_Object *btn_minus;
+ if (cgroup_input_d->img && *cgroup_input_d->img) {
+ btn_minus = elm_button_add(obj);
+ p_retvm_if(NULL == btn_minus, NULL, "elm_button_add() return NULL");
+ elm_object_style_set(btn_minus, "icon_minus");
+ evas_object_size_hint_aspect_set(btn_minus, EVAS_ASPECT_CONTROL_NONE, 1, 1);
+ evas_object_size_hint_align_set(btn_minus, 0.5, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(btn_minus, "clicked", group_input_image_delete_cb, cgroup_input_d);
+ return btn_minus;
+ }
+ else
+ return NULL;
+ }
+ return NULL;
+}
+
+int group_input_get_member_list(int group_id, Eina_List **list)
+{
+ int ret;
+ int person_id;
+ contacts_record_h record = NULL;
+ contacts_list_h person_list = NULL;
+
+ ret = phone_cts_get_list(_contacts_person_grouprel._uri, _contacts_person_grouprel.group_id, group_id, &person_list);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "phone_cts_get_list() Failed(%d)", ret);
+ ret = contacts_list_get_current_record_p(person_list,&record);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ while (record) {
+ ct_person_list *person_info;
+ char *display_name = NULL;
+ char *addressbook_ids = NULL;
+
+ ret = contacts_record_get_int(record, _contacts_person.id,&person_id);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_get_int() Failed(%d)", ret);
+
+ person_info = calloc(1, sizeof(ct_person_list));
+ person_info->id = person_id;
+ ret = contacts_record_get_str_p(record, _contacts_person.display_name,&display_name);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_get_str_p() Failed(%d)", ret);
+ person_info->display = SAFE_STRDUP(display_name);
+
+ ret = contacts_record_get_int(record, _contacts_person.link_count,&(person_info->link_count));
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_get_int() Failed(%d)", ret);
+
+ ret = contacts_record_get_str(record, _contacts_person.addressbook_ids,&addressbook_ids);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_get_int() Failed(%d)", ret);
+ person_info->addressbook_id_list = ctui_get_addressbook_id_list(addressbook_ids, " ");
+
+ *list = eina_list_append(*list, person_info);
+
+ ret = contacts_list_next(person_list);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_list_next() Failed(%d)", ret);
+ ret = contacts_list_get_current_record_p(person_list, &record);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_list_get_current_record_p() Failed(%d)", ret);
+ }
+ ret = contacts_list_destroy(person_list, true);
+ p_retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_list_destroy() Failed(%d)", ret);
+
+ return ret;
+}
+
+
+static void group_input_add_member_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ p_retm_if(NULL == cgroup_input_d, "parameter(cgroup_input_d) is NULL");
+
+ ctui_create_gadd_list_select_view(cgroup_input_d->win, cgroup_input_d->navi, cgroup_input_d->id_grp, cgroup_input_d->id_ab, cgroup_input_d->member_list);
+}
+static Evas_Object* group_input_gl_btn_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ Evas_Object *ret_obj;
+ ct_group_input_data *cgroup_input_d = data;
+ p_retvm_if(NULL == cgroup_input_d, NULL, "parameter(cgroup_input_d) is NULL");
+
+ ret_obj = NULL;
+ if (0 == strcmp(part, "elm.icon")) {
+ Evas_Object *btn;
+ btn = ctui_create_btn(obj, T_(CT_GET_TEXT_BASE_OP, CTTEXT_ADD_MEMBER));
+ p_retvm_if(NULL == btn, NULL, "ctui_create_btn() return NULL");
+ evas_object_smart_callback_add(btn, "clicked", group_input_add_member_clicked_cb, cgroup_input_d);
+
+ ret_obj = btn;
+ }
+ return ret_obj;
+}
+
+
+static void group_input_genlist_style_set(void)
+{
+ group_input_itcs[GINPUT_ITC_GROUP_IMAGE].func.content_get = group_input_gl_icon_get;
+ group_input_itcs[GINPUT_ITC_GROUP_CREATE].func.content_get = group_input_gl_create_icon_get;
+ group_input_itcs[GINPUT_ITC_GROUP_VIBRATION].func.text_get = group_input_gl_vibration_label_get;
+ group_input_itcs[GINPUT_ITC_GROUP_RINGTON].func.text_get = group_input_gl_ringtone_label_get;
+ group_input_itcs[GINPUT_ITC_ADDRBOOK].func.text_get = group_input_gl_label_get;
+ group_input_itcs[GINPUT_ITC_ADDMEM_BUTTON].func.content_get = group_input_gl_btn_icon_get;
+}
+
+static void group_input_view_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ PH_FN_CALL;
+ ct_group_input_data *cgroup_input_d = data;
+
+ if (cgroup_input_d->popup)
+ evas_object_del(cgroup_input_d->popup);
+ if (cgroup_input_d->th) {
+ elm_theme_extension_del(cgroup_input_d->th, IMAGE_LAYOUT_EDJ);
+ elm_theme_free(cgroup_input_d->th);
+ }
+
+ if (cgroup_input_d->src_ug)
+ ug_destroy(cgroup_input_d->src_ug);
+
+ if (cgroup_input_d->crop_ug)
+ ug_destroy(cgroup_input_d->crop_ug);
+
+ if (cgroup_input_d->win_prop_change)
+ ecore_event_handler_del(cgroup_input_d->win_prop_change);
+
+ evas_object_data_del(cgroup_input_d->navi, "navi_it_pop_to");
+ ctui_list_free_contacts(cgroup_input_d->member_list);
+ free(cgroup_input_d->ab_name);
+ free(cgroup_input_d->gname_old);
+ free(cgroup_input_d->gname);
+ free(cgroup_input_d->img);
+ free(cgroup_input_d->ringtone);
+ free(cgroup_input_d->vibration);
+ free(cgroup_input_d);
+}
+
+static Eina_Bool group_input_win_prop_change(void *data, int type, void *event)
+{
+ ct_group_input_data *cgroup_input_d = data;
+ Evas_Object *l_btn, *r_btn;
+ char *text;
+ Ecore_X_Event_Window_Property *ev = event;
+ Ecore_X_Virtual_Keyboard_State state = ecore_x_e_virtual_keyboard_state_get(ev->win);
+
+ p_retvm_if(NULL == cgroup_input_d, ECORE_CALLBACK_CANCEL, "parameter(clist_d) is NULL");
+ p_retvm_if(NULL == cgroup_input_d->navi_it, ECORE_CALLBACK_CANCEL, "parameter(clist_d->navi_it) is NULL");
+ if (ECORE_X_VIRTUAL_KEYBOARD_STATE_ON == state &&
+ NULL == elm_object_item_part_content_get(cgroup_input_d->navi_it, "title_left_btn")) {
+ l_btn = phone_create_navi_btn(cgroup_input_d->navi, "plus");
+ evas_object_smart_callback_add(l_btn, "clicked", group_input_save_btn_cb, cgroup_input_d);
+ evas_object_show(l_btn);
+ elm_object_item_part_content_set(cgroup_input_d->navi_it, "title_left_btn", l_btn);
+ text = ctui_entry_markup_to_utf8(elm_entry_entry_get(cgroup_input_d->entry));
+ p_retvm_if(NULL == text, ECORE_CALLBACK_PASS_ON, "ctui_entry_markup_to_utf8() return NULL");
+ if (*text)
+ elm_object_disabled_set(l_btn, EINA_FALSE);
+ else
+ elm_object_disabled_set(l_btn, EINA_TRUE);
+
+ r_btn = phone_create_navi_btn(cgroup_input_d->navi, "naviframe/prev_btn/default");
+ evas_object_smart_callback_add(r_btn, "clicked", phone_view_back_btn_cb, cgroup_input_d->navi);
+ evas_object_show(r_btn);
+ elm_object_item_part_content_set(cgroup_input_d->navi_it, "title_right_btn", r_btn);
+
+ free(text);
+ }
+ else if (ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF == state &&
+ NULL != elm_object_item_part_content_get(cgroup_input_d->navi_it, "title_left_btn")) {
+
+ elm_object_item_part_content_set(cgroup_input_d->navi_it, "title_left_btn", NULL);
+ elm_object_item_part_content_set(cgroup_input_d->navi_it, "title_right_btn", NULL);
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static void group_input_get_data(ct_group_input_data *cgroup_input_d)
+{
+ PH_FN_CALL;
+ char *img = NULL;
+ char *vibration = NULL;
+ char *ringtone = NULL;
+ char *gname = NULL;
+ bool is_read_only = false;
+ contacts_error_e err = CONTACTS_ERROR_NONE;
+ contacts_record_h record = NULL;
+
+ err = contacts_db_get_record(_contacts_group._uri,cgroup_input_d->id_grp,&record);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_db_get_record() Failed(%d)", err);
+ err = contacts_record_get_str_p(record,_contacts_group.image_path,&img);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ cgroup_input_d->img = SAFE_STRDUP(img);
+
+ err = contacts_record_get_str_p(record,_contacts_group.vibration,&vibration);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ cgroup_input_d->vibration = SAFE_STRDUP(vibration);
+
+ err = contacts_record_get_str_p(record,_contacts_group.ringtone_path,&ringtone);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ cgroup_input_d->ringtone = SAFE_STRDUP(ringtone);
+
+ err = contacts_record_get_str_p(record,_contacts_group.name,&gname);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_str_p() Failed(%d)", err);
+ if (gname && *gname) {
+ if (strcmp(gname,"friends") == 0)
+ gname = T_(CT_GET_TEXT_BASIC, CTTEXT_FRIENDS);
+ else if (strcmp(gname,"family") == 0)
+ gname = T_(CT_GET_TEXT_BASIC, CTTEXT_FAMILY);
+ else if (strcmp(gname,"coworkers") == 0)
+ gname = T_(CT_GET_TEXT_BASIC, CTTEXT_CO_WORKERS);
+ }
+
+ cgroup_input_d->gname = SAFE_STRDUP(gname);
+ cgroup_input_d->gname_old = SAFE_STRDUP(gname);
+
+ err = contacts_record_get_bool(record,_contacts_group.is_read_only,&is_read_only);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_get_bool() Failed(%d)", err);
+ cgroup_input_d->is_read_only = is_read_only;
+
+ err = contacts_record_destroy(record, true);
+ p_retm_if(CONTACTS_ERROR_NONE != err, "contacts_record_destroy() Failed(%d)", err);
+}
+
+void ctui_create_group_input_view(Evas_Object *win, Evas_Object *navi, ct_group_list *info, ct_group_input_result_cb result_cb, void *cb_data)
+{
+ PH_FN_CALL;
+ ct_group_input_data *cgroup_input_d;
+ Evas_Object *layout;
+ Evas_Object *bg;
+ Evas_Object *back_btn;
+ Elm_Theme *th;
+
+ cgroup_input_d = calloc(1, sizeof(ct_group_input_data));
+ p_retm_if(NULL == cgroup_input_d, "calloc() return NULL");
+
+ if(info != NULL){
+ cgroup_input_d->id_grp = info->id_grp;
+
+ cgroup_input_d->id_ab = info->id_ab;
+ group_input_get_data(cgroup_input_d);
+ cgroup_input_d->editgroup = true;
+ group_input_get_member_list(cgroup_input_d->id_grp, &cgroup_input_d->member_list);
+ PH_DBG("cgroup_input_d->id_grp : %d",cgroup_input_d->id_grp );
+ }
+ else{
+ cgroup_input_d->editgroup = false;
+ cgroup_input_d->id_ab = 0;
+ }
+ cgroup_input_d->win = win;
+ cgroup_input_d->navi = navi;
+ cgroup_input_d->result_cb = result_cb;
+ cgroup_input_d->result_cb_data = cb_data;
+
+ layout = phone_create_base_layout(cgroup_input_d->navi, false);
+ bg = phone_create_bg(layout);
+ if (NULL == bg) {
+ ERR("phone_create_bg() return NULL");
+ free(cgroup_input_d);
+ evas_object_del(layout);
+ return;
+ }
+
+ elm_win_conformant_set(cgroup_input_d->win, EINA_TRUE);
+ cgroup_input_d->win_prop_change = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, group_input_win_prop_change, cgroup_input_d);
+ cgroup_input_d->genlist = elm_genlist_add(layout);
+ elm_object_style_set(cgroup_input_d->genlist, "dialogue");
+ elm_object_style_set(cgroup_input_d->genlist, "no_effect");
+ th = elm_theme_new();
+ elm_theme_ref_set(th, NULL);
+ elm_theme_extension_add(th, IMAGE_LAYOUT_EDJ);
+ cgroup_input_d->th = th;
+ elm_object_theme_set(cgroup_input_d->genlist, cgroup_input_d->th);
+ elm_genlist_decorate_mode_set(cgroup_input_d->genlist, EINA_TRUE);
+ group_input_genlist_style_set();
+ evas_object_size_hint_weight_set(cgroup_input_d->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(cgroup_input_d->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(cgroup_input_d->genlist);
+ elm_object_part_content_set(layout, "elm.swallow.content", cgroup_input_d->genlist);
+ group_input_fill_genlist(cgroup_input_d);
+
+ back_btn = elm_button_add(cgroup_input_d->navi);
+ elm_object_style_set(back_btn, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(back_btn, "clicked", phone_view_back_btn_cb, cgroup_input_d->navi);
+
+ phone_navi_item_clear(cgroup_input_d->navi_it);
+
+ if(cgroup_input_d->editgroup == true){
+ cgroup_input_d->navi_it = elm_naviframe_item_push(cgroup_input_d->navi,
+ T_(CT_GET_TEXT_BASE_OP, CTTEXT_EDIT_GROUP), back_btn, NULL, layout, NULL);
+ evas_object_data_set(cgroup_input_d->navi, "navi_it_pop", cgroup_input_d->navi_it);
+ }
+ else{
+ cgroup_input_d->navi_it = elm_naviframe_item_push(cgroup_input_d->navi,
+ T_(CT_GET_TEXT_BASE_OP, CTTEXT_CREATE_GROUP), back_btn, NULL, layout, NULL);
+ evas_object_data_set(cgroup_input_d->navi, "navi_it_pop", evas_object_data_get(cgroup_input_d->navi, "navi_it_pop_to"));
+ }
+
+ cgroup_input_d->done_button = phone_create_toolbar_btn(cgroup_input_d->navi, S_(CT_SYS_SK_DONE), group_input_save_btn_cb, cgroup_input_d);
+ elm_object_item_part_content_set(cgroup_input_d->navi_it, "toolbar_button1", cgroup_input_d->done_button);
+ elm_object_disabled_set(cgroup_input_d->done_button, EINA_TRUE);
+
+ evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL,
+ group_input_view_delete_cb, cgroup_input_d);
+}