From 80634c3aab68866d30efdd92a13f7da775136ed5 Mon Sep 17 00:00:00 2001 From: Milind Murhekar Date: Thu, 1 Dec 2016 16:49:54 +0530 Subject: [PATCH] [TSAM-10381] Fixed input text limit on proxy address/port settings Description: This patch adds the maximum input characters limit on proxy address/port. Change-Id: I9ffe76a0ed83bdc252c0916a98ace3b8b4ded485 Signed-off-by: Milind Murhekar --- sources/wearable/src/wearable-circle/app_main.c | 33 ++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/sources/wearable/src/wearable-circle/app_main.c b/sources/wearable/src/wearable-circle/app_main.c index 34dd7bc..ad5650c 100755 --- a/sources/wearable/src/wearable-circle/app_main.c +++ b/sources/wearable/src/wearable-circle/app_main.c @@ -49,6 +49,8 @@ #define MAX_WEP_DIGIT_PASSWORD_LENGTH 26 #define MAX_POPUP_TEXT_LENGTH 1024 #define MAX_SUB_TEXT_LENGTH 100 +#define MAX_PROXY_ADDRESS_LENGTH 2000 +#define MAX_PROXY_PORT_LENGTH 5 typedef struct { // network module @@ -1238,7 +1240,6 @@ static void __wifi_manager_connected_cb(wifi_manager_object *manager, wifi_ap_object *ap, wifi_error_e error_code, gpointer user_data) { app_object *app_obj = user_data; - char buf[MAX_POPUP_TEXT_LENGTH] = ""; __WIFI_FUNC_ENTER__; WIFI_RET_IF_FAIL(app_obj != NULL); @@ -3213,6 +3214,26 @@ static gboolean __is_valid_proxy_setting_string_length(const gchar *text) return TRUE; } +static void __proxy_setting_address_maxlength_reached_cb(void *data, Evas_Object *obj, + void *event_info) +{ + app_object *app_obj = data; + __WIFI_FUNC_ENTER__; + WIFI_RET_IF_FAIL(app_obj != NULL); + + _toast_popup_show(app_obj, STR_MAXIMUM_NUMBER); +} + +static void __proxy_setting_port_maxlength_reached_cb(void *data, Evas_Object *obj, + void *event_info) +{ + app_object *app_obj = data; + __WIFI_FUNC_ENTER__; + WIFI_RET_IF_FAIL(app_obj != NULL); + + _toast_popup_show(app_obj, STR_MAXIMUM_NUMBER); +} + static void __proxy_setting_wearable_input_changed_cb(void *data, Evas_Object *obj, void *event_info) { @@ -3293,6 +3314,16 @@ static layout_wearable_input_object *_proxy_setting_wearable_input_create(app_ob layout_wearable_input_set_input_activated_cb(wearable_input, __proxy_setting_wearable_input_activated_cb, app_obj); + if (input_type == ELM_INPUT_PANEL_LAYOUT_NORMAL) + layout_wearable_input_set_input_maxlength_reached_cb(wearable_input, + MAX_PROXY_ADDRESS_LENGTH, + __proxy_setting_address_maxlength_reached_cb, app_obj); + + if (input_type == ELM_INPUT_PANEL_LAYOUT_NUMBERONLY) + layout_wearable_input_set_input_maxlength_reached_cb(wearable_input, + MAX_PROXY_PORT_LENGTH, + __proxy_setting_port_maxlength_reached_cb, app_obj); + if (!layout_wearable_input_create(wearable_input)) { WIFI_LOG_ERR("layout_wearable_input_create() is failed."); layout_wearable_input_free(wearable_input); -- 2.7.4