4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
6 * Contact: MyoungJune Park <mj2004.park@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #include <setting-about.h>
23 #include <setting-about-main.h>
24 #include <setting-cfg.h>
28 #define UG_MODULE_API __attribute__ ((visibility("default")))
32 void setting_about_layout_ug_cb(ui_gadget_h ug, enum ug_mode mode,
35 //SettingAboutUG *ad = (SettingAboutUG *) priv;
43 base = (Evas_Object *) ug_get_layout(ug);
49 case UG_MODE_FULLVIEW:
50 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
52 // elm_win_resize_object_add(ad->win_get, base);
53 evas_object_show(base);
63 * @brief Event process when the sizeof UG view changes
70 static void setting_about_ug_cb_resize(void *data, Evas *e, Evas_Object *obj,
73 SettingAboutUG *ad = (SettingAboutUG *) data;
74 setting_view_update(&setting_view_about_main, ad);
78 * @brief on_create function of the UG
87 static void *setting_about_ug_on_create(ui_gadget_h ug, enum ug_mode mode,
88 app_control_h service, void *priv)
91 setting_retvm_if((NULL == priv), NULL, "NULL == priv");
92 SettingAboutUG *aboutUG = priv;
96 int ret = tethering_create(&aboutUG->tethering_handle);
97 if (ret != TETHERING_ERROR_NONE) {
98 SETTING_TRACE_ERROR("tethering_create is failed : %d", ret);
101 aboutUG->win_main_layout = (Evas_Object *) ug_get_parent_layout(ug);
102 aboutUG->win_get = (Evas_Object *) ug_get_window();
103 evas_object_show(aboutUG->win_main_layout);
104 aboutUG->evas = evas_object_evas_get(aboutUG->win_main_layout);
106 setting_retvm_if(aboutUG->win_main_layout == NULL, NULL,
107 "cannot get main window ");
109 setting_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR);
111 /* register view node table */
112 setting_view_node_table_intialize();
113 setting_view_node_table_register(&setting_view_about_main, NULL);
115 /* creating a view. */
116 setting_create_Gendial_itc("1line", &(aboutUG->itc_1text));
117 setting_create_Gendial_itc("2line.top", &(aboutUG->itc_2text_2));
118 setting_create_Gendial_itc("groupindex", &(aboutUG->itc_group_item));
119 setting_create_Gendial_itc("2line.top", &(aboutUG->itc_2text_3_parent));
120 setting_create_Gendial_itc("2line.top", &(aboutUG->itc_1icon_1text_sub));
121 setting_create_Gendial_itc("multiline/1text", &(aboutUG->itc_help_style));
123 setting_view_node_set_cur_view(&setting_view_about_main);
124 setting_view_create(&setting_view_about_main, (void *)aboutUG);
125 evas_object_event_callback_add(aboutUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_about_ug_cb_resize, aboutUG);
127 aboutUG->popup_showed_flag = FALSE;
128 return aboutUG->ly_main;
131 static void setting_about_ug_on_start(ui_gadget_h ug, app_control_h service,
136 static void setting_about_ug_on_pause(ui_gadget_h ug, app_control_h service,
140 SettingAboutUG *SettingAboutUG = priv;
141 SettingAboutUG->pause_flag = TRUE;
144 static void setting_about_ug_on_resume(ui_gadget_h ug, app_control_h service,
148 setting_retm_if((!priv), "!priv");
149 SettingAboutUG *aboutUG = priv;
150 aboutUG->pause_flag = FALSE;
152 char str[MAX_DISPLAY_STR_LEN_ON_PHONE_INFO] = { 0, };
154 memset(str, 0x00, MAX_DISPLAY_STR_LEN_ON_PHONE_INFO);
155 if(aboutUG->item_data_wifi)
157 setting_about_main_get_wifi_mac_address_string(str, MAX_DISPLAY_STR_LEN_ON_PHONE_INFO);
158 aboutUG->item_data_wifi->sub_desc = (char*)g_strdup(str);
159 elm_object_item_data_set(aboutUG->item_data_wifi->item, aboutUG->item_data_wifi);
160 elm_genlist_item_update(aboutUG->item_data_wifi->item);
162 memset(str, 0x00, MAX_DISPLAY_STR_LEN_ON_PHONE_INFO);
163 if(aboutUG->item_data_bt)
165 setting_about_main_get_bluetooth_address_string(str, MAX_DISPLAY_STR_LEN_ON_PHONE_INFO);
166 aboutUG->item_data_bt->sub_desc = (char*)g_strdup(str);
167 elm_object_item_data_set(aboutUG->item_data_bt->item, aboutUG->item_data_bt);
168 elm_genlist_item_update(aboutUG->item_data_bt->item);
171 if (aboutUG->item_dev_name) {
172 if (elm_object_focus_get(aboutUG->item_dev_name->eo_check)) {
173 elm_object_focus_set(aboutUG->item_dev_name->eo_check, EINA_TRUE);
174 Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(aboutUG->item_dev_name->eo_check);
176 ecore_imf_context_input_panel_show(imf_context);
183 * on_destroy function of the UG
189 static void setting_about_ug_on_destroy(ui_gadget_h ug, app_control_h service,
193 setting_retm_if((!priv), "!priv");
194 SettingAboutUG *aboutUG = priv;
196 #if SUPPORT_TETHERING
197 int ret = tethering_destroy(aboutUG->tethering_handle);
198 if (ret != TETHERING_ERROR_NONE) {
199 SETTING_TRACE_ERROR("tethering_destroy() is failed : %d", ret);
202 evas_object_event_callback_del(aboutUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_about_ug_cb_resize); /* fix flash issue for gallery */
205 /* delete the allocated objects. */
206 setting_view_destroy(&setting_view_about_main, aboutUG);
207 if (NULL != ug_get_layout(aboutUG->ug)) {
208 evas_object_hide((Evas_Object *) ug_get_layout(aboutUG->ug));
209 evas_object_del((Evas_Object *) ug_get_layout(aboutUG->ug));
215 static void setting_about_ug_on_message(ui_gadget_h ug, app_control_h msg,
216 app_control_h service, void *priv)
222 * @brief ug_event processing function
231 static void setting_about_ug_on_event(ui_gadget_h ug, enum ug_event event,
232 app_control_h service, void *priv)
235 SettingAboutUG *ad = (SettingAboutUG *)priv;
236 setting_retm_if(NULL == ad, "ad is NULL");
238 case UG_EVENT_LOW_MEMORY:
240 case UG_EVENT_LOW_BATTERY:
242 case UG_EVENT_LANG_CHANGE:
243 setting_navi_items_update(ad->navi_bar);
245 case UG_EVENT_ROTATE_PORTRAIT:
247 case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
249 case UG_EVENT_ROTATE_LANDSCAPE:
251 case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
253 //restore the focus status
254 SettingAboutUG *ad = (SettingAboutUG *) priv;
255 if (!ad || !ad->is_dev_name_focus || !ad->item_dev_name){
258 SETTING_TRACE("ad->is_dev_name_focus:%d", ad->is_dev_name_focus);
260 Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(ad->item_dev_name->eo_check);
262 //ecore_imf_context_input_panel_hide(imf_context);
263 ecore_imf_context_input_panel_show(imf_context);
265 elm_object_focus_set(ad->item_dev_name->eo_check, ad->is_dev_name_focus);
266 elm_entry_cursor_pos_set(ad->item_dev_name->eo_check, ad->cursor_pos);
267 ad->is_dev_name_focus = FALSE;
270 case UG_EVENT_REGION_CHANGE:
278 * @brief ug_key_event processing function
287 static void setting_about_ug_on_key_event(ui_gadget_h ug,
288 enum ug_key_event event,
289 app_control_h service, void *priv)
292 SettingAboutUG *ad = (SettingAboutUG *) priv;
298 case UG_KEY_EVENT_END:
300 if (elm_naviframe_top_item_get(ad->navi_bar) ==
301 elm_naviframe_bottom_item_get(ad->navi_bar)) {
304 /* elm_naviframe_item_pop(ad->navi_bar); */
305 setting_view_cb_at_endKey(ad);
316 * @brief aboutUG init
320 UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
323 SettingAboutUG *aboutUG = calloc(1, sizeof(SettingAboutUG));
324 setting_retvm_if(!aboutUG, -1, "Create SettingAboutUG obj failed");
326 ops->create = setting_about_ug_on_create;
327 ops->start = setting_about_ug_on_start;
328 ops->pause = setting_about_ug_on_pause;
329 ops->resume = setting_about_ug_on_resume;
330 ops->destroy = setting_about_ug_on_destroy;
331 ops->message = setting_about_ug_on_message;
332 ops->event = setting_about_ug_on_event;
333 ops->key_event = setting_about_ug_on_key_event;
335 ops->opt = UG_OPT_INDICATOR_ENABLE;
341 * @brief aboutUG exit
345 UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
348 SettingAboutUG *aboutUG;
349 setting_retm_if(!ops, "ops == NULL");
354 && tel_deinit(aboutUG->handle) == TAPI_API_SUCCESS) {
355 SETTING_TRACE("tel_deinit sucessed");
362 * @brief aboutUG searchable nodes array
364 * @see the struct Setting_Cfg_Node_T
366 static Setting_Cfg_Node_T s_cfg_node_array[] = {
367 {"IDS_ST_BODY_IMEI", NULL, "viewtype:frontpage;tab:first;keyword:IDS_ST_BODY_IMEI", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
368 {"IDS_ST_BODY_MY_NUMBER", NULL, "viewtype:frontpage;tab:first;keyword:IDS_ST_BODY_MY_NUMBER", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
369 {"IDS_COM_BODY_FILEDETAIL_MODEL", NULL, "viewtype:frontpage;tab:first;keyword:IDS_COM_BODY_FILEDETAIL_MODEL", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
370 {"IDS_COM_POP_VERSION", NULL, "viewtype:frontpage;tab:first;keyword:IDS_COM_POP_VERSION", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
371 {"IDS_COM_BODY_BLUETOOTH", NULL, "viewtype:frontpage;tab:first;keyword:IDS_COM_BODY_BLUETOOTH", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
372 {"IDS_ST_HEADER_WI_FI", NULL, "viewtype:frontpage;tab:first;keyword:IDS_ST_HEADER_WI_FI", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
373 {"IDS_ST_BODY_SERIAL_NUMBER", NULL, "viewtype:frontpage;tab:first;keyword:IDS_ST_BODY_SERIAL_NUMBER", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
374 {"IDS_ST_BODY_BATTERY", NULL, "viewtype:frontpage;tab:first;keyword:IDS_ST_BODY_BATTERY", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
375 {"IDS_ST_BODY_CPU_USAGE", NULL, "viewtype:frontpage;tab:first;keyword:IDS_ST_BODY_CPU_USAGE", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
376 {"IDS_ST_MBODY_DEVICE_STATUS", NULL, "viewtype:frontpage;tab:first;keyword:IDS_ST_MBODY_DEVICE_STATUS", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
377 {"IDS_ST_BODY_LICENCE", NULL, "viewtype:frontpage;tab:first;keyword:IDS_ST_BODY_LICENCE", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
378 {"IDS_ST_MBODY_SOFTWARE_UPDATE", NULL, "viewtype:frontpage;tab:first;keyword:IDS_ST_MBODY_SOFTWARE_UPDATE", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
379 {"IDS_COM_BODY_CERTIFICATES", NULL, "viewtype:frontpage;tab:first;keyword:IDS_COM_BODY_CERTIFICATES", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
383 * @brief init search db for aboutUG searchable nodes
385 * @param service struct Setting_Cfg_Node_T
386 * @param priv struct Setting_Cfg_Node_T
387 * @param applocale struct Setting_Cfg_Node_T
389 * @return 0 for success
391 UG_MODULE_API int setting_plugin_search_init(app_control_h service, void *priv, char** applocale)
394 SETTING_TRACE(">> setting-about-efl DB search code");
396 *applocale = strdup("setting:/usr/apps/org.tizen.setting/res/locale");
398 Eina_List **pplist = (Eina_List**)priv;
400 int size = sizeof(s_cfg_node_array)/sizeof(s_cfg_node_array[0]);
401 for(i=0;i<size;i++) {
402 Setting_Cfg_Node_T * node = setting_plugin_search_item_subindex_add(s_cfg_node_array[i].key_name, s_cfg_node_array[i].ug_args, IMG_AboutPhone, s_cfg_node_array[i].item_type, s_cfg_node_array[i].data, "About");
403 *pplist = eina_list_append(*pplist, node);