2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <Elementary.h>
19 #include "cst-common.h"
20 #include "cst-common-string.h"
21 #include "cst-widget.h"
22 #include "cst-call-setting.h"
24 #include "cst-prefix-dial.h"
25 #include "cst-prefix-dial-ime.h"
26 #include "cst-delete-list.h"
29 void _cst_set_prefix_dialling_list(int index, char *number)
31 ENTER(_cst_set_prefix_dialling_list);
33 ret_if(number == NULL);
36 _cst_vconf_set_str(VCONFKEY_CISSAPPL_PREFIX_DIAL_NUM1_STR,
40 _cst_vconf_set_str(VCONFKEY_CISSAPPL_PREFIX_DIAL_NUM2_STR,
44 _cst_vconf_set_str(VCONFKEY_CISSAPPL_PREFIX_DIAL_NUM3_STR,
48 _cst_vconf_set_str(VCONFKEY_CISSAPPL_PREFIX_DIAL_NUM4_STR,
52 _cst_vconf_set_str(VCONFKEY_CISSAPPL_PREFIX_DIAL_NUM5_STR,
56 DBG("Error set prefix dialling list");
61 char *_cst_get_prefix_dialling_list(int index)
63 ENTER(_cst_get_prefix_dialling_list);
68 number = _cst_vconf_get_str(VCONFKEY_CISSAPPL_PREFIX_DIAL_NUM1_STR);
71 number = _cst_vconf_get_str(VCONFKEY_CISSAPPL_PREFIX_DIAL_NUM2_STR);
74 number = _cst_vconf_get_str(VCONFKEY_CISSAPPL_PREFIX_DIAL_NUM3_STR);
77 number = _cst_vconf_get_str(VCONFKEY_CISSAPPL_PREFIX_DIAL_NUM4_STR);
80 number = _cst_vconf_get_str(VCONFKEY_CISSAPPL_PREFIX_DIAL_NUM5_STR);
83 retv_if(NULL == number, NULL);
87 static void __cst_click_prefix_dial_save(void *data,
91 ENTER(__cst_click_prefix_dial_save);
94 CstUgData_t *ugd = (CstUgData_t *)data;
95 const char *number = elm_entry_entry_get(ugd->dg_entry);
96 Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(ugd->dg_entry);
99 ecore_imf_context_input_panel_event_callback_del (imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _cst_prefix_dialling_input_panel_event_callback);
102 DBG("number : %s ", number);
103 if (0 == strlen(number)) {
104 if (0 == strlen(_cst_get_prefix_dialling_list(CST_ITEM_1))) {
105 _cst_vconf_set_bool(VCONFKEY_CISSAPPL_PREFIX_DIAL_BOOL, EINA_FALSE);
108 _cst_set_prefix_dialling_list(CST_ITEM_1, (char *)number);
110 elm_naviframe_item_pop(ugd->nf);
113 static void __cst_create_prefix_dialling_ime(Evas_Object *parent, void *data)
115 ENTER(__cst_create_prefix_dialling_ime);
117 CstUgData_t *ugd = (CstUgData_t *)data;
119 Elm_Object_Item *navi_it;
123 eo = _cst_create_prefix_dialling_ime(ugd->nf, NULL, ugd);
124 evas_object_show(eo);
126 _cst_remove_naviframe(ugd->nf);
128 btn = elm_button_add(ugd->nf);
129 navi_it = elm_naviframe_item_push(ugd->nf, T_(CST_STR_AUTO_AREA_CODE),
130 btn, NULL, eo, "1line");
131 elm_object_style_set(btn, "naviframe/back_btn/default");
133 evas_object_smart_callback_add(btn, "clicked",
134 __cst_click_prefix_dial_save, ugd);
137 void _cst_on_click_prefix_dialling(void *data, Evas *evas, Evas_Object *obj, void *event_info)
139 ENTER(_cst_on_click_prefix_dialling);
140 ret_if(NULL == data);
141 CstUgData_t *ugd = (CstUgData_t *)data;
142 __cst_create_prefix_dialling_ime(ugd->nf, ugd);
145 void _cst_prefix_dialling_input_panel_event_callback(void *data, Ecore_IMF_Context *imf_context, int value)
147 ENTER(_cst_prefix_dialling_input_panel_event_callback);
149 CstUgData_t *ugd = (CstUgData_t *)data;
151 Elm_Object_Item *top_it = elm_naviframe_top_item_get(ugd->nf);
153 Evas_Object *btn = elm_object_item_part_content_get(top_it, "prev_btn");
154 evas_object_del(btn);
155 btn = elm_button_add(ugd->nf);
156 elm_object_style_set(btn, "naviframe/back_btn/default");
157 evas_object_smart_callback_add(btn, "clicked",
158 __cst_click_prefix_dial_save, ugd);
160 if(value == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
162 DBG("ECORE_IMF_INPUT_PANEL_STATE_SHOW");
163 elm_object_item_part_content_set(top_it, "title_right_btn", btn);
165 } else if(value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
166 DBG("ECORE_IMF_INPUT_PANEL_STATE_HIDE");
167 elm_object_item_part_content_set(top_it, "title_right_btn", NULL);
168 elm_object_item_part_content_set(top_it, "prev_btn", btn);