*
* Copyright 2012 Samsung Electronics Co., Ltd
-* Licensed under the Flora License, Version 1.0 (the "License");
+* Licensed under the Flora License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
#include "mh_popup.h"
#include "mh_view_wifi_setup.h"
+#include "mh_view_main.h"
#include "mh_string.h"
static void __gl_realized(void *data, Evas_Object *obj, void *event_info);
static void __cancel_btn_cb(void *data, Evas_Object *object, void *event_info);
static void __save_btn_cb(void *data, Evas_Object *object, void *event_info);
+static void __create_password_item(Evas_Object *genlist, mh_appdata_t *ad);
+static void __destroy_password_item(mh_appdata_t *ad);
+
+static guint tethering_param_timer = 0;
+
static void __hide_btn_changed_cb(void *data, Evas_Object *obj, void *event_info)
{
__MOBILE_AP_FUNC_ENTER__;
__MOBILE_AP_FUNC_EXIT__;
}
+#ifndef TIZEN_FEATURE_EMULATOR
static bool __save_hide_btn_change(mh_appdata_t *ad)
{
__MOBILE_AP_FUNC_ENTER__;
__MOBILE_AP_FUNC_EXIT__;
return true;
}
+#endif
static void __security_btn_changed_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;
- if (st->security_type_new == TETHERING_WIFI_SECURITY_TYPE_NONE)
+ if (st->security_type_new == TETHERING_WIFI_SECURITY_TYPE_NONE) {
st->security_type_new = TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK;
- else
+ if (st->pw_item == NULL)
+ __create_password_item(st->genlist, ad);
+ } else {
st->security_type_new = TETHERING_WIFI_SECURITY_TYPE_NONE;
+ /* Disable password entry */
+ __destroy_password_item(ad);
+ }
/* update wifi passphrase item */
if (st->security_type_new == TETHERING_WIFI_SECURITY_TYPE_NONE) {
elm_object_disabled_set(st->save_button, EINA_FALSE);
} else {
elm_object_item_disabled_set(st->pw_item, EINA_FALSE);
- if (st->pw_entry == NULL || elm_entry_entry_get(st->pw_entry) == NULL ||
- strlen(elm_entry_entry_get(st->pw_entry)) == 0)
- elm_object_disabled_set(st->save_button, EINA_TRUE);
}
if (st->pw_item)
__MOBILE_AP_FUNC_EXIT__;
}
+static void __check_box_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __MOBILE_AP_FUNC_ENTER__;
+
+ if (data == NULL || obj == NULL) {
+ ERR("Invalid param\n");
+ return;
+ }
+
+ Eina_Bool state = elm_check_state_get(obj);
+ mh_appdata_t *ad = (mh_appdata_t *)data;
+ mh_wifi_setting_view_t *st = &ad->setup;
+
+ if (state)
+ elm_entry_password_set(st->pw_entry, EINA_FALSE);
+ else
+ elm_entry_password_set(st->pw_entry, EINA_TRUE);
+
+ __MOBILE_AP_FUNC_EXIT__;
+ return;
+}
+
+#ifndef TIZEN_FEATURE_EMULATOR
static bool __save_security_btn_change(mh_appdata_t *ad)
{
__MOBILE_AP_FUNC_ENTER__;
__MOBILE_AP_FUNC_EXIT__;
return true;
}
+#endif
static char *__gl_device_name_title_label_get(void *data, Evas_Object *obj, const char *part)
{
return btn;
}
+#ifndef TIZEN_FEATURE_EMULATOR
static bool __save_wifi_passphrase(mh_appdata_t *ad)
{
__MOBILE_AP_FUNC_ENTER__;
__MOBILE_AP_FUNC_EXIT__;
return true;
}
+#endif
static void __pw_entry_changed_cb(void *data, Evas_Object *obj,
void *event_info)
elm_entry_single_line_set(entry, EINA_TRUE);
elm_entry_scrollable_set(entry, EINA_TRUE);
- elm_entry_password_set(entry, EINA_FALSE);
+ elm_entry_password_set(entry, EINA_TRUE);
evas_object_smart_callback_add(entry, "language,changed",
__pw_entry_language_changed_cb, ad);
return NULL;
}
+static char *_gl_pswd_check_box_text_get(void *data,
+ Evas_Object *obj, const char *part)
+{
+ if (!strcmp("elm.text", part))
+ return strdup(STR_SHOW_PASSWORD);
+
+ return NULL;
+
+}
+
+static Evas_Object *_gl_pswd_check_box_content_get(void *data,
+ Evas_Object *obj, const char *part)
+{
+ mh_appdata_t *ad = (mh_appdata_t *)data;
+ Evas_Object *check = NULL;
+
+ if (data == NULL || obj == NULL || part == NULL) {
+ ERR("Invalid param\n");
+ return NULL;
+ }
+
+ if (!strcmp("elm.swallow.icon", part)) {
+ check = elm_check_add(obj);
+ evas_object_propagate_events_set(check, EINA_FALSE);
+
+ evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_smart_callback_add(check, "changed", __check_box_changed_cb, (void *)ad);
+
+ elm_object_focus_allow_set(check, EINA_FALSE);
+
+ return check;
+ }
+ return NULL;
+}
+
+
static void __gl_hide_item_sel(void *data, Evas_Object *obj, void *event_info)
{
__MOBILE_AP_FUNC_ENTER__;
{
__MOBILE_AP_FUNC_ENTER__;
-#if 0 /* not used */
- ad->setup.sp_itc = elm_genlist_item_class_new();
- if (ad->setup.sp_itc == NULL) {
- ERR("elm_genlist_item_class_new failed\n");
- __MOBILE_AP_FUNC_EXIT__;
- return;
- }
- ad->setup.sp_itc->item_style = "dialogue/separator";
- ad->setup.sp_itc->func.text_get = NULL;
- ad->setup.sp_itc->func.content_get = NULL;
- ad->setup.sp_itc->func.state_get = NULL;
- ad->setup.sp_itc->func.del = NULL;
-#endif
ad->setup.name_itc = elm_genlist_item_class_new();
if (ad->setup.name_itc == NULL) {
ERR("elm_genlist_item_class_new failed\n");
ad->setup.pw_itc->func.state_get = NULL;
ad->setup.pw_itc->func.del = NULL;
-#if 0 /* not used */
- ad->setup.sp2_itc = elm_genlist_item_class_new();
- if (ad->setup.sp2_itc == NULL) {
+ ad->setup.check_box_itc = elm_genlist_item_class_new();
+ if (ad->setup.check_box_itc == NULL) {
ERR("elm_genlist_item_class_new failed\n");
__MOBILE_AP_FUNC_EXIT__;
return;
}
- ad->setup.sp2_itc->item_style = "dialogue/separator.2";
- ad->setup.sp2_itc->func.text_get = NULL;
- ad->setup.sp2_itc->func.content_get = NULL;
- ad->setup.sp2_itc->func.state_get = NULL;
- ad->setup.sp2_itc->func.del = NULL;
-#endif
+ ad->setup.check_box_itc->item_style = MH_GENLIST_1LINE_TEXT_ICON_STYLE;
+ ad->setup.check_box_itc->func.text_get = _gl_pswd_check_box_text_get;
+ ad->setup.check_box_itc->func.content_get = _gl_pswd_check_box_content_get;
+ ad->setup.check_box_itc->func.state_get = NULL;
+ ad->setup.check_box_itc->func.del = NULL;
+
__MOBILE_AP_FUNC_EXIT__;
return;
}
__MOBILE_AP_FUNC_ENTER__;
+ g_source_remove(tethering_param_timer);
+
mh_appdata_t *ad = (mh_appdata_t *)user_data;
if (result != TETHERING_ERROR_NONE)
return;
}
+static gboolean _update_tethering_param(gpointer data)
+{
+ __MOBILE_AP_FUNC_ENTER__;
+ mh_appdata_t *ad = (mh_appdata_t *)data;
+#ifndef TIZEN_FEATURE_EMULATOR
+ int ret;
+#endif
+
+ if (ad == NULL) {
+ ERR("Invalid parameter\n");
+ return FALSE;
+ }
+
+#ifndef TIZEN_FEATURE_EMULATOR
+ /* reload wifi settings */
+ ret = tethering_wifi_reload_settings(ad->handle, __settings_reloaded_cb,
+ (void *)ad);
+ if (ret != TETHERING_ERROR_NONE)
+ ERR("reload_configuration is failed : %d\n", ret);
+#else
+ __settings_reloaded_cb(TETHERING_ERROR_NONE, (void *)ad);
+#endif
+
+ __MOBILE_AP_FUNC_EXIT__;
+ return FALSE;
+}
+
static void __save_btn_cb(void *data, Evas_Object *object, void *event_info)
{
DBG("+\n");
mh_appdata_t *ad = (mh_appdata_t *)data;
mh_wifi_setting_view_t *st = &ad->setup;
- bool ret = false;
bool is_setting_changed = false;
+#ifndef TIZEN_FEATURE_EMULATOR
+ bool ret = false;
/* handle hide button change */
if (st->visibility != st->visibility_new) {
g_strlcpy(st->wifi_passphrase, st->wifi_passphrase_new,
sizeof(st->wifi_passphrase));
is_setting_changed = true;
- if (ad->main.help_item) {
- if (ad->main.help_item)
- elm_genlist_item_update(ad->main.help_item);
- }
+ if (ad->main.help_item)
+ elm_genlist_item_update(ad->main.help_item);
}
}
+#else
+ is_setting_changed = true;
+ ad->setup.visibility = ad->setup.visibility_new;
+ ad->setup.security_type = ad->setup.security_type_new;
+ if (strcmp(st->wifi_passphrase, st->wifi_passphrase_new)) {
+ g_strlcpy(st->wifi_passphrase, st->wifi_passphrase_new,
+ sizeof(st->wifi_passphrase));
+ }
+#endif
if (is_setting_changed) {
_update_wifi_item(ad, MH_STATE_PROCESS);
if (ad->main.help_item)
elm_genlist_item_update(ad->main.help_item);
- /* reload wifi settings */
- ret = tethering_wifi_reload_settings(ad->handle, __settings_reloaded_cb,
- (void *)ad);
- if (ret != TETHERING_ERROR_NONE)
- ERR("reload_configuration is failed : %d\n", ret);
+ /* Here, The Dbus takes some amount of time
+ to set the tethering parameters, due to
+ which UI shows incorrect display, to avoid
+ this issue, CAPI will be called after 0.1sec for smooth
+ transition of UI frames */
+ tethering_param_timer = g_timeout_add(100,
+ _update_tethering_param, ad);
}
elm_naviframe_item_pop(ad->naviframe);
ad->rename_popup = NULL;
}
ad->setup.navi_it = NULL;
+ _ctxpopup_more_button_callback_add(ad);
DBG("-\n");
return EINA_TRUE;
return;
}
+static void __create_password_item(Evas_Object *genlist, mh_appdata_t *ad)
+{
+ void *data = (void *)ad;
+ mh_wifi_setting_view_t *st = &ad->setup;
+
+ st->pw_item = elm_genlist_item_append(genlist, st->pw_itc, data, NULL,
+ ELM_GENLIST_ITEM_NONE, __select_passphrase_item, ad);
+ if (st->security_type == TETHERING_WIFI_SECURITY_TYPE_NONE)
+ elm_object_item_disabled_set(st->pw_item, EINA_TRUE);
+ else
+ elm_object_item_disabled_set(st->pw_item, EINA_FALSE);
+
+ st->check_box_item = elm_genlist_item_append(genlist, st->check_box_itc, data, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+}
+
+static void __destroy_password_item(mh_appdata_t *ad)
+{
+ mh_wifi_setting_view_t *st = &ad->setup;
+
+ elm_object_item_del(st->check_box_item);
+ st->check_box_item = NULL;
+
+ elm_object_item_del(st->pw_item);
+ st->pw_item = NULL;
+}
+
Evas_Object *__create_genlist(mh_appdata_t *ad)
{
__MOBILE_AP_FUNC_ENTER__;
st->security_item = elm_genlist_item_append(genlist, st->security_itc, data, NULL,
ELM_GENLIST_ITEM_NONE, __gl_security_item_sel, data);
- st->pw_item = elm_genlist_item_append(genlist, st->pw_itc, data, NULL,
- ELM_GENLIST_ITEM_NONE, __select_passphrase_item, ad);
- if (st->security_type == TETHERING_WIFI_SECURITY_TYPE_NONE)
- elm_object_item_disabled_set(st->pw_item, EINA_TRUE);
- else
- elm_object_item_disabled_set(st->pw_item, EINA_FALSE);
-
-/* End separator is removed because of P131104-03336. It is confirmed by UX team for this case.
- 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;
-*/
+ if (st->security_type != TETHERING_WIFI_SECURITY_TYPE_NONE)
+ __create_password_item(genlist, ad);
__MOBILE_AP_FUNC_EXIT__;
return;
}
- st->navi_it = elm_naviframe_item_push(ad->naviframe, "IDS_MOBILEAP_MBODY_WI_FI_TETHERING",
+ st->navi_it = elm_naviframe_item_push(ad->naviframe, "IDS_MOBILEAP_BODY_CONFIGURE_MOBILE_HOTSPOT_ABB_US_TMO",
NULL, NULL, st->genlist, NULL);
elm_object_item_domain_text_translatable_set(st->navi_it, PKGNAME, EINA_TRUE);