From: Abhishek Sansanwal Date: Fri, 5 May 2017 09:45:14 +0000 (+0530) Subject: Added fixes for NETWORK UI X-Git-Tag: submit/tizen/20170508.072313^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F88%2F128088%2F2;p=profile%2Ftv%2Fapps%2Fnative%2Fair_settings.git Added fixes for NETWORK UI Description: Fixed issues with retry button. Fixed loading icon on connected ap and many other small fixes. Change-Id: Ib98b78b6a0c80d54d1b23ab05fe3d3310d904a39 Signed-off-by: Abhishek Sansanwal Signed-off-by: Saurav Babu --- diff --git a/include/common/utils.h b/include/common/utils.h index 1c6d099..583ba9a 100644 --- a/include/common/utils.h +++ b/include/common/utils.h @@ -111,6 +111,8 @@ Evas_Object *utils_add_table(Evas_Object *parent, int padding_x, int padding_y); Evas_Object *utils_add_ctxpopup(Evas_Object *parent, int opt_size, int *opt_id, const char **opt_text, void *opt_handler, void *data, int selected); +Evas_Object *utils_add_configpopup(Evas_Object *parent, int opt_size, int *opt_id, + const char **opt_text, void *opt_handler, void *data, int selected); /** * @brief Creates elm_gengrid container. * diff --git a/include/data/system/data_wireless.h b/include/data/system/data_wireless.h index 4044ba8..4648a1e 100644 --- a/include/data/system/data_wireless.h +++ b/include/data/system/data_wireless.h @@ -40,5 +40,5 @@ struct wifi_manager_ap_info { * @return The pointer to data_class */ struct data_class *get_wireless_data_class(void); - +int wireless_get_connected_ap(wifi_manager_h wifi, char *essid); #endif /* __AIR_SETTINGS_DATA_WIRELESS_H__ */ diff --git a/include/data/system/settings_wireless.h b/include/data/system/settings_wireless.h index 1a9c6b2..5414ea7 100644 --- a/include/data/system/settings_wireless.h +++ b/include/data/system/settings_wireless.h @@ -27,6 +27,6 @@ * * @return True on success, false otherwise. */ -bool settings_wireless_passharase_required(wifi_manager_ap_h ap); +int settings_wireless_passharase_required(wifi_manager_ap_h ap, bool *r); #endif /* __AIR_SETTINGS_WIRELESS_H__ */ diff --git a/include/define.h b/include/define.h index 0ca77dc..ceda7aa 100644 --- a/include/define.h +++ b/include/define.h @@ -127,7 +127,7 @@ #define STYLE_CTXPOPUP "style.ctxpopup" #define STYLE_GRID_DEFAULT "style.grid.default" #define STYLE_DISABLE_BTN "style.disable.button" -#define STYLE_DATETIME "style.datetime" +#define STYLE_POPUP_BTN "style.popup.button" #define STYLE_POPUP "style.popup" #define STYLE_DATETIME "style.datetime" diff --git a/include/layout/layout_network.h b/include/layout/layout_network.h new file mode 100644 index 0000000..c612bcd --- /dev/null +++ b/include/layout/layout_network.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __AIR_SETTINGS_LAYOUT_LAYOUT_NETWORK_H__ +#define __AIR_SETTINGS_LAYOUT_LAYOUT_NETWORK_H__ +#include "common/layoutmgr.h" + +enum network_type { + TYPE_WIRELESS = 0, + TYPE_WIRED, + TYPE_NEW_NETWORK, +}; + +struct _priv { + Evas_Object *base; + Evas_Object *ly; + Evas_Object *table; + Evas_Object *network_type_btn; + Evas_Object *action_btn; + Evas_Object *network_type_popup; + Evas_Object *popup_btn1; + Evas_Object *popup_btn2; + Evas_Object *wired_layout; + + layoutmgr *lmgr; + struct listmgr *listmgr; + struct datamgr *wirelessmgr; + Elm_Object_Item *selected_wireless_item; + Elm_Object_Item *focused_wireless_item; + Elm_Object_Item *connecting_wireless_item; + Evas_Object *passcode_popup; + Evas_Object *passcode_entry; + enum network_type cur_type; + + bool wireless_support; + bool wireless_update_requested; + + struct _connection_data *wired; + struct menumgr *menu; +}; + + +void _retry_wireless_network(struct _priv *priv); +struct _priv* get_priv(); +void _destroy_wireless_status_popup(); +void _popup_failed_wireless_status(struct _priv *priv); +void _wireless_selected_cb(Elm_Object_Item *it, void *data); +void layoutmgr_add_grid_cb(struct listmgr *listmgr, const char *list_id, + void *data); +void _popup_connecting_wireless_status(struct _priv *priv); +void _wireless_data_found_done(Evas_Object *ly, Eina_List *list); +#endif /* __AIR_SETTINGS_LAYOUT_LAYOUT_NETWORK_H__ */ + diff --git a/include/layout/network.h b/include/layout/network.h index ba0e148..912a89f 100644 --- a/include/layout/network.h +++ b/include/layout/network.h @@ -28,7 +28,9 @@ #define GRP_CONTENT_NETWORK_POPUP_LIST "grp.content.network.popup.list" #define GRP_CONNECTING_IMAGE_NETWORK_POPUP "grp.connecting.image.network.popup" #define GRP_CONNECTED_IMAGE_NETWORK_POPUP "grp.connected.image.network.popup" +#define GRP_WIRELESS_CONNECTED_IMAGE_NETWORK_POPUP "grp.wireless.connected.image.network.popup" #define GRP_FAILED_IMAGE_NETWORK_POPUP "grp.failed.image.network.popup" +#define GRP_WIRELESS_FAILED_IMAGE_NETWORK_POPUP "grp.wireless.failed.image.network.popup" /* Style */ #define STYLE_GRID_WIRELESS "style.grid.wireless" @@ -72,6 +74,7 @@ #define STR_WIRED_COMPLETED "Wired network connection." #define STR_WIRELESS_COMPLETED "Wireless network connection." #define STR_WIRED_FAILED "Wired network connection failed.
Press retry button or plug a network cable into the back of your TV." +#define STR_WIRELESS_FAILED "Wireless network connection failed.
Press retry again." #define STR_OK "OK" #define STR_CANCEL "Cancel" #define STR_WIRELESS_WRONG_PWD "Wrong password" diff --git a/res/layout/network.edc b/res/layout/network.edc index 52f73e8..59bed13 100644 --- a/res/layout/network.edc +++ b/res/layout/network.edc @@ -1749,7 +1749,7 @@ group { min, 0 200; rel1 { to, "part.text.content"; - relative, 0.18 1.0; + relative, 0.17 1.0; } rel2 { to, "part.text.content"; @@ -1829,7 +1829,7 @@ group { scale, 1; description { state, "default" 0.0; - min, 325 0; + min, 335 0; rel1 { to, "part.close.btn"; relative, 1.0 0.0; @@ -1850,8 +1850,8 @@ group { scale, 1; description { state, "default" 0.0; - min, 225 40; - max, 225 40; + min, 245 40; + max, 245 40; rel1 { to, "padding.new.network.btn"; relative, 1.0 0.0; @@ -3492,4 +3492,829 @@ group { name: "grp.item.ip_address"; } } } +group { + name, GRP_WIRELESS_FAILED_IMAGE_NETWORK_POPUP; + images { + image, IC_SETTINGS_NETWORK_FAILED_PNG COMP; + image, IC_SETTINGS_NETWORK_DOT10_PNG COMP; + image, IC_SETTINGS_NETWORK_TV_PNG COMP; + image, IC_SETTINGS_NETWORK_WEB_PNG COMP; + } + + parts { + part { + name, "area"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + visible, 0; + } + } + + part { + name, "part.line"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 0 0 0 255; + min: 2 2; + max: -1 2; + rel1.to, "area"; + rel2 { + to, "area"; + relative, 1.0 0.0; + } + + } + } + + part { + name, "padding.text.content"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 0 15; + rel1.to, "area"; + rel2 { + to, "area"; + relative, 1.0 0.0; + } + align, 0.5 0.0; + fixed, 0 1; + } + } + + part { + name, "part.text.content"; + type, TEXT; + scale, 1; + description { + state, "default" 0.0; + min, 0 24; + rel1 { + to, "padding.text.content"; + relative, 0.0 1.0; + } + rel2.to, "padding.text.content"; + align, 0 0.0; + fixed, 0 1; + color, COLOR_TEXT_POPUP; + text { + text, "Wireless network connection failed."; + align, 0.5 0.0; + font, FONT_LIGHT; + size, 22; + } + } + } + + part { + name, "part.text.content1"; + type, TEXT; + scale, 1; + description { + state, "default" 0.0; + min, 0 24; + rel1 { + to, "part.text.content"; + relative, 0.0 1.0; + } + rel2.to, "part.text.content"; + align, 0 0.1; + fixed, 0 1; + color, COLOR_TEXT_POPUP; + text { + text, "Press retry again."; + align, 0.5 0.0; + font, FONT_LIGHT; + size, 22; + } + } + } + + part { + name, "padding.image.tv"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 0 94; + rel1 { + to, "part.text.content"; + relative, 0.35 1.0;//0.0 1.0; + } + rel2 { + to, "part.text.content"; + relative, 0.35 1.0; + } + align, 0.5 0.0; + fixed, 1 1; + } + } + + part { + name, "part.image.tv"; + type, IMAGE; + scale, 1; + description { + state, "default" 0.0; + min, 96 96; + max, 96 96; + rel1 { + to, "padding.image.tv"; + relative, 0.5 1.0; + } + rel2.to, "padding.image.tv"; + rel2.relative, 0.5 1.0; + fixed, 1 1; + visible, 1; + image.normal, IC_SETTINGS_NETWORK_TV_PNG; + } + } + + part { + name, "padding.dot1"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 32 0; + rel1 { + to, "part.image.tv"; + relative, 1.0 0.0; + } + rel2.to, "part.image.tv"; + align, 0.0 0.5; + fixed, 1 0; + } + } + + part { + name, "part.dot1"; + type, IMAGE; + scale, 1; + description { + state, "default" 0.0; + min, 6 6; + max, 6 6; + rel1 { + to, "padding.dot1"; + relative, 1.0 0.0; + } + rel2.to, "padding.dot1"; + fixed, 1 1; + visible, 1; + image.normal, IC_SETTINGS_NETWORK_DOT10_PNG; + } + } + + part { + name, "padding.dot2"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 12 0; + rel1 { + to, "part.dot1"; + relative, 1.0 0.0; + } + rel2.to, "part.dot1"; + align, 0.0 0.5; + fixed, 1 0; + } + } + + part { + name, "part.dot2"; + type, IMAGE; + scale, 1; + description { + state, "default" 0.0; + min, 6 6; + max, 6 6; + rel1 { + to, "padding.dot2"; + relative, 1.0 0.0; + } + rel2.to, "padding.dot2"; + fixed, 1 1; + visible, 1; + image.normal, IC_SETTINGS_NETWORK_DOT10_PNG; + } + } + + part { + name, "padding.image.completed"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 24 0; + rel1 { + to, "part.dot2"; + relative, 1.0 0.0; + } + rel2.to, "part.dot2"; + align, 0.0 0.5; + fixed, 1 0; + } + } + + part { + name, "part.image.completed"; + type, IMAGE; + scale, 1; + description { + state, "default" 0.0; + min, 50 50; + max, 50 50; + rel1 { + to, "padding.image.completed"; + relative, 1.0 0.0; + } + rel2.to, "padding.image.completed"; + fixed, 1 1; + visible, 1; + image.normal, IC_SETTINGS_NETWORK_FAILED_PNG; + } + } + + part { + name, "padding.dot5"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 58 0; + rel1 { + to, "part.dot2"; + relative, 1.0 0.0; + } + rel2.to, "part.dot2"; + align, 0.0 0.5; + fixed, 1 0; + } + } + + part { + name, "part.dot5"; + type, IMAGE; + scale, 1; + description { + state, "default" 0.0; + min, 6 6; + max, 6 6; + rel1 { + to, "padding.dot5"; + relative, 1.0 0.0; + } + rel2 { + to, "padding.dot5"; + relative, 1.0 0.0; + } + fixed, 1 1; + visible, 1; + image.normal, IC_SETTINGS_NETWORK_DOT10_PNG; + } + } + + part { + name, "padding.dot6"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 12 0; + rel1 { + to, "part.dot5"; + relative, 1.0 0.0; + } + rel2.to, "part.dot5"; + align, 0.0 0.5; + fixed, 1 0; + } + } + + part { + name, "part.dot6"; + type, IMAGE; + scale, 1; + description { + state, "default" 0.0; + min, 6 6; + max, 6 6; + rel1 { + to, "padding.dot6"; + relative, 1.0 0.0; + } + rel2.to, "padding.dot6"; + fixed, 1 1; + visible, 1; + image.normal, IC_SETTINGS_NETWORK_DOT10_PNG; + } + } + part { + name, "padding.image.web"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 60 0; + rel1 { + to, "part.dot6"; + relative, 1.0 0.0; + } + rel2.to, "part.dot6"; + align, 0.0 0.5; + fixed, 1 0; + } + } + + part { + name, "part.image.web"; + type, IMAGE; + scale, 1; + description { + state, "default" 0.0; + min, 96 96; + max, 96 96; + rel1 { + to, "padding.image.web"; + relative, 1.0 0.0; + } + rel2.to, "padding.image.web"; + fixed, 1 1; + visible, 1; + image.normal, IC_SETTINGS_NETWORK_WEB_PNG; + } + } + + part { + name, "padding.close.btn"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 0 50; + rel1 { + to, "part.image.tv"; + relative, 0.0 1.0; + } + rel2 { + to, "part.image.tv"; + relative, 0.0 1.0; + } + align, 0.0 0.0; + fixed, 1 1; + } + } + + part { + name, "part.close.btn"; + type, SWALLOW; + scale, 1; + description { + state, "default" 0.0; + min, 200 40; + max, 200 40; + rel1 { + to, "padding.close.btn"; + relative, 0.0 1.0; + } + rel2 { + to, "padding.close.btn"; + relative, 0.0 1.0; + } + align, 0.5 0.0; + visible, 1; + } + } + + part { + name, "padding.retry.btn"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 200 0; + rel1 { + to, "part.close.btn"; + relative, 1.0 0.0; + } + rel2 { + to, "part.close.btn"; + relative, 1.0 0.0; + } + align, 0.0 0.0; + fixed, 1 1; + } + } + + part { + name, "part.retry.btn"; + type, SWALLOW; + scale, 1; + description { + state, "default" 0.0; + min, 200 40; + max, 200 40; + rel1 { + to, "padding.retry.btn"; + relative, 1.0 0.0; + } + rel2 { + to, "padding.retry.btn"; + relative, 1.0 0.0; + } + align, 0.5 0.0; + visible, 1; + } + } + } +} + +group { + name, GRP_WIRELESS_CONNECTED_IMAGE_NETWORK_POPUP; + images { + image, IC_SETTINGS_NETWORK_COMPLETED_PNG COMP; + image, IC_SETTINGS_NETWORK_DOT10_PNG COMP; + image, IC_SETTINGS_NETWORK_TV_PNG COMP; + image, IC_SETTINGS_NETWORK_WEB_PNG COMP; + } + + parts { + part { + name, "area"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + visible, 0; + } + } + + part { + name, "part.line"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 0 0 0 255; + min: 2 2; + max: -1 2; + rel1.to, "area"; + rel2 { + to, "area"; + relative, 1.0 0.0; + } + + } + } + + part { + name, "padding.text.content"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 0 15; + rel1.to, "area"; + rel2 { + to, "area"; + relative, 1.0 0.0; + } + align, 0.5 0.0; + fixed, 0 1; + } + } + + part { + name, "part.text.content"; + type, TEXT; + scale, 1; + description { + state, "default" 0.0; + min, 0 24; + rel1 { + to, "padding.text.content"; + relative, 0.0 1.0; + } + rel2.to, "padding.text.content"; + align, 0 0.0; + fixed, 0 1; + color, COLOR_TEXT_POPUP; + text { + align, 0.5 0.0; + font, FONT_LIGHT; + size, 24; + } + } + } + + part { + name, "padding.image.tv"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 0 94; + rel1 { + to, "part.text.content"; + relative, 0.35 1.0;//0.0 1.0; + } + rel2 { + to, "part.text.content"; + relative, 0.35 1.0; + } + align, 0.5 0.0; + fixed, 1 1; + } + } + + part { + name, "part.image.tv"; + type, IMAGE; + scale, 1; + description { + state, "default" 0.0; + min, 96 96; + max, 96 96; + rel1 { + to, "padding.image.tv"; + relative, 0.5 1.0; + } + rel2.to, "padding.image.tv"; + rel2.relative, 0.5 1.0; + fixed, 1 1; + visible, 1; + image.normal, IC_SETTINGS_NETWORK_TV_PNG; + } + } + + part { + name, "padding.dot1"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 32 0; + rel1 { + to, "part.image.tv"; + relative, 1.0 0.0; + } + rel2.to, "part.image.tv"; + align, 0.0 0.5; + fixed, 1 0; + } + } + + part { + name, "part.dot1"; + type, IMAGE; + scale, 1; + description { + state, "default" 0.0; + min, 6 6; + max, 6 6; + rel1 { + to, "padding.dot1"; + relative, 1.0 0.0; + } + rel2.to, "padding.dot1"; + fixed, 1 1; + visible, 1; + image.normal, IC_SETTINGS_NETWORK_DOT10_PNG; + } + } + + part { + name, "padding.dot2"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 12 0; + rel1 { + to, "part.dot1"; + relative, 1.0 0.0; + } + rel2.to, "part.dot1"; + align, 0.0 0.5; + fixed, 1 0; + } + } + + part { + name, "part.dot2"; + type, IMAGE; + scale, 1; + description { + state, "default" 0.0; + min, 6 6; + max, 6 6; + rel1 { + to, "padding.dot2"; + relative, 1.0 0.0; + } + rel2.to, "padding.dot2"; + fixed, 1 1; + visible, 1; + image.normal, IC_SETTINGS_NETWORK_DOT10_PNG; + } + } + + part { + name, "padding.image.completed"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 24 0; + rel1 { + to, "part.dot2"; + relative, 1.0 0.0; + } + rel2.to, "part.dot2"; + align, 0.0 1.0; + fixed, 1 0; + } + } + + part { + name, "part.image.completed"; + type, IMAGE; + scale, 1; + description { + state, "default" 0.0; + min, 58 58; + max, 58 58; + rel1 { + to, "padding.image.completed"; + relative, 1.0 0.0; + } + rel2.to, "padding.image.completed"; + rel2.relative, 1.0 0.0; + align: 0.5 1.0; + fixed, 1 1; + visible, 1; + image.normal, IC_SETTINGS_NETWORK_COMPLETED_PNG; + } + } + + part { + name, "padding.dot5"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 58 0; + rel1 { + to, "part.dot2"; + relative, 1.0 0.0; + } + rel2.to, "part.dot2"; + align, 0.0 0.5; + fixed, 1 0; + } + } + + + part { + name, "part.dot5"; + type, IMAGE; + scale, 1; + description { + state, "default" 0.0; + min, 6 6; + max, 6 6; + rel1 { + to, "padding.dot5"; + relative, 1.0 0.0; + } + rel2 { + to, "padding.dot5"; + relative, 1.0 0.0; + } + fixed, 1 1; + visible, 1; + image.normal, IC_SETTINGS_NETWORK_DOT10_PNG; + } + } + + part { + name, "padding.dot6"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 12 0; + rel1 { + to, "part.dot5"; + relative, 1.0 0.0; + } + rel2.to, "part.dot5"; + align, 0.0 0.5; + fixed, 1 0; + } + } + + part { + name, "part.dot6"; + type, IMAGE; + scale, 1; + description { + state, "default" 0.0; + min, 6 6; + max, 6 6; + rel1 { + to, "padding.dot6"; + relative, 1.0 0.0; + } + rel2.to, "padding.dot6"; + fixed, 1 1; + visible, 1; + image.normal, IC_SETTINGS_NETWORK_DOT10_PNG; + } + } + part { + name, "padding.image.web"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 60 0; + rel1 { + to, "part.dot6"; + relative, 1.0 0.0; + } + rel2.to, "part.dot6"; + align, 0.0 0.5; + fixed, 1 0; + } + } + + part { + name, "part.image.web"; + type, IMAGE; + scale, 1; + description { + state, "default" 0.0; + min, 96 96; + max, 96 96; + rel1 { + to, "padding.image.web"; + relative, 1.0 0.0; + } + rel2.to, "padding.image.web"; + fixed, 1 1; + visible, 1; + image.normal, IC_SETTINGS_NETWORK_WEB_PNG; + } + } + part { + name, "padding.done.btn"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 0 200; + rel1 { + to, "part.text.content"; + relative, 0.5 1.0; + } + rel2 { + to, "part.text.content"; + relative, 0.5 1.0; + } + align, 0.5 0.0; + fixed, 1 1; + } + } + + part { + name, "part.done.btn"; + type, SWALLOW; + scale, 1; + description { + state, "default" 0.0; + min, 200 40; + max, 200 40; + rel1 { + to, "padding.done.btn"; + relative, 0.0 1.0; + } + rel2 { + to, "padding.done.btn"; + relative, 0.0 1.0; + } + align, 0.5 0.0; + visible, 1; + } + } + } +} diff --git a/res/widget/button.edc b/res/widget/button.edc index 832d3f8..f31036c 100644 --- a/res/widget/button.edc +++ b/res/widget/button.edc @@ -1513,3 +1513,96 @@ group { } } } +group { + name, "elm/button/base/style.popup.button"; + inherit, "elm/button/base/style.base.button"; + parts { + part { + name, "elm.text"; + type, TEXT; + scale: 0; + description { + state, "default" 0.0; + color, 87 87 87 255; + text { + font, FONT_LIGHT; + size, 28; + align, 0.5 0.5; + } + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + color, 255 255 255 255; + } + description { + state, "selected" 0.0; + inherit, "default" 0.0; + color, 64 136 211 255; + } + } + + part { + name, "part.inside.line.up"; + description { + state, "disabled" 0.0; + inherit, "default" 0.0; + color, 87 87 87 127; + } + } + + part { + name, "part.inside.line.down"; + description { + state, "disabled" 0.0; + inherit, "default" 0.0; + color, 87 87 87 127; + } + } + + part { + name, "part.inside.line.left"; + description { + state, "disabled" 0.0; + inherit, "default" 0.0; + color, 87 87 87 127; + } + } + + part { + name, "part.inside.line.right"; + description { + state, "disabled" 0.0; + inherit, "default" 0.0; + color, 87 87 87 127; + } + } + } + + programs { + program { + name, SIG_DISABLED; + signal, SIG_DISABLED; + source, SRC_ELM; + action, STATE_SET "disabled" 0.0; + target, "part.bg"; + target, "part.inside.line.up"; + target, "part.inside.line.down"; + target, "part.inside.line.left"; + target, "part.inside.line.right"; + target, "elm.text"; + } + program { + name, SIG_ENABLED; + signal, SIG_ENABLED; + source, SRC_ELM; + action, STATE_SET "default" 0.0; + target, "part.bg"; + target, "part.inside.line.up"; + target, "part.inside.line.down"; + target, "part.inside.line.left"; + target, "part.inside.line.right"; + target, "elm.text"; + } + } +} diff --git a/src/common/utils.c b/src/common/utils.c index 09751cc..7d29406 100755 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -298,6 +298,64 @@ Evas_Object *utils_add_gengrid(Evas_Object *parent, Eina_Bool horizontal, return grid; } +Evas_Object *utils_add_configpopup(Evas_Object *parent, int opt_size, int *opt_id, + const char **opt_text, void *opt_handler, void *data, int selected) +{ + Evas_Object *ctx_popup, *box, *btn, *first_btn; + int i; + + if (!parent || opt_size <= 0 || !opt_text) { + _ERR("Invalid argument."); + return NULL; + } + + ctx_popup = elm_ctxpopup_add(parent); + if (!ctx_popup) { + _ERR("elm_ctxpopup_add failed."); + return NULL; + } + + box = utils_add_box(ctx_popup, NULL, EINA_FALSE, 0, 0); + if (!box) { + _ERR("Add box failed."); + evas_object_del(ctx_popup); + return NULL; + } + + elm_object_style_set(ctx_popup, STYLE_CTXPOPUP); + elm_object_content_set(ctx_popup, box); + elm_ctxpopup_direction_priority_set(ctx_popup, 0, 0, 0, 0); + evas_object_show(ctx_popup); + + for (i = 0; i < opt_size; i++) { + btn = utils_add_button(box, NULL, STYLE_OPTION_LIST_BTN, + opt_text[i]); + if (!btn) { + _ERR("Add button failed."); + evas_object_del(ctx_popup); + return NULL; + } + evas_object_size_hint_min_set(btn, ELM_SCALE_SIZE(200), ELM_SCALE_SIZE(30)); + evas_object_size_hint_max_set(btn, ELM_SCALE_SIZE(200), ELM_SCALE_SIZE(30)); + elm_box_pack_end(box, btn); + + if (opt_handler) + inputmgr_add_callback(btn, opt_id[i], + opt_handler, data); + + if (i == 0) + first_btn = btn; + + if (i == selected) + elm_object_focus_set(btn, EINA_TRUE); + } + + elm_object_focus_next_object_set(first_btn, btn, ELM_FOCUS_UP); + elm_object_focus_next_object_set(btn, first_btn, ELM_FOCUS_DOWN); + + return ctx_popup; +} + Evas_Object *utils_add_entry(Evas_Object *parent, const char *part, const char *text_style, Eina_Bool is_password) diff --git a/src/data/system/data_wireless.c b/src/data/system/data_wireless.c index fdc9de5..23a58ae 100644 --- a/src/data/system/data_wireless.c +++ b/src/data/system/data_wireless.c @@ -442,11 +442,11 @@ static void _wifi_manager_connected_cb(wifi_manager_error_e err, void *data) _ERR("Connect ap failed. err [%s]", wifi_manager_error_to_string(err)); if (err == WIFI_MANAGER_ERROR_INVALID_KEY) { _DBG("Invalid password"); + if (priv->event_cb) priv->event_cb(EVENT_DATA_INVALID_PWD_WIRELESS, priv->cb_data); } else { - if (priv->event_cb) - priv->event_cb(EVENT_DATA_SELECT_FAIL, priv->cb_data); + _DBG("Fail"); } return; @@ -465,7 +465,6 @@ static void _wifi_manager_connect_new_ap(struct _priv *priv) ap_info = elm_object_item_data_get(priv->new_ap); if (!ap_info || !ap_info->ap) return; - if (priv->new_passcode) { if (!_wifi_set_passcode(ap_info->ap, priv->new_passcode)) { _ERR("Set passcode failed."); @@ -474,8 +473,12 @@ static void _wifi_manager_connect_new_ap(struct _priv *priv) } r = wifi_manager_connect(priv->wifi, ap_info->ap, _wifi_manager_connected_cb, priv); - if (r != WIFI_MANAGER_ERROR_NONE) + if (r != WIFI_MANAGER_ERROR_NONE) { _ERR("Wifi connect failed. [%s]", wifi_manager_error_to_string(r)); + if (priv->event_cb) + priv->event_cb(EVENT_DATA_SELECT_FAIL, priv->cb_data); + + } } static void _wifi_prev_ap_disconnected(wifi_manager_error_e err, void *data) @@ -497,7 +500,6 @@ static bool _select(void *dclass_data, Elm_Object_Item *it, void *data) struct _priv *priv; wifi_manager_ap_h prev_ap; int r; - if (!dclass_data || !it) { _ERR("Invalid argument."); return false; @@ -561,3 +563,4 @@ struct data_class *get_wireless_data_class(void) { return &_dclass; } + diff --git a/src/data/system/settings_wireless.c b/src/data/system/settings_wireless.c index 8aed3d0..c80eae9 100644 --- a/src/data/system/settings_wireless.c +++ b/src/data/system/settings_wireless.c @@ -17,18 +17,22 @@ #include "data/system/settings_wireless.h" #include "app_debug.h" -bool settings_wireless_passharase_required(wifi_manager_ap_h ap) +int settings_wireless_passharase_required(wifi_manager_ap_h ap, bool *r) { bool res = false; - int r; + int ret; if (!ap) - return false; + return -1; wifi_manager_ap_refresh(ap); - r = wifi_manager_ap_is_passphrase_required(ap, &res); - if (WIFI_MANAGER_ERROR_NONE != r) - _ERR("Failed to get result [%X]", r); + ret = wifi_manager_ap_is_passphrase_required(ap, &res); + if (WIFI_MANAGER_ERROR_NONE != ret) { + res = false; + _ERR("Failed to get result [%X]", ret); + return -1; + } - return res; + *r = res; + return 0; } diff --git a/src/layout/layout_network.c b/src/layout/layout_network.c index ad658e3..58027b5 100644 --- a/src/layout/layout_network.c +++ b/src/layout/layout_network.c @@ -31,6 +31,7 @@ #include "grid/grid_wireless.h" #include "layout.h" #include "layout/network.h" +#include "layout/layout_network.h" #include "view_new_network.h" #include "view/view_base.h" //#include "view/network/view_wired.h" @@ -50,11 +51,6 @@ enum object_type { EO_ENTRY_PASSCODE, }; -enum network_type { - TYPE_WIRELESS = 0, - TYPE_WIRED, - TYPE_NEW_NETWORK, -}; static int id_network_type_opt[] = { TYPE_WIRELESS, @@ -68,38 +64,8 @@ const char *str_network_type_opt[] = { STR_NEW_NETWORK, }; -struct _priv { - Evas_Object *base; - Evas_Object *ly; - Evas_Object *table; - Evas_Object *network_type_btn; - Evas_Object *action_btn; - Evas_Object *network_type_popup; - Evas_Object *popup_btn1; - Evas_Object *popup_btn2; - Evas_Object *wired_layout; - - layoutmgr *lmgr; - struct listmgr *listmgr; - struct datamgr *wirelessmgr; - Elm_Object_Item *selected_wireless_item; - Elm_Object_Item *focused_wireless_item; - Elm_Object_Item *connecting_wireless_item; - Evas_Object *passcode_popup; - Evas_Object *passcode_entry; - enum network_type cur_type; - - bool wireless_support; - bool wireless_update_requested; - - struct _connection_data *wired; - struct menumgr *menu; -}; - static void _remove_wifi_passcode_popup(struct _priv *priv); static void _retry_wired_network(struct _priv *priv); -void _retry_wireless_network(struct _priv *priv); -static void _wireless_selected_cb(Elm_Object_Item *it, void *data); static bool _draw_wifi_passcode_popup(struct _priv *priv, char *wifi_name, bool isReconnect); static void _focused1(void *data, int id); @@ -119,7 +85,7 @@ static struct menumgr_info menu_info[] = { .title = STR_WIRELESS, .style = STYLE_NORMAL_BTN, .disabled = EINA_FALSE, - //.status = _get_contrast, + //.status = _get_connected_ap, .status = NULL, .progress_value = NULL, .progress_evas = NULL, @@ -147,6 +113,33 @@ static struct menumgr_info menu_info[] = { .update_cb = NULL } }; + + +static void _destroy_status_popup() +{ + evas_object_hide(connected_wireless_popup); + evas_object_hide(connecting_wireless_popup); + evas_object_hide(failed_wireless_popup); + + evas_object_del(connected_wireless_popup); + connected_wireless_popup = NULL; + + evas_object_del(connecting_wireless_popup); + connecting_wireless_popup = NULL; + + evas_object_del(failed_wireless_popup); + failed_wireless_popup = NULL; + + return; +} + + +static void _stop_dismissed_cb(void *data, Evas_Object *obj, void *ei) +{ + _destroy_status_popup(); + return; +} + static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev) { @@ -435,12 +428,25 @@ static void _wired_retry_cb(void *data, Evas_Object *obj, void *ei) static void _wireless_retry_cb(void *data, Evas_Object *obj, void *ei) { struct _priv *priv;; + priv = data; +struct wifi_manager_ap_info *ap_info; + char *essid; + priv = get_priv(); if (!priv) return; + ap_info = elm_object_item_data_get(priv->connecting_wireless_item); + essid = ap_info->essid; _destroy_wireless_status_popup(); - _retry_wireless_network(priv); + if (!_draw_wifi_passcode_popup(priv, essid,true)) { + _ERR("Draw passcode popup failed."); + return; + } +// _wireless_selected_cb(priv->connecting_wireless_item, data); + + +// _retry_wireless_network(priv); } static void _new_network_cb(void *data, Evas_Object *obj, void *ei) @@ -525,6 +531,34 @@ void _popup_connecting_wired_status(struct _priv *priv) evas_object_show(connecting_wired_popup); } +void _popup_connecting_wireless_status(struct _priv *priv) +{ + Evas_Object *ly, *stop_btn; + connecting_wireless_popup = utils_add_popup(priv->base, STYLE_POPUP, "Wireless", NULL); + if (!connecting_wireless_popup) { + _ERR("Add popup failed"); + return; + } + ly = utils_add_layout(connecting_wireless_popup, GRP_CONNECTING_IMAGE_NETWORK_POPUP, EINA_FALSE); + if (!ly) { + _ERR("Add layout failed."); + evas_object_del(connecting_wireless_popup); + return; + } + elm_object_part_text_set(ly, "part.text.content", STR_WIRELESS_PROGRESS); + + + stop_btn = utils_add_button(ly, "part.stop.btn", STYLE_DISABLE_BTN, "STOP"); + if (!stop_btn) { + _ERR("Add button failed."); + evas_object_del(connecting_wireless_popup); + return; + } + evas_object_smart_callback_add(stop_btn, "clicked", _stop_dismissed_cb, connecting_wireless_popup); + + elm_object_content_set(connecting_wireless_popup, ly); + evas_object_show(connecting_wireless_popup); +} void _popup_connected_wireless_status(struct _priv *priv) { @@ -534,7 +568,7 @@ void _popup_connected_wireless_status(struct _priv *priv) _ERR("Add popup failed"); return; } - ly = utils_add_layout(connected_wireless_popup, GRP_CONNECTED_IMAGE_NETWORK_POPUP, EINA_FALSE); + ly = utils_add_layout(connected_wireless_popup, GRP_WIRELESS_CONNECTED_IMAGE_NETWORK_POPUP, EINA_FALSE); if (!ly) { _ERR("Add layout failed."); evas_object_del(connected_wireless_popup); @@ -571,13 +605,13 @@ void _popup_failed_wireless_status(struct _priv *priv) _ERR("Add popup failed"); return; } - ly = utils_add_layout(failed_wireless_popup, GRP_FAILED_IMAGE_NETWORK_POPUP, EINA_FALSE); + ly = utils_add_layout(failed_wireless_popup, GRP_WIRELESS_FAILED_IMAGE_NETWORK_POPUP, EINA_FALSE); if (!ly) { _ERR("Add layout failed."); evas_object_del(failed_wireless_popup); return; } - //elm_object_part_text_set(ly, "part.text.content", STR_WIRED_FAILED); +// elm_object_part_text_set(ly, "part.text.content", STR_WIRELESS_FAILED); close_btn = utils_add_button(ly, "part.close.btn", STYLE_DISABLE_BTN, "CLOSE"); if (!close_btn) { @@ -593,7 +627,7 @@ void _popup_failed_wireless_status(struct _priv *priv) evas_object_del(failed_wireless_popup); return; } - evas_object_smart_callback_add(retry_btn, "clicked", _wireless_retry_cb, failed_wireless_popup); + evas_object_smart_callback_add(retry_btn, "clicked", _wireless_retry_cb, priv); /* new_network_btn = utils_add_button(ly, "part.new.network.btn", STYLE_DISABLE_BTN, "NEW NETWORK"); if (!new_network_btn) { @@ -624,9 +658,8 @@ void _popup_failed_wired_status(struct _priv *priv) evas_object_del(failed_wired_popup); return; } - //elm_object_part_text_set(ly, "part.text.content", STR_WIRED_FAILED); - close_btn = utils_add_button(ly, "part.close.btn", STYLE_DISABLE_BTN, "CLOSE"); + close_btn = utils_add_button(ly, "part.close.btn", STYLE_POPUP_BTN, "CLOSE"); if (!close_btn) { _ERR("Add button failed."); evas_object_del(failed_wired_popup); @@ -634,7 +667,7 @@ void _popup_failed_wired_status(struct _priv *priv) } evas_object_smart_callback_add(close_btn, "clicked", _close_wired_dismissed_cb, failed_wired_popup); - retry_btn = utils_add_button(ly, "part.retry.btn", STYLE_DISABLE_BTN, "RETRY"); + retry_btn = utils_add_button(ly, "part.retry.btn", STYLE_POPUP_BTN, "RETRY"); if (!retry_btn) { _ERR("Add button failed."); evas_object_del(failed_wired_popup); @@ -642,7 +675,7 @@ void _popup_failed_wired_status(struct _priv *priv) } evas_object_smart_callback_add(retry_btn, "clicked", _wired_retry_cb, failed_wired_popup); - new_network_btn = utils_add_button(ly, "part.new.network.btn", STYLE_DISABLE_BTN, "NEW NETWORK"); + new_network_btn = utils_add_button(ly, "part.new.network.btn", STYLE_POPUP_BTN, "NEW NETWORK"); if (!new_network_btn) { _ERR("Add button failed."); evas_object_del(failed_wired_popup); @@ -850,7 +883,7 @@ static void _grid_remove_connecting_state(Elm_Object_Item *it, void *data) return; } - if (it != priv->connecting_wireless_item) +// if (it != priv->connecting_wireless_item) elm_object_item_signal_emit(it, SIG_LOADING_STOP, SRC_ELM); } @@ -873,6 +906,64 @@ static void _grid_focused_cb(int id, void *data, Evas_Object *obj, Elm_Object_It viewmgr_update_view(VIEW_WIRELESS_LIST, GRID_FOREACH, _grid_set_unfocus); } +void _wireless_selected_cb(Elm_Object_Item *it, void *data) +{ + struct _priv *priv; + struct wifi_manager_ap_info *ap_info; + char *wifi_name; + bool required = false; +// int ret; + + if (!it || !data) { + _ERR("Invalid argument."); + return; + } + + priv = data; + + ap_info = elm_object_item_data_get(it); + if (!ap_info) { + _ERR("Get data failed."); + return; + } + + if (ap_info->connection_state == WIFI_MANAGER_CONNECTION_STATE_CONNECTED) { + _ERR("Already connected AP."); + return; + } + + settings_wireless_passharase_required(ap_info->ap, &required); + _DBG("[%s] required : %s", ap_info->essid, (required) ? "True" : "False"); + if (required) { + wifi_name = ap_info->essid; + if (!wifi_name) + return; + + if (!_draw_wifi_passcode_popup(priv, wifi_name, false)) { + _ERR("Draw passcode popup failed."); + return; + } + + } else { + _popup_connecting_wireless_status(priv); + if (!datamgr_select(priv->wirelessmgr, it, NULL)) { + _ERR("Unavailable status for selecting wifi."); + return; + } + + priv->connecting_wireless_item = priv->selected_wireless_item; + + elm_object_item_signal_emit(priv->connecting_wireless_item, + SIG_LOADING_START, SRC_ELM); + + /* Remove connection state from other items */ + /*listmgr_foreach_list(priv->listmgr, LIST_WIRELESS, + _grid_remove_connecting_state, priv);*/ + viewmgr_update_view(VIEW_WIRELESS_LIST, GRID_FOREACH, + _grid_remove_connecting_state); + } +} + static void _grid_selected_cb(int id, void *data, Evas_Object *obj, Elm_Object_Item *item) @@ -882,7 +973,6 @@ static void _grid_selected_cb(int id, void *data, Evas_Object *obj, _ERR("User data not found"); return; } - priv->selected_wireless_item = item; _wireless_selected_cb(priv->selected_wireless_item, data); } @@ -916,6 +1006,14 @@ static input_handler _grid_input_handler = { .selected = _grid_selected_cb }; +void layoutmgr_add_grid_cb(struct listmgr *listmgr, const char *list_id, + void *data) +{ + listmgr_add_inner_grid_cb(listmgr, list_id, + &_grid_input_handler, data); + +} + static void _draw_no_contents_message(struct _priv *priv) { elm_object_signal_emit(priv->ly, SIG_NO_WIRELESS, SRC_ELM); @@ -926,7 +1024,7 @@ static void _draw_no_contents_message(struct _priv *priv) viewmgr_update_view(VIEW_WIRELESS_LIST, GRID_UPDATE, NULL); } -static void _wireless_data_found_done(struct _priv *priv, Eina_List *list) +void _wireless_data_found_done(Evas_Object *ly, Eina_List *list) { viewmgr_update_view(VIEW_WIRELESS_LIST, GRID_FILL, list); viewmgr_update_view(VIEW_WIRELESS_LIST, GRID_SHOW, NULL); @@ -937,9 +1035,9 @@ static void _wireless_data_found_done(struct _priv *priv, Eina_List *list) return; } */ - elm_object_signal_emit(priv->ly, SIG_WIRELESS_EXISTS, SRC_ELM); - elm_object_signal_emit(priv->ly, SIG_LOADING_STOP, SRC_ELM); - elm_object_part_text_set(priv->ly, PART_NO_NETWORK_TEXT, ""); + elm_object_signal_emit(ly, SIG_WIRELESS_EXISTS, SRC_ELM); + elm_object_signal_emit(ly, SIG_LOADING_STOP, SRC_ELM); + elm_object_part_text_set(ly, PART_NO_NETWORK_TEXT, ""); } #if 0 static void _profile_changed_cb(connection_profile_state_e state, void* user_data) @@ -1037,15 +1135,14 @@ static void _data_event_cb(enum event_type type, void *data) case EVENT_DATA_UPDATE_DONE: priv->wireless_update_requested = false; - + /* Do not update if network menu is not wireless */ + if (priv->cur_type != TYPE_WIRELESS) + return; //viewmgr_pop_all_views(); - viewmgr_add_view(view_wireless_list_get_vclass(), priv->wirelessmgr); + viewmgr_add_view(view_wireless_list_get_vclass(), priv); _DBG("Wireless is not activated"); if (!viewmgr_show_view(VIEW_WIRELESS_LIST)) _ERR("Push wireless view failed."); - /* Do not update if network menu is not wireless */ - if (priv->cur_type != TYPE_WIRELESS) - return; list = datamgr_get_data(priv->wirelessmgr); if (!list) { @@ -1053,7 +1150,7 @@ static void _data_event_cb(enum event_type type, void *data) return; } - _wireless_data_found_done(priv, list); + _wireless_data_found_done(priv->ly, list); break; @@ -1069,8 +1166,13 @@ static void _data_event_cb(enum event_type type, void *data) case EVENT_DATA_SELECT_FAIL: _DBG("Failed to connect"); + evas_object_hide(connecting_wireless_popup); + evas_object_hide(connected_wireless_popup); + _popup_failed_wireless_status(priv); + /* listmgr_foreach_list(priv->listmgr, LIST_WIRELESS, _grid_remove_connecting_state, priv);*/ + //_popup_failed_wireless_status(priv); viewmgr_update_view(VIEW_WIRELESS_LIST, GRID_FOREACH, _grid_remove_connecting_state); @@ -1089,18 +1191,9 @@ static void _data_event_cb(enum event_type type, void *data) case EVENT_DATA_CONNECTED: _DBG("Connected succesfully"); - evas_object_hide(connecting_wireless_popup); - evas_object_hide(failed_wireless_popup); _popup_connected_wireless_status(priv); - -/* listmgr_foreach_list(priv->listmgr, LIST_WIRELESS, - _grid_remove_connecting_state, priv);*/ - viewmgr_update_view(VIEW_WIRELESS_LIST, GRID_FOREACH, - _grid_remove_connecting_state); elm_object_item_signal_emit(priv->connecting_wireless_item, SIG_LOADING_STOP, SRC_ELM); - elm_object_item_signal_emit(priv->connecting_wireless_item, - SIG_CONNECTION_FAIL, SRC_ELM); /* Update connection state for all items. * When profile is switched to ethernet, @@ -1108,22 +1201,21 @@ static void _data_event_cb(enum event_type type, void *data) /*if (!listmgr_update_grid(priv->listmgr, LIST_WIRELESS)) _ERR("Listmgr update list failed.");*/ viewmgr_update_view(VIEW_WIRELESS_LIST, GRID_UPDATE, NULL); + + evas_object_hide(connecting_wireless_popup); + evas_object_hide(failed_wireless_popup); + +/* listmgr_foreach_list(priv->listmgr, LIST_WIRELESS, + _grid_remove_connecting_state, priv);*/ + viewmgr_update_view(VIEW_WIRELESS_LIST, GRID_FOREACH, + _grid_remove_connecting_state); break; case EVENT_DATA_INVALID_PWD_WIRELESS: { - char *wifi_name; - struct wifi_manager_ap_info *ap_info; evas_object_hide(connecting_wireless_popup); evas_object_hide(connected_wireless_popup); _popup_failed_wireless_status(priv); - ap_info = elm_object_item_data_get(priv->connecting_wireless_item); - if (!ap_info) { - _ERR("Get data failed."); - break; - } - wifi_name = ap_info->essid; - _DBG("Invalid password"); /* Remove connection state from other items */ /*listmgr_foreach_list(priv->listmgr, LIST_WIRELESS, @@ -1142,7 +1234,7 @@ static void _data_event_cb(enum event_type type, void *data) _ERR("Listmgr update list failed.");*/ viewmgr_update_view(VIEW_WIRELESS_LIST, GRID_UPDATE, NULL); - _draw_wifi_passcode_popup(priv, wifi_name, true); +// _draw_wifi_passcode_popup(priv, wifi_name, true); break; } @@ -1175,6 +1267,7 @@ static void _connect_wifi_with_passcode(struct _priv *priv) } priv->connecting_wireless_item = priv->selected_wireless_item; + if (!datamgr_select(priv->wirelessmgr, priv->connecting_wireless_item, passcode)) { _ERR("Unavailable status for selecting wifi."); @@ -1210,6 +1303,8 @@ static void _popup_clicked_cb(int id, void *data, Evas_Object *obj) break; case EO_BTN_OK: + + _popup_connecting_wireless_status(priv); _connect_wifi_with_passcode(priv); /* Update status for all items */ @@ -1476,60 +1571,6 @@ static bool _draw_wifi_passcode_popup(struct _priv *priv, char *wifi_name, return true; } -static void _wireless_selected_cb(Elm_Object_Item *it, void *data) -{ - struct _priv *priv; - struct wifi_manager_ap_info *ap_info; - char *wifi_name; - bool required = false; - - if (!it || !data) { - _ERR("Invalid argument."); - return; - } - - priv = data; - - ap_info = elm_object_item_data_get(it); - if (!ap_info) { - _ERR("Get data failed."); - return; - } - - if (ap_info->connection_state == WIFI_MANAGER_CONNECTION_STATE_CONNECTED) { - _ERR("Already connected AP."); - return; - } - - required = settings_wireless_passharase_required(ap_info->ap); - _DBG("[%s] required : %s", ap_info->essid, (required) ? "True" : "False"); - if (required) { - wifi_name = ap_info->essid; - if (!wifi_name) - return; - - if (!_draw_wifi_passcode_popup(priv, wifi_name, false)) { - _ERR("Draw passcode popup failed."); - return; - } - } else { - if (!datamgr_select(priv->wirelessmgr, it, NULL)) { - _ERR("Unavailable status for selecting wifi."); - return; - } - - priv->connecting_wireless_item = priv->selected_wireless_item; - elm_object_item_signal_emit(priv->connecting_wireless_item, - SIG_LOADING_START, SRC_ELM); - - /* Remove connection state from other items */ - /*listmgr_foreach_list(priv->listmgr, LIST_WIRELESS, - _grid_remove_connecting_state, priv);*/ - viewmgr_update_view(VIEW_WIRELESS_LIST, GRID_FOREACH, - _grid_remove_connecting_state); - } -} - static bool _draw_network_buttons(struct _priv *priv, Evas_Object *tab_button) { Evas_Object *btn1, *btn2; @@ -1633,6 +1674,7 @@ static bool _create(layoutmgr *lmgr, void *data) } priv->wired_layout = wired; */ + dmgr = datamgr_create(get_wireless_data_class(), _data_event_cb, priv); if (!dmgr) { _ERR("Create datamgr failed."); diff --git a/src/view/network/view_wireless_list.c b/src/view/network/view_wireless_list.c index df1ae1c..a02bde2 100644 --- a/src/view/network/view_wireless_list.c +++ b/src/view/network/view_wireless_list.c @@ -28,6 +28,7 @@ #include "common/listmgr.h" #include "common/utils.h" #include "layout/network.h" +#include "layout/layout_network.h" #include "layout.h" //#include "data/system/settings_language.h" #include "view/network/view_wireless.h" @@ -36,62 +37,13 @@ #define MAX_WIRELESS_LEN 64 #define MIN_WIRELESS_LEN 8 -struct _priv { - Evas_Object *base; - struct datamgr *wirelessmgr; - struct listmgr *listmgr; - Evas_Object *passcode_popup; - Evas_Object *passcode_entry; - Evas_Object *popup_btn1; - Evas_Object *popup_btn2; - Elm_Object_Item *selected_wireless_item; - Elm_Object_Item *focused_wireless_item; - Elm_Object_Item *connecting_wireless_item; - - //Evas_Object *btn1; - //Evas_Object *btn2; -}; -static void _wireless_selected_cb(Elm_Object_Item *it, void *data); -static void _remove_wifi_passcode_popup(struct _priv *priv); enum object_type { EO_BTN_OK = 0, EO_BTN_CANCEL, EO_ENTRY_PASSCODE, }; -static void _popup_mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Mouse_Move *ev) -{ - struct _priv *priv = data; - - if (!priv || !obj) { - _ERR("Invalid argument."); - return; - } - if (priv->passcode_entry) { - Ecore_IMF_Context *ctx; - Ecore_IMF_Input_Panel_State state; - ctx = (Ecore_IMF_Context*)elm_entry_imf_context_get(priv->passcode_entry); - state = ecore_imf_context_input_panel_state_get(ctx); - - if (state == ECORE_IMF_INPUT_PANEL_STATE_HIDE) { - if (!elm_object_focus_get(obj)) - elm_object_focus_set(obj, EINA_TRUE); - } - } -} -static void _grid_remove_connecting_state(Elm_Object_Item *it, void *data) -{ - struct _priv *priv = data; - if (NULL == priv) { - _ERR("User data not found"); - return; - } - - if (it != priv->connecting_wireless_item) - elm_object_item_signal_emit(it, SIG_LOADING_STOP, SRC_ELM); -} static void widget_min_set(Evas_Object *table, Evas_Object *obj, Evas_Coord w, Evas_Coord h) { Evas_Object *rect; @@ -110,34 +62,7 @@ static void widget_min_set(Evas_Object *table, Evas_Object *obj, Evas_Coord w, E // return table; } -static void _connect_wifi_with_passcode(struct _priv *priv) -{ - char *passcode; - - passcode = elm_entry_markup_to_utf8 - (elm_entry_entry_get(priv->passcode_entry)); - if (!passcode) { - _ERR("Passcode is NULL."); - return; - } - - priv->connecting_wireless_item = priv->selected_wireless_item; - if (!datamgr_select(priv->wirelessmgr, priv->connecting_wireless_item, - passcode)) { - _ERR("Unavailable status for selecting wifi."); - return; - } - - elm_object_item_signal_emit(priv->connecting_wireless_item, - SIG_LOADING_START, SRC_ELM); - - /* Remove connection state from other items */ - listmgr_foreach_list(priv->listmgr, LIST_WIRELESS, - _grid_remove_connecting_state, priv); - - _remove_wifi_passcode_popup(priv); -} -static void _destroy_status_popup() +/*void _destroy_wireless_status_popup() { evas_object_hide(connected_wireless_popup); evas_object_hide(connecting_wireless_popup); @@ -153,96 +78,53 @@ static void _destroy_status_popup() failed_wireless_popup = NULL; return; -} +}*/ -static void _stop_dismissed_cb(void *data, Evas_Object *obj, void *ei) -{ - _destroy_status_popup(); - return; -} -void _popup_connecting_wireless_status(struct _priv *priv) +/*void _popup_failed_wireless_status(struct _priv *priv) { - Evas_Object *ly, *stop_btn; - connecting_wireless_popup = utils_add_popup(priv->base, STYLE_POPUP, "Wireless", NULL); - if (!connecting_wireless_popup) { + Evas_Object *ly, *close_btn, *retry_btn; + failed_wireless_popup = utils_add_popup(priv->base, STYLE_POPUP, "Wireless", NULL); + if (!failed_wireless_popup) { _ERR("Add popup failed"); return; } - ly = utils_add_layout(connecting_wireless_popup, GRP_CONNECTING_IMAGE_NETWORK_POPUP, EINA_FALSE); + ly = utils_add_layout(failed_wireless_popup, GRP_FAILED_IMAGE_NETWORK_POPUP, EINA_FALSE); if (!ly) { _ERR("Add layout failed."); - evas_object_del(connecting_wireless_popup); + evas_object_del(failed_wireless_popup); return; } - elm_object_part_text_set(ly, "part.text.content", STR_WIRELESS_PROGRESS); + //elm_object_part_text_set(ly, "part.text.content", STR_WIRED_FAILED); - - stop_btn = utils_add_button(ly, "part.stop.btn", STYLE_DISABLE_BTN, "STOP"); - if (!stop_btn) { + close_btn = utils_add_button(ly, "part.close.btn", STYLE_DISABLE_BTN, "CLOSE"); + if (!close_btn) { _ERR("Add button failed."); - evas_object_del(connecting_wireless_popup); - return; + evas_object_del(failed_wireless_popup); + return; } - evas_object_smart_callback_add(stop_btn, "clicked", _stop_dismissed_cb, connecting_wireless_popup); - - elm_object_content_set(connecting_wireless_popup, ly); - evas_object_show(connecting_wireless_popup); -} - -static void _popup_clicked_cb(int id, void *data, Evas_Object *obj) -{ - struct _priv *priv; - - if (!data || !obj) { - _ERR("Invalid argument."); - return; - } - - priv = data; - evas_object_show(priv->base); - switch (id) { - case EO_BTN_CANCEL: - _remove_wifi_passcode_popup(priv); - break; - - case EO_BTN_OK: - evas_object_hide(connected_wireless_popup); - evas_object_hide(failed_wireless_popup); - _popup_connecting_wireless_status(priv); - _connect_wifi_with_passcode(priv); - - /* Update status for all items */ - if (!listmgr_update_grid(priv->listmgr, LIST_WIRELESS)) - _ERR("Listmgr update list failed."); - break; - - default: - _ERR("Unhandled object type."); - return; - } -} -static void _popup_key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Key_Down *ev) -{ - struct _priv *priv; + evas_object_smart_callback_add(close_btn, "clicked", _close_wireless_dismissed_cb, failed_wireless_popup); - if (!ev || !data) { - _ERR("Invalid argument."); - return; - } + retry_btn = utils_add_button(ly, "part.retry.btn", STYLE_DISABLE_BTN, "RETRY"); + if (!retry_btn) { + _ERR("Add button failed."); + evas_object_del(failed_wireless_popup); + return; + } + evas_object_smart_callback_add(retry_btn, "clicked", _wireless_retry_cb, failed_wireless_popup); - priv = data; + new_network_btn = utils_add_button(ly, "part.new.network.btn", STYLE_DISABLE_BTN, "NEW NETWORK"); + if (!new_network_btn) { + _ERR("Add button failed."); + evas_object_del(failed_wireless_popup); + return; + } + evas_object_smart_callback_add(new_network_btn, "clicked", _new_network_cb, failed_wireless_popup); - if (!strcmp(ev->keyname, KEY_BACK) || !strcmp(ev->keyname, KEY_BACK_WAY) - || !strcmp(ev->keyname, KEY_ESC) || !strcmp(ev->keyname, KEY_ESC_WAY) - ) { - _remove_wifi_passcode_popup(priv); - } else if (!strcmp(ev->keyname, KEY_ENTER)) { - if (id == EO_ENTRY_PASSCODE) - _connect_wifi_with_passcode(priv); - } + elm_object_content_set(failed_wireless_popup, ly); + evas_object_show(failed_wireless_popup); } +*/ enum input_type { @@ -251,191 +133,11 @@ enum input_type { }; -static input_handler _popup_input_handler = { - .mouse_move = _popup_mouse_move_cb, - .clicked = _popup_clicked_cb, - .key_down = _popup_key_down_cb -}; - -static void _wireless_data_found_done(struct _priv *priv, Eina_List *list) -{ - if (!listmgr_fill_grid(priv->listmgr, LIST_WIRELESS, list, NULL, NULL) - || !listmgr_show_grid(priv->listmgr, LIST_WIRELESS, PART_WIRELESS_LIST, NULL)) { - _ERR("Listmgr show list failed."); - return; - } - -// elm_object_signal_emit(priv->ly, SIG_WIRELESS_EXISTS, SRC_ELM); -// elm_object_signal_emit(priv->ly, SIG_LOADING_STOP, SRC_ELM); -// elm_object_part_text_set(priv->ly, PART_NO_NETWORK_TEXT, ""); -} -static void _remove_wifi_passcode_popup(struct _priv *priv) -{ - if (!priv) { - _ERR("Invalid popup data !"); - return; - } - - inputmgr_remove_callback(priv->popup_btn1, &_popup_input_handler); - inputmgr_remove_callback(priv->popup_btn2, &_popup_input_handler); - elm_entry_input_panel_enabled_set(priv->passcode_entry, EINA_FALSE); - - priv->popup_btn1 = NULL; - priv->popup_btn2 = NULL; - evas_object_del(priv->passcode_entry); - priv->passcode_entry = NULL; - - evas_object_del(priv->passcode_popup); - priv->passcode_popup = NULL; -} - - -static void _grid_set_unfocus(Elm_Object_Item *it, void *data) -{ - struct _priv *priv = data; - if (NULL == priv) { - _ERR("User data not found"); - return; - } - - if (it != priv->focused_wireless_item) - elm_object_item_signal_emit(it, SIG_LIST_ITEM_UNFOCUS, SRC_ELM); -} - -static void _grid_realized_cb(int id, void *data, Evas_Object *obj, - Elm_Object_Item *item) -{ - struct wifi_manager_ap_info *ap_info = NULL; - - if (!item) { - _ERR("Invalid argument."); - return; - } - - /* If realized but has no focus, send updated status */ - if (!elm_object_item_focus_get(item)) { - /* realized, but has no focus on it */ - elm_object_item_signal_emit(item, SIG_LIST_ITEM_UNFOCUS, SRC_ELM); - } - - ap_info = (struct wifi_manager_ap_info*)elm_object_item_data_get(item); - if (ap_info) { - switch (ap_info->signal_level) { - case SIGNAL_LEVEL_1: - elm_object_item_signal_emit(item, "wifi_signal_level,1", SRC_ELM); - break; - case SIGNAL_LEVEL_2: - elm_object_item_signal_emit(item, "wifi_signal_level,2", SRC_ELM); - break; - case SIGNAL_LEVEL_3: - elm_object_item_signal_emit(item, "wifi_signal_level,3", SRC_ELM); - break; - case SIGNAL_LEVEL_4: - elm_object_item_signal_emit(item, "wifi_signal_level,4", SRC_ELM); - break; - } - } -} -static void _imf_commit_event_cb(void *data, Ecore_IMF_Context *ctx, void *event_info) -{ - struct _priv *priv = data; - const char *buf = NULL; - int len = 0; - - if (NULL == priv) - return; - - buf = elm_entry_entry_get(priv->passcode_entry); - if (NULL == buf) - return; - - len = strlen(buf); - if (len >= MIN_WIRELESS_LEN) - elm_object_disabled_set(priv->popup_btn2, EINA_FALSE); - else - elm_object_disabled_set(priv->popup_btn2, EINA_TRUE); -} - -static void _imf_delete_event_cb(void *data, Ecore_IMF_Context *ctx, void *event_info) -{ - struct _priv *priv = data; - - if (NULL == priv) - return; - - elm_object_disabled_set(priv->popup_btn2, EINA_TRUE); -} -static void _check_passcode_input_cb(void *data, Evas_Object *entry, char **text) -{ - struct _priv *priv = data; - const char *buf = NULL; - if (!priv) { - _ERR("invalid data"); - return; - } - - if (NULL == text || NULL == *text) { - _ERR("invalid text"); - return; - } - - buf = elm_entry_entry_get(entry); - if (!buf) - return; - - /* Check length of string */ - if (strlen(buf) >= MAX_WIRELESS_LEN) { - char *ref = elm_entry_markup_to_utf8(buf); - /* Ignore input key event */ - free(*text); - *text = NULL; - - elm_entry_entry_set(entry, ref); - elm_entry_cursor_end_set(entry); - free(ref); - return; - } -} - -static void _grid_focused_cb(int id, void *data, Evas_Object *obj, Elm_Object_Item *item) -{ - struct _priv *priv = data; - if (NULL == priv) { - _ERR("User data not found"); - return; - } - - /* If popup is shown, revert focus to popup */ -/* - if (priv->passcode_popup) - elm_object_focus_set(priv->popup_btn1, EINA_TRUE); - - priv->focused_wireless_item = item; -*/ - /* Unfocus other items */ - listmgr_foreach_list(priv->listmgr, LIST_WIRELESS, _grid_set_unfocus, priv); -} -static void _grid_selected_cb(int id, void *data, Evas_Object *obj, - Elm_Object_Item *item) -{ - struct _priv *priv = data; - if (NULL == priv) { - _ERR("User data not found"); - return; - } - priv->selected_wireless_item = item; - _wireless_selected_cb(priv->selected_wireless_item, data); -} -static input_handler _grid_input_handler = { - .realized = _grid_realized_cb, - .focused = _grid_focused_cb, - .selected = _grid_selected_cb -}; //static void _clicked_cb(int id, void *data, Evas_Object *obj); //static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, @@ -484,178 +186,6 @@ static input_handler _grid_input_handler = { evas_object_del(priv->base); free(priv); }*/ -static void _popup_entry_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - struct _priv *priv = (struct _priv *)data; - Evas_Event_Key_Down *ev = (Evas_Event_Key_Down*)event_info; - const char *str = NULL; - int len = 0; - - if (!priv || !ev) { - _ERR("Invalid callback data !"); - return; - } - - if (!strcmp(ev->keyname, KEY_ENTER)) { - elm_object_focus_set(priv->popup_btn2, EINA_TRUE); - } else if (!strcmp(ev->keyname, KEY_BACK) - || !strcmp(ev->keyname, KEY_ESC) || !strcmp(ev->keyname, KEY_ESC_WAY) - ) { - elm_object_focus_set(priv->popup_btn1, EINA_TRUE); - } - - str = elm_entry_entry_get(priv->passcode_entry); - if (NULL == str) - return; - - len = strlen(str); - if (len >= MIN_WIRELESS_LEN) - elm_object_disabled_set(priv->popup_btn2, EINA_FALSE); - else - elm_object_disabled_set(priv->popup_btn2, EINA_TRUE); -} - -static bool _draw_wifi_passcode_popup(struct _priv *priv, char *wifi_name, - bool isReconnect) -{ - Evas_Object *popup, *ly, *entry, *btn1, *btn2; - Evas_Object *scroller; - Ecore_IMF_Context *ctx; - - if (priv->passcode_popup) { - _ERR("Already popup exists"); - return false; - } - - popup = utils_add_popup(priv->base, STYLE_POPUP, STR_ENTER_PASSCODE, NULL); - if (!popup) { - _ERR("Add popup failed"); - return false; - } - - ly = utils_add_layout(popup, GRP_POPUP_PASSCODE, EINA_FALSE); - if (!ly) { - _ERR("Add layout failed."); - evas_object_del(popup); - return false; - } - elm_object_part_text_set(ly, PART_WIFI_NAME, wifi_name); - - scroller = elm_scroller_add(ly); - evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_part_content_set(ly, PART_WIFI_PASSCODE, scroller); - - entry = utils_add_entry(ly, NULL, STYLE_ENTRY_PASSCODE_TXT, EINA_TRUE); - if (!entry) { - _ERR("Add entry failed."); - evas_object_del(popup); - return false; - } - elm_object_content_set(scroller, entry); - - elm_object_content_set(popup, ly); - - btn1 = utils_add_button(ly, PART_WIFI_POPUP_BTN_CANCEL, STYLE_DISABLE_BTN, STR_CANCEL); - if (!btn1) { - _ERR("Add button failed."); - evas_object_del(popup); - return false; - } - - btn2 = utils_add_button(ly, PART_WIFI_POPUP_BTN_OK, STYLE_DISABLE_BTN, STR_OK); - if (!btn2) { - _ERR("Add button failed."); - evas_object_del(popup); - return false; - } - - priv->passcode_popup = popup; - priv->passcode_entry = entry; - priv->popup_btn1 = btn1; - priv->popup_btn2 = btn2; - - /* use this function to limit entry string */ - elm_entry_markup_filter_append(entry, _check_passcode_input_cb, priv); - - inputmgr_add_callback(priv->popup_btn1, EO_BTN_CANCEL, &_popup_input_handler, priv); - inputmgr_add_callback(priv->popup_btn2, EO_BTN_OK, &_popup_input_handler, priv); - - evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, - _popup_entry_key_down_cb, priv); - - /* Handle special button events */ - ctx = (Ecore_IMF_Context*)elm_entry_imf_context_get(entry); - ecore_imf_context_event_callback_add(ctx, - ECORE_IMF_CALLBACK_COMMIT, _imf_commit_event_cb, priv); - ecore_imf_context_event_callback_add(ctx, - ECORE_IMF_CALLBACK_DELETE_SURROUNDING, _imf_delete_event_cb, priv); - - elm_object_disabled_set(priv->popup_btn2, EINA_TRUE); - /* Set focus into entry */ - elm_object_focus_set(priv->popup_btn1, EINA_TRUE); - - if (isReconnect) - elm_object_part_text_set(ly, PART_WIFI_POPUP_ERROR_MSG, STR_WIRELESS_WRONG_PWD); - - evas_object_show(popup); - - return true; -} - -static void _wireless_selected_cb(Elm_Object_Item *it, void *data) -{ - struct _priv *priv; - struct wifi_manager_ap_info *ap_info; - char *wifi_name; - bool required = false; - - if (!it || !data) { - _ERR("Invalid argument."); - return; - } - - priv = data; - - ap_info = elm_object_item_data_get(it); - if (!ap_info) { - _ERR("Get data failed."); - return; - } - - if (ap_info->connection_state == WIFI_MANAGER_CONNECTION_STATE_CONNECTED) { - _ERR("Already connected AP."); - return; - } - - required = settings_wireless_passharase_required(ap_info->ap); - _DBG("[%s] required : %s", ap_info->essid, (required) ? "True" : "False"); - if (required) { - wifi_name = ap_info->essid; - if (!wifi_name) - return; - - if (!_draw_wifi_passcode_popup(priv, wifi_name, false)) { - _ERR("Draw passcode popup failed."); - return; - } else { - evas_object_hide(priv->base); - } - } else { - _popup_connecting_wireless_status(priv); - if (!datamgr_select(priv->wirelessmgr, it, NULL)) { - _ERR("Unavailable status for selecting wifi."); - return; - } - - priv->connecting_wireless_item = priv->selected_wireless_item; - elm_object_item_signal_emit(priv->connecting_wireless_item, - SIG_LOADING_START, SRC_ELM); - - /* Remove connection state from other items */ - listmgr_foreach_list(priv->listmgr, LIST_WIRELESS, - _grid_remove_connecting_state, priv); - } -} static Evas_Object *_create(Evas_Object *win, void *data) @@ -670,19 +200,8 @@ static Evas_Object *_create(Evas_Object *win, void *data) return NULL; } - priv = calloc(1, sizeof(struct _priv)); - if (!priv) { - _ERR("Calloc failed."); - return NULL; - } - priv->wirelessmgr = data; + priv = data; - list = datamgr_get_data(priv->wirelessmgr); - if (!list) { - //_draw_no_contents_message(priv); - return NULL; - } - _wireless_data_found_done(priv, list); priv->base = utils_add_popup(win, STYLE_POPUP, STR_WIRELESS, NULL); if (!priv->base) { @@ -698,6 +217,14 @@ static Evas_Object *_create(Evas_Object *win, void *data) free(priv); return NULL; } + + list = datamgr_get_data(priv->wirelessmgr); + if (!list) { + //_draw_no_contents_message(priv); + return NULL; + } + _wireless_data_found_done(ly, list); + table = elm_table_add(priv->base); // elm_table_homogeneous_set(table, EINA_TRUE); @@ -731,8 +258,8 @@ static Evas_Object *_create(Evas_Object *win, void *data) widget_min_set(table, grid, 40.0, 45.0); evas_object_show(table); - listmgr_add_inner_grid_cb(priv->listmgr, LIST_WIRELESS, - &_grid_input_handler, priv); + layoutmgr_add_grid_cb(priv->listmgr, LIST_WIRELESS, + priv); if (!listmgr_update_grid(priv->listmgr, LIST_WIRELESS)) @@ -746,7 +273,7 @@ static Evas_Object *_create(Evas_Object *win, void *data) if (!listmgr_update_grid(priv->listmgr, LIST_WIRELESS)) _ERR("Listmgr update list failed."); - _wireless_data_found_done(priv, list); + _wireless_data_found_done(ly, list); // Elm_Object_Item *gg = elm_gengrid_last_item_get(grid); // if (!gg) return NULL; diff --git a/src/view/view_new_network.c b/src/view/view_new_network.c index 47be465..357dd93 100644 --- a/src/view/view_new_network.c +++ b/src/view/view_new_network.c @@ -949,33 +949,39 @@ static void _remove_content_manual(struct _content_manual *content, priv->content_automatic = content; }*/ +static void _dismissed_cb(void *data, Evas_Object *obj, void *event_info) + +{ + evas_object_del(obj); +} + static void _destroy_ip_type_popup(struct _priv *priv) { evas_object_hide(priv->ip_type_popup); - evas_object_del(priv->ip_type_popup); - priv->ip_type_popup = NULL; } static void _ip_type_option_selected(struct _priv *priv, int id, Evas_Object *obj) { - //Evas_Object *preserve; - _destroy_ip_type_popup(priv); - - elm_object_text_set(priv->ip_type_btn, str_config_type_opt[id]); + //elm_object_text_set(priv->ip_type_btn, str_config_type_opt[id]); switch (id) { case TYPE_AUTOMATICALLY: SETTING_TRACE("Automatic IP"); + elm_object_text_set(priv->ip_type_btn, str_config_type_opt[0]); _update_entry_input_state(priv); priv->ip_menu = 0; elm_object_disabled_set(priv->content_manual->address_ip, EINA_TRUE); elm_object_disabled_set(priv->content_manual->address_subnet, EINA_TRUE); elm_object_disabled_set(priv->content_manual->address_gateway, EINA_TRUE); + + elm_object_disabled_set(priv->btn_done, EINA_FALSE); + elm_object_disabled_set(priv->dns_type_btn, EINA_FALSE); break; case TYPE_MANUALLY: SETTING_TRACE("Manual IP"); + elm_object_text_set(priv->ip_type_btn, str_config_type_opt[1]); _update_entry_input_state(priv); priv->ip_menu = 1; elm_object_disabled_set(priv->content_manual->address_ip, EINA_FALSE); @@ -985,15 +991,15 @@ static void _ip_type_option_selected(struct _priv *priv, int id, elm_object_text_set(priv->dns_type_btn, str_config_type_opt[1]); elm_object_disabled_set(priv->content_manual->address_dns, EINA_FALSE); //elm_object_disabled_set(priv->dns_type_popup, EINA_TRUE); - //elm_object_disabled_set(priv->dns_type_btn, EINA_TRUE); + elm_object_disabled_set(priv->dns_type_btn, EINA_TRUE); //inputmgr_add_callback(priv->dns_type_btn, 0, NULL, priv); break; default: _ERR("Unhandled network type."); return; } + evas_object_hide(priv->ip_type_popup); priv->config_cur_type = id; - elm_win_activate(priv->base); elm_object_focus_set(priv->base, EINA_TRUE); } @@ -1044,7 +1050,7 @@ static void _draw_ip_type_popup(struct _priv *priv) elm_object_signal_emit(priv->ip_type_btn, SIG_SELECTED, SRC_ELM); - configpopup = utils_add_ctxpopup(priv->base, 2, + configpopup = utils_add_configpopup(priv->base, 2, id_config_type_opt, str_config_type_opt, &_ip_type_option_input_handler, priv, priv->config_cur_type); if (!configpopup) { @@ -1052,6 +1058,8 @@ static void _draw_ip_type_popup(struct _priv *priv) return; } + evas_object_smart_callback_add(configpopup, "dismissed", _dismissed_cb, NULL); + evas_object_geometry_get(priv->ip_type_btn, &x, &y, &w, &h); evas_object_move(configpopup, (x + w / 2), (y + h)); evas_object_size_hint_min_set(configpopup, w, 0); @@ -1061,22 +1069,21 @@ static void _draw_ip_type_popup(struct _priv *priv) void _destroy_dns_type_popup(struct _priv *priv) { - evas_object_hide(priv->ip_type_popup); - evas_object_del(priv->ip_type_popup); - priv->ip_type_popup = NULL; + evas_object_hide(priv->dns_type_popup); } static void _dns_type_option_selected(struct _priv *priv, int id, Evas_Object *obj) { - //Evas_Object *preserve; - _destroy_dns_type_popup(priv); + if(elm_object_disabled_get(priv->dns_type_btn)) + return; - elm_object_text_set(priv->dns_type_btn, str_config_type_opt[id]); + //elm_object_text_set(priv->dns_type_btn, str_config_type_opt[id]); switch (id) { case TYPE_AUTOMATICALLY: SETTING_TRACE("Automatic DNS"); + elm_object_text_set(priv->dns_type_btn, str_config_type_opt[0]); priv->dns_menu = 0; elm_object_disabled_set(priv->content_manual->address_dns, EINA_TRUE); _update_entry_input_state(priv); @@ -1084,6 +1091,7 @@ static void _dns_type_option_selected(struct _priv *priv, int id, case TYPE_MANUALLY: SETTING_TRACE("Manual DNS"); + elm_object_text_set(priv->dns_type_btn, str_config_type_opt[1]); priv->dns_menu = 1; elm_object_disabled_set(priv->content_manual->address_dns, EINA_FALSE); _update_entry_input_state(priv); @@ -1092,8 +1100,8 @@ static void _dns_type_option_selected(struct _priv *priv, int id, _ERR("Unhandled dns type."); return; } + evas_object_hide(priv->dns_type_popup); priv->config_cur_type = id; - elm_win_activate(priv->base); elm_object_focus_set(priv->base, EINA_TRUE); } @@ -1137,7 +1145,6 @@ static input_handler _dns_type_option_input_handler = { .mouse_down = _dns_type_option_mouse_down_cb }; - static void _draw_dns_type_popup(struct _priv *priv) { Evas_Object *configpopup; @@ -1145,7 +1152,7 @@ static void _draw_dns_type_popup(struct _priv *priv) elm_object_signal_emit(priv->dns_type_btn, SIG_SELECTED, SRC_ELM); - configpopup = utils_add_ctxpopup(priv->base, 2, + configpopup = utils_add_configpopup(priv->base, 2, id_config_type_opt, str_config_type_opt, &_dns_type_option_input_handler, priv, priv->config_cur_type); if (!configpopup) { @@ -1153,6 +1160,8 @@ static void _draw_dns_type_popup(struct _priv *priv) return; } + evas_object_smart_callback_add(configpopup, "dismissed", _dismissed_cb, NULL); + evas_object_geometry_get(priv->dns_type_btn, &x, &y, &w, &h); evas_object_move(configpopup, (x + w / 2), (y + h)); evas_object_size_hint_min_set(configpopup, w, 0); @@ -1185,22 +1194,18 @@ static void _dns_type_clicked_cb(int id, void *data, Evas_Object *obj) return; } priv = data; - + _draw_dns_type_popup(priv); } static input_handler _ipconfig_type_option_input_handler = { .mouse_move = _mouse_move_cb, .clicked = _ip_type_clicked_cb, - .key_down = _ip_type_option_key_down_cb,//To write new func Priya - .mouse_down = _ip_type_option_mouse_down_cb//To write new func Priya }; static input_handler _dnsconfig_type_option_input_handler = { .mouse_move = _mouse_move_cb, .clicked = _dns_type_clicked_cb, - .key_down = _dns_type_option_key_down_cb,//To write new func Priya - .mouse_down = _dns_type_option_mouse_down_cb//To write new func Priya }; static bool _draw_config_buttons(struct _priv *priv) @@ -1218,7 +1223,6 @@ static bool _draw_config_buttons(struct _priv *priv) inputmgr_add_callback(ip_btn, 0, &_ipconfig_type_option_input_handler, priv); priv->ip_type_btn = ip_btn; - dns_btn = utils_add_button(priv->content_manual->layout_content_dns, "part.dns.type", STYLE_OPTION_BTN, str_config_type_opt[priv->config_cur_type]); if (!dns_btn) { @@ -1230,7 +1234,6 @@ static bool _draw_config_buttons(struct _priv *priv) inputmgr_add_callback(dns_btn, 0, &_dnsconfig_type_option_input_handler, priv); priv->dns_type_btn = dns_btn; - return true; } @@ -1422,26 +1425,6 @@ static Evas_Object *_create(Evas_Object *win, void *data) return NULL; } - //_draw_config_buttons(priv); - - /*btn_automatic = utils_add_button(base, "part.new_network.btn.automatic", - STYLE_DISABLE_BTN, "Automatically"); - if (!btn_automatic) { - _ERR("Add automatic button failed."); - evas_object_del(base); - free(priv); - return NULL; - }*/ - - /*btn_manual = utils_add_button(base, "part.new_network.btn.manual", - STYLE_DISABLE_BTN, "Enter manually"); - if (!btn_manual) { - _ERR("Add manual button failed."); - evas_object_del(base); - free(priv); - return NULL; - }*/ - btn_cancel = utils_add_button(base, "part.new_network.btn.cancel", STYLE_DISABLE_BTN, "Cancel"); if (!btn_cancel) { @@ -1632,3 +1615,4 @@ view_class *view_new_network_get_vclass(void) { return &_vclass; } +