*
* 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 <efl_extension.h>
#include <app_control_internal.h>
+#include <bundle.h>
+#include <bundle_internal.h>
+#include <aul.h>
#include "mh_common_utility.h"
#include "mobile_hotspot.h"
#include "mh_popup.h"
#include "mh_string.h"
+#define MAX_BUF_SIZE (256u)
+#define NETPOPUP "net.netpopup"
+#define NETWORK_SETTING_APP "org.tizen.setting-network"
+
static mh_popup_type_e popup_type = MH_POPUP_NONE;
static Evas_Object *popup_content = NULL;
static char *popup_string = NULL;
int ret = APP_CONTROL_ERROR_NONE;
app_control_h app_control;
- app_control_create(&app_control);
+ ret = app_control_create(&app_control);
if (ret != APP_CONTROL_ERROR_NONE) {
ERR("app_control_create failed");
return;
}
app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
app_control_set_launch_mode(app_control, APP_CONTROL_LAUNCH_MODE_GROUP);
- app_control_set_app_id(app_control, "setting-network-efl");
+ app_control_set_app_id(app_control, NETWORK_SETTING_APP);
ret = app_control_send_launch_request(app_control, NULL, NULL);
if (ret == APP_CONTROL_ERROR_NONE)
if (state)
_set_checkbox_status(TETHERING_TYPE_USB, 1);
- if (_get_vconf_usb_state() != VCONFKEY_SYSMAN_USB_AVAILABLE) {
+ if (_get_vconf_usb_state() == VCONFKEY_SYSMAN_USB_DISCONNECTED) {
_update_tethering_item(ad, MH_STATE_NONE);
break;
}
__MOBILE_AP_FUNC_EXIT__;
}
+#ifdef TIZEN_FEATURE_EMULATOR
+static void __handle_emul_popup_resp(void *data, bool response)
+{
+ __MOBILE_AP_FUNC_ENTER__;
+
+ if (data == NULL) {
+ ERR("The param is NULL\n");
+ return;
+ }
+
+ mh_appdata_t *ad = (mh_appdata_t *)data;
+ Eina_Bool state = 0;
+
+ if (ad->popup_checkbox) {
+ state = elm_check_state_get(ad->popup_checkbox);
+ evas_object_del(ad->popup_checkbox);
+ ad->popup_checkbox = NULL;
+ DBG("Checkbox status is = %d\n", state);
+ }
+ if (ad->popup) {
+ evas_object_del(ad->popup);
+ ad->popup = NULL;
+ }
+
+ if (response == true) {
+ switch (popup_type) {
+ case MH_POPUP_WIFI_ON_CHECKBOX:
+ if (state)
+ _set_checkbox_status(TETHERING_TYPE_WIFI, 1);
+ ad->is_wifi_teth_enabling = false;
+ break;
+
+ case MH_POPUP_BT_ON_CHECKBOX:
+ if (state)
+ _set_checkbox_status(TETHERING_TYPE_BT, 1);
+ ad->is_bt_teth_enabling = false;
+ break;
+
+ default:
+ ERR("Unknown popup_type : %d\n", popup_type);
+ break;
+ }
+ } else {
+ switch (popup_type) {
+ case MH_POPUP_WIFI_ON_CHECKBOX:
+ _update_tethering_enabling_item(ad, TETHERING_TYPE_WIFI, MH_STATE_NONE);
+ _wifi_tethering_checkbox_popup_status_set(false);
+ break;
+
+ case MH_POPUP_BT_ON_CHECKBOX:
+ _update_tethering_enabling_item(ad, TETHERING_TYPE_BT, MH_STATE_NONE);
+ break;
+
+ default:
+ ERR("Unknown popup_type : %d\n", popup_type);
+ break;
+ }
+ }
+
+ __MOBILE_AP_FUNC_EXIT__;
+}
+#endif
+
void _teth_on(mh_appdata_t *ad)
{
+#ifndef TIZEN_FEATURE_EMULATOR
__handle_popup_resp(ad, true);
+#else
+ __handle_emul_popup_resp(ad, true);
+#endif
}
static void __popup_yes_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
return;
}
+#ifndef TIZEN_FEATURE_EMULATOR
__handle_popup_resp(data, true);
+#else
+ mh_appdata_t *ad = (mh_appdata_t *)data;
+
+ __handle_emul_popup_resp(data, true);
+ _update_emul_main_view(ad, _get_selected_type(), _get_selected_state());
+#endif
}
static void __popup_no_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
return;
}
+#ifndef TIZEN_FEATURE_EMULATOR
__handle_popup_resp(data, false);
+#else
+ __handle_emul_popup_resp(data, false);
+#endif
}
static void __popup_no_btn_mouse_event_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
Evas_Event_Mouse_Up *ev = event_info;
if (ev->button == 3)
+#ifndef TIZEN_FEATURE_EMULATOR
__handle_popup_resp(data, false);
+#else
+ __handle_emul_popup_resp(data, false);
+#endif
}
static void __popup_block_clicked_cb(void *data, Evas_Object *obj, void *event_info)
return;
}
+#ifndef TIZEN_FEAUTRE_EMULATOR
__handle_popup_resp(data, false);
+#else
+ __handle_emul_popup_resp(data, false);
+#endif
}
void _prepare_popup_with_content(int type, Evas_Object *obj)
switch (ad->type) {
case TETHERING_TYPE_WIFI:
- wifi_is_activated(&wifi_state);
+ wifi_manager_is_activated(ad->wifi_handle, &wifi_state);
_set_vconf_prev_wifi_state(wifi_state);
if (wifi_state == true || _is_wifi_direct_on() == true)
fmt = STR_TETH_ON_DESC_1;
case MH_POPUP_WIFI_OFF:
popup = elm_popup_add(ad->win);
+ elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
ad->popup = popup;
elm_object_domain_translatable_part_text_set(popup, "title,text", PACKAGE,
case MH_POPUP_FLIGHT_MODE:
case MH_POPUP_NETWORK_OUT_OF_RANGE:
popup = elm_popup_add(ad->win);
+ elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
ad->popup = popup;
evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
case MH_POPUP_MOBILE_DATA_OFF:
popup = elm_popup_add(ad->win);
+ elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
ad->popup = popup;
evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
case MH_POPUP_WIFI_AP_OFF:
popup = elm_popup_add(ad->win);
+ elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
ad->popup = popup;
evas_object_size_hint_weight_set(popup,
EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
return;
}
+
+void _create_security_restriction_noti(tethering_type_e type)
+{
+ bundle *b = NULL;
+ char restricted_type[MAX_BUF_SIZE] = {0, };
+ int ret;
+
+ switch (type) {
+ case TETHERING_TYPE_WIFI:
+ g_strlcpy(restricted_type, "wifi tethering", MAX_BUF_SIZE - 1);
+ break;
+ case TETHERING_TYPE_USB:
+ g_strlcpy(restricted_type, "usb tethering", MAX_BUF_SIZE - 1);
+ break;
+ case TETHERING_TYPE_BT:
+ g_strlcpy(restricted_type, "bt tethering", MAX_BUF_SIZE - 1);
+ break;
+ default:
+ ERR("Invalid type.\n");
+ return;
+ }
+ b = bundle_create();
+
+ bundle_add(b, "_SYSPOPUP_TYPE_", "toast_popup");
+ bundle_add(b, "_SYSPOPUP_CONTENT_", "security restriction");
+ bundle_add(b, "_RESTRICTED_TYPE_", restricted_type);
+
+ DBG("Launch security restriction alert network popup");
+ ret = aul_launch_app(NETPOPUP, b);
+ if (ret < 0)
+ ERR("Fail to launch syspopup");
+
+ bundle_free(b);
+ return;
+}