From bd3989b30929241fc5ce3b3d6cc424ee929c3dfe Mon Sep 17 00:00:00 2001 From: Jiwan Kim Date: Mon, 24 Oct 2016 15:13:41 +0900 Subject: [PATCH] Fix ip address entry on new network menu - Fix TSAM-9202 - Fix TSAM-9201 Change-Id: I5c351bac61193c1b3ac46558905a155aa95d24e1 Signed-off-by: Jiwan Kim --- src/view/view_new_network.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/view/view_new_network.c b/src/view/view_new_network.c index 3394ef0..6de82c8 100644 --- a/src/view/view_new_network.c +++ b/src/view/view_new_network.c @@ -385,6 +385,9 @@ static void _focused_cb(void *data, Evas_Object *obj, void *ei) if (!priv) return; + if (priv->content_manual == NULL || priv->content_automatic == NULL) + return; + priv->focused_entry = obj; if (obj == priv->content_automatic->dns_ip1 || obj == priv->content_automatic->dns_ip2 @@ -447,6 +450,9 @@ static void _unfocused_cb(void *data, Evas_Object *obj, void *ei) if (!priv) return; + if (priv->content_manual == NULL || priv->content_automatic == NULL) + return; + if (obj == priv->content_automatic->dns_ip1 || obj == priv->content_automatic->dns_ip2 || obj == priv->content_automatic->dns_ip3 @@ -654,6 +660,7 @@ static void _markup_cb(void *data, Evas_Object *entry, char **text) { struct _priv *priv = data; const char *buf = NULL; + char *tmp = NULL; bool ignore = false; int val_priv = 0, val_input = 0; int candidate = 0; @@ -686,7 +693,12 @@ static void _markup_cb(void *data, Evas_Object *entry, char **text) //elm_object_focus_set(priv->btn_done, EINA_TRUE); /* Ignore input key event */ + free(*text); *text = NULL; + + tmp = elm_entry_markup_to_utf8(buf); + elm_entry_entry_set(entry, tmp); + free(tmp); return; } @@ -698,7 +710,12 @@ static void _markup_cb(void *data, Evas_Object *entry, char **text) if (0 > val_priv || 255 < val_priv || 0 > candidate || 255 < candidate) { /* Ignore input value */ + free(*text); *text = NULL; + + tmp = elm_entry_markup_to_utf8(buf); + elm_entry_entry_set(entry, tmp); + free(tmp); return; } @@ -727,7 +744,6 @@ static Evas_Object *_create_ip_address_entry(Evas_Object *parent, { Evas_Object *obj = NULL; Ecore_IMF_Context *ctx; - static Elm_Entry_Filter_Accept_Set limit_accept_set; obj = utils_add_entry(parent, part, NULL, EINA_FALSE); if (!obj) { @@ -737,9 +753,8 @@ static Evas_Object *_create_ip_address_entry(Evas_Object *parent, elm_object_style_set(obj, "input.field.ipaddr"); /* Set limitations */ - limit_accept_set.accepted = "0123456789."; - elm_entry_markup_filter_append(obj, elm_entry_filter_accept_set, &limit_accept_set); elm_entry_single_line_set(obj, EINA_TRUE); + elm_entry_input_panel_layout_set(obj, ELM_INPUT_PANEL_LAYOUT_NUMBERONLY); /* use this function to limit entry string */ elm_entry_markup_filter_append(obj, _markup_cb, user_data); @@ -1280,6 +1295,10 @@ static void _destroy(void *data) } priv = data; + /* Remove contents */ + _remove_content_manual(priv->content_manual, priv); + _remove_content_automatic(priv->content_automatic, priv); + /* Remove input callback */ if (priv->btn_automatic) { inputmgr_remove_callback(priv->btn_automatic, &_menu_btn_input_handler); -- 2.7.4