4 * Copyright 2012 Samsung Electronics Co., Ltd
6 * Licensed under the Flora License, Version 1.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.tizenopensource.org/license
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
22 #include <efl_extension.h>
23 #include <dpm/restriction.h>
25 #include "mh_view_main.h"
27 #include "mh_string.h"
29 static void __ctx_move_more_ctxpopup(Evas_Object *ctx, mh_appdata_t *ad);
30 static void __ctx_delete_more_ctxpopup_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
31 static Eina_Bool rotate_flag = EINA_FALSE;
33 void _genlist_update_device_item(mh_appdata_t *ad);
34 mh_appdata_t *g_ad = NULL;
35 #define UPDATE_INTERVAL 1
37 void _select_connected_dev(void *data, Evas_Object *obj, void *event_info)
39 __MOBILE_AP_FUNC_ENTER__;
42 ERR("data is NULL\n");
46 mh_appdata_t *ad = (mh_appdata_t *)data;
48 elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
49 _create_connected_client_view(ad);
50 __MOBILE_AP_FUNC_EXIT__;
53 static bool _connected_clients_cb(tethering_client_h client, void *user_data)
55 __MOBILE_AP_FUNC_ENTER__;
57 if (user_data == NULL) {
58 ERR("user_data is NULL\n");
62 mh_appdata_t *ad = (mh_appdata_t *)user_data;
64 _append_list_client_handle(ad, client);
66 __MOBILE_AP_FUNC_EXIT__;
70 void ap_update_data_device(mh_appdata_t *ad)
72 __MOBILE_AP_FUNC_ENTER__;
75 ERR("Invalid param\n");
79 _genlist_update_device_item(ad);
81 __MOBILE_AP_FUNC_EXIT__;
84 #ifdef TETHERING_DATA_USAGE_SUPPORT
85 Eina_Bool ap_update_data_packet_usage(mh_appdata_t *ad)
88 ERR("Invalid param\n");
92 if (ad->main.usage_item)
93 elm_genlist_item_update(ad->main.usage_item);
98 Eina_Bool ap_get_data_statistics(void *data)
101 ERR("The param is NULL\n");
102 return ECORE_CALLBACK_CANCEL;
104 mh_appdata_t *ad = (mh_appdata_t *)data;
106 if (ad->main.hotspot_mode == VCONFKEY_MOBILE_HOTSPOT_MODE_NONE) {
107 ad->update_statistics_handle = NULL;
108 return ECORE_CALLBACK_CANCEL;
111 /* If previous data is not updated, new data is not required */
112 if (ad->data_statistics.is_updated == false)
113 return ECORE_CALLBACK_RENEW;
115 /* Because previous data is updated, new data is required.
116 It will be returned asynchronously. */
117 tethering_get_data_usage(ad->handle, _data_usage_cb, (void *)ad);
118 ad->data_statistics.is_updated = false;
120 return ECORE_CALLBACK_RENEW;
124 Eina_Bool ap_update_device_conn_time(void * data)
127 ERR("The param is NULL\n");
128 return ECORE_CALLBACK_CANCEL;
130 mh_appdata_t *ad = (mh_appdata_t *)data;
133 if (ad->main.hotspot_mode == VCONFKEY_MOBILE_HOTSPOT_MODE_NONE) {
134 _stop_update_device_conn_time(ad);
135 __MOBILE_AP_FUNC_EXIT__;
136 return ECORE_CALLBACK_CANCEL;
139 while (count < ad->connected_device.no_of_clients) {
140 if (ad->connected_device.station_items[count])
141 elm_genlist_item_fields_update(ad->connected_device.station_items[count++],
142 "elm.text.sub", ELM_GENLIST_ITEM_FIELD_TEXT);
144 return ECORE_CALLBACK_RENEW;
147 void _start_update_device_conn_time(mh_appdata_t *ad)
149 __MOBILE_AP_FUNC_ENTER__;
152 ERR("Invalid param\n");
153 __MOBILE_AP_FUNC_EXIT__;
157 if (ad->update_conn_time_handle)
158 _stop_update_device_conn_time(ad);
160 ad->update_conn_time_handle = ecore_timer_add(UPDATE_INTERVAL,
161 ap_update_device_conn_time, (void *)ad);
163 __MOBILE_AP_FUNC_EXIT__;
166 void _stop_update_device_conn_time(mh_appdata_t *ad)
168 __MOBILE_AP_FUNC_ENTER__;
171 ERR("Invalid param\n");
175 if (ad->update_conn_time_handle) {
176 ecore_timer_del(ad->update_conn_time_handle);
177 ad->update_conn_time_handle = NULL;
179 __MOBILE_AP_FUNC_EXIT__;
182 #ifdef TETHERING_DATA_USAGE_SUPPORT
183 void _start_update_data_packet_usage(mh_appdata_t *ad)
185 __MOBILE_AP_FUNC_ENTER__;
188 ERR("Invalid param\n");
192 if (ad->update_statistics_handle)
193 _stop_update_data_packet_usage(ad);
195 ad->data_statistics.is_updated = false;
196 tethering_get_data_usage(ad->handle, _data_usage_cb, (void *)ad);
197 ad->update_statistics_handle = ecore_timer_add(MH_UPDATE_INTERVAL,
198 ap_get_data_statistics, (void *)ad);
200 __MOBILE_AP_FUNC_EXIT__;
204 void _stop_update_data_packet_usage(mh_appdata_t *ad)
206 __MOBILE_AP_FUNC_ENTER__;
209 ERR("Invalid param\n");
213 if (ad->update_statistics_handle) {
214 ecore_timer_del(ad->update_statistics_handle);
215 ad->data_statistics.is_updated = false;
216 ad->update_statistics_handle = NULL;
219 __MOBILE_AP_FUNC_EXIT__;
224 static void __read_setting(mh_appdata_t *ad)
226 __MOBILE_AP_FUNC_ENTER__;
229 ERR("Invalid param\n");
235 char *passphrase = NULL;
237 tethering_wifi_security_type_e type;
239 ad->main.hotspot_mode = _get_vconf_hotspot_mode();
241 #ifdef TETHERING_DATA_USAGE_SUPPORT
242 ad->data_statistics.pdp_total_sent = 0;
243 ad->data_statistics.pdp_total_receive = 0;
244 if (ad->main.hotspot_mode != VCONFKEY_MOBILE_HOTSPOT_MODE_NONE)
245 tethering_get_data_usage(ad->handle, _data_usage_cb, (void *)ad);
248 ret = tethering_wifi_get_ssid(ad->handle, &ssid);
249 if (ret != TETHERING_ERROR_NONE || ssid == NULL) {
250 ERR("tethering_wifi_get_ssid is failed : %d\n", ret);
253 g_strlcpy(ad->setup.device_name, ssid, sizeof(ad->setup.device_name));
256 ret = tethering_wifi_get_passphrase(ad->handle, &passphrase);
257 if (ret != TETHERING_ERROR_NONE || passphrase == NULL) {
258 ERR("tethering_wifi_get_passphrase is failed : %d\n", ret);
262 g_strlcpy(ad->setup.wifi_passphrase, passphrase,
263 sizeof(ad->setup.wifi_passphrase));
264 g_strlcpy(ad->setup.wifi_passphrase_new, passphrase,
265 sizeof(ad->setup.wifi_passphrase_new));
268 ret = tethering_wifi_get_ssid_visibility(ad->handle, &visibility);
269 if (ret != TETHERING_ERROR_NONE)
270 ERR("tethering_wifi_get_ssid_visibility is failed\n");
272 ad->setup.visibility = visibility;
273 ad->setup.visibility_new = visibility;
275 ret = tethering_wifi_get_security_type(ad->handle, &type);
276 if (ret != TETHERING_ERROR_NONE)
277 ERR("tethering_wifi_get_security_type is failed\n");
279 ad->setup.security_type = type;
280 ad->setup.security_type_new = type;
282 __MOBILE_AP_FUNC_EXIT__;
285 void _update_wifi_item(mh_appdata_t *ad, int wifi_state)
287 __MOBILE_AP_FUNC_ENTER__;
289 if (ad->main.wifi_state == wifi_state)
292 if (ad->main.wifi_state == MH_STATE_PROCESS) {
293 ad->main.wifi_state = MH_STATE_NONE;
294 elm_genlist_item_select_mode_set(ad->main.wifi_item, ELM_OBJECT_SELECT_MODE_DEFAULT);
295 } else if (ad->main.wifi_state == MH_STATE_NONE) {
296 ad->main.wifi_state = MH_STATE_PROCESS;
297 elm_genlist_item_select_mode_set(ad->main.wifi_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
300 if (ad->main.wifi_item)
301 elm_genlist_item_update(ad->main.wifi_item);
303 if (ad->main.setup_item)
304 elm_object_item_signal_emit(ad->main.setup_item, "elm,state,bottom", "");
306 __MOBILE_AP_FUNC_EXIT__;
311 void _update_bt_item(mh_appdata_t *ad, int bt_state)
313 __MOBILE_AP_FUNC_ENTER__;
315 if (ad->main.bt_state == bt_state)
318 if (ad->main.bt_state == MH_STATE_PROCESS) {
319 ad->main.bt_state = MH_STATE_NONE;
320 elm_genlist_item_select_mode_set(ad->main.bt_item, ELM_OBJECT_SELECT_MODE_DEFAULT);
321 } else if (ad->main.bt_state == MH_STATE_NONE) {
322 ad->main.bt_state = MH_STATE_PROCESS;
323 elm_genlist_item_select_mode_set(ad->main.bt_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
326 if (ad->main.bt_item)
327 elm_genlist_item_update(ad->main.bt_item);
329 __MOBILE_AP_FUNC_EXIT__;
334 void _update_usb_item(mh_appdata_t *ad, int usb_state)
336 __MOBILE_AP_FUNC_ENTER__;
338 if (ad->main.usb_state == usb_state)
341 if (ad->main.usb_state == MH_STATE_PROCESS) {
342 ad->main.usb_state = MH_STATE_NONE;
343 elm_genlist_item_select_mode_set(ad->main.usb_item, ELM_OBJECT_SELECT_MODE_DEFAULT);
344 } else if (ad->main.usb_state == MH_STATE_NONE) {
345 ad->main.usb_state = MH_STATE_PROCESS;
346 elm_genlist_item_select_mode_set(ad->main.usb_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
349 elm_genlist_item_update(ad->main.usb_item);
351 __MOBILE_AP_FUNC_EXIT__;
356 void _genlist_update_device_item(mh_appdata_t *ad)
358 __MOBILE_AP_FUNC_ENTER__;
361 ERR("Invalid param\n");
364 unsigned int no_of_dev = 0;
365 no_of_dev = _get_list_clients_count(ad);
366 Elm_Object_Item *item = NULL;
368 if (ad->main.device_item) {
369 elm_object_item_del(ad->main.device_item);
370 ad->main.device_item = NULL;
371 if (no_of_dev == 0) {
372 item = elm_genlist_item_append(ad->main.genlist,
373 ad->main.device0_itc, ad, NULL,
374 ELM_GENLIST_ITEM_NONE, NULL, NULL);
375 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
377 item = elm_genlist_item_append(ad->main.genlist,
378 ad->main.device_itc, ad, NULL,
379 ELM_GENLIST_ITEM_NONE, _select_connected_dev, (void *)ad);
380 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DEFAULT);
382 ad->main.device_item = item;
385 if (ad->connected_device.navi_it)
386 _update_conn_clients(ad);
388 __MOBILE_AP_FUNC_EXIT__;
392 void _update_main_view(mh_appdata_t *ad, tethering_type_e type)
394 __MOBILE_AP_FUNC_ENTER__;
397 ERR("Invalid param\n");
401 int state = VCONFKEY_MOBILE_HOTSPOT_MODE_NONE;
402 Eina_Bool wifi_state = EINA_FALSE;
403 Eina_Bool bt_state = EINA_FALSE;
404 Eina_Bool usb_state = EINA_FALSE;
405 Eina_Bool wifi_ap_state = EINA_FALSE;
406 Elm_Object_Item *item = NULL;
410 ad->main.hotspot_mode = _get_vconf_hotspot_mode();
411 state = ad->main.hotspot_mode;
413 wifi_state = (Eina_Bool)(state & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI);
414 bt_state = (Eina_Bool)(state & VCONFKEY_MOBILE_HOTSPOT_MODE_BT);
415 usb_state = (Eina_Bool)(state & VCONFKEY_MOBILE_HOTSPOT_MODE_USB);
416 wifi_ap_state = (Eina_Bool)(state & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI_AP);
419 if (ad->main.wifi_item)
420 elm_object_item_disabled_set(ad->main.wifi_item, EINA_TRUE);
421 if (ad->main.setup_item)
422 elm_object_item_disabled_set(ad->main.setup_item, EINA_TRUE);
423 if (ad->main.bt_item)
424 elm_object_item_disabled_set(ad->main.bt_item, EINA_TRUE);
425 if (ad->main.usb_item)
426 elm_object_item_disabled_set(ad->main.usb_item, EINA_TRUE);
428 if (ad->main.setup_item)
429 elm_object_item_disabled_set(ad->main.setup_item, EINA_FALSE);
430 if (ad->main.bt_item)
431 elm_object_item_disabled_set(ad->main.bt_item, EINA_FALSE);
432 if (_get_vconf_usb_state() != VCONFKEY_SYSMAN_USB_AVAILABLE) {
433 if (ad->main.usb_item)
434 elm_object_item_disabled_set(ad->main.usb_item, EINA_TRUE);
436 if (ad->main.usb_item)
437 elm_object_item_disabled_set(ad->main.usb_item, EINA_FALSE);
441 if (wifi_state || bt_state || usb_state) {
442 #ifdef TETHERING_DATA_USAGE_SUPPORT
443 if (ad->main.usage_item == NULL) {
444 item = elm_genlist_item_insert_before(ad->main.genlist,
445 ad->main.usage_itc, ad, NULL,
447 ELM_GENLIST_ITEM_NONE, NULL, NULL);
448 elm_genlist_item_select_mode_set(item,
449 ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
450 ad->main.usage_item = item;
454 no_of_dev = _get_list_clients_count(ad);
455 if (ad->main.device_item == NULL) {
456 if (no_of_dev == 0) {
457 item = elm_genlist_item_append(ad->main.genlist,
458 ad->main.device0_itc, ad, NULL,
459 ELM_GENLIST_ITEM_NONE, NULL, NULL);
460 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
462 item = elm_genlist_item_append(ad->main.genlist,
463 ad->main.device_itc, ad, NULL,
464 ELM_GENLIST_ITEM_NONE, _select_connected_dev, (void *)ad);
465 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DEFAULT);
467 ad->main.device_item = item;
470 if (ad->main.device_item) {
471 elm_object_item_del(ad->main.device_item);
472 ad->main.device_item = NULL;
474 #ifdef TETHERING_DATA_USAGE_SUPPORT
475 if (ad->main.usage_item) {
476 elm_object_item_del(ad->main.usage_item);
477 ad->main.usage_item = NULL;
483 if (ad->main.help_item) {
484 elm_genlist_item_update(ad->main.help_item);
486 item = elm_genlist_item_insert_after(ad->main.genlist,
487 ad->main.help_itc, ad, NULL,
489 ELM_GENLIST_ITEM_NONE, NULL,
492 ERR("elm_genlist_item_insert_after NULL\n");
494 elm_genlist_item_select_mode_set(item,
495 ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
496 ad->main.help_item = item;
500 if (ad->main.help_item) {
501 elm_object_item_del(ad->main.help_item);
502 ad->main.help_item = NULL;
507 case TETHERING_TYPE_WIFI:
508 /* Update Wi-Fi tethering on / off button */
509 if (ad->main.wifi_state != MH_STATE_NONE) {
510 _update_wifi_item(ad, MH_STATE_NONE);
512 obj = elm_object_item_part_content_get(ad->main.wifi_item, "elm.swallow.end");
514 elm_check_state_set(obj, wifi_state);
516 if (ad->main.wifi_item)
517 elm_genlist_item_update(ad->main.wifi_item);
521 case TETHERING_TYPE_BT:
522 /* Update BT tethering on / off button */
523 if (ad->main.bt_state != MH_STATE_NONE) {
524 _update_bt_item(ad, MH_STATE_NONE);
526 obj = elm_object_item_part_content_get(ad->main.bt_item, "elm.swallow.end");
528 elm_check_state_set(obj, bt_state);
530 if (ad->main.bt_item)
531 elm_genlist_item_update(ad->main.bt_item);
535 case TETHERING_TYPE_USB:
536 /* Update USB tethering on / off button */
537 if (ad->main.usb_state != MH_STATE_NONE) {
538 _update_usb_item(ad, MH_STATE_NONE);
540 obj = elm_object_item_part_content_get(ad->main.usb_item, "elm.swallow.end");
542 elm_check_state_set(obj, usb_state);
544 if (ad->main.usb_item)
545 elm_genlist_item_update(ad->main.usb_item);
550 DBG("Unknown tethering type : %d\n", type);
554 __MOBILE_AP_FUNC_EXIT__;
559 static int __is_allowed(tethering_type_e type)
562 device_policy_manager_h dpm = NULL;
564 dpm = dpm_manager_create();
566 ERR("Failed to create device policy manager!!");
571 case TETHERING_TYPE_WIFI:
572 dpm_restriction_get_wifi_hotspot_state(dpm, &state);
574 case TETHERING_TYPE_USB:
575 dpm_restriction_get_usb_tethering_state(dpm, &state);
577 case TETHERING_TYPE_BT:
578 dpm_restriction_get_bluetooth_tethering_state(dpm, &state);
584 dpm_manager_destroy(dpm);
589 static void __wifi_onoff_changed_cb(void *data, Evas_Object *obj,
592 __MOBILE_AP_FUNC_ENTER__;
594 if (!__is_allowed(TETHERING_TYPE_WIFI)) {
595 ERR("Wi-Fi tethering is restricted!!");
596 elm_check_state_set(obj, EINA_FALSE);
597 _create_security_restriction_noti(TETHERING_TYPE_WIFI);
602 ERR("The param is NULL\n");
606 mh_appdata_t *ad = (mh_appdata_t *)data;
608 _update_wifi_item(ad, MH_STATE_PROCESS);
609 ad->type = TETHERING_TYPE_WIFI;
610 ad->is_wifi_teth_enabling = true;
611 if (_handle_wifi_onoff_change(ad) != 0) {
612 ERR("_handle_wifi_onoff_change is failed\n");
613 _update_wifi_item(ad, MH_STATE_NONE);
614 ad->is_wifi_teth_enabling = false;
617 __MOBILE_AP_FUNC_EXIT__;
622 static void __select_wifi_item(void *data, Evas_Object *obj, void *event_info)
624 __MOBILE_AP_FUNC_ENTER__;
626 Evas_Object *content;
627 Elm_Object_Item *item = (Elm_Object_Item *)event_info;
630 ERR("The param is NULL\n");
634 elm_genlist_item_selected_set(item, EINA_FALSE);
636 content = elm_object_item_part_content_get(item, "elm.icon");
637 __wifi_onoff_changed_cb(data, content, NULL);
639 __MOBILE_AP_FUNC_EXIT__;
644 static void __bt_onoff_changed_cb(void *data, Evas_Object *obj, void *event_info)
646 __MOBILE_AP_FUNC_ENTER__;
648 if (!__is_allowed(TETHERING_TYPE_BT)) {
649 ERR("BT tethering is restricted!!");
650 elm_check_state_set(obj, EINA_FALSE);
651 _create_security_restriction_noti(TETHERING_TYPE_BT);
656 ERR("The param is NULL\n");
660 mh_appdata_t *ad = (mh_appdata_t *)data;
662 _update_bt_item(ad, MH_STATE_PROCESS);
663 ad->type = TETHERING_TYPE_BT;
664 ad->is_bt_teth_enabling = true;
666 if (_handle_bt_onoff_change(ad) != 0) {
667 ERR("_handle_bt_onoff_change is failed\n");
668 _update_bt_item(ad, MH_STATE_NONE);
669 ad->is_bt_teth_enabling = false;
672 __MOBILE_AP_FUNC_EXIT__;
677 static void __select_bt_item(void *data, Evas_Object *obj, void *event_info)
679 __MOBILE_AP_FUNC_ENTER__;
681 Evas_Object *content;
682 Elm_Object_Item *item = (Elm_Object_Item *)event_info;
685 ERR("The param is NULL\n");
689 elm_genlist_item_selected_set(item, EINA_FALSE);
691 content = elm_object_item_part_content_get(item, "elm.icon");
692 __bt_onoff_changed_cb(data, content, NULL);
694 __MOBILE_AP_FUNC_EXIT__;
699 static void __usb_onoff_changed_cb(void *data, Evas_Object *obj, void *event_info)
701 __MOBILE_AP_FUNC_ENTER__;
703 if (!__is_allowed(TETHERING_TYPE_USB)) {
704 ERR("USB tethering is restricted!!");
705 elm_check_state_set(obj, EINA_FALSE);
706 _create_security_restriction_noti(TETHERING_TYPE_USB);
711 ERR("The param is NULL\n");
715 mh_appdata_t *ad = (mh_appdata_t *)data;
716 _update_usb_item(ad, MH_STATE_PROCESS);
717 ad->type = TETHERING_TYPE_USB;
718 ad->is_usb_teth_enabling = true;
719 if (_handle_usb_onoff_change(ad) != 0) {
720 ERR("_handle_usb_onoff_change is failed\n");
721 _update_usb_item(ad, MH_STATE_NONE);
722 ad->is_usb_teth_enabling = false;
725 __MOBILE_AP_FUNC_EXIT__;
730 static void __select_usb_item(void *data, Evas_Object *obj, void *event_info)
732 __MOBILE_AP_FUNC_ENTER__;
734 Evas_Object *content;
735 Elm_Object_Item *item = (Elm_Object_Item *)event_info;
738 ERR("The param is NULL\n");
742 elm_genlist_item_selected_set(item, EINA_FALSE);
744 content = elm_object_item_part_content_get(item, "elm.icon");
745 __usb_onoff_changed_cb(data, content, NULL);
747 __MOBILE_AP_FUNC_EXIT__;
752 static void __back_btn_cb(void *data, Elm_Object_Item *navi_item)
757 ERR("The param is NULL\n");
761 mh_appdata_t *ad = (mh_appdata_t*)data;
763 _release_list_client_handle(ad);
764 _main_callback_del(ad);
766 ug_destroy_me(((mh_ugdata_t *)ad->gadget)->ug);
772 static char *__get_wifi_label(void *data, Evas_Object *obj, const char *part)
774 if (!strcmp("elm.text", part))
775 return strdup(STR_MOBILE_HOTSPOT);
780 static Evas_Object *__get_wifi_icon(void *data, Evas_Object *obj,
783 mh_appdata_t *ad = (mh_appdata_t*)data;
784 Evas_Object *btn = NULL;
787 ERR("The param is NULL\n");
791 if (!strcmp("elm.swallow.end", part)) {
792 if (ad->main.wifi_state == MH_STATE_PROCESS) {
793 btn = _create_progressbar(obj, "process_medium");
795 btn = elm_check_add(obj);
796 elm_object_style_set(btn, "on&off");
798 evas_object_propagate_events_set(btn, EINA_FALSE);
799 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
800 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
801 elm_check_state_set(btn, ad->main.hotspot_mode &
802 VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI ? EINA_TRUE : EINA_FALSE);
804 evas_object_smart_callback_add(btn, "changed", __wifi_onoff_changed_cb, ad);
805 evas_object_show(btn);
812 static char *__get_bt_label(void *data, Evas_Object *obj, const char *part)
814 if (!strcmp("elm.text", part))
815 return strdup(STR_BLUETOOTH_TETH);
820 static Evas_Object *__get_bt_icon(void *data, Evas_Object *obj, const char *part)
822 mh_appdata_t *ad = (mh_appdata_t *)data;
823 Evas_Object *btn = NULL;
826 ERR("The param is NULL\n");
830 if (!strcmp("elm.swallow.end", part)) {
831 if (ad->main.bt_state == MH_STATE_PROCESS) {
832 btn = _create_progressbar(obj, "process_medium");
834 btn = elm_check_add(obj);
836 ERR("btn is NULL\n");
839 elm_object_style_set(btn, "on&off");
840 evas_object_pass_events_set(btn, EINA_TRUE);
841 evas_object_propagate_events_set(btn, EINA_FALSE);
842 elm_check_state_set(btn, ad->main.hotspot_mode &
843 VCONFKEY_MOBILE_HOTSPOT_MODE_BT ? EINA_TRUE : EINA_FALSE);
844 evas_object_show(btn);
845 evas_object_smart_callback_add(btn, "changed", __bt_onoff_changed_cb, ad);
852 static char *__get_usb_label(void *data, Evas_Object *obj, const char *part)
854 if (!strcmp("elm.text", part))
855 return strdup(STR_USB_TETH);
860 static Evas_Object *__get_usb_icon(void *data, Evas_Object *obj,
863 mh_appdata_t *ad = (mh_appdata_t *)data;
864 Evas_Object *btn = NULL;
867 ERR("The param is NULL\n");
871 if (!strcmp("elm.swallow.end", part)) {
872 if (ad->main.usb_state == MH_STATE_PROCESS) {
873 btn = _create_progressbar(obj, "process_medium");
875 btn = elm_check_add(obj);
877 ERR("btn is NULL\n");
880 elm_object_style_set(btn, "on&off");
881 evas_object_pass_events_set(btn, EINA_TRUE);
882 evas_object_propagate_events_set(btn, EINA_FALSE);
883 elm_check_state_set(btn, ad->main.hotspot_mode &
884 VCONFKEY_MOBILE_HOTSPOT_MODE_USB ? EINA_TRUE : EINA_FALSE);
885 evas_object_show(btn);
886 evas_object_smart_callback_add(btn, "changed", __usb_onoff_changed_cb, ad);
893 static char *__get_help_label(void *data, Evas_Object *obj, const char *part)
895 mh_appdata_t *ad = (mh_appdata_t *)data;
896 char buf[MH_LABEL_LENGTH_MAX] = {0, };
897 char device_name[MH_LABEL_LENGTH_MAX] = {0, };
898 char passphrase[MH_LABEL_LENGTH_MAX] = {0, };
899 char security_type[MH_LABEL_LENGTH_MAX] = {0, };
900 char *fmt = STR_SECURITY_TYPE_PS;
903 char *device_name_utf = NULL;
904 int wifi_state = VCONFKEY_MOBILE_HOTSPOT_MODE_NONE;
907 ERR("The param is NULL\n");
911 if (!strcmp("elm.text.multiline", part)) {
912 device_name_utf = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
913 if (device_name_utf == NULL) {
914 ERR("vconf_get_str failed \n");
918 ptr = elm_entry_utf8_to_markup(device_name_utf);
920 g_free(device_name_utf);
921 ERR("elm_entry_utf8_to_markup is failed\n");
925 g_strlcpy(ad->setup.device_name, ptr,
926 sizeof(ad->setup.device_name));
927 g_strlcpy(device_name, ptr, MH_LABEL_LENGTH_MAX);
928 g_free(device_name_utf);
932 if (ad->setup.security_type != TETHERING_WIFI_SECURITY_TYPE_NONE) {
933 ptr = elm_entry_utf8_to_markup(ad->setup.wifi_passphrase);
935 ERR("elm_entry_utf8_to_markup is failed\n");
938 g_strlcpy(passphrase, ptr, MH_LABEL_LENGTH_MAX);
941 snprintf(security_type, sizeof(security_type),
945 wifi_state = ad->main.hotspot_mode & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI;
947 if (wifi_state && ad->setup.visibility == false)
948 hidden = STR_MOBILE_HOTSPOT_IS_HIDDEN;
950 if (wifi_state && ad->setup.security_type != TETHERING_WIFI_SECURITY_TYPE_NONE) {
951 snprintf(buf, MH_LABEL_LENGTH_MAX,
964 STR_ENTER_THE_PASSWORD_ON_THE_OTHER_DEVICE,
965 hidden[0] != '\0' ? "<br>" : "",
968 snprintf(buf, MH_LABEL_LENGTH_MAX,
975 hidden[0] != '\0' ? "<br>" : "",
985 static char *__get_no_connected_device_label(void *data, Evas_Object *obj,
988 mh_appdata_t *ad = (mh_appdata_t*)data;
989 char buf[MH_LABEL_LENGTH_MAX] = {0, };
993 ERR("The param is NULL\n");
997 if (!strcmp("elm.text.multiline", part)) {
998 no_of_dev = _get_list_clients_count(ad);
999 snprintf(buf, MH_LABEL_LENGTH_MAX, "<font_size=30>%s<br>%d</font_size>", STR_CONNECTED_DEV, no_of_dev);
1006 static char *__get_connected_device_label(void *data, Evas_Object *obj,
1009 mh_appdata_t *ad = (mh_appdata_t*)data;
1010 char buf[MH_LABEL_LENGTH_MAX] = {0, };
1014 ERR("The param is NULL\n");
1018 if (!strcmp("elm.text.sub", part)) {
1019 g_strlcpy(buf, STR_CONNECTED_DEV, sizeof(buf));
1021 } else if (!strcmp("elm.text", part)) {
1022 no_of_dev = _get_list_clients_count(ad);
1023 snprintf(buf, MH_LABEL_LENGTH_MAX, "%d", no_of_dev);
1030 #ifdef TETHERING_DATA_USAGE_SUPPORT
1031 static char *__get_usage_label(void *data, Evas_Object *obj, const char *part)
1033 mh_appdata_t *ad = (mh_appdata_t*)data;
1034 unsigned long long total = 0;
1035 unsigned long long sent = 0;
1036 unsigned long long received = 0;
1038 char buf[MH_LABEL_LENGTH_MAX] = {0, };
1039 char label[MH_LABEL_LENGTH_MAX] = {0, };
1042 ERR("The param is NULL\n");
1046 if (!strcmp("elm.text", part)) {
1047 g_strlcpy(label, STR_DATA_USAGE, sizeof(label));
1048 return strdup(label);
1049 } else if (!strcmp("elm.text.multiline", part)) {
1050 sent = ad->data_statistics.pdp_total_sent;
1051 received = ad->data_statistics.pdp_total_receive;
1053 if (sent >= MH_MB || received >= MH_MB) {
1057 total = sent + received;
1059 } else if (sent + received >= MH_MB) {
1060 total = (sent + received) / MH_MB;
1062 } else if (sent >= MH_KB || received >= MH_KB) {
1066 total = sent + received;
1068 } else if (sent + received >= MH_KB) {
1069 total = (sent + received) / MH_KB;
1072 total = sent + received;
1076 if (total > INT_MAX) {
1077 ERR("data usage overflow\n");
1080 snprintf(label, MH_LABEL_LENGTH_MAX, fmt_str, (int)total);
1081 return strdup(label);
1088 static void __set_genlist_itc(mh_appdata_t *ad)
1090 /* On, Off view's item class for genlist */
1091 ad->main.wifi_itc = elm_genlist_item_class_new();
1092 if (ad->main.wifi_itc == NULL) {
1093 ERR("elm_genlist_item_class_new failed\n");
1097 ad->main.wifi_itc->item_style = MH_GENLIST_1LINE_TEXT_ICON_STYLE;
1098 ad->main.wifi_itc->func.text_get = __get_wifi_label;
1099 ad->main.wifi_itc->func.content_get = __get_wifi_icon;
1100 ad->main.wifi_itc->func.state_get = NULL;
1101 ad->main.wifi_itc->func.del = NULL;
1103 /* End of On, Off view's item class for genlist */
1105 /* Off view's item class for genlist */
1106 ad->main.bt_itc = elm_genlist_item_class_new();
1107 if (ad->main.bt_itc == NULL) {
1108 ERR("elm_genlist_item_class_new failed\n");
1112 ad->main.bt_itc->item_style = MH_GENLIST_1LINE_TEXT_ICON_STYLE;
1113 ad->main.bt_itc->func.text_get = __get_bt_label;
1114 ad->main.bt_itc->func.content_get = __get_bt_icon;
1115 ad->main.bt_itc->func.state_get = NULL;
1116 ad->main.bt_itc->func.del = NULL;
1118 ad->main.usb_itc = elm_genlist_item_class_new();
1119 if (ad->main.usb_itc == NULL) {
1120 ERR("elm_genlist_item_class_new failed\n");
1124 ad->main.usb_itc->item_style = MH_GENLIST_1LINE_TEXT_ICON_STYLE;
1125 ad->main.usb_itc->func.text_get = __get_usb_label;
1126 ad->main.usb_itc->func.content_get = __get_usb_icon;
1127 ad->main.usb_itc->func.state_get = NULL;
1128 ad->main.usb_itc->func.del = NULL;
1130 ad->main.help_itc = elm_genlist_item_class_new();
1131 if (ad->main.help_itc == NULL) {
1132 ERR("elm_genlist_item_class_new failed\n");
1136 ad->main.help_itc->item_style = MH_GENLIST_MULTILINE_TEXT_STYLE;
1137 ad->main.help_itc->func.text_get = __get_help_label;
1138 ad->main.help_itc->func.content_get = NULL;
1139 ad->main.help_itc->func.state_get = NULL;
1140 ad->main.help_itc->func.del = NULL;
1142 /* End of Off view's item class for genlist */
1144 /* On view's item class for genlist */
1145 ad->main.device0_itc = elm_genlist_item_class_new();
1146 if (ad->main.device0_itc == NULL) {
1147 ERR("elm_genlist_item_class_new failed\n");
1151 ad->main.device0_itc->item_style = MH_GENLIST_MULTILINE_TEXT_STYLE;
1152 ad->main.device0_itc->func.text_get = __get_no_connected_device_label;
1153 ad->main.device0_itc->func.content_get = NULL;
1154 ad->main.device0_itc->func.state_get = NULL;
1155 ad->main.device0_itc->func.del = NULL;
1157 ad->main.device_itc = elm_genlist_item_class_new();
1158 if (ad->main.device_itc == NULL) {
1159 ERR("elm_genlist_item_class_new failed\n");
1163 ad->main.device_itc->item_style = MH_GENLIST_2LINE_BOTTOM_TEXT_STYLE;
1164 ad->main.device_itc->func.text_get = __get_connected_device_label;
1165 ad->main.device_itc->func.content_get = NULL;
1166 ad->main.device_itc->func.state_get = NULL;
1167 ad->main.device_itc->func.del = NULL;
1169 #ifdef TETHERING_DATA_USAGE_SUPPORT
1170 ad->main.usage_itc = elm_genlist_item_class_new();
1171 if (ad->main.usage_itc == NULL) {
1172 ERR("elm_genlist_item_class_new failed\n");
1176 ad->main.usage_itc->item_style = MH_GENLIST_MULTILINE_TEXT_STYLE;
1177 ad->main.usage_itc->func.text_get = __get_usage_label;
1178 ad->main.usage_itc->func.content_get = NULL;
1179 ad->main.usage_itc->func.state_get = NULL;
1180 ad->main.usage_itc->func.del = NULL;
1182 /* End of On view's item class for genlist */
1186 static void __gl_realized(void *data, Evas_Object *obj, void *event_info)
1188 if (data == NULL || event_info == NULL) {
1189 ERR("Invalid param\n");
1193 mh_appdata_t *ad = (mh_appdata_t *)data;
1194 Elm_Object_Item *item = (Elm_Object_Item *)event_info;
1197 char str[MH_LABEL_LENGTH_MAX] = {0, };
1200 if (item == ad->main.wifi_item || item == ad->main.bt_item || item == ad->main.usb_item) {
1201 ao = elm_object_item_access_object_get(item);
1202 btn = elm_object_item_part_content_get(item, "on&off");
1203 snprintf(str, sizeof(str), "%s, %s", "On/off button",
1204 (elm_check_state_get(btn) ? "On" : "Off"));
1205 elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, str);
1207 if (item == ad->main.wifi_item || item == ad->main.bt_item) {
1208 DBG("Wi-Fi or BT item : %p\n", item);
1209 elm_object_item_signal_emit(item, "elm,state,top", "");
1210 } else if (item == ad->main.usb_item) {
1212 elm_object_item_signal_emit(item, "elm,state,bottom", "");
1214 } else if (item == ad->main.setup_item) {
1215 DBG("setup_item\n");
1216 ao = elm_object_item_access_object_get(item);
1217 elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, "Item");
1219 elm_object_item_signal_emit(item, "elm,state,bottom", "");
1220 } else if (item == ad->main.device_item) {
1221 DBG("device_item\n");
1222 ao = elm_object_item_access_object_get(item);
1223 snprintf(str, sizeof(str), "%s, %s", "Expandable list",
1224 "Double tap to open list");
1225 elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, str);
1227 elm_object_item_signal_emit(item, "elm,state,top", "");
1228 } else if (ad->main.device_item != NULL &&
1229 ad->main.device_item == elm_genlist_item_parent_get(item)) {
1230 DBG("device_item's child\n");
1231 elm_object_item_signal_emit(item, "elm,state,center", "");
1233 for (i = 0; i < 4; i++) {
1234 if (item == ad->main.sp_item[i])
1235 elm_object_item_access_unregister(item);
1238 #ifdef TETHERING_DATA_USAGE_SUPPORT
1239 if (item == ad->main.usage_item) {
1240 DBG("usage_item\n");
1241 elm_object_item_signal_emit(item, "elm,state,bottom", "");
1247 static void __create_inner_contents(mh_appdata_t *ad)
1249 __MOBILE_AP_FUNC_ENTER__;
1251 Elm_Object_Item *item = NULL;
1255 ad->main.genlist = elm_genlist_add(ad->naviframe);
1256 elm_genlist_mode_set(ad->main.genlist, ELM_LIST_COMPRESS);
1257 evas_object_smart_callback_add(ad->main.genlist, "realized", __gl_realized, ad);
1259 __set_genlist_itc(ad);
1261 item = elm_genlist_item_append(ad->main.genlist, ad->main.wifi_itc,
1262 ad, NULL, ELM_GENLIST_ITEM_NONE,
1263 __select_wifi_item, ad);
1264 ad->main.wifi_item = item;
1266 if (ad->main.hotspot_mode & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI) {
1267 item = elm_genlist_item_append(ad->main.genlist, ad->main.help_itc,
1268 ad, NULL, ELM_GENLIST_ITEM_NONE,
1270 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1271 ad->main.help_item = item;
1274 item = elm_genlist_item_append(ad->main.genlist, ad->main.bt_itc,
1275 ad, NULL, ELM_GENLIST_ITEM_NONE,
1276 __select_bt_item, ad);
1277 ad->main.bt_item = item;
1279 item = elm_genlist_item_append(ad->main.genlist, ad->main.usb_itc,
1280 ad, NULL, ELM_GENLIST_ITEM_NONE,
1281 __select_usb_item, ad);
1282 ad->main.usb_item = item;
1283 if (_get_vconf_usb_state() != VCONFKEY_SYSMAN_USB_AVAILABLE) {
1284 if (ad->main.usb_item)
1285 elm_object_item_disabled_set(ad->main.usb_item, EINA_TRUE);
1287 if (ad->main.usb_item)
1288 elm_object_item_disabled_set(ad->main.usb_item, EINA_FALSE);
1290 if (ad->main.hotspot_mode & (VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI |
1291 VCONFKEY_MOBILE_HOTSPOT_MODE_USB |
1292 VCONFKEY_MOBILE_HOTSPOT_MODE_BT)) {
1293 #ifdef TETHERING_DATA_USAGE_SUPPORT
1294 item = elm_genlist_item_append(ad->main.genlist, ad->main.usage_itc,
1295 ad, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
1296 elm_genlist_item_select_mode_set(item,
1297 ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1298 ad->main.usage_item = item;
1300 /* Insert "Connected devices" item */
1301 tethering_foreach_connected_clients(ad->handle, TETHERING_TYPE_ALL,
1302 _connected_clients_cb, (void *)ad);
1304 no_of_dev = _get_list_clients_count(ad);
1305 if (no_of_dev == 0) {
1306 item = elm_genlist_item_append(ad->main.genlist,
1307 ad->main.device0_itc, ad, NULL,
1308 ELM_GENLIST_ITEM_NONE, NULL, NULL);
1309 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1311 item = elm_genlist_item_append(ad->main.genlist,
1312 ad->main.device_itc, ad, NULL,
1313 ELM_GENLIST_ITEM_NONE, _select_connected_dev, (void *)ad);
1314 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DEFAULT);
1316 ad->main.device_item = item;
1319 if (ad->main.hotspot_mode & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI_AP) {
1320 if (ad->main.wifi_item)
1321 elm_object_item_disabled_set(ad->main.wifi_item, EINA_TRUE);
1322 if (ad->main.setup_item)
1323 elm_object_item_disabled_set(ad->main.setup_item, EINA_TRUE);
1324 if (ad->main.bt_item)
1325 elm_object_item_disabled_set(ad->main.bt_item, EINA_TRUE);
1326 if (ad->main.usb_item)
1327 elm_object_item_disabled_set(ad->main.usb_item, EINA_TRUE);
1330 __MOBILE_AP_FUNC_EXIT__;
1334 void _main_free_genlist_itc(mh_appdata_t *ad)
1336 __MOBILE_AP_FUNC_ENTER__;
1341 mh_main_view_t *mv = &ad->main;
1343 #ifdef TETHERING_DATA_USAGE_SUPPORT
1344 _free_genlist_itc(&mv->usage_itc);
1346 _free_genlist_itc(&mv->device_itc);
1347 _free_genlist_itc(&mv->device0_itc);
1348 _free_genlist_itc(&mv->help_itc);
1349 _free_genlist_itc(&mv->usb_itc);
1350 _free_genlist_itc(&mv->bt_itc);
1351 _free_genlist_itc(&mv->setup_itc);
1352 _free_genlist_itc(&mv->wifi_itc);
1353 __MOBILE_AP_FUNC_EXIT__;
1357 void _main_callback_del(mh_appdata_t *ad)
1359 __MOBILE_AP_FUNC_ENTER__;
1362 ERR("ad is NULL\n");
1368 obj = elm_object_item_part_content_get(ad->main.wifi_item, "elm.swallow.end");
1370 evas_object_smart_callback_del(obj, "changed", __wifi_onoff_changed_cb);
1372 obj = elm_object_item_part_content_get(ad->main.bt_item, "elm.swallow.end");
1374 evas_object_smart_callback_del(obj, "changed", __bt_onoff_changed_cb);
1376 obj = elm_object_item_part_content_get(ad->main.usb_item, "elm.swallow.end");
1378 evas_object_smart_callback_del(obj, "changed", __usb_onoff_changed_cb);
1380 evas_object_smart_callback_del(ad->main.genlist, "realized", __gl_realized);
1382 __MOBILE_AP_FUNC_EXIT__;
1385 static void __ctx_move_more_ctxpopup(Evas_Object *ctx, mh_appdata_t *ad)
1390 __MOBILE_AP_FUNC_ENTER__;
1392 elm_win_screen_size_get(ad->win, NULL, NULL, &w, &h);
1393 pos = elm_win_rotation_get(ad->win);
1398 evas_object_move(ctx, w/2, h);
1401 evas_object_move(ctx, h/2, w);
1404 evas_object_move(ctx, h/2, w);
1407 __MOBILE_AP_FUNC_EXIT__;
1410 static void __rotate_more_ctxpopup_cb(void *data, Evas_Object *obj, void *event_info)
1412 __MOBILE_AP_FUNC_ENTER__;
1414 mh_appdata_t *ad = (mh_appdata_t *)data;
1415 Evas_Object *ctx = ad->ctxpopup;
1417 __ctx_move_more_ctxpopup(ctx, ad);
1418 evas_object_show(ctx);
1420 __MOBILE_AP_FUNC_EXIT__;
1423 static void __dismissed_more_ctxpopup_cb(void *data, Evas_Object *obj, void *event)
1425 __MOBILE_AP_FUNC_ENTER__;
1427 mh_appdata_t *ad = (mh_appdata_t *)data;
1428 Evas_Object *ctx = ad->ctxpopup;
1431 evas_object_del(ctx);
1434 __ctx_move_more_ctxpopup(ctx, ad);
1435 evas_object_show(ctx);
1436 rotate_flag = EINA_FALSE;
1438 __MOBILE_AP_FUNC_EXIT__;
1441 static void __ctx_delete_more_ctxpopup_cb(void *data, Evas *e, Evas_Object *obj,
1444 Evas_Object *navi = (Evas_Object *)data;
1445 Evas_Object *ctx = obj;
1448 ERR("data is null\n");
1451 __MOBILE_AP_FUNC_ENTER__;
1453 evas_object_smart_callback_del(ctx, "dismissed",
1454 __dismissed_more_ctxpopup_cb);
1455 evas_object_smart_callback_del(elm_object_top_widget_get(ctx),
1456 "rotation,changed", __rotate_more_ctxpopup_cb);
1457 evas_object_event_callback_del_full(ctx, EVAS_CALLBACK_DEL,
1458 __ctx_delete_more_ctxpopup_cb, navi);
1459 __MOBILE_AP_FUNC_EXIT__;
1462 static void __gl_configure_wifi_tethering(void *data, Evas_Object *obj, void *event_info)
1464 __MOBILE_AP_FUNC_ENTER__;
1467 ERR("The param is NULL\n");
1470 mh_appdata_t *ad = (mh_appdata_t *)data;
1472 evas_object_del(ad->ctxpopup);
1473 ad->ctxpopup = NULL;
1475 elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
1476 mh_draw_wifi_setup_view(ad);
1478 __MOBILE_AP_FUNC_EXIT__;
1483 static void __create_ctxpopup_more_button(void *data, Evas_Object *obj,
1486 mh_appdata_t *ad = (mh_appdata_t *)data;
1487 Evas_Object *ctxpopup = NULL;
1490 ERR("ad is null\n");
1493 __MOBILE_AP_FUNC_ENTER__;
1495 ctxpopup = elm_ctxpopup_add(ad->win);
1496 elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE);
1498 eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_BACK,
1499 eext_ctxpopup_back_cb, ad);
1500 eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_MORE,
1501 eext_ctxpopup_back_cb, ad);
1502 elm_object_style_set(ctxpopup, "more/default");
1503 evas_object_smart_callback_add(ctxpopup, "dismissed",
1504 __dismissed_more_ctxpopup_cb, ad);
1505 evas_object_smart_callback_add(elm_object_top_widget_get(ctxpopup), "rotation,changed",
1506 __rotate_more_ctxpopup_cb, ad);
1507 evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_DEL,
1508 __ctx_delete_more_ctxpopup_cb, ad->naviframe);
1510 elm_ctxpopup_direction_priority_set(ctxpopup, ELM_CTXPOPUP_DIRECTION_UP,
1511 ELM_CTXPOPUP_DIRECTION_DOWN,
1512 ELM_CTXPOPUP_DIRECTION_UNKNOWN,
1513 ELM_CTXPOPUP_DIRECTION_UNKNOWN);
1515 __ctx_move_more_ctxpopup(ctxpopup, ad);
1516 elm_ctxpopup_item_append(ctxpopup, STR_CONFIGURE_MOBILE_HOTSPOT,
1517 NULL, __gl_configure_wifi_tethering, ad);
1519 evas_object_show(ctxpopup);
1521 ad->ctxpopup = ctxpopup;
1523 __MOBILE_AP_FUNC_EXIT__;
1527 void _main_draw_contents(mh_appdata_t *ad)
1531 Elm_Object_Item *navi_item;
1533 __create_inner_contents(ad);
1535 ad->main.back_btn = elm_button_add(ad->naviframe);
1536 if (ad->main.back_btn == NULL) {
1537 ERR("elm_button_add is failed\n");
1538 if (ad->main.genlist) {
1539 evas_object_del(ad->main.genlist);
1540 ad->main.genlist = NULL;
1544 elm_object_style_set(ad->main.back_btn, "naviframe/back_btn/default");
1546 eext_object_event_callback_add(ad->naviframe, EEXT_CALLBACK_BACK,
1547 eext_naviframe_back_cb, NULL);
1548 eext_object_event_callback_add(ad->naviframe, EEXT_CALLBACK_MORE,
1549 __create_ctxpopup_more_button, ad);
1551 evas_object_smart_callback_add(ad->main.back_btn, "clicked", (Evas_Smart_Cb)__back_btn_cb, (void *)ad);
1552 elm_object_focus_allow_set(ad->main.back_btn, EINA_FALSE);
1554 navi_item = elm_naviframe_item_push(ad->naviframe, IDS_TETH,
1555 ad->main.back_btn, NULL, ad->main.genlist, NULL);
1556 elm_object_item_domain_text_translatable_set(navi_item, PKGNAME, EINA_TRUE);
1558 elm_naviframe_item_pop_cb_set(navi_item, (Elm_Naviframe_Item_Pop_Cb)__back_btn_cb, (void *)ad);
1559 ad->navi_item = navi_item;