From 774a44499de83a516e8d5bf953c39f6cc4539f44 Mon Sep 17 00:00:00 2001 From: Seungyoun Ju Date: Fri, 29 Mar 2013 13:33:40 +0900 Subject: [PATCH] UI issues are fixed - Fix : The grouping of genlist item is wrong - Back button position and Naviframe title visibility are changed - Make grouping for genlist expanded item - Editfield change is applied - Ticker notification is implemented for passphrase entry - Implement title slide - Pop-up parent and entry's context menu allowance are changed Change-Id: I242185a644ff7d0622e988598e5668b58c5549b7 --- CMakeLists.txt | 17 +- include/mh_common_utility.h | 6 +- include/mobile_hotspot.h | 8 +- packaging/ug-setting-mobileap-efl.spec | 1 + src/mh_common_utility.c | 217 ++++++++++++------ src/mh_func_onoff.c | 54 +++-- src/mh_main_ug.c | 114 ++++++--- src/mh_view_main.c | 46 +++- src/mh_view_wifi_setup.c | 406 ++++++++++++++++++++------------- 9 files changed, 562 insertions(+), 307 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b1b4d78..78d631b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,23 +16,16 @@ SET(SRCS src/mh_common_utility.c ) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) + +SET(dependents "elementary evas ui-gadget-1 wifi-direct capi-network-tethering capi-network-connection capi-network-wifi capi-telephony-sim notification") + IF("${CMAKE_BUILD_TYPE}" STREQUAL "") SET(CMAKE_BUILD_TYPE "Release") ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) - INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED - elementary - evas - ui-gadget-1 - wifi-direct - capi-network-tethering - capi-network-connection - capi-network-wifi - capi-telephony-sim - ) +pkg_check_modules(pkgs REQUIRED ${dependents}) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} ${flag}") diff --git a/include/mh_common_utility.h b/include/mh_common_utility.h index 5549efe..6af98c4 100644 --- a/include/mh_common_utility.h +++ b/include/mh_common_utility.h @@ -29,14 +29,18 @@ extern "C" { #define MH_POPUP_TIMEOUT 2.0f -void _prepare_popup(mh_appdata_t *ad, int type, const char *str); +void _prepare_popup_with_content(int type, Evas_Object *obj); +void _prepare_popup(int type, const char *str); Eina_Bool _create_popup(mh_appdata_t *ad); +void _destroy_popup(mh_appdata_t *ad); Evas_Object *_create_bg(Evas_Object *parent, const char *style); Evas_Object *_create_win_layout(mh_appdata_t *ad); Evas_Object *_create_naviframe(Evas_Object *parent); void _handle_usb_mode_change(keynode_t *key, void *data); int _get_vconf_hotspot_mode(void); Eina_Bool _get_no_of_connected_device(tethering_h handle, int *no, tethering_type_e type); +Evas_Object *_create_label(Evas_Object *parent, const char *text); +Evas_Object *_create_slide_title(Evas_Object *parent, const char *text); #ifdef __cplusplus } diff --git a/include/mobile_hotspot.h b/include/mobile_hotspot.h index fb27abb..3fac392 100644 --- a/include/mobile_hotspot.h +++ b/include/mobile_hotspot.h @@ -110,7 +110,6 @@ typedef enum { /* One button pop-up */ MH_POP_INFORMATION, MH_POP_USB_CONNECT, - MH_POP_WIFI_PASSWORD_SHORT, /* No button & timeout pop-up */ MH_POP_INFORMATION_WO_BUTTON, @@ -145,6 +144,7 @@ typedef struct ap_app_main { Elm_Genlist_Item_Class *usage_itc; Elm_Genlist_Item_Class *dev_itc[TETHERING_TYPE_MAX]; + Elm_Object_Item *sp_item[4]; Elm_Object_Item *wifi_item; Elm_Object_Item *setup_item; Elm_Object_Item *bt_item; @@ -168,7 +168,6 @@ typedef struct { Evas_Object *title_back_btn; Evas_Object *hide_btn; Evas_Object *security_btn; - Evas_Object *pw_layout; Evas_Object *pw_entry; Elm_Genlist_Item_Class *sp_itc; @@ -178,6 +177,7 @@ typedef struct { Elm_Genlist_Item_Class *pw_itc; Elm_Genlist_Item_Class *name_itc; + Elm_Object_Item *sp_item[2]; Elm_Object_Item *hide_item; Elm_Object_Item *security_item; Elm_Object_Item *pw_item; @@ -222,8 +222,8 @@ typedef struct { mh_data_usage_t data_statistics; mh_clients_t clients; - int popup_type; - char popup_string[MH_LABEL_LENGTH_MAX]; + enum ug_event rotate_state; + Ecore_IMF_Input_Panel_State imf_state; } mh_appdata_t; typedef struct { diff --git a/packaging/ug-setting-mobileap-efl.spec b/packaging/ug-setting-mobileap-efl.spec index a99a057..de7eb77 100644 --- a/packaging/ug-setting-mobileap-efl.spec +++ b/packaging/ug-setting-mobileap-efl.spec @@ -20,6 +20,7 @@ BuildRequires: pkgconfig(capi-network-tethering) BuildRequires: pkgconfig(capi-network-connection) BuildRequires: pkgconfig(capi-network-wifi) BuildRequires: pkgconfig(capi-telephony-sim) +BuildRequires: pkgconfig(notification) %description Tethering UI Gadget Library diff --git a/src/mh_common_utility.c b/src/mh_common_utility.c index 2cb2ccf..b39eea2 100644 --- a/src/mh_common_utility.c +++ b/src/mh_common_utility.c @@ -20,6 +20,10 @@ #include "mh_common_utility.h" #include "mobile_hotspot.h" +static mh_popup_type_e popup_type = MH_POPUP_NONE; +static Evas_Object *popup_content = NULL; +static char *popup_string = NULL; + static void __one_btn_popup_resp(void *data, Evas_Object *obj, void *event_info) { __MOBILE_AP_FUNC_ENTER__; @@ -34,8 +38,8 @@ static void __one_btn_popup_resp(void *data, Evas_Object *obj, void *event_info) evas_object_del(ad->popup); ad->popup = NULL; - DBG("popup_type : %d\n", ad->popup_type); - switch (ad->popup_type) { + DBG("popup_type : %d\n", popup_type); + switch (popup_type) { case MH_POP_USB_CONNECT: _update_usb_item(ad, MH_STATE_NONE); vconf_ignore_key_changed(VCONFKEY_SETAPPL_USB_MODE_INT, @@ -45,16 +49,8 @@ static void __one_btn_popup_resp(void *data, Evas_Object *obj, void *event_info) case MH_POP_INFORMATION: break; - case MH_POP_WIFI_PASSWORD_SHORT: - if (ad->setup.pw_entry == NULL) - break; - - evas_object_show(ad->setup.pw_entry); - elm_object_focus_set(ad->setup.pw_entry, EINA_TRUE); - break; - default: - DBG("Unknown popup_type : %d\n", ad->popup_type); + DBG("Unknown popup_type : %d\n", popup_type); break; } @@ -75,13 +71,13 @@ static void __alert_popup_resp(void *data, Evas_Object *obj, void *event_info) evas_object_del(ad->popup); ad->popup = NULL; - DBG("popup_type : %d\n", ad->popup_type); - switch (ad->popup_type) { + DBG("popup_type : %d\n", popup_type); + switch (popup_type) { case MH_POP_INFORMATION_WO_BUTTON: break; default: - DBG("Unknown popup_type : %d\n", ad->popup_type); + DBG("Unknown popup_type : %d\n", popup_type); break; } @@ -104,8 +100,8 @@ static void __popup_resp_yes(void *data, Evas_Object *obj, void *event_info) evas_object_del(ad->popup); ad->popup = NULL; - DBG("popup_type : %d\n", ad->popup_type); - switch (ad->popup_type) { + DBG("popup_type : %d\n", popup_type); + switch (popup_type) { case MH_POP_WIFI_ON_CONF: wifi_is_activated(&wifi_state); if (wifi_state == true) { @@ -145,7 +141,7 @@ static void __popup_resp_yes(void *data, Evas_Object *obj, void *event_info) case MH_POP_USB_ON_CONF: if (_get_vconf_usb_state() != VCONFKEY_SYSMAN_USB_AVAILABLE) { - _prepare_popup(ad, MH_POP_USB_CONNECT, + _prepare_popup(MH_POP_USB_CONNECT, _("IDS_MOBILEAP_POP_CONNECT_USB_CABLE")); _create_popup(ad); vconf_notify_key_changed(VCONFKEY_SETAPPL_USB_MODE_INT, @@ -153,7 +149,7 @@ static void __popup_resp_yes(void *data, Evas_Object *obj, void *event_info) break; } - _prepare_popup(ad, MH_POP_USB_ON_PREVCONN_CONF, + _prepare_popup(MH_POP_USB_ON_PREVCONN_CONF, _("IDS_MOBILEAP_POP_ENABLING_USB_TETHERING_WILL_DISCONNECT_PREVIOUS_USB_CONNECTION")); _create_popup(ad); break; @@ -179,7 +175,7 @@ static void __popup_resp_yes(void *data, Evas_Object *obj, void *event_info) break; default: - DBG("Unknown popup_type : %d\n", ad->popup_type); + DBG("Unknown popup_type : %d\n", popup_type); break; } @@ -200,8 +196,8 @@ static void __popup_resp_no(void *data, Evas_Object *obj, void *event_info) evas_object_del(ad->popup); ad->popup = NULL; - DBG("popup_type : %d\n", ad->popup_type); - switch (ad->popup_type) { + DBG("popup_type : %d\n", popup_type); + switch (popup_type) { case MH_POP_WIFI_ON_CONF: _update_wifi_item(ad, MH_STATE_NONE); break; @@ -226,7 +222,7 @@ static void __popup_resp_no(void *data, Evas_Object *obj, void *event_info) break; default: - DBG("Unknown popup_type : %d\n", ad->popup_type); + DBG("Unknown popup_type : %d\n", popup_type); break; } @@ -247,24 +243,47 @@ static bool _count_connected_clients_cb(tethering_client_h client, void *user_da return true; } -void _prepare_popup(mh_appdata_t *ad, int type, const char *str) +void _prepare_popup_with_content(int type, Evas_Object *obj) { __MOBILE_AP_FUNC_ENTER__; - if (ad == NULL || str == NULL) { - ERR("param is NULL : ad[%x], str[%x]\n", ad, str); + if (obj == NULL) { + ERR("param is NULL\n"); return; } - int nLen = 0; + popup_type = type; - nLen = strlen(str); - if (sizeof(ad->popup_string) <= nLen) - ERR("We should make the message[%s] less than %d", - str, sizeof(ad->popup_string)); + if (popup_content) + evas_object_del(popup_content); + popup_content = obj; - ad->popup_type = type; - snprintf(ad->popup_string, sizeof(ad->popup_string), "%s", str); + if (popup_string) { + free(popup_string); + popup_string = NULL; + } + + __MOBILE_AP_FUNC_EXIT__; +} + +void _prepare_popup(int type, const char *str) +{ + __MOBILE_AP_FUNC_ENTER__; + + if (str == NULL) { + ERR("param is NULL\n"); + return; + } + + popup_type = type; + popup_content = NULL; + + if (popup_string) + free(popup_string); + + popup_string = strndup(str, MH_LABEL_LENGTH_MAX); + if (popup_string == NULL) + ERR("strndup is failed\n"); __MOBILE_AP_FUNC_EXIT__; } @@ -277,7 +296,13 @@ Eina_Bool _create_popup(mh_appdata_t *ad) if (ad == NULL) { ERR("The param is NULL\n"); - return 0; + if (popup_string) { + free(popup_string); + popup_string = NULL; + } + popup_content = NULL; + + return EINA_FALSE; } if (ad->popup != NULL) { @@ -286,14 +311,17 @@ Eina_Bool _create_popup(mh_appdata_t *ad) ad->popup = NULL; } - DBG("Create_popup %d\n", ad->popup_type); - switch (ad->popup_type) { + DBG("Create_popup %d\n", popup_type); + switch (popup_type) { case MH_POP_WIFI_ON_CONF: ad->popup = elm_popup_add(ad->win); evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_text_set(ad->popup, ad->popup_string); + if (popup_content == NULL) + elm_object_text_set(ad->popup, popup_string); + else + elm_object_content_set(ad->popup, popup_content); btn = elm_button_add(ad->popup); elm_object_style_set(btn, "popup_button/default"); @@ -317,7 +345,10 @@ Eina_Bool _create_popup(mh_appdata_t *ad) evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_text_set(ad->popup, ad->popup_string); + if (popup_content == NULL) + elm_object_text_set(ad->popup, popup_string); + else + elm_object_content_set(ad->popup, popup_content); btn = elm_button_add(ad->popup); elm_object_style_set(btn, "popup_button/default"); @@ -341,7 +372,10 @@ Eina_Bool _create_popup(mh_appdata_t *ad) evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_text_set(ad->popup, ad->popup_string); + if (popup_content == NULL) + elm_object_text_set(ad->popup, popup_string); + else + elm_object_content_set(ad->popup, popup_content); btn = elm_button_add(ad->popup); elm_object_style_set(btn, "popup_button/default"); @@ -358,7 +392,10 @@ Eina_Bool _create_popup(mh_appdata_t *ad) evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_text_set(ad->popup, ad->popup_string); + if (popup_content == NULL) + elm_object_text_set(ad->popup, popup_string); + else + elm_object_content_set(ad->popup, popup_content); btn = elm_button_add(ad->popup); elm_object_style_set(btn, "popup_button/default"); @@ -383,7 +420,10 @@ Eina_Bool _create_popup(mh_appdata_t *ad) evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_text_set(ad->popup, ad->popup_string); + if (popup_content == NULL) + elm_object_text_set(ad->popup, popup_string); + else + elm_object_content_set(ad->popup, popup_content); btn = elm_button_add(ad->popup); elm_object_style_set(btn, "popup_button/default"); @@ -407,24 +447,10 @@ Eina_Bool _create_popup(mh_appdata_t *ad) evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_text_set(ad->popup, ad->popup_string); - - btn = elm_button_add(ad->popup); - elm_object_style_set(btn, "popup_button/default"); - elm_object_text_set(btn, S_("IDS_COM_POP_CLOSE")); - elm_object_part_content_set(ad->popup, "button1", btn); - evas_object_smart_callback_add(btn, "clicked", - __one_btn_popup_resp, (void *)ad); - - evas_object_show(ad->popup); - break; - - case MH_POP_WIFI_PASSWORD_SHORT: - ad->popup = elm_popup_add(ad->win); - evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - - elm_object_text_set(ad->popup, ad->popup_string); + if (popup_content == NULL) + elm_object_text_set(ad->popup, popup_string); + else + elm_object_content_set(ad->popup, popup_content); btn = elm_button_add(ad->popup); elm_object_style_set(btn, "popup_button/default"); @@ -441,7 +467,10 @@ Eina_Bool _create_popup(mh_appdata_t *ad) evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_text_set(ad->popup, ad->popup_string); + if (popup_content == NULL) + elm_object_text_set(ad->popup, popup_string); + else + elm_object_content_set(ad->popup, popup_content); elm_popup_timeout_set(ad->popup, MH_POPUP_TIMEOUT); evas_object_smart_callback_add(ad->popup, "timeout", @@ -457,7 +486,10 @@ Eina_Bool _create_popup(mh_appdata_t *ad) evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_text_set(ad->popup, ad->popup_string); + if (popup_content == NULL) + elm_object_text_set(ad->popup, popup_string); + else + elm_object_content_set(ad->popup, popup_content); btn = elm_button_add(ad->popup); elm_object_style_set(btn, "popup_button/default"); @@ -475,28 +507,37 @@ Eina_Bool _create_popup(mh_appdata_t *ad) evas_object_show(ad->popup); break; + default: + ERR("Unknown popup_type : %d\n", popup_type); + break; } + if (popup_string) { + free(popup_string); + popup_string = NULL; + } + popup_content = NULL; + __MOBILE_AP_FUNC_EXIT__; - return TRUE; + return EINA_TRUE; } void _destroy_popup(mh_appdata_t *ad) { __MOBILE_AP_FUNC_ENTER__; - if (ad == NULL) { - ERR("ad is NULL\n"); - return; - } - - if (ad->popup) { + if (ad && ad->popup) { evas_object_del(ad->popup); ad->popup = NULL; } - ad->popup_type = MH_POPUP_NONE; + if (popup_string) { + free(popup_string); + popup_string = NULL; + } + popup_content = NULL; + popup_type = MH_POPUP_NONE; __MOBILE_AP_FUNC_EXIT__; @@ -648,3 +689,43 @@ Eina_Bool _get_no_of_connected_device(tethering_h handle, int *no, tethering_typ return TRUE; } + +Evas_Object *_create_label(Evas_Object *parent, const char *text) +{ + Evas_Object *label; + + label = elm_entry_add(parent); + if (label == NULL) { + ERR("elm_entry_add is failed\n"); + return NULL; + } + + elm_entry_editable_set(label, EINA_FALSE); + elm_entry_context_menu_disabled_set(label, EINA_TRUE); + elm_object_text_set(label, text); + + evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(label); + + return label; +} + +Evas_Object *_create_slide_title(Evas_Object *parent, const char *text) +{ + if (parent == NULL || text == NULL) + return NULL; + + Evas_Object *label; + + label = elm_label_add(parent); + elm_object_style_set(label, "naviframe_title"); + elm_label_slide_mode_set(label, ELM_LABEL_SLIDE_MODE_AUTO); + elm_label_wrap_width_set(label, 1); + elm_label_ellipsis_set(label, EINA_TRUE); + elm_object_text_set(label, text); + evas_object_show(label); + + elm_access_object_unregister(label); + return label; +} \ No newline at end of file diff --git a/src/mh_func_onoff.c b/src/mh_func_onoff.c index 770b669..118f9a4 100644 --- a/src/mh_func_onoff.c +++ b/src/mh_func_onoff.c @@ -51,7 +51,7 @@ int _get_vconf_usb_state() static bool __is_connected_wifi_net(mh_appdata_t *ad) { - connection_wifi_state_e wifi_state; + connection_wifi_state_e wifi_state = CONNECTION_WIFI_STATE_DEACTIVATED; int ret; ret = connection_get_wifi_state(ad->conn_handle, &wifi_state); @@ -71,7 +71,7 @@ static bool __is_connected_wifi_net(mh_appdata_t *ad) static bool __is_connected_ethernet_net(mh_appdata_t *ad) { - connection_ethernet_state_e ethernet_state; + connection_ethernet_state_e ethernet_state = CONNECTION_ETHERNET_STATE_DEACTIVATED; int ret; ret = connection_get_ethernet_state(ad->conn_handle, ðernet_state); @@ -91,19 +91,22 @@ static bool __is_connected_ethernet_net(mh_appdata_t *ad) static bool __is_connected_cellular_net(mh_appdata_t *ad) { - connection_cellular_state_e cellular_state; - sim_state_e sim_state; + connection_cellular_state_e cellular_state = CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE; + sim_state_e sim_state = SIM_STATE_UNAVAILABLE; int ret; /* Check SIM state */ ret = sim_get_state(&sim_state); if (ret != SIM_ERROR_NONE) { ERR("sim_get_state() is failed : %d\n", ret); + _prepare_popup(MH_POP_INFORMATION, + _("IDS_MOBILEAP_POP_INSERT_SIM_CARD_AND_RESTART_DEVICE_TO_USE_TETHERING")); + _create_popup(ad); return false; } DBG("SIM State : %d\n", sim_state); if (sim_state != SIM_STATE_AVAILABLE) { - _prepare_popup(ad, MH_POP_INFORMATION, + _prepare_popup(MH_POP_INFORMATION, _("IDS_MOBILEAP_POP_INSERT_SIM_CARD_AND_RESTART_DEVICE_TO_USE_TETHERING")); _create_popup(ad); return false; @@ -116,14 +119,14 @@ static bool __is_connected_cellular_net(mh_appdata_t *ad) } if (cellular_state == CONNECTION_CELLULAR_STATE_FLIGHT_MODE) { - _prepare_popup(ad, MH_POP_INFORMATION_WO_BUTTON, + _prepare_popup(MH_POP_INFORMATION_WO_BUTTON, _("IDS_MOBILEAP_POP_UNABLE_TO_USE_TETHERING_IN_FLIGHT_MODE_TO_USE_TETHERING_DISABLE_FLIGHT_MODE")); _create_popup(ad); ERR("Cellular network is not connected\n"); return false; } else if (cellular_state != CONNECTION_CELLULAR_STATE_CONNECTED && cellular_state != CONNECTION_CELLULAR_STATE_AVAILABLE) { - _prepare_popup(ad, MH_POP_INFORMATION, + _prepare_popup(MH_POP_INFORMATION, _("IDS_MOBILEAP_POP_UNABLE_TO_USE_PACKET_DATA_SERVICE_OUT_OF_COVERAGE")); _create_popup(ad); ERR("Cellular network is not connected : %d\n", cellular_state); @@ -136,16 +139,15 @@ static bool __is_connected_cellular_net(mh_appdata_t *ad) static int __create_wifi_hotspot_on_popup(mh_appdata_t *ad) { - bool wifi_state; - char *str = NULL; + char *str; + bool wifi_state = false; wifi_is_activated(&wifi_state); if (wifi_state == true || _is_wifi_direct_on() == true) str = _("IDS_MOBILEAP_POP_WI_FI_NETWORK_WILL_BE_DISCONNECTED_WI_FI_TETHERING_CONSUMES_MORE_BATTERY_POWER_AND_INCREASES_YOUR_DATA_USAGE_CONTINUE_Q"); else str = _("IDS_MOBILEAP_POP_WI_FI_TETHERING_CONSUMES_MORE_BATTERY_POWER_AND_INCREASES_YOUR_DATA_USAGE_CONTINUE_Q"); - - _prepare_popup(ad, MH_POP_WIFI_ON_CONF, str); + _prepare_popup(MH_POP_WIFI_ON_CONF, str); _create_popup(ad); return 0; @@ -153,8 +155,10 @@ static int __create_wifi_hotspot_on_popup(mh_appdata_t *ad) static int __create_bt_tethering_on_popup(mh_appdata_t *ad) { - _prepare_popup(ad, MH_POP_BT_ON_CONF, - _("IDS_MOBILEAP_POP_TETHERING_CONSUMES_MORE_BATTERY_POWER_AND_INCREASES_YOUR_DATA_USAGE")); + char *str; + + str = _("IDS_MOBILEAP_POP_TETHERING_CONSUMES_MORE_BATTERY_POWER_AND_INCREASES_YOUR_DATA_USAGE"); + _prepare_popup(MH_POP_BT_ON_CONF, str); _create_popup(ad); return 0; @@ -162,8 +166,10 @@ static int __create_bt_tethering_on_popup(mh_appdata_t *ad) static int __create_usb_tethering_on_popup(mh_appdata_t *ad) { - _prepare_popup(ad, MH_POP_USB_ON_CONF, - _("IDS_MOBILEAP_POP_TETHERING_CONSUMES_MORE_BATTERY_POWER_AND_INCREASES_YOUR_DATA_USAGE")); + char *str; + + str = _("IDS_MOBILEAP_POP_TETHERING_CONSUMES_MORE_BATTERY_POWER_AND_INCREASES_YOUR_DATA_USAGE"); + _prepare_popup(MH_POP_USB_ON_CONF, str); _create_popup(ad); return 0; @@ -295,7 +301,7 @@ static void __wifi_deactivated_cb(wifi_error_e result, void *user_data) } mh_appdata_t *ad = (mh_appdata_t *)user_data; - int ret = 0; + int ret; if (result != WIFI_ERROR_NONE) { ERR("__wifi_deactivated_cb error : %d\n", result); @@ -343,7 +349,7 @@ void _enabled_cb(tethering_error_e result, tethering_type_e type, bool is_reques } if (result != TETHERING_ERROR_NONE) { - _prepare_popup(ad, MH_POP_INFORMATION, + _prepare_popup(MH_POP_INFORMATION, _("IDS_MOBILEAP_POP_UNABLE_TO_USE_TETHERING")); _create_popup(ad); } @@ -379,7 +385,7 @@ void _disabled_cb(tethering_error_e result, tethering_type_e type, tethering_dis } if (result != TETHERING_ERROR_NONE) { - _prepare_popup(ad, MH_POP_INFORMATION, + _prepare_popup(MH_POP_INFORMATION, _("IDS_MOBILEAP_POP_UNABLE_TO_USE_TETHERING")); _create_popup(ad); _update_main_view(ad); @@ -442,7 +448,7 @@ int _handle_wifi_onoff_change(mh_appdata_t *ad) { __MOBILE_AP_FUNC_ENTER__; - int ret = 0; + int ret; int connected_wifi_clients = 0; /* Turn off WiFi hotspot */ @@ -452,7 +458,7 @@ int _handle_wifi_onoff_change(mh_appdata_t *ad) ERR("Getting the number of connected device is failed\n"); } if (connected_wifi_clients > 0) { - _prepare_popup(ad, MH_POP_WIFI_OFF_CONF, + _prepare_popup(MH_POP_WIFI_OFF_CONF, _("IDS_MOBILEAP_POP_DISABLING_TETHERING_WILL_PREVENT_LINKED_DEVICES_FROM_ACCESSING_THE_INTERNET_CONTINUE_Q")); _create_popup(ad); } else { @@ -505,7 +511,7 @@ int _handle_bt_onoff_change(mh_appdata_t *ad) } if (__create_bt_tethering_on_popup(ad) < 0) { - ERR("__create_wifi_hotspot_on_popup fail\n"); + ERR("__create_bt_tethering_on_popup fail\n"); return -1; } @@ -538,7 +544,7 @@ int _handle_usb_onoff_change(mh_appdata_t *ad) } if (__create_usb_tethering_on_popup(ad) < 0) { - ERR("__create_wifi_hotspot_on_popup fail\n"); + ERR("__create_usb_tethering_on_popup fail\n"); return -1; } @@ -576,7 +582,7 @@ int _turn_on_wifi(void) bool _is_wifi_direct_on(void) { int wifi_direct_state = 0; - int ret = 0; + int ret; ret = vconf_get_int(VCONFKEY_WIFI_DIRECT_STATE, &wifi_direct_state); if (ret < 0) { @@ -589,7 +595,7 @@ bool _is_wifi_direct_on(void) int _turn_off_wifi_direct(mh_appdata_t *ad) { - int ret = 0; + int ret; ret = wifi_direct_initialize(); if (ret < 0) { diff --git a/src/mh_main_ug.c b/src/mh_main_ug.c index 6bba6af..5096407 100644 --- a/src/mh_main_ug.c +++ b/src/mh_main_ug.c @@ -24,6 +24,7 @@ #include "mobile_hotspot.h" #include "mh_view_main.h" #include "mh_func_onoff.h" +#include "mh_common_utility.h" static Evas_Object *create_content(mh_appdata_t *ad) { @@ -39,32 +40,41 @@ static Evas_Object *create_content(mh_appdata_t *ad) static void __set_callbacks(tethering_h handle, void *user_data) { - tethering_set_enabled_cb(handle, TETHERING_TYPE_USB, _enabled_cb, user_data); - tethering_set_enabled_cb(handle, TETHERING_TYPE_WIFI, _enabled_cb, user_data); - tethering_set_enabled_cb(handle, TETHERING_TYPE_BT, _enabled_cb, user_data); + int ret; - tethering_set_disabled_cb(handle, TETHERING_TYPE_USB, _disabled_cb, user_data); - tethering_set_disabled_cb(handle, TETHERING_TYPE_WIFI, _disabled_cb, user_data); - tethering_set_disabled_cb(handle, TETHERING_TYPE_BT, _disabled_cb, user_data); + ret = tethering_set_enabled_cb(handle, TETHERING_TYPE_ALL, + _enabled_cb, user_data); + if (ret != TETHERING_ERROR_NONE) + ERR("tethering_set_enabled_cb [0x%X]\n", ret); - tethering_set_connection_state_changed_cb(handle, TETHERING_TYPE_USB, _connection_changed_cb, user_data); - tethering_set_connection_state_changed_cb(handle, TETHERING_TYPE_WIFI, _connection_changed_cb, user_data); - tethering_set_connection_state_changed_cb(handle, TETHERING_TYPE_BT, _connection_changed_cb, user_data); + ret = tethering_set_disabled_cb(handle, TETHERING_TYPE_ALL, + _disabled_cb, user_data); + if (ret != TETHERING_ERROR_NONE) + ERR("tethering_set_disabled_cb [0x%X]\n", ret); + + ret = tethering_set_connection_state_changed_cb(handle, + TETHERING_TYPE_ALL, + _connection_changed_cb, user_data); + if (ret != TETHERING_ERROR_NONE) + ERR("tethering_set_connection_state_changed_cb [0x%X]\n", ret); } static void __unset_callbacks(tethering_h handle) { - tethering_unset_enabled_cb(handle, TETHERING_TYPE_USB); - tethering_unset_enabled_cb(handle, TETHERING_TYPE_WIFI); - tethering_unset_enabled_cb(handle, TETHERING_TYPE_BT); + int ret; - tethering_unset_disabled_cb(handle, TETHERING_TYPE_USB); - tethering_unset_disabled_cb(handle, TETHERING_TYPE_WIFI); - tethering_unset_disabled_cb(handle, TETHERING_TYPE_BT); + ret = tethering_unset_connection_state_changed_cb(handle, + TETHERING_TYPE_ALL); + if (ret != TETHERING_ERROR_NONE) + ERR("tethering_unset_connection_state_changed_cb[0x%X]\n", ret); - tethering_unset_connection_state_changed_cb(handle, TETHERING_TYPE_USB); - tethering_unset_connection_state_changed_cb(handle, TETHERING_TYPE_WIFI); - tethering_unset_connection_state_changed_cb(handle, TETHERING_TYPE_BT); + ret = tethering_unset_disabled_cb(handle, TETHERING_TYPE_ALL); + if (ret != TETHERING_ERROR_NONE) + ERR("tethering_unset_disabled_cb [0x%X]\n", ret); + + ret = tethering_unset_enabled_cb(handle, TETHERING_TYPE_ALL); + if (ret != TETHERING_ERROR_NONE) + ERR("tethering_unset_enabled [0x%X]\n", ret); } static void *on_create(ui_gadget_h ug, enum ug_mode mode, @@ -240,6 +250,47 @@ static void on_message(ui_gadget_h ug, service_h msg, { } +static void __rotate_changed_cb(mh_appdata_t *ad, enum ug_event rotate_state) +{ + if (ad == NULL) { + ERR("ad is NULL\n"); + return; + } + + Elm_Object_Item *top_navi_it = NULL; + mh_wifi_setting_view_t *st = &ad->setup; + + ad->rotate_state = rotate_state; + + top_navi_it = elm_naviframe_top_item_get(ad->naviframe); + if (top_navi_it == NULL) { + ERR("elm_naviframe_top_item_get returns NULL\n"); + return; + } + + if (top_navi_it != st->navi_it) { + return; + } + + if (rotate_state == UG_EVENT_ROTATE_PORTRAIT || + rotate_state == UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN) { + DBG("Naviframe title is shown\n"); + elm_naviframe_item_title_visible_set(st->navi_it, + EINA_TRUE); + } else if (rotate_state == UG_EVENT_ROTATE_LANDSCAPE || + rotate_state == UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN) { + if (ad->imf_state == ECORE_IMF_INPUT_PANEL_STATE_SHOW) { + DBG("Naviframe title is hided\n"); + elm_naviframe_item_title_visible_set(st->navi_it, + EINA_FALSE); + } + } else { + ERR("Unknown rotate_state : %d\n", rotate_state); + } + + return; +} + static void on_event(ui_gadget_h ug, enum ug_event event, service_h service, void *priv) { @@ -250,6 +301,9 @@ static void on_event(ui_gadget_h ug, enum ug_event event, return; } + mh_ugdata_t *ugd = (mh_ugdata_t *)priv; + mh_appdata_t *ad = ugd->ad; + switch (event) { case UG_EVENT_LOW_MEMORY: DBG("UG_EVENT_LOW_MEMORY\n"); @@ -261,16 +315,14 @@ static void on_event(ui_gadget_h ug, enum ug_event event, DBG("UG_EVENT_LANG_CHANGE\n"); break; case UG_EVENT_ROTATE_PORTRAIT: - DBG("UG_EVENT_ROTATE_PORTRAIT\n"); - break; case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN: - DBG("UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN\n"); + DBG("UG_EVENT_ROTATE_PORTRAIT[_UPSIDEDOWN]\n"); + __rotate_changed_cb(ad, event); break; case UG_EVENT_ROTATE_LANDSCAPE: - DBG("UG_EVENT_ROTATE_LANDSCAPE\n"); - break; case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN: - DBG("UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN\n"); + DBG("UG_EVENT_ROTATE_LANDSCAPE[_UPSIDEDOWN]\n"); + __rotate_changed_cb(ad, event); break; default: DBG("default\n"); @@ -300,17 +352,11 @@ static void on_key_event(ui_gadget_h ug, enum ug_key_event event, switch (event) { case UG_KEY_EVENT_END: - DBG("UG_KEY_EVENT_END is received : %p\n", ad->popup); - if (NULL == ad->popup) { + DBG("UG_KEY_EVENT_END is received : %p\n", ad->popup); + if (NULL == ad->popup) ug_destroy_me(ug); - break; - } - - if (ad->popup_type != MH_POP_INFORMATION_WO_BUTTON) { - evas_object_del(ad->popup); - ad->popup = NULL; - ad->popup_type = MH_POPUP_NONE; - } + else + _destroy_popup(ad); break; default: diff --git a/src/mh_view_main.c b/src/mh_view_main.c index 3563cbe..badd2b9 100644 --- a/src/mh_view_main.c +++ b/src/mh_view_main.c @@ -312,12 +312,6 @@ static void __read_setting(mh_appdata_t *ad) if (ret != TETHERING_ERROR_NONE) { ERR("tethering_wifi_get_security_type is failed\n"); } - - DBG("VCONFKEY_MOBILE_HOTSPOT_MODE: %d\n", ad->main.hotspot_mode); - DBG("Device name: %s\n", ad->setup.device_name); - DBG("Connected device: %d\n", ad->clients.number); - DBG("Visibility: %d\n", ad->setup.visibility); - DBG("Security: %d\n", ad->setup.security_type); DBG("End of Load setting value \n"); __MOBILE_AP_FUNC_EXIT__; @@ -552,7 +546,7 @@ static void __select_setup_item(void *data, Evas_Object *obj, void *event_info) } if (connected_wifi_clients > 0) { - _prepare_popup(ad, MH_POP_ENTER_TO_WIFI_SETUP_CONF, + _prepare_popup(MH_POP_ENTER_TO_WIFI_SETUP_CONF, _("IDS_MOBILEAP_POP_CONNECTED_DEVICE_WILL_BE_DISCONNECTED")); _create_popup(ad); } else { @@ -1278,12 +1272,44 @@ static void __gl_realized(void *data, Evas_Object *obj, void *event_info) { mh_appdata_t *ad = (mh_appdata_t *)data; Elm_Object_Item *item = (Elm_Object_Item *)event_info; + Evas_Object *ao; + Evas_Object *btn; + char str[MH_LABEL_LENGTH_MAX] = {0, }; + int i = 0; if (item == ad->main.wifi_item || item == ad->main.bt_item || item == ad->main.device_item) elm_object_item_signal_emit(item, "elm,state,top", ""); else if (item == ad->main.setup_item || item == ad->main.usage_item || item == ad->main.usb_item) elm_object_item_signal_emit(item, "elm,state,bottom", ""); + for (i = 0; i < 4; i++) { + if (item == ad->main.sp_item[i]) + elm_object_item_access_unregister(item); + } + + if (item == ad->main.wifi_item || item == ad->main.bt_item || item == ad->main.usb_item) { + ao = elm_object_item_access_object_get(item); + btn = elm_object_item_part_content_get(item, "on&off"); + snprintf(str, sizeof(str), "%s, %s", "On/off button", + (elm_check_state_get(btn) ? "On" : "Off")); + elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, str); + } else if (item == ad->main.setup_item) { + ao = elm_object_item_access_object_get(item); + elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, "Item"); + } else if (item == ad->main.device_item) { + ao = elm_object_item_access_object_get(item); + snprintf(str, sizeof(str), "%s, %s", "Expandable list", + "Double tap to open list"); + elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, str); + } + + if (ad->main.device_item == elm_genlist_item_parent_get(item)) { + if (ad->clients.number == elm_genlist_item_index_get(item) - 9) + elm_object_item_signal_emit(item, "elm,state,bottom", ""); + else + elm_object_item_signal_emit(item, "elm,state,center", ""); + } + return; } @@ -1292,6 +1318,7 @@ static void __create_inner_contents(mh_appdata_t *ad) __MOBILE_AP_FUNC_ENTER__; Elm_Object_Item *item = NULL; + int i = 0; __read_setting(ad); if (ad->main.hotspot_mode != VCONFKEY_MOBILE_HOTSPOT_MODE_NONE) @@ -1307,6 +1334,7 @@ static void __create_inner_contents(mh_appdata_t *ad) item = elm_genlist_item_append(ad->main.genlist, ad->main.sp_itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + ad->main.sp_item[i++] = item; item = elm_genlist_item_append(ad->main.genlist, ad->main.wifi_itc, ad, NULL, ELM_GENLIST_ITEM_NONE, @@ -1322,6 +1350,7 @@ static void __create_inner_contents(mh_appdata_t *ad) item = elm_genlist_item_append(ad->main.genlist, ad->main.sp_itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + ad->main.sp_item[i++] = item; item = elm_genlist_item_append(ad->main.genlist, ad->main.bt_itc, ad, NULL, ELM_GENLIST_ITEM_NONE, @@ -1347,6 +1376,7 @@ static void __create_inner_contents(mh_appdata_t *ad) item = elm_genlist_item_append(ad->main.genlist, ad->main.sp_itc, ad, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + ad->main.sp_item[i++] = item; item = elm_genlist_item_append(ad->main.genlist, ad->main.usage_itc, ad, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); @@ -1359,6 +1389,7 @@ static void __create_inner_contents(mh_appdata_t *ad) item = elm_genlist_item_append(ad->main.genlist, ad->main.end_sp_itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + ad->main.sp_item[i++] = item; __MOBILE_AP_FUNC_EXIT__; return; @@ -1415,6 +1446,7 @@ void ap_draw_contents(mh_appdata_t *ad) elm_object_style_set(ad->main.back_btn, "naviframe/back_btn/default"); evas_object_smart_callback_add(ad->main.back_btn, "clicked", __back_btn_cb, ad); + elm_object_focus_allow_set(ad->main.back_btn, EINA_FALSE); elm_naviframe_item_push(ad->naviframe, _("IDS_MOBILEAP_BODY_TETHERING"), diff --git a/src/mh_view_wifi_setup.c b/src/mh_view_wifi_setup.c index f61c5b2..a9ed253 100644 --- a/src/mh_view_wifi_setup.c +++ b/src/mh_view_wifi_setup.c @@ -16,7 +16,7 @@ * limitations under the License. * */ - +#include #include "mh_view_wifi_setup.h" static void __back_btn_cb(void *data, Evas_Object *obj, void *event_info); @@ -29,19 +29,24 @@ static void __input_panel_event_cb(void *data, Ecore_IMF_Context *ctx, int value return; } - mh_wifi_setting_view_t *st = (mh_wifi_setting_view_t *)data; + mh_appdata_t *ad = (mh_appdata_t *)data; + mh_wifi_setting_view_t *st = &ad->setup; + + ad->imf_state = value; if (st->navi_it == NULL) { DBG("naviframe item is not pushed yet\n"); return; } - if (value == ECORE_IMF_INPUT_PANEL_STATE_SHOW) { - DBG("value == ECORE_IMF_INPUT_PANEL_STATE_SHOW\n"); - elm_object_item_signal_emit(st->navi_it, "elm,state,sip,shown", ""); - } else if(value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) { - DBG("value == ECORE_IMF_INPUT_PANEL_STATE_HIDE\n"); - elm_object_item_signal_emit(st->navi_it, "elm,state,sip,hidden", ""); + if (value == ECORE_IMF_INPUT_PANEL_STATE_SHOW && + (ad->rotate_state == UG_EVENT_ROTATE_LANDSCAPE || + ad->rotate_state == UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN)) { + DBG("ECORE_IMF_INPUT_PANEL_STATE_SHOW and Landscape mode\n"); + elm_naviframe_item_title_visible_set(st->navi_it, EINA_FALSE); + } else if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) { + DBG("ECORE_IMF_INPUT_PANEL_STATE_HIDE\n"); + elm_naviframe_item_title_visible_set(st->navi_it, EINA_TRUE); } return; @@ -271,7 +276,6 @@ static Eina_Bool __save_wifi_passphrase(mh_appdata_t *ad) return EINA_FALSE; } - DBG("SUCCESS : setting up VCONFKEY_MOBILE_HOTSPOT_WIFI_KEY\n"); g_strlcpy(st->wifi_passphrase, st->wifi_passphrase_new, sizeof(st->wifi_passphrase)); __MOBILE_AP_FUNC_EXIT__; @@ -291,25 +295,22 @@ static void __passphrase_maxlength_reached_cb(void *data, Evas_Object *obj, mh_appdata_t *ad = (mh_appdata_t *)data; char buf[MH_LABEL_LENGTH_MAX] = {0, }; + int ret; - if (ad->popup != NULL) { - ERR("Popup already exists\n"); - return; - } - + ecore_imf_input_panel_hide(); elm_object_focus_set(ad->setup.pw_entry, EINA_FALSE); if (__save_wifi_passphrase(ad) == EINA_FALSE) { ERR("__save_wifi_passphrase is failed\n"); - return; } snprintf(buf, sizeof(buf), _("IDS_MOBILEAP_POP_PASSWORD_MUST_CONTAIN_AT_LEAST_PD_CHARACTERS_AND_NOT_EXCEED_PD_CHARACTERS"), WIFI_PASSPHRASE_LENGTH_MIN, WIFI_PASSPHRASE_LENGTH_MAX); - _prepare_popup(ad, MH_POP_INFORMATION_WO_BUTTON, buf); - _create_popup(ad); + ret = notification_status_message_post(buf); + if (ret != NOTIFICATION_ERROR_NONE) + ERR("notification_status_message_post() is failed : %d\n", ret); __MOBILE_AP_FUNC_EXIT__; } @@ -325,12 +326,31 @@ static void __passphrase_activated_cb(void *data, Evas_Object *obj, } mh_appdata_t *ad = (mh_appdata_t *)data; + int ret; + char *ptr; + ecore_imf_input_panel_hide(); elm_object_focus_set(ad->setup.pw_entry, EINA_FALSE); + if (strlen(ad->setup.wifi_passphrase_new) < WIFI_PASSPHRASE_LENGTH_MIN) { + DBG("Password is shorter than %d\n", WIFI_PASSPHRASE_LENGTH_MIN); + ret = notification_status_message_post(_("IDS_ST_BODY_ENTER_PASSWORD_OF_AT_LEAST_8_CHARACTERS")); + if (ret != NOTIFICATION_ERROR_NONE) + ERR("notification_status_message_post() is failed : %d\n", ret); + + ptr = elm_entry_utf8_to_markup(ad->setup.wifi_passphrase); + if (ptr != NULL) { + elm_entry_entry_set(ad->setup.pw_entry, ptr); + free(ptr); + } else { + ERR("elm_entry_utf8_to_markup is failed\n"); + } + + return; + } + if (__save_wifi_passphrase(ad) == EINA_FALSE) { ERR("__save_wifi_passphrase is failed\n"); - return; } __MOBILE_AP_FUNC_EXIT__; @@ -368,16 +388,16 @@ static void __pw_entry_changed_cb(void *data, Evas_Object *obj, free(utf8_string); } - if (!elm_object_focus_get(st->pw_layout)) { + if (!elm_object_focus_get(st->pw_entry)) { return; } if (elm_entry_is_empty(st->pw_entry)) { - elm_object_signal_emit(st->pw_layout, - "elm,state,eraser,hide", "elm"); + elm_object_item_signal_emit(st->pw_item, + "elm,state,eraser,hide", ""); } else { - elm_object_signal_emit(st->pw_layout, - "elm,state,eraser,show", "elm"); + elm_object_item_signal_emit(st->pw_item, + "elm,state,eraser,show", ""); } __MOBILE_AP_FUNC_EXIT__; @@ -399,14 +419,11 @@ static void __pw_entry_focused_cb(void *data, Evas_Object *obj, mh_appdata_t *ad = (mh_appdata_t *)data; mh_wifi_setting_view_t *st = &ad->setup; - elm_entry_cursor_end_set(st->pw_entry); - - if (!elm_entry_is_empty(st->pw_entry)) - elm_object_signal_emit(st->pw_layout, - "elm,state,eraser,show", "elm"); - - elm_object_signal_emit(st->pw_layout, - "elm,state,guidetext,hide", "elm"); + if (!elm_entry_is_empty(st->pw_entry)) { + elm_entry_cursor_end_set(st->pw_entry); + elm_object_item_signal_emit(st->pw_item, + "elm,state,eraser,show", ""); + } __MOBILE_AP_FUNC_EXIT__; @@ -427,12 +444,8 @@ static void __pw_entry_unfocused_cb(void *data, Evas_Object *obj, mh_appdata_t *ad = (mh_appdata_t *)data; mh_wifi_setting_view_t *st = &ad->setup; - if (elm_entry_is_empty(st->pw_entry)) - elm_object_signal_emit(st->pw_layout, - "elm,state,guidetext,show", "elm"); - - elm_object_signal_emit(st->pw_layout, - "elm,state,eraser,hide", "elm"); + elm_object_item_signal_emit(st->pw_item, + "elm,state,eraser,hide", ""); __MOBILE_AP_FUNC_EXIT__; @@ -440,8 +453,7 @@ static void __pw_entry_unfocused_cb(void *data, Evas_Object *obj, } -static void __pw_layout_eraser_clicked_cb(void *data, Evas_Object *obj, - const char *emission, const char *source) +static void __pw_layout_eraser_clicked_cb(void *data, Evas_Object *obj, void *event_info) { __MOBILE_AP_FUNC_ENTER__; @@ -461,118 +473,131 @@ static void __pw_layout_eraser_clicked_cb(void *data, Evas_Object *obj, } -static Evas_Object *__gl_pw_icon_get(void *data, Evas_Object *obj, - const char *part) +static char *__gl_pw_text_get(void *data, Evas_Object *obj, const char *part) { __MOBILE_AP_FUNC_ENTER__; if (data == NULL || obj == NULL || part == NULL) { - ERR("Invalid param\n"); + ERR("Invalid parameter\n"); return NULL; } - if (strcmp(part, "elm.icon") != 0) { + if (g_strcmp0(part, "elm.text") != 0) { ERR("Invalid part : %s\n", part); return NULL; } - static Elm_Entry_Filter_Limit_Size limit_filter_data; - - mh_appdata_t *ad = (mh_appdata_t *)data; - mh_wifi_setting_view_t *st = &ad->setup; - Evas_Object *entry = NULL; - char *ptr = NULL; - Ecore_IMF_Context *imf_context; + __MOBILE_AP_FUNC_EXIT__; + return strdup(_("IDS_MOBILEAP_BODY_PASSWORD")); +} - st->pw_layout = elm_layout_add(obj); - if (st->pw_layout == NULL) { - ERR("elm_layout_add returns NULL\n"); - return NULL; - } - elm_layout_theme_set(st->pw_layout, "layout", "editfield", "title"); - evas_object_size_hint_weight_set(st->pw_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); +static Evas_Object *__gl_pw_icon_get(void *data, Evas_Object *obj, + const char *part) +{ + __MOBILE_AP_FUNC_ENTER__; - entry = elm_entry_add(st->pw_layout); - if (entry == NULL) { - ERR("elm_entry_add returns NULL\n"); - evas_object_del(st->pw_layout); - st->pw_layout = NULL; + if (data == NULL || obj == NULL || part == NULL) { + ERR("Invalid param\n"); return NULL; } - st->pw_entry = entry; - /* Set single line of entry */ - elm_entry_scrollable_set(entry, EINA_TRUE); - elm_entry_single_line_set(entry, EINA_TRUE); - elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_PASSWORD); + if (g_strcmp0(part, "elm.icon.entry") == 0) { + static Elm_Entry_Filter_Limit_Size limit_filter_data; - /* Set the maximum length filter for passphrase entry */ - limit_filter_data.max_char_count = 0; - limit_filter_data.max_byte_count = WIFI_PASSPHRASE_LENGTH_MAX; - elm_entry_markup_filter_append(entry, - elm_entry_filter_limit_size, &limit_filter_data); + mh_appdata_t *ad = (mh_appdata_t *)data; + mh_wifi_setting_view_t *st = &ad->setup; + Evas_Object *entry = NULL; + char *ptr = NULL; + Ecore_IMF_Context *imf_context; - DBG("security_type : %d\n", st->security_type); - if (st->security_type == TETHERING_WIFI_SECURITY_TYPE_NONE) { - ptr = elm_entry_utf8_to_markup(st->wifi_passphrase); - if (ptr != NULL) { - elm_entry_entry_set(entry, ptr); - free(ptr); - } else { - ERR("elm_entry_utf8_to_markup is failed\n"); + entry = elm_entry_add(obj); + if (entry == NULL) { + ERR("elm_entry_add returns NULL\n"); + st->pw_entry = NULL; + return NULL; } - /* Set editable mode */ - elm_entry_input_panel_enabled_set(entry, EINA_FALSE); + /* Set single line of entry */ + elm_entry_scrollable_set(entry, EINA_TRUE); + elm_entry_single_line_set(entry, EINA_TRUE); + elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_PASSWORD); + elm_entry_select_allow_set(entry, EINA_FALSE); elm_entry_context_menu_disabled_set(entry, EINA_TRUE); - elm_object_disabled_set(entry, EINA_TRUE); - } else { - ptr = elm_entry_utf8_to_markup(st->wifi_passphrase_new); - if (ptr != NULL) { - elm_entry_entry_set(entry, ptr); - free(ptr); + + /* Set the maximum length filter for passphrase entry */ + limit_filter_data.max_char_count = 0; + limit_filter_data.max_byte_count = WIFI_PASSPHRASE_LENGTH_MAX; + elm_entry_markup_filter_append(entry, + elm_entry_filter_limit_size, &limit_filter_data); + + DBG("security_type : %d\n", st->security_type); + if (st->security_type == TETHERING_WIFI_SECURITY_TYPE_NONE) { + ptr = elm_entry_utf8_to_markup(st->wifi_passphrase); + if (ptr != NULL) { + elm_entry_entry_set(entry, ptr); + free(ptr); + } else { + ERR("elm_entry_utf8_to_markup is failed\n"); + } + + /* Set editable mode */ + elm_entry_input_panel_enabled_set(entry, EINA_FALSE); + elm_object_disabled_set(entry, EINA_TRUE); } else { - ERR("elm_entry_utf8_to_markup is failed\n"); + ptr = elm_entry_utf8_to_markup(st->wifi_passphrase_new); + if (ptr != NULL) { + elm_entry_entry_set(entry, ptr); + free(ptr); + } else { + ERR("elm_entry_utf8_to_markup is failed\n"); + } } - } - - evas_object_smart_callback_add(entry, "maxlength,reached", - __passphrase_maxlength_reached_cb, data); - evas_object_smart_callback_add(entry, "activated", - __passphrase_activated_cb, data); - evas_object_smart_callback_add(entry, "changed", - __pw_entry_changed_cb, data); - evas_object_smart_callback_add(entry, "focused", - __pw_entry_focused_cb, data); - evas_object_smart_callback_add(entry, "unfocused", - __pw_entry_unfocused_cb, data); - imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(entry); - if (imf_context) - ecore_imf_context_input_panel_event_callback_add(imf_context, - ECORE_IMF_INPUT_PANEL_STATE_EVENT, - __input_panel_event_cb, (void *)st); - - if (!elm_entry_is_empty(entry)) { - elm_object_signal_emit(st->pw_layout, - "elm,state,guidetext,hide", "elm"); - } + evas_object_smart_callback_add(entry, "maxlength,reached", + __passphrase_maxlength_reached_cb, data); + evas_object_smart_callback_add(entry, "activated", + __passphrase_activated_cb, data); + evas_object_smart_callback_add(entry, "changed", + __pw_entry_changed_cb, data); + evas_object_smart_callback_add(entry, "focused", + __pw_entry_focused_cb, data); + evas_object_smart_callback_add(entry, "unfocused", + __pw_entry_unfocused_cb, data); + + imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(entry); + if (imf_context == NULL) { + ERR("elm_entry_imf_context_get() is failed\n"); + } else { + ecore_imf_context_input_panel_event_callback_add(imf_context, + ECORE_IMF_INPUT_PANEL_STATE_EVENT, + __input_panel_event_cb, (void *)ad); + } - elm_object_part_text_set(st->pw_layout, "elm.text", - _("IDS_MOBILEAP_BODY_PASSWORD")); - elm_object_part_content_set(st->pw_layout, "elm.swallow.content", entry); - elm_object_part_text_set(st->pw_layout, "elm.guidetext", - _("IDS_ST_BODY_ENTER_PASSWORD_OF_AT_LEAST_8_CHARACTERS")); + elm_object_item_signal_emit(st->pw_item, + "elm,state,rename,hide", ""); + if (!elm_entry_is_empty(entry)) { + elm_object_item_signal_emit(st->pw_item, + "elm,state,eraser,hide", ""); + } - elm_object_signal_callback_add(st->pw_layout, "elm,eraser,clicked", "elm", - __pw_layout_eraser_clicked_cb, data); + elm_object_part_text_set(entry, "elm.guide", + S_("IDS_COM_BODY_ENTER_PASSWORD")); - evas_object_show(entry); - evas_object_show(st->pw_layout); + evas_object_show(entry); + st->pw_entry = entry; - __MOBILE_AP_FUNC_EXIT__; + __MOBILE_AP_FUNC_EXIT__; + return st->pw_entry; + } else if (g_strcmp0(part, "elm.icon.eraser") == 0) { + Evas_Object *btn = elm_button_add(obj); + elm_object_style_set(btn, "editfield_clear"); + evas_object_smart_callback_add(btn, "clicked", __pw_layout_eraser_clicked_cb, data); + return btn; + } else { + DBG("Unknown part : %s\n", part); + } - return st->pw_layout; + return NULL; } static void __gl_hide_item_sel(void *data, Evas_Object *obj, void *event_info) @@ -655,8 +680,8 @@ static void __set_genlist_itc(mh_appdata_t *ad) ad->setup.security_itc->func.del = NULL; ad->setup.pw_itc = elm_genlist_item_class_new(); - ad->setup.pw_itc->item_style = "dialogue/1icon"; - ad->setup.pw_itc->func.text_get = NULL; + ad->setup.pw_itc->item_style = "dialogue/editfield/title"; + ad->setup.pw_itc->func.text_get = __gl_pw_text_get; ad->setup.pw_itc->func.content_get = __gl_pw_icon_get; ad->setup.pw_itc->func.state_get = NULL; ad->setup.pw_itc->func.del = NULL; @@ -712,7 +737,6 @@ static void __deconstruct_wifi_setup_view(mh_wifi_setting_view_t *st) st->hide_btn = NULL; st->security_btn = NULL; - st->pw_layout = NULL; st->pw_entry = NULL; st->back_btn = NULL; st->genlist = NULL; @@ -731,15 +755,27 @@ static void __back_btn_cb(void *data, Evas_Object *obj, void *event_info) mh_appdata_t *ad = (mh_appdata_t *)data; mh_wifi_setting_view_t *st = &ad->setup; + Eina_Bool imf_state; int ret; + char *ptr = NULL; + imf_state = ecore_imf_input_panel_hide(); elm_object_focus_set(st->pw_entry, EINA_FALSE); if (strlen(st->wifi_passphrase_new) < WIFI_PASSPHRASE_LENGTH_MIN) { DBG("Password is shorter than %d\n", WIFI_PASSPHRASE_LENGTH_MIN); - _prepare_popup(ad, MH_POP_WIFI_PASSWORD_SHORT, - _("IDS_ST_BODY_ENTER_PASSWORD_OF_AT_LEAST_8_CHARACTERS")); - _create_popup(ad); + ret = notification_status_message_post(_("IDS_ST_BODY_ENTER_PASSWORD_OF_AT_LEAST_8_CHARACTERS")); + if (ret != NOTIFICATION_ERROR_NONE) + ERR("notification_status_message_post() is failed : %d\n", ret); + + ptr = elm_entry_utf8_to_markup(st->wifi_passphrase); + if (ptr != NULL) { + elm_entry_entry_set(st->pw_entry, ptr); + free(ptr); + } else { + ERR("elm_entry_utf8_to_markup is failed\n"); + } + return; } @@ -749,6 +785,11 @@ static void __back_btn_cb(void *data, Evas_Object *obj, void *event_info) } } + if (imf_state == EINA_TRUE) { + DBG("IMF is hided\n"); + return; + } + if (ad->main.need_recover_wifi_tethering == true) { DBG("Turn on Wi-Fi tethering again\n"); _update_wifi_item(ad, MH_STATE_PROCESS); @@ -773,29 +814,6 @@ static void __back_btn_cb(void *data, Evas_Object *obj, void *event_info) __MOBILE_AP_FUNC_EXIT__; } -static void __title_back_btn_cb(void *data, Evas_Object *obj, void *event_info) -{ - __MOBILE_AP_FUNC_ENTER__; - - if (data == NULL || obj == NULL) { - ERR("Invalid param\n"); - return; - } - - mh_appdata_t *ad = (mh_appdata_t *)data; - - elm_object_focus_set(ad->setup.pw_entry, EINA_FALSE); - - if (__save_wifi_passphrase(ad) == EINA_FALSE) { - ERR("__save_wifi_passphrase is failed\n"); - return; - } - - __MOBILE_AP_FUNC_EXIT__; - - return; -} - static void __gl_realized(void *data, Evas_Object *obj, void *event_info) { __MOBILE_AP_FUNC_ENTER__; @@ -803,6 +821,10 @@ static void __gl_realized(void *data, Evas_Object *obj, void *event_info) mh_appdata_t *ad = (mh_appdata_t *)data; mh_wifi_setting_view_t *st = &(ad->setup); Elm_Object_Item *item = (Elm_Object_Item *)event_info; + Evas_Object *ao; + Evas_Object *btn; + char str[MH_LABEL_LENGTH_MAX] = {0, }; + int i = 0; if (item == st->hide_item) { DBG("Hide item is realized\n"); @@ -817,6 +839,19 @@ static void __gl_realized(void *data, Evas_Object *obj, void *event_info) DBG("Name item is realized\n"); } + for (i = 0; i < 2; i++) { + if (item == st->sp_item[i]) + elm_object_item_access_unregister(item); + } + + if (item == st->hide_item || item == st->security_item) { + ao = elm_object_item_access_object_get(item); + btn = elm_object_item_part_content_get(item, "on&off"); + snprintf(str, sizeof(str), "%s, %s", "On/off button", + (elm_check_state_get(btn) ? "On" : "Off")); + elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, str); + } + __MOBILE_AP_FUNC_EXIT__; return; @@ -835,6 +870,7 @@ Evas_Object *__create_genlist(mh_appdata_t *ad) mh_wifi_setting_view_t *st = &ad->setup; Evas_Object *genlist; Elm_Object_Item *item; + int i = 0; genlist = elm_genlist_add(ad->naviframe); if (genlist == NULL) { @@ -850,6 +886,7 @@ Evas_Object *__create_genlist(mh_appdata_t *ad) item = elm_genlist_item_append(genlist, st->sp_itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + st->sp_item[i++] = item; st->hide_item = elm_genlist_item_append(genlist, st->hide_itc, data, NULL, ELM_GENLIST_ITEM_NONE, __gl_hide_item_sel, data); @@ -859,7 +896,7 @@ Evas_Object *__create_genlist(mh_appdata_t *ad) st->pw_item = elm_genlist_item_append(genlist, st->pw_itc, data, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(st->pw_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + elm_genlist_item_select_mode_set(st->pw_item, ELM_OBJECT_SELECT_MODE_NONE); st->name_item = elm_genlist_item_append(genlist, st->name_itc, data, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); @@ -868,6 +905,7 @@ Evas_Object *__create_genlist(mh_appdata_t *ad) item = elm_genlist_item_append(genlist, st->end_sp_itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + st->sp_item[i++] = item; __MOBILE_AP_FUNC_EXIT__; @@ -875,6 +913,45 @@ Evas_Object *__create_genlist(mh_appdata_t *ad) return genlist; } +char *__slide_title_access_info_cb(void *data, Evas_Object *obj) +{ + Evas_Object *label; + Elm_Object_Item *navi_it; + Eina_Strbuf *buf; + const char *info; + char *ret; + + navi_it = (Elm_Object_Item *) data; + label = elm_object_item_part_content_get(navi_it, "elm.swallow.title"); + if (label == NULL) + return NULL; + + info = elm_object_text_get(label); + if (info == NULL) + return NULL; + + buf = eina_strbuf_new(); + eina_strbuf_append(buf, info); + + ret = eina_strbuf_string_steal(buf); + eina_strbuf_free(buf); + return ret; +} + +static void __title_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *label; + Elm_Object_Item *navi_it = event_info; + if (navi_it == NULL) + return; + + label = elm_object_item_part_content_get(navi_it, "elm.swallow.title"); + if (label == NULL) + return; + + elm_label_slide_go(label); +} + void mh_draw_wifi_setup_view(mh_appdata_t *ad) { __MOBILE_AP_FUNC_ENTER__; @@ -885,6 +962,9 @@ void mh_draw_wifi_setup_view(mh_appdata_t *ad) } mh_wifi_setting_view_t *st = &ad->setup; + Evas_Object *ao; + Evas_Object *label; + if (st->genlist != NULL) { ERR("Wi-Fi setup view already exists\n"); @@ -905,15 +985,27 @@ void mh_draw_wifi_setup_view(mh_appdata_t *ad) elm_object_style_set(st->back_btn, "naviframe/back_btn/default"); evas_object_smart_callback_add(st->back_btn, "clicked", __back_btn_cb, ad); + elm_object_focus_allow_set(st->back_btn, EINA_FALSE); st->navi_it = elm_naviframe_item_push(ad->naviframe, - _("IDS_MOBILEAP_MBODY_WI_FI_TETHERING_SETTINGS"), + NULL, st->back_btn, NULL, st->genlist, NULL); - st->title_back_btn = elm_button_add(ad->naviframe); - elm_object_style_set(st->title_back_btn, "naviframe/back_btn/default"); - evas_object_smart_callback_add(st->title_back_btn, "clicked", __title_back_btn_cb, ad); - elm_object_item_part_content_set(st->navi_it, "title_prev_btn", st->title_back_btn); + /* Slide title */ + label = _create_slide_title(ad->naviframe, _("IDS_MOBILEAP_MBODY_WI_FI_TETHERING_SETTINGS")); + elm_object_item_part_content_set(st->navi_it, "elm.swallow.title", label); + evas_object_smart_callback_add(ad->naviframe, "title,clicked", __title_clicked_cb, NULL); + + ao = elm_object_item_access_object_get(st->navi_it); + if (ao) { + elm_access_info_set(ao, ELM_ACCESS_TYPE, "title"); + elm_access_info_cb_set(ao, ELM_ACCESS_INFO, + __slide_title_access_info_cb, st->navi_it); + elm_object_focus_set(ao, EINA_TRUE); + } + + /* Realize genlist item forcely since UIFW doesn't make realize to avoid crash on landscape mode*/ + elm_genlist_item_update(st->pw_item); __MOBILE_AP_FUNC_EXIT__; -- 2.7.4