*/
#include <glib.h>
+#include <efl_extension.h>
#include "common.h"
#include "common_utils.h"
static Elm_Object_Item* _add_description(Evas_Object* genlist, char* title,
char* description, Elm_Object_Item* insert_after);
+static void _ip_info_entry_add_callbacks(Evas_Object *entry,
+ common_utils_entry_info_t *entry_info);
static Elm_Genlist_Item_Class *ip_toggle_itc;
static Elm_Genlist_Item_Class *description_itc;
curr_unfocuc_cursor_pos = 0;
}
+static void _popup_deleted_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ evas_object_del(obj);
+}
+
+static void _popup_cancel_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ common_utils_entry_info_t *entry_info = NULL;
+ Evas_Object *popup = NULL;
+
+ entry_info = (common_utils_entry_info_t *)data;
+ retm_if(NULL == entry_info);
+ retm_if(NULL == entry_info->popup);
+
+ popup = entry_info->popup;
+ entry_info->popup = NULL;
+ evas_object_del(popup);
+}
+
+static void _popup_ok_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *popup, *entry, *layout;
+ common_utils_entry_info_t *entry_info = NULL;
+
+ entry_info = (common_utils_entry_info_t *)data;
+ retm_if(NULL == entry_info);
+
+ retm_if(NULL == entry_info->popup);
+ popup = entry_info->popup;
+
+ layout = elm_object_content_get(popup);
+ retm_if(NULL == layout);
+
+ entry = elm_layout_content_get(layout, "elm.swallow.content");
+ retm_if(NULL == entry);
+
+ entry_info->entry_txt = elm_entry_markup_to_utf8(elm_entry_entry_get(entry));
+ if (entry_info->entry_txt == NULL) {
+ entry_info->popup = NULL;
+ evas_object_del(popup);
+ return;
+ }
+
+ if (entry_info->entry_txt && entry_info->entry_txt[0] == '\0') {
+ free(entry_info->entry_txt);
+ entry_info->entry_txt = NULL;
+ } else {
+ elm_genlist_item_update(entry_info->item);
+ }
+
+ entry_info->popup = NULL;
+ evas_object_del(popup);
+}
+
+static void _update_input_panel(Evas_Object *entry, entry_id_type_t id, imf_ctxt_panel_cb_t callback, void *data)
+{
+ Elm_Input_Panel_Layout panel_type;
+ Elm_Input_Panel_Return_Key_Type return_key_type;
+ char *accepted = NULL;
+ UG_TYPE ug_type = common_util_get_ug_type();
+
+ switch (id) {
+ case ENTRY_TYPE_PASSWORD:
+ case ENTRY_TYPE_IP_ADDR:
+ case ENTRY_TYPE_SUBNET_MASK:
+ case ENTRY_TYPE_GATEWAY:
+ case ENTRY_TYPE_DNS_1:
+ case ENTRY_TYPE_DNS_2:
+ panel_type = ELM_INPUT_PANEL_LAYOUT_IP;
+ return_key_type
+ = (ug_type == UG_VIEW_IOT_COMMON) ?
+ ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE : ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT;
+ accepted = "0123456789.";
+ break;
+ case ENTRY_TYPE_PROXY_ADDR:
+ panel_type = ELM_INPUT_PANEL_LAYOUT_URL;
+ return_key_type
+ = (ug_type == UG_VIEW_IOT_COMMON) ?
+ ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE : ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT;
+ break;
+ case ENTRY_TYPE_PROXY_PORT:
+ panel_type = ELM_INPUT_PANEL_LAYOUT_URL;
+ return_key_type = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE;
+ accepted = "0123456789";
+ break;
+ default:
+ return;
+ }
+
+ elm_entry_input_panel_layout_set(entry, panel_type);
+ elm_entry_input_panel_return_key_type_set(entry, return_key_type);
+
+ Elm_Entry_Filter_Accept_Set digits_filter_data;
+ memset(&digits_filter_data, 0, sizeof(Elm_Entry_Filter_Accept_Set));
+ digits_filter_data.accepted = accepted;
+ elm_entry_markup_filter_append(entry, elm_entry_filter_accept_set, &digits_filter_data);
+
+ if (callback) {
+ Ecore_IMF_Context *imf_ctxt = elm_entry_imf_context_get(entry);
+ if (imf_ctxt) {
+ ecore_imf_context_input_panel_event_callback_add(
+ imf_ctxt,
+ ECORE_IMF_INPUT_PANEL_STATE_EVENT,
+ callback, data);
+ }
+ }
+}
+
+static void _create_input_popup(common_utils_entry_info_t *entry_info)
+{
+ Evas_Object *popup, *btn;
+ Evas_Object *entry;
+ Evas_Object *layout;
+
+ retm_if(NULL == entry_info);
+ retm_if(NULL == entry_info->win);
+
+ popup = elm_popup_add(entry_info->win);
+ elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_domain_translatable_part_text_set(popup, "title,text",
+ PACKAGE, entry_info->title_txt);
+
+ evas_object_smart_callback_add(popup, "dismissed", _popup_deleted_cb, NULL);
+ evas_object_smart_callback_add(popup, "block,clicked", _popup_deleted_cb, NULL);
+
+ layout = elm_layout_add(popup);
+ elm_layout_file_set(layout, CUSTOM_POPUP_PATH, "custom_popup_input_text");
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_content_set(popup, layout);
+
+ entry = elm_entry_add(layout);
+ elm_entry_single_line_set(entry, EINA_TRUE);
+ elm_entry_scrollable_set(entry, EINA_TRUE);
+ evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ eext_entry_selection_back_event_allow_set(entry, EINA_TRUE);
+ elm_object_part_text_set(entry, "elm.guide", entry_info->guide_txt);
+ elm_object_part_content_set(layout, "elm.swallow.content", entry);
+
+ _update_input_panel(entry, entry_info->entry_id, NULL, NULL);
+ _ip_info_entry_add_callbacks(entry, entry_info);
+
+ btn = elm_button_add(popup);
+ elm_object_style_set(btn, "border");
+ elm_object_text_set(btn, sc(PACKAGE, I18N_TYPE_Cancel));
+ elm_object_part_content_set(popup, "button1", btn);
+ evas_object_smart_callback_add(btn, "clicked", _popup_cancel_btn_clicked_cb, entry_info);
+
+ btn = elm_button_add(popup);
+ elm_object_text_set(btn, sc(PACKAGE, I18N_TYPE_Ok));
+ elm_object_part_content_set(popup, "button2", btn);
+ evas_object_smart_callback_add(btn, "clicked", _popup_ok_btn_clicked_cb, entry_info);
+
+ entry_info->popup = popup;
+ evas_object_show(popup);
+}
+
static void _gl_editbox_sel_cb(void *data, Evas_Object *obj, void *event_info)
{
Elm_Object_Item *item = (Elm_Object_Item *)event_info;
elm_genlist_item_selected_set(item, FALSE);
+
+ if (data && common_util_get_ug_type() == UG_VIEW_IOT_COMMON)
+ _create_input_popup((common_utils_entry_info_t *)data);
}
static void _ip_info_detail_description_del(void *data, Evas_Object *obj)
Evas_Object *layout = NULL;
Evas_Object *label = NULL;
Evas_Object *editfield = NULL;
- char *guide_txt = NULL;
- char *accepted = NULL;
- Elm_Input_Panel_Layout panel_type;
UG_TYPE ug_type = common_util_get_ug_type();
- int return_key_type;
char buf[MAX_LABEL_LENGTH] = {0, };
int font_size = ug_type == UG_VIEW_IOT_COMMON ? 20 : 40;
- switch (entry_info->entry_id) {
- case ENTRY_TYPE_IP_ADDR:
- case ENTRY_TYPE_SUBNET_MASK:
- case ENTRY_TYPE_GATEWAY:
- case ENTRY_TYPE_DNS_1:
- case ENTRY_TYPE_DNS_2:
- guide_txt = entry_info->guide_txt;
- panel_type = ELM_INPUT_PANEL_LAYOUT_IP;
- return_key_type = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT;
- accepted = "0123456789.";
- break;
- case ENTRY_TYPE_PROXY_ADDR:
- guide_txt = DEFAULT_GUIDE_PROXY_IP;
- panel_type = ELM_INPUT_PANEL_LAYOUT_URL;
- return_key_type = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT;
- /* Temporary fix */
- /* accepted = "0123456789.abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ"; */
- break;
- case ENTRY_TYPE_PROXY_PORT:
- guide_txt = DEFAULT_GUIDE_PROXY_PORT;
- panel_type = ELM_INPUT_PANEL_LAYOUT_NUMBERONLY;
- return_key_type = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE;
- accepted = "0123456789";
- break;
- default:
- return NULL;
- }
-
layout = elm_layout_add(obj);
if (ug_type == UG_VIEW_IOT_COMMON)
elm_layout_file_set(layout, CUSTOM_GENLIST_PATH, "gl_custom_common_item");
elm_entry_cnp_mode_set(editfield, ELM_CNP_MODE_PLAINTEXT);
- elm_object_part_text_set(editfield, "elm.guide", guide_txt);
+ elm_object_part_text_set(editfield, "elm.guide", entry_info->guide_txt);
if (entry_info->entry_txt && (strlen(entry_info->entry_txt) > 0) &&
g_strcmp0(entry_info->entry_txt, DEFAULT_GUIDE_IP) != 0) {
elm_entry_entry_set(editfield, entry_info->entry_txt);
}
- elm_entry_input_panel_layout_set(editfield, panel_type);
-
- Elm_Entry_Filter_Accept_Set digits_filter_data;
- memset(&digits_filter_data, 0, sizeof(Elm_Entry_Filter_Accept_Set));
- digits_filter_data.accepted = accepted;
- elm_entry_markup_filter_append(editfield, elm_entry_filter_accept_set, &digits_filter_data);
-
- if (entry_info->input_panel_cb) {
- Ecore_IMF_Context *imf_ctxt = elm_entry_imf_context_get(editfield);
- if (imf_ctxt) {
- ecore_imf_context_input_panel_event_callback_add(
- imf_ctxt,
- ECORE_IMF_INPUT_PANEL_STATE_EVENT,
- entry_info->input_panel_cb,
- entry_info->input_panel_cb_data);
- }
- }
+ if (ug_type == UG_VIEW_IOT_COMMON)
+ elm_entry_editable_set(editfield, EINA_FALSE); // use input popup.
- elm_entry_input_panel_return_key_type_set(editfield, return_key_type);
+ _update_input_panel(editfield, entry_info->entry_id,
+ entry_info->input_panel_cb, entry_info->input_panel_cb_data);
_ip_info_entry_add_callbacks(editfield, entry_info);
elm_object_part_content_set(layout, "elm.swallow.content", editfield);
edit_box_details->str_pkg_name = ip_info_list_data->str_pkg_name;
edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb;
edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data;
+ edit_box_details->win = ip_info_list_data->win;
edit_box_details->item = elm_genlist_item_insert_after(
ip_info_list_data->genlist, ip_entry_itc,
edit_box_details, NULL, ip_info_list_data->ip_toggle_item,
- ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
+ ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, edit_box_details);
#ifdef ACCESSIBLITY_FEATURE
Evas_Object *ao = elm_object_item_access_object_get(edit_box_details->item);
elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details);
edit_box_details->str_pkg_name = ip_info_list_data->str_pkg_name;
edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb;
edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data;
+ edit_box_details->win = ip_info_list_data->win;
edit_box_details->item = elm_genlist_item_insert_after(
ip_info_list_data->genlist, ip_entry_itc,
edit_box_details, NULL, ip_info_list_data->ip_addr_item,
- ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
+ ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, edit_box_details);
#ifdef ACCESSIBLITY_FEATURE
ao = elm_object_item_access_object_get(edit_box_details->item);
elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details);
edit_box_details->str_pkg_name = ip_info_list_data->str_pkg_name;
edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb;
edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data;
+ edit_box_details->win = ip_info_list_data->win;
edit_box_details->item = elm_genlist_item_insert_after(
ip_info_list_data->genlist, ip_entry_itc,
edit_box_details, NULL, ip_info_list_data->subnet_mask_item,
- ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
+ ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, edit_box_details);
#ifdef ACCESSIBLITY_FEATURE
ao = elm_object_item_access_object_get(edit_box_details->item);
elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details);
edit_box_details->str_pkg_name = ip_info_list_data->str_pkg_name;
edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb;
edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data;
+ edit_box_details->win = ip_info_list_data->win;
edit_box_details->item = elm_genlist_item_insert_after(
ip_info_list_data->genlist, ip_entry_itc,
edit_box_details, NULL, ip_info_list_data->prefix_length_item,
- ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
+ ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, edit_box_details);
#ifdef ACCESSIBLITY_FEATURE
ao = elm_object_item_access_object_get(edit_box_details->item);
elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details);
edit_box_details->str_pkg_name = ip_info_list_data->str_pkg_name;
edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb;
edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data;
+ edit_box_details->win = ip_info_list_data->win;
edit_box_details->item = elm_genlist_item_insert_after(
ip_info_list_data->genlist, ip_entry_itc,
edit_box_details, NULL, ip_info_list_data->dns_1_item,
- ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
+ ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, edit_box_details);
#ifdef ACCESSIBLITY_FEATURE
ao = elm_object_item_access_object_get(edit_box_details->item);
elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details);
wifi_manager_ap_foreach_ipv6_address(ap, __ap_foreach_ipv6_callback, &ipv6_addr);
/* Dynamic IP Address */
-
if (g_strcmp0(ip_addr, IPV4_DEFAULT_ADDR) || (!g_strcmp0(ip_addr, IPV4_DEFAULT_ADDR) && !g_strcmp0(ipv6_addr, IPV6_DEFAULT_ADDR)))
ip_info_list_data->ipv4_addr_item = _add_description(
ip_info_list_data->genlist,
return toggle_btn;
}
-#if 0
-static void ip_info_print_values(wifi_manager_ap_h ap)
-{
- char *txt;
- wifi_manager_ip_config_type_e type = WIFI_MANAGER_IP_CONFIG_TYPE_NONE;
-
- wifi_manager_ap_get_ip_config_type(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &type);
- if (WIFI_MANAGER_IP_CONFIG_TYPE_STATIC == type) {
- DEBUG_LOG(UG_NAME_NORMAL, "* STATIC CONFIGURATION *");
-
- /* IP Address */
- wifi_manager_ap_get_ip_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
- SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* IP address [%s]", txt);
- g_free(txt);
-
- /* Subnet Mask */
- wifi_manager_ap_get_subnet_mask(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
- SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* Subnet Mask [%s]", txt);
- g_free(txt);
-
- /* Gateway Address */
- wifi_manager_ap_get_gateway_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
- SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* Gateway address [%s]", txt);
- g_free(txt);
-
- /* DNS 1 */
- wifi_manager_ap_get_dns_address(ap, 1, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
- SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* DNS-1 address [%s]", txt);
- g_free(txt);
-
- /* DNS 2 */
- wifi_manager_ap_get_dns_address(ap, 2, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
- SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* DNS-2 address [%s]", txt);
- g_free(txt);
-
- } else if (WIFI_MANAGER_IP_CONFIG_TYPE_DYNAMIC == type) {
- DEBUG_LOG(UG_NAME_NORMAL, "* DYNAMIC CONFIGURATION *");
-
- /* Dynamic IP Address */
- wifi_manager_ap_get_ip_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
- SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* IP address [%s]", txt);
- g_free(txt);
- }
-
- /* Mac address */
- wifi_get_mac_address(&txt);
- SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* MAC address [%s]", txt);
- g_free(txt);
- txt = NULL;
-
- wifi_manager_ap_get_proxy_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
- assertm_if(NULL == txt, "NULL!!");
-
- if (!txt || !strlen(txt)) {
- if (txt)
- g_free(txt);
- txt = g_strdup(DEFAULT_PROXY_ADDR);
- }
-
- /* Proxy Address */
- char *save_str = NULL;
- char *proxy_addr = strtok_r(txt, ":", &save_str);
- SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* PROXY ADDR [%s]", proxy_addr);
-
- /* Proxy port */
- char *proxy_port = strtok_r(NULL, ":", &save_str);
- SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* PROXY PORT [%s]", proxy_port);
- g_free(txt);
-}
-#endif
-
#define EMULATOR_MAC_ADDR_SIZE 6
#define EMULATOR_MAC_ADDR_MAX 20
static int ip_info_emulator_get_random_mac(unsigned char *buf)
}
full_ip_info_t *ip_info_append_items(wifi_manager_ap_h ap, const char *pkg_name,
- Evas_Object *genlist, imf_ctxt_panel_cb_t input_panel_cb, void *input_panel_cb_data)
+ Evas_Object *genlist, imf_ctxt_panel_cb_t input_panel_cb, void *input_panel_cb_data,
+ Evas_Object *win)
{
__COMMON_FUNC_ENTER__;
int ret = WIFI_MANAGER_ERROR_NONE;
ip_info_list_data->ap = ap;
ip_info_list_data->str_pkg_name = pkg_name;
+ ip_info_list_data->win = win;
ip_info_list_data->genlist = genlist;
ip_info_list_data->input_panel_cb = input_panel_cb;
ip_info_list_data->input_panel_cb_data = input_panel_cb_data;
edit_box_details->guide_txt = DEFAULT_GUIDE_PROXY_IP;
edit_box_details->input_panel_cb = input_panel_cb;
edit_box_details->input_panel_cb_data = input_panel_cb_data;
+ edit_box_details->win = win;
edit_box_details->item = elm_genlist_item_append(genlist, ip_entry_itc,
edit_box_details, NULL, ELM_GENLIST_ITEM_NONE,
- _gl_editbox_sel_cb, NULL);
+ _gl_editbox_sel_cb, edit_box_details);
#ifdef ACCESSIBLITY_FEATURE
Evas_Object *ao = elm_object_item_access_object_get(edit_box_details->item);
elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details);
edit_box_details->guide_txt = DEFAULT_GUIDE_PROXY_PORT;
edit_box_details->input_panel_cb = input_panel_cb;
edit_box_details->input_panel_cb_data = input_panel_cb_data;
+ edit_box_details->win = win;
edit_box_details->item = elm_genlist_item_append(genlist, ip_entry_itc,
edit_box_details, NULL, ELM_GENLIST_ITEM_NONE,
- _gl_editbox_sel_cb, NULL);
+ _gl_editbox_sel_cb, edit_box_details);
#ifdef ACCESSIBLITY_FEATURE
ao = elm_object_item_access_object_get(edit_box_details->item);
elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details);