/*
* net-popup
*
-* Copyright 2012-2013 Samsung Electronics Co., Ltd
+* Copyright 2012 Samsung Electronics Co., Ltd
*
-* Licensed under the Apache License, Version 2.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
*
-* http://www.apache.org/licenses/LICENSE-2.0
+* http://www.tizenopensource.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
*
*/
+#include <glib.h>
#include <stdio.h>
+#if 0
+#include <Ecore_X.h>
+#endif
#include <syspopup.h>
-#include <glib.h>
-#include <status.h>
#include <notification.h>
#include <notification_list.h>
-#include <notification_internal.h>
#include <notification_text_domain.h>
-#include <appcore-efl.h>
+#include <app.h>
+#include <app_control.h>
#include <appsvc.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+#include <gio/gio.h>
+#include <dbus/dbus.h>
+#include <efl_extension.h>
+#include <tzplatform_config.h>
+#include <vpn_service.h>
+#include <vpn_service_internal.h>
+#include <stc.h>
+#include <stc_internal.h>
+#include <system_info.h>
#include "net-popup.h"
+#include "net-popup-w.h"
+#include "net-popup-vpn.h"
#include "net-popup-strings.h"
+#define NET_POPUP_APPID "org.tizen.net-popup"
+#define NET_WIFIQS_APPID "net.wifi-qs"
+#define DATA_USAGE_APPID "org.tizen.setting"
+#define WIFI_EFL_UG "wifi-efl-ug"
+
#define LOCALEDIR "/usr/share/locale"
+#define NETPOPUP_EDJ "/usr/apps/" \
+ NET_POPUP_APPID \
+ "/res/edje/netpopup-custom.edj"
+#define QP_PRELOAD_NOTI_ICON_PATH tzplatform_mkpath(TZ_SYS_RO_APP, "/org.tizen.quickpanel/shared/res/noti_icons/Wi-Fi")
+
+#define STC_NOTI_DATA_USAGE_ICON_PATH "/usr/share/icons/"
+#define STC_NOTI_DATA_USAGE_ICON_NAME "stc_noti_datausage.png"
#define NETCONFIG_NOTIFICATION_WIFI_ICON \
- "/usr/share/icon/Q02_Notification__wifi_in_range.png"
+ tzplatform_mkpath(TZ_SYS_RO_ICONS, "/noti_wifi_in_range.png")
+#define NETCONFIG_NOTIFICATION_WIFI_ICON_LITE \
+ tzplatform_mkpath(TZ_SYS_RO_ICONS, "/noti_wifi_in_range_ongoing.png")
+#define NETCONFIG_NOTIFICATION_WIFI_CAPTIVE_ICON \
+ tzplatform_mkpath(TZ_SYS_RO_ICONS, "/B03_notify_Wi-fi_range.png")
+#define NETCONFIG_NOTIFICATION_WIFI_IN_RANGE_ICON \
+ tzplatform_mkpath(TZ_SYS_RO_ICONS, "/Q02_Notification_wifi_in_range.png")
+#define NETCONFIG_NOTIFICATION_WIFI_IN_RANGE_ICON_LITE \
+ tzplatform_mkpath(TZ_SYS_RO_ICONS, "/noti_wifi_in_range.png")
#define NETCONFIG_NOTIFICATION_WIFI_FOUND_TITLE \
- dgettext(PACKAGE, "IDS_COM_BODY_WI_FI_NETWORKS_AVAILABLE")
+ dgettext(DOMAIN_NAME, "IDS_COM_BODY_WI_FI_NETWORKS_AVAILABLE")
#define NETCONFIG_NOTIFICATION_WIFI_FOUND_CONTENT \
- dgettext(PACKAGE, "IDS_WIFI_BODY_OPEN_WI_FI_SETTINGS_ABB")
-#define NETCONFIG_NOTIFICATION_MANUAL_NETWORK_FAIL_NO_SERVICE \
- dgettext("sys_string", "IDS_COM_BODY_NO_SERVICE")
-#define NETCONFIG_NOTIFICATION_MANUAL_NETWORK_FAIL_NOT_AVAILABLE \
- dgettext(PACKAGE, "IDS_COM_BODY_SELECTED_NETWORK_HPS_NOT_AVAILABLE")
-
-static int __net_popup_show_tickernoti(bundle *b, void *data);
-static int __net_popup_show_popup(bundle *b, void *data);
+ dgettext(DOMAIN_NAME, "IDS_WIFI_SBODY_TAP_HERE_TO_CONNECT")
+#define NETCONFIG_NOTIFICATION_WIFI_PORTAL_TITLE \
+ dgettext(DOMAIN_NAME, "IDS_WIFI_HEADER_SIGN_IN_TO_WI_FI_NETWORK_ABB")
+#define NETCONFIG_NOTIFICATION_IP_CONFLICT_TITLE \
+ dgettext(DOMAIN_NAME, "IDS_IP_CONFLICT")
+#define NETCONFIG_NOTIFICATION_WIFI_PORTAL_CONTENT "\"%s\""
+
+#define STC_NOTIFICATION_WARNING_TITLE \
+ dgettext(DOMAIN_NAME, "IDS_COM_BODY_DATA_USAGE_WARNING")
+#define STC_NOTIFICATION_WARNING_CONTENT \
+ dgettext(DOMAIN_NAME, "IDS_SM_SBODY_TAP_HERE_TO_VIEW_YOUR_DATA_USAGE_ABB")
+#define STC_NOTIFICATION_RESTRICTION_OK_TITLE \
+ dgettext(DOMAIN_NAME, "IDS_SM_HEADER_MOBILE_DATA_TURNED_OFF_ABB2")
+#define STC_NOTIFICATION_RESTRICTION_OK_CONTENT \
+ dgettext(DOMAIN_NAME, "IDS_SM_SBODY_TAP_HERE_TO_TURN_IT_ON_AGAIN_ABB")
+#define STC_NOTIFICATION_RESTRICTION_ON_TITLE \
+ dgettext(DOMAIN_NAME, "IDS_SM_TMBODY_MOBILE_DATA_LIMIT_EXCEEDED_ABB")
+
+#define STC_TOTAL_DATACALL "TOTAL_DATACALL"
+#define STC_TOTAL_WIFI "TOTAL_WIFI"
+#define STC_TOTAL_BLUETOOTH "TOTAL_BLUETOOTH"
+
+#define USER_RESP_LEN 30
+#define ICON_PATH_LEN 128
+#define RESP_REMAIN_CONNECTED "RESP_REMAIN_CONNECTED"
+#define RESP_WIFI_TETHERING_OFF "RESP_TETHERING_TYPE_WIFI_OFF"
+#define RESP_WIFI_AP_TETHERING_OFF "RESP_TETHERING_TYPE_WIFI_AP_OFF"
+#define RESP_TETHERING_ON "RESP_TETHERING_ON"
+#define CAPTIVE_PORTAL_LOGIN "Login required to access Internet"
+#define CAPTIVE_PORTAL_LOGIN_ERROR "Login not completed. Disconnected active Wifi"
+
+static Ecore_Event_Handler *ecore_event_evas_handler;
+static Ecore_Event_Handler *ecore_event_evas_quick_panel_handler;
+
+#define BUF_SIZE 1024
+long sizes[] = {1073741824, 1048576, 1024, 0};
+char *units[] = {"GB", "MB", "KB", "B"};
+
+static tizen_profile_t g_profile = TIZEN_PROFILE_UNKNOWN;
+
+static app_control_h g_req_handle = NULL;
+static char *resp_popup_mode = NULL;
+
+static GDBusConnection *conn = NULL;
+static GDBusProxy *proxy = NULL;
+
+/* vpn-service popup */
+static char *iface_name = NULL;
+
+/* data roaming popup */
+static Eina_Bool turn_on_roaming = FALSE;
+static Eina_Bool do_not_show_popup = FALSE;
+
+/* data usage popup */
+static char *data_usage_app_id = NULL;
+static char *data_usage_iftype = NULL;
+
+static int __net_popup_show_notification(app_control_h request, void *data);
+static int __toast_popup_show(app_control_h request, void *data);
+static int __net_popup_show_popup(app_control_h request, void *data);
+static void __net_popup_show_warning_noti(app_control_h request, void *data);
+static void __net_popup_show_restriction_noti(app_control_h request, void *data);
static void __net_popup_add_found_ap_noti(void);
static void __net_popup_del_found_ap_noti(void);
-static void __net_popup_add_manual_network_fail_noti(bundle *b);
-static void __net_popup_del_manual_network_fail_noti(void);
-static void __net_popup_add_restricted_state_noti(bundle *b);
-static void __net_popup_del_restricted_state_noti(void);
+static void __net_popup_add_portal_noti(app_control_h request);
+static void __net_popup_del_portal_noti(void);
+static void __net_popup_show_popup_with_user_resp(app_control_h request, void *data);
+static void __net_popup_show_vpn_popup(app_control_h request, void *data);
+static int _net_popup_send_user_resp(char *resp, Eina_Bool state);
+static int __net_popup_show_network_error_popup(app_control_h request, void *data);
+static void __net_popup_add_ip_conflict_noti(app_control_h request);
+static void __net_popup_del_ip_conflict_noti(void);
+
+static void __net_popup_get_tizen_profile(void)
+{
+ char *profile_name = NULL;
+
+ system_info_get_platform_string("http://tizen.org/feature/profile", &profile_name);
+
+ switch (*profile_name) {
+ case 'm':
+ case 'M':
+ g_profile = TIZEN_PROFILE_MOBILE;
+ log_print(NET_POPUP, "mobile profile\n");
+ break;
+ case 'w':
+ case 'W':
+ g_profile = TIZEN_PROFILE_WEARABLE;
+ log_print(NET_POPUP, "wearable profile\n");
+ break;
+ case 't':
+ case 'T':
+ g_profile = TIZEN_PROFILE_TV;
+ log_print(NET_POPUP, "tv profile\n");
+ break;
+ case 'i':
+ case 'I':
+ g_profile = TIZEN_PROFILE_IVI;
+ log_print(NET_POPUP, "ivi profile\n");
+ break;
+ default:
+ g_profile = TIZEN_PROFILE_COMMON;
+ log_print(NET_POPUP, "common profile\n");
+ }
+ free(profile_name);
+}
+
+GDBusProxy *__net_popup_init_dbus(void)
+{
+ log_print(NET_POPUP, "__net_popup_init_dbus()\n");
+
+ GError *err = NULL;
+
+ conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
+ if (err != NULL) {
+ g_error_free(err);
+ return NULL;
+ }
+
+ proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+ NET_POPUP_APPID,
+ "/Netpopup",
+ NET_POPUP_APPID,
+ NULL, &err);
+
+ if (proxy == NULL) {
+ g_object_unref(conn);
+ conn = NULL;
+ }
+
+ return proxy;
+}
+
+void __net_popup_deinit_dbus(void)
+{
+ log_print(NET_POPUP, "__net_popup_deinit_dbus()\n");
+
+ if (proxy) {
+ g_object_unref(proxy);
+ proxy = NULL;
+ }
+
+ if (conn) {
+ g_object_unref(conn);
+ conn = NULL;
+ }
+
+ return;
+}
+
+void __net_popup_send_data_usage_msg(const char *app_id,
+ const char *iftype)
+{
+ log_print(NET_POPUP, "__net_popup_send_data_usage_msg()\n");
+
+ int ret = STC_ERROR_NONE;
+ stc_h stc = NULL;
+ stc_restriction_rule_h rule = NULL;
+
+ ret = stc_initialize(&stc);
+ if (ret != STC_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to initialize ret= %d\n", ret);
+ goto DONE;
+ }
+
+ ret = stc_restriction_rule_create(stc, &rule);
+ if (ret != STC_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to create restriction rule ret= %d\n", ret);
+ goto DONE;
+ }
+
+ ret = stc_restriction_rule_set_app_id(rule, app_id);
+ if (ret != STC_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to set application ID ret= %d\n", ret);
+ goto DONE;
+ }
+
+ ret = stc_restriction_rule_set_iface_type(rule, iftype[0] - '0');
+ if (ret != STC_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to set interface type ret= %d\n", ret);
+ goto DONE;
+ }
+
+ ret = stc_unset_restriction(stc, rule);
+ if (ret != STC_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to unset restriction ret= %d\n", ret);
+ goto DONE;
+ }
+
+ log_print(NET_POPUP, "Success to unset restriction\n");
+
+DONE:
+ if (rule) {
+ ret = stc_restriction_rule_destroy(rule);
+ if (ret != STC_ERROR_NONE)
+ log_print(NET_POPUP, "Failed to destroy restriction rule ret= %d\n", ret);
+ }
+
+ if (stc) {
+ ret = stc_deinitialize(stc);
+ if (ret != STC_ERROR_NONE)
+ log_print(NET_POPUP, "Failed to deinitialize ret= %d\n", ret);
+ }
+
+ return;
+}
+
+static bool __net_popup_create(void *data)
+{
+ log_print(NET_POPUP, "__net_popup_create()\n");
+
+ bindtextdomain(DOMAIN_NAME, LOCALEDIR);
+
+ return true;
+}
+
+static void __net_popup_terminate(void *data)
+{
+ log_print(NET_POPUP, "__net_popup_terminate()\n");
+
+ if (ecore_event_evas_handler) {
+ ecore_event_handler_del(ecore_event_evas_handler);
+ ecore_event_evas_handler = NULL;
+ }
+
+ if (ecore_event_evas_quick_panel_handler) {
+ ecore_event_handler_del(ecore_event_evas_quick_panel_handler);
+ ecore_event_evas_quick_panel_handler = NULL;
+ }
+
+ if (g_req_handle) {
+ app_control_destroy(g_req_handle);
+ g_req_handle = NULL;
+ }
+
+ if (resp_popup_mode) {
+ free(resp_popup_mode);
+ resp_popup_mode = NULL;
+ }
+
+ if (iface_name) {
+ free(iface_name);
+ iface_name = NULL;
+ }
+
+ return;
+}
+
+static void __net_popup_pause(void *data)
+{
+ log_print(NET_POPUP, "__net_popup_pause()\n");
+}
+
+static void __net_popup_resume(void *data)
+{
+ return;
+}
+
+static Eina_Bool __key_release_event_cb(void *data, int type,
+ void *event)
+{
+ log_print(NET_POPUP, "__key_release_event_cb()\n");
+
+ Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *) event;
+
+ if (!ev)
+ return ECORE_CALLBACK_RENEW;
+
+ if (!ev->keyname)
+ return ECORE_CALLBACK_RENEW;
+
+ log_print(NET_POPUP, "key_release : %s", ev->keyname);
+ if (g_strcmp0(ev->keyname, "XF86Phone") == 0 ||
+ g_strcmp0(ev->keyname, "XF86Stop") == 0) {
+ elm_exit();
+ }
+
+ return ECORE_CALLBACK_DONE;
+}
+
+#if 0
+static Eina_Bool _ecore_event_client_message_cb(void *data, int type,
+ void *event)
+{
+ Ecore_X_Event_Client_Message *ev = event;
+
+ if (ev->message_type == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE) {
+ if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF)
+ log_print(NET_POPUP, "ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF");
+ else if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON)
+ log_print(NET_POPUP, "ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON");
+ }
+ return ECORE_CALLBACK_RENEW;
+}
+#endif
+
+static void __net_popup_service_cb(app_control_h request, void *data)
+{
+ log_print(NET_POPUP, "__net_popup_service_cb()\n");
+
+ int ret = 0;
+ char *operation = NULL;
+ char *type = NULL;
+
+ if (ecore_event_evas_handler == NULL) {
+ ecore_event_evas_handler = ecore_event_handler_add(ECORE_EVENT_KEY_UP,
+ __key_release_event_cb, NULL);
+ }
+
+ ret = app_control_get_operation(request, &operation);
+ if (APP_CONTROL_ERROR_NONE != ret)
+ log_print(NET_POPUP, "Failed to get operation ret= %d", ret);
+
+ if (operation != NULL && g_str_equal(operation, APP_CONTROL_OPERATION_SETTING_VPN)) {
+ app_control_clone(&g_req_handle, request);
+ __net_popup_show_vpn_popup(request, data);
+ if (operation) {
+ free(operation);
+ operation = NULL;
+ }
+ return;
+ }
+
+ if (operation) {
+ free(operation);
+ operation = NULL;
+ }
+
+ ret = app_control_get_extra_data(request, "_SYSPOPUP_TYPE_", &type);
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ log_print(NET_POPUP, "Failed to get _SYSPOPUP_TYPE_ ret = %d", ret);
+ g_free(type);
+ elm_exit();
+ return;
+ }
+
+ log_print(NET_POPUP, "type = %s\n", type);
+
+ if (g_str_equal(type, "notification")) {
+ __net_popup_show_notification(request, data);
+ elm_exit();
+ } else if (g_str_equal(type, "toast_popup")) {
+ __toast_popup_show(request, data);
+ } else if (g_str_equal(type, "popup")) {
+ __net_popup_show_popup(request, data);
+ } else if (g_str_equal(type, "warning_noti")) {
+ __net_popup_show_warning_noti(request, data);
+ elm_exit();
+ } else if (g_str_equal(type, "restriction_noti")) {
+ __net_popup_show_restriction_noti(request, data);
+ } else if (g_str_equal(type, "add_found_ap_noti")) {
+ __net_popup_add_found_ap_noti();
+ elm_exit();
+ } else if (g_str_equal(type, "del_found_ap_noti")) {
+ __net_popup_del_found_ap_noti();
+ elm_exit();
+ } else if (g_str_equal(type, "add_portal_noti")) {
+ __net_popup_add_portal_noti(request);
+ elm_exit();
+ } else if (g_str_equal(type, "del_portal_noti")) {
+ __net_popup_del_portal_noti();
+ elm_exit();
+ } else if (g_str_equal(type, "add_ip_conflict_noti")) {
+ __net_popup_add_ip_conflict_noti(request);
+ elm_exit();
+ } else if (g_str_equal(type, "del_ip_conflict_noti")) {
+ __net_popup_del_ip_conflict_noti();
+ elm_exit();
+ } else if (g_str_equal(type, "popup_user_resp")) {
+ app_control_clone(&g_req_handle, request);
+ __net_popup_show_popup_with_user_resp(request, data);
+ } else if (g_str_equal(type, "network_error_popup")) {
+ __net_popup_show_network_error_popup(request, data);
+ } else {
+ __net_popup_show_notification(request, data);
+ elm_exit();
+ }
+
+ g_free(type);
+
+ return;
+}
+
+static void __net_popup_set_orientation(Evas_Object *win)
+{
+ log_print(NET_POPUP, "__net_popup_set_orientation()\n");
+
+ int rots[4] = { 0, 90, 180, 270 };
+
+ if (!elm_win_wm_rotation_supported_get(win))
+ return;
+
+ elm_win_wm_rotation_available_rotations_set(win, rots, 4);
+}
+
+static Evas_Object* __net_popup_create_win(void)
+{
+ log_print(NET_POPUP, "__net_popup_create_win()\n");
+
+ Evas_Object *win = NULL;
+ Evas *e = NULL;
+ Ecore_Evas *ee = NULL;
+#if 0
+ int w, h;
+#endif
+
+ win = elm_win_add(NULL, PACKAGE, ELM_WIN_NOTIFICATION);
+
+ e = evas_object_evas_get(win);
+ ee = ecore_evas_ecore_evas_get(e);
+ ecore_evas_name_class_set(ee, "APP_POPUP", "APP_POPUP");
+
+ elm_win_alpha_set(win, EINA_TRUE);
+ elm_win_borderless_set(win, EINA_TRUE);
+#if 0
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
+ evas_object_resize(win, w, h);
+ utilx_set_system_notification_level(ecore_x_display_get(),
+ elm_win_xwindow_get(win),
+ UTILX_NOTIFICATION_LEVEL_LOW);
+#endif
+
+ __net_popup_set_orientation(win);
+
+ return win;
+}
+
+static void __launch_app_control(char *operation)
+{
+ app_control_h app_control;
+
+ app_control_create(&app_control);
+ if (app_control == NULL) {
+ log_print(NET_POPUP, "Failed to create app control handle");
+ return;
+ }
+
+ app_control_set_operation(app_control, operation);
+ if (app_control_send_launch_request(app_control, NULL, NULL) == APP_CONTROL_ERROR_NONE)
+ log_print(NET_POPUP, "Succeeded to launch %s", operation);
+ else
+ log_print(NET_POPUP, "Failed to launch %s", operation);
+
+ app_control_destroy(app_control);
+}
+
+static void __data_roaming_check_changed_cb(void* data, Evas_Object* obj, void* event_info)
+{
+ turn_on_roaming = elm_check_state_get(obj);
+ log_print(NET_POPUP, "Romaing(%d)", turn_on_roaming);
+}
+
+static void __do_not_show_check_changed_cb(void* data, Evas_Object* obj, void* event_info)
+{
+ do_not_show_popup = elm_check_state_get(obj);
+ log_print(NET_POPUP, "Do not show again(%d)", do_not_show_popup);
+}
+
+static void _ok_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ log_print(NET_POPUP, "_ok_button_clicked_cb()\n");
+
+ if (data)
+ evas_object_del(data);
+ elm_exit();
+}
+
+static void _cancel_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ log_print(NET_POPUP, "_cancel_button_clicked_cb()");
+
+ if (data)
+ evas_object_del(data);
+
+ elm_exit();
+}
+
+static void _wifi_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ log_print(NET_POPUP, "_wifi_button_clicked_cb()");
+
+ __launch_app_control(APP_CONTROL_OPERATION_SETTING_WIFI);
+
+ if (data)
+ evas_object_del(data);
+
+ elm_exit();
+}
+
+static void _settings_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ log_print(NET_POPUP, "_settings_button_clicked_cb()");
+
+ __launch_app_control(APP_CONTROL_OPERATION_SETTING);
+
+ if (data)
+ evas_object_del(data);
+
+ elm_exit();
+}
+
+static void _retry_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ log_print(NET_POPUP, "_retry_button_clicked_cb()");
+
+ int ret = vconf_set_bool(VCONFKEY_3G_ENABLE, 1);
+ if (ret)
+ log_print(NET_POPUP, "Failed to enable mobile data");
+
+ if (data)
+ evas_object_del(data);
+
+ elm_exit();
+}
+
+static void _data_raoming_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ log_print(NET_POPUP, "_data_roaming_button_clicked_cb()");
+
+ int ret = vconf_set_bool(VCONFKEY_SETAPPL_STATE_DATA_ROAMING_BOOL, turn_on_roaming);
+ if (ret)
+ log_print(NET_POPUP, "Failed to enable mobile data");
+
+ if (data)
+ evas_object_del(data);
+
+ elm_exit();
+}
+
+static void _connect_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ log_print(NET_POPUP, "_connect_button_clicked_cb()");
+
+ int ret = vconf_set_bool(VCONFKEY_3G_ENABLE, 1);
+ if (ret)
+ log_print(NET_POPUP, "Failed to enable mobile data");
+
+ if (data)
+ evas_object_del(data);
+
+ elm_exit();
+}
+
+static void _timeout_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ log_print(NET_POPUP, "_timeout_cb()\n");
+
+ evas_object_del(obj);
+
+ elm_exit();
+}
+
+static int __toast_popup_show(app_control_h request, void *data)
+{
+ log_print(NET_POPUP, "__toast_popup_show()\n");
+
+ char buf[ALERT_STR_LEN_MAX] = "";
+ int ret = 0;
+ char *mode = NULL;
+ Evas_Object *twin = NULL;
+ Evas_Object *tpop = NULL;
+ char *ap_name = NULL;
+ char *restricted_type = NULL;
+
+ ret = app_control_get_extra_data(request, "_SYSPOPUP_CONTENT_", &mode);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to get _SYSPOPUP_CONTENT_ ret = %d", ret);
+ g_free(mode);
+ elm_exit();
+ return 0;
+ }
+
+ log_print(NET_POPUP, "_SYSPOPUP_CONTENT_ = %s\n", mode);
+
+ twin = __net_popup_create_win();
+ tpop = elm_popup_add(twin);
+ elm_object_style_set(tpop, "toast");
+ evas_object_size_hint_weight_set(tpop, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ elm_popup_timeout_set(tpop, 2.0);
+
+ evas_object_smart_callback_add(tpop, "timeout", _timeout_cb, twin);
+ if (strcmp(mode, "wrong password") == 0) {
+ log_print(NET_POPUP, "alert wrong password\n");
+
+ g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_ERR_WRONG_PASSWORD);
+ } else if (strcmp(mode, "no ap found") == 0) {
+ log_print(NET_POPUP, "alert no ap found\n");
+
+ g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_NO_AP_FOUND);
+ } else if (strcmp(mode, "unable to connect") == 0) {
+ log_print(NET_POPUP, "alert no ap found\n");
+
+ g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_ERR_CONNECT);
+ } else if (strcmp(mode, "wifi connected") == 0) {
+ ret = app_control_get_extra_data(request, "_AP_NAME_", &ap_name);
+
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ log_print(NET_POPUP, "Failed to get _AP_NAME_ ret = %d", ret);
+ g_free(mode);
+ return 0;
+ }
+
+ if (ap_name != NULL)
+ g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_WIFI_CONNECTED, ap_name);
+ else
+ g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_WIFI_CONNECTED, "");
+ log_print(NET_POPUP, "alert wifi connected\n");
+ g_free(ap_name);
+ } else if (strcmp(mode, "warn threshold crossed") == 0) {
+ char *app_id = NULL;
+
+ ret = app_control_get_extra_data(request, "_APP_ID_", &app_id);
+
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ log_print(NET_POPUP, "Failed to get _APP_ID_ ret = %d", ret);
+ g_free(mode);
+ return 0;
+ }
+
+ g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_DATA_USAGE_WARNING);
+
+ log_print(NET_POPUP, "alert warn threshold crossed [%s]\n", app_id);
+ g_free(app_id);
+ } else if (strcmp(mode, "security restriction") == 0) {
+ ret = app_control_get_extra_data(request, "_RESTRICTED_TYPE_", &restricted_type);
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ log_print(NET_POPUP, "Failed to get _RESTRICTED_TYPE_ ret = %d", ret);
+ g_free(mode);
+ return 0;
+ }
+
+ if (strcmp(restricted_type, "wifi") == 0)
+ g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_RESTRICTED_USE_WIFI);
+ else if (strcmp(restricted_type, "wifi tethering") == 0)
+ g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_SECURITY_RESTRICTION, ALERT_STR_WIFI_TETHERING);
+ else if (strcmp(restricted_type, "bt tethering") == 0)
+ g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_SECURITY_RESTRICTION, ALERT_STR_BT_TETHERING);
+ else if (strcmp(restricted_type, "usb tethering") == 0)
+ g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_SECURITY_RESTRICTION, ALERT_STR_USB_TETHERING);
+
+ log_print(NET_POPUP, "alert security restriction\n");
+ g_free(restricted_type);
+ } else
+ log_print(NET_POPUP, "%s\n", mode);
+
+ elm_object_text_set(tpop, buf);
+ evas_object_show(tpop);
+ evas_object_show(twin);
+ g_free(mode);
+
+ return 0;
+}
+
+static int __net_popup_show_notification(app_control_h request, void *data)
+{
+ log_print(NET_POPUP, "__net_popup_show_notification()\n");
+
+ int ret = 0;
+ char *mode = NULL;
+ char buf[ALERT_STR_LEN_MAX] = "";
+ char *ap_name = NULL;
+
+ ret = app_control_get_extra_data(request, "_SYSPOPUP_CONTENT_", &mode);
+
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ log_print(NET_POPUP, "Failed to get _SYSPOPUP_CONTENT_");
+ return 0;
+ }
+
+ secure_log_print(NET_POPUP, "_SYSPOPUP_CONTENT_ = %s\n", mode);
+
+ if (strcmp(mode, "connected") == 0) {
+ notification_status_message_post(ALERT_STR_MOBILE_NETWORKS_CHARGE);
+ log_print(NET_POPUP, "alert 3g\n");
+ } else if (strcmp(mode, "fail to connect") == 0) {
+ notification_status_message_post(ALERT_STR_ERR_UNAVAILABLE);
+ log_print(NET_POPUP, "alert err\n");
+ } else if (strcmp(mode, "unable to connect") == 0) {
+ notification_status_message_post(ALERT_STR_ERR_CONNECT);
+ log_print(NET_POPUP, "alert unable to connect\n");
+ } else if (strcmp(mode, "wrong password") == 0) {
+ notification_status_message_post(ALERT_STR_ERR_WRONG_PASSWORD);
+ log_print(NET_POPUP, "alert wrong password\n");
+ } else if (strcmp(mode, "not support") == 0) {
+ notification_status_message_post(ALERT_STR_ERR_NOT_SUPPORT);
+ log_print(NET_POPUP, "alert not support\n");
+ } else if (strcmp(mode, "wifi restricted") == 0) {
+ notification_status_message_post(ALERT_STR_RESTRICTED_USE_WIFI);
+ log_print(NET_POPUP, "alert wifi restricted\n");
+ } else if (strcmp(mode, "no ap found") == 0) {
+ notification_status_message_post(ALERT_STR_NO_AP_FOUND);
+ log_print(NET_POPUP, "alert no ap found\n");
+ } else if (strcmp(mode, "Lengthy Password") == 0) {
+ notification_status_message_post(ALERT_STR_LENGHTY_PASSWORD);
+ log_print(NET_POPUP, "Password entered crosses 64 bytes\n");
+ } else if (strcmp(mode, "Portal Login") == 0) {
+ notification_status_message_post(CAPTIVE_PORTAL_LOGIN);
+ log_print(NET_POPUP, "Please login to access Internet\n");
+ } else if (strcmp(mode, "Portal Login Error") == 0) {
+ notification_status_message_post(CAPTIVE_PORTAL_LOGIN_ERROR);
+ log_print(NET_POPUP, "Login not completed. Disconnected Wifi\n");
+ } else if (strcmp(mode, "wifi connected") == 0) {
+ ret = app_control_get_extra_data(request, "_AP_NAME_", &ap_name);
+
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ log_print(NET_POPUP, "Failed to get _AP_NAME_ ret = %d", ret);
+ g_free(mode);
+ return 0;
+ }
+
+ if (ap_name != NULL)
+ g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_WIFI_CONNECTED, ap_name);
+ else
+ g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_WIFI_CONNECTED, "");
+
+ notification_status_message_post(buf);
+
+ log_print(NET_POPUP, "alert wifi connected\n");
+ g_free(ap_name);
+ } else if (strcmp(mode, "warn threshold crossed") == 0) {
+ char buf[ALERT_STR_LEN_MAX] = "";
+ char *app_id = NULL;
+
+ ret = app_control_get_extra_data(request, "_APP_ID_", &app_id);
+
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ log_print(NET_POPUP, "Failed to get _APP_ID_ ret = %d", ret);
+ g_free(mode);
+ return 0;
+ }
+
+ g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_DATA_USAGE_WARNING);
+
+ notification_status_message_post(buf);
+
+ log_print(NET_POPUP, "alert warn threshold crossed [%s]\n", app_id);
+ g_free(app_id);
+ } else {
+ notification_status_message_post(mode);
+ log_print(NET_POPUP, "%s\n", mode);
+ }
+ g_free(mode);
+
+ return 0;
+}
+
+static int _net_popup_send_user_resp(char *resp, Eina_Bool state)
+{
+ log_print(NET_POPUP, "_net_popup_send_user_resp()\n");
+
+ int ret = 0;
+ app_control_h reply = NULL;
+ char checkbox_str[USER_RESP_LEN] = { '\0', };
+
+ log_print(NET_POPUP, "Send the user response to the caller");
+ ret = app_control_create(&reply);
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ log_print(NET_POPUP, "Failed to create service ret = %d", ret);
+ app_control_destroy(g_req_handle);
+ g_req_handle = NULL;
+
+ return false;
+ }
+
+ if (TRUE == state)
+ g_strlcpy(checkbox_str, "TRUE", USER_RESP_LEN);
+ else
+ g_strlcpy(checkbox_str, "FALSE", USER_RESP_LEN);
+
+ log_print(NET_POPUP, "Checkbox_str[%s]", checkbox_str);
+
+ ret = app_control_add_extra_data(reply, "_SYSPOPUP_RESP_", resp);
+ if (APP_CONTROL_ERROR_NONE == ret) {
+ ret = app_control_add_extra_data(reply, "_SYSPOPUP_CHECKBOX_RESP_",
+ checkbox_str);
+ if (APP_CONTROL_ERROR_NONE == ret) {
+ ret = app_control_reply_to_launch_request(reply, g_req_handle,
+ APP_CONTROL_RESULT_SUCCEEDED);
+ if (APP_CONTROL_ERROR_NONE == ret) {
+ log_print(NET_POPUP, "Service reply success");
+ ret = TRUE;
+ } else {
+ log_print(NET_POPUP, "Service reply failed ret = %d", ret);
+ }
+ } else {
+ log_print(NET_POPUP, "Service data addition failed ret = %d", ret);
+ }
+ } else {
+ log_print(NET_POPUP, "Service data addition failed ret = %d", ret);
+ }
+
+ app_control_destroy(reply);
+ app_control_destroy(g_req_handle);
+ g_req_handle = NULL;
+
+ return ret;
+}
+
+static Evas_Object *__net_popup_create_checkview_layout(Evas_Object *parent)
+{
+ Evas_Object *layout = NULL;
+
+ layout = elm_layout_add(parent);
+ elm_layout_file_set(layout, NETPOPUP_EDJ, "popup_checkview");
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, 1.0);
+ elm_object_content_set(parent, layout);
+
+ return layout;
+}
+
+static Evas_Object *__net_popup_create_label(Evas_Object *parent)
+{
+ Evas_Object *label = NULL;
+
+ label = elm_label_add(parent);
+ elm_object_style_set(label, "popup/default");
+ elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
+ evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(label);
+
+ return label;
+}
+
+static Evas_Object *__net_popup_create_cancel_button(Evas_Object *parent)
+{
+ Evas_Object *btn = NULL;
+
+ btn = elm_button_add(parent);
+ elm_object_style_set(btn, "popup");
+ elm_object_text_set(btn, ALERT_STR_CANCEL);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(btn, "clicked", _cancel_button_clicked_cb, parent);
+
+ return btn;
+}
+
+static Evas_Object *__net_popup_create_wifi_button(Evas_Object *parent)
+{
+ Evas_Object *btn = NULL;
+
+ btn = elm_button_add(parent);
+ elm_object_style_set(btn, "popup");
+ elm_object_text_set(btn, ALERT_STR_WIFI);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(btn, "clicked", _wifi_button_clicked_cb, parent);
+
+ return btn;
+}
+
+static Evas_Object *__net_popup_create_settings_button(Evas_Object *parent)
+{
+ Evas_Object *btn = NULL;
+
+ btn = elm_button_add(parent);
+ elm_object_style_set(btn, "popup");
+ elm_object_text_set(btn, ALERT_STR_SETTINGS);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(btn, "clicked", _settings_button_clicked_cb, parent);
+
+ return btn;
+}
+
+static Evas_Object *__net_popup_create_retry_button(Evas_Object *parent)
+{
+ Evas_Object *btn = NULL;
+
+ btn = elm_button_add(parent);
+ elm_object_style_set(btn, "popup");
+ elm_object_text_set(btn, ALERT_STR_RETRY);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(btn, "clicked", _retry_button_clicked_cb, parent);
+
+ return btn;
+}
+
+static Evas_Object *__net_popup_create_data_roaming_button(Evas_Object *parent)
+{
+ Evas_Object *btn = NULL;
+
+ btn = elm_button_add(parent);
+ elm_object_style_set(btn, "popup");
+ elm_object_text_set(btn, ALERT_STR_OK);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(btn, "clicked", _data_raoming_button_clicked_cb, parent);
+
+ return btn;
+}
+
+static Evas_Object *__net_popup_create_connect_button(Evas_Object *parent)
+{
+ Evas_Object *btn = NULL;
+
+ btn = elm_button_add(parent);
+ elm_object_style_set(btn, "popup");
+ elm_object_text_set(btn, ALERT_STR_VPN_CONNECT_BUTTON);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(btn, "clicked", _connect_button_clicked_cb, parent);
+
+ return btn;
+}
+
+static int __net_popup_show_network_error_popup(app_control_h request, void *data)
+{
+ log_print(NET_POPUP, "__net_popup_show_network_error_popup()\n");
+
+ Evas_Object *win;
+ Evas_Object *popup;
+ Evas_Object *layout;
+ Evas_Object *label;
+ Evas_Object *check;
+ Evas_Object *btn1, *btn2, *btn3;
+ int ret = 0;
+ char *mode = NULL;
+
+ ret = app_control_get_extra_data(request, "_SYSPOPUP_CONTENT_", &mode);
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ log_print(NET_POPUP, "Failed to get _SYSPOPUP_CONTENT_ ret = %d", ret);
+ g_free(mode);
+ elm_exit();
+ return 0;
+ }
+
+ secure_log_print(NET_POPUP, "_SYSPOPUP_CONTENT_ = %s\n", mode);
+
+ win = __net_popup_create_win();
+ popup = elm_popup_add(win);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ if (strcmp(mode, "connect_to_mobile_network") == 0) {
+ elm_object_part_text_set(popup, "title,text", ALERT_STR_CONNECT_TO_MOBILE_NETWORK);
+ layout = __net_popup_create_checkview_layout(popup);
+ label = __net_popup_create_label(layout);
+ elm_object_text_set(label, ALERT_STR_ROAMING_WITH_PAYMENT);
+ elm_object_part_content_set(layout, "elm.swallow.content", label);
+ check = elm_check_add(popup);
+ elm_object_style_set(check, "popup");
+ elm_object_part_content_set(layout, "elm.swallow.end", check);
+ elm_object_text_set(check, ALERT_STR_DO_NOT_SHOW_AGAIN);
+ elm_check_state_set(check, EINA_FALSE);
+ evas_object_smart_callback_add(check, "changed",
+ __do_not_show_check_changed_cb, NULL);
+ btn1 = __net_popup_create_cancel_button(popup);
+ elm_object_part_content_set(popup, "button1", btn1);
+ btn2 = __net_popup_create_connect_button(popup);
+ elm_object_part_content_set(popup, "button2", btn2);
+ } else {
+ elm_object_part_text_set(popup, "title,text", ALERT_STR_NO_NETWORK_CONNECTION);
+ if (strcmp(mode, "flight_mode") == 0) {
+ elm_object_text_set(popup, ALERT_STR_CANT_CONNECT_TO_MOBILE);
+ btn1 = __net_popup_create_cancel_button(popup);
+ elm_object_part_content_set(popup, "button1", btn1);
+ btn2 = __net_popup_create_wifi_button(popup);
+ elm_object_part_content_set(popup, "button2", btn2);
+ btn3 = __net_popup_create_settings_button(popup);
+ elm_object_part_content_set(popup, "button3", btn3);
+ } else if (strcmp(mode, "mobile_data_is_turned_off") == 0) {
+ elm_object_text_set(popup, ALERT_STR_MOBILE_DATA_IS_TURNED_OFF);
+ btn1 = __net_popup_create_cancel_button(popup);
+ elm_object_part_content_set(popup, "button1", btn1);
+ btn2 = __net_popup_create_wifi_button(popup);
+ elm_object_part_content_set(popup, "button2", btn2);
+ btn3 = __net_popup_create_settings_button(popup);
+ elm_object_part_content_set(popup, "button3", btn3);
+ } else if (strcmp(mode, "no_mobile_networks") == 0) {
+ elm_object_text_set(popup, ALERT_STR_NO_MOBILE_NETWORKS);
+ btn1 = __net_popup_create_cancel_button(popup);
+ elm_object_part_content_set(popup, "button1", btn1);
+ btn2 = __net_popup_create_retry_button(popup);
+ elm_object_part_content_set(popup, "button2", btn2);
+ } else if (strcmp(mode, "roaming_with_check") == 0) {
+ layout = __net_popup_create_checkview_layout(popup);
+ label = __net_popup_create_label(layout);
+ elm_object_text_set(label, ALERT_STR_ROAMING_WITH_PAYMENT);
+ elm_object_part_content_set(layout, "elm.swallow.content", label);
+ check = elm_check_add(popup);
+ elm_object_style_set(check, "popup");
+ elm_object_part_content_set(layout, "elm.swallow.end", check);
+ elm_object_text_set(check, ALERT_STR_TURN_ON_DATA_ROAMING);
+ elm_check_state_set(check, EINA_FALSE);
+ evas_object_smart_callback_add(check, "changed",
+ __data_roaming_check_changed_cb, NULL);
+ btn1 = __net_popup_create_data_roaming_button(popup);
+ elm_object_part_content_set(popup, "button1", btn1);
+ } else if (strcmp(mode, "roaming_with_settings") == 0) {
+ elm_object_text_set(popup, ALERT_STR_ROAMING);
+ btn1 = __net_popup_create_cancel_button(popup);
+ elm_object_part_content_set(popup, "button1", btn1);
+ btn2 = __net_popup_create_wifi_button(popup);
+ elm_object_part_content_set(popup, "button2", btn2);
+ btn3 = __net_popup_create_settings_button(popup);
+ elm_object_part_content_set(popup, "button3", btn3);
+ }
+ }
+
+ evas_object_show(popup);
+ evas_object_show(win);
+ g_free(mode);
+
+ return 0;
+}
+
+void _tethering_wifi_btn_yes_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ log_print(NET_POPUP, "_tethering_wifi_btn_yes_cb()\n");
+
+ bool result = FALSE;
+ Evas_Object *popup = (Evas_Object *)data;
+
+ result = _net_popup_send_user_resp(RESP_WIFI_TETHERING_OFF, FALSE);
+ if (true != result)
+ log_print(NET_POPUP, "Failed to send user response ");
+
+ if (popup)
+ evas_object_del(popup);
+
+ elm_exit();
+}
+
+void _tethering_wifi_ap_btn_yes_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ log_print(NET_POPUP, "_tethering_wifi_ap_btn_yes_cb()\n");
+
+ bool result = FALSE;
+ Evas_Object *popup = (Evas_Object *)data;
+
+ result = _net_popup_send_user_resp(RESP_WIFI_AP_TETHERING_OFF, FALSE);
+ if (true != result)
+ log_print(NET_POPUP, "Failed to send user response ");
+
+ if (popup)
+ evas_object_del(popup);
+
+ elm_exit();
+}
+
+static void _vpn_send_result(int result)
+{
+ log_print(NET_POPUP, "Send the result of vpn-service to the caller");
+
+ int ret = 0;
+ app_control_h reply = NULL;
+ app_control_result_e resp_code;
+
+ ret = app_control_create(&reply);
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ log_print(NET_POPUP, "Failed to create service ret = %d", ret);
+ app_control_destroy(g_req_handle);
+ g_req_handle = NULL;
+ return;
+ }
+
+ if (result == VPNSVC_ERROR_NONE)
+ resp_code = APP_CONTROL_RESULT_SUCCEEDED;
+ else if (result == VPNSVC_ERROR_CANCELED)
+ resp_code = APP_CONTROL_RESULT_CANCELED;
+ else
+ resp_code = APP_CONTROL_RESULT_FAILED;
+
+ ret = app_control_add_extra_data(reply, APP_CONTROL_DATA_TEXT, __get_vpn_error_message(result));
+ if (APP_CONTROL_ERROR_NONE == ret) {
+ ret = app_control_reply_to_launch_request(reply, g_req_handle, resp_code);
+ if (APP_CONTROL_ERROR_NONE == ret)
+ log_print(NET_POPUP, "Service reply success");
+ else
+ log_print(NET_POPUP, "Service reply failed ret = %d", ret);
+ } else {
+ log_print(NET_POPUP, "Service data addition failed ret = %d", ret);
+ }
+
+ app_control_destroy(reply);
+ app_control_destroy(g_req_handle);
+ g_req_handle = NULL;
+
+ return;
+}
+
+void _vpn_btn_connect_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ log_print(NET_POPUP, "_vpn_btn_connect_cb()");
+ Evas_Object *popup = (Evas_Object *)data;
+ int ret = VPNSVC_ERROR_NONE;
+
+ ret = _vpnsvc_up(iface_name);
+ _vpn_send_result(ret);
+
+ if (iface_name) {
+ g_free(iface_name);
+ iface_name = NULL;
+ }
+ if (popup)
+ evas_object_del(popup);
+ if (obj)
+ evas_object_del(obj);
+
+ elm_exit();
+}
+
+void _vpn_btn_disconnect_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ log_print(NET_POPUP, "_vpn_btn_disconnect_cb()");
+ Evas_Object *popup = (Evas_Object *)data;
+ int ret = VPNSVC_ERROR_NONE;
+
+ ret = _vpnsvc_down(iface_name);
+ _vpn_send_result(ret);
+
+ if (iface_name) {
+ g_free(iface_name);
+ iface_name = NULL;
+ }
+ if (popup)
+ evas_object_del(popup);
+ if (obj)
+ evas_object_del(obj);
+
+ elm_exit();
+}
+
+void _vpn_btn_no_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ log_print(NET_POPUP, "_vpn_btn_no_cb()");
+ Evas_Object *popup = (Evas_Object *)data;
+
+ _vpn_send_result(VPNSVC_ERROR_CANCELED);
+
+ if (iface_name) {
+ g_free(iface_name);
+ iface_name = NULL;
+ }
+ if (popup)
+ evas_object_del(popup);
+ if (obj)
+ evas_object_del(obj);
+
+ elm_exit();
+}
+
+void _btn_no_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ log_print(NET_POPUP, "_btn_no_cb()\n");
+
+ bool result = FALSE;
+ Evas_Object *popup = (Evas_Object *)data;
+
+ result = _net_popup_send_user_resp(RESP_TETHERING_ON, FALSE);
+ if (true != result)
+ log_print(NET_POPUP, "Failed to send user response ");
+
+ if (popup)
+ evas_object_del(popup);
+
+ elm_exit();
+}
+
+static void __data_usage_notification(notification_type_e type,
+ notification_ly_type_e ly_type, const char *title_text, const char *title_key,
+ const char *content_text, const char *content_key, const char *launch_appid)
+{
+ int ret = 0;
+ int noti_flags = 0;
+ char icon_path[ICON_PATH_LEN];
+ notification_h noti = NULL;
+ notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+ app_control_h service_handle = NULL;
+
+ noti = notification_create(type);
+ if (noti == NULL) {
+ log_print(NET_POPUP, "Failed to create notification");
+ return;
+ }
+
+ noti_err = notification_set_time(noti, time(NULL));
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to notification_set_time : %d", noti_err);
+ goto error;
+ }
+
+ g_snprintf(icon_path, sizeof(icon_path), "%s%s",
+ STC_NOTI_DATA_USAGE_ICON_PATH, STC_NOTI_DATA_USAGE_ICON_NAME);
+ noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, icon_path);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to notification_set_image : %d", noti_err);
+ goto error;
+ }
+
+ noti_err = notification_set_layout(noti, ly_type);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to notification_set_layout : %d", noti_err);
+ goto error;
+ }
+
+ noti_err = notification_set_text_domain(noti, PACKAGE,
+ LOCALEDIR);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to notification_set_text_domain : %d", noti_err);
+ goto error;
+ }
+
+ noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
+ title_text, title_key,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to notification_set_title : %d", noti_err);
+ goto error;
+ }
+
+ if (content_text) {
+ noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
+ content_text, content_key,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to notification_set_content: %d", noti_err);
+ goto error;
+ }
+ }
+
+ noti_flags = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY |
+ NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR;
+ noti_err = notification_set_display_applist(noti, noti_flags);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to notification_set_display_applist: %d", noti_err);
+ goto error;
+ }
+
+ if (launch_appid) {
+ ret = app_control_create(&service_handle);
+ log_print(NET_POPUP, "Service create ret[%d]", ret);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ goto error;
+
+ ret = app_control_set_app_id(service_handle, launch_appid);
+ log_print(NET_POPUP, "Service set app id ret = %d", ret);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ goto error;
+
+ ret = app_control_add_extra_data(service_handle, "caller", "notification");
+ log_print(NET_POPUP, "Service data addition ret = %d", ret);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ goto error;
+
+ noti_err = notification_set_launch_option(noti,
+ NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, service_handle);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to notification_set_launch_option");
+ goto error;
+ }
+ }
+
+ noti_err = notification_post(noti);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to insert notification[error# is %d]", noti_err);
+ goto error;
+ }
+
+ log_print(NET_POPUP, "Successfully added notification");
+
+error:
+
+ if (noti != NULL)
+ notification_free(noti);
+
+ if (service_handle)
+ app_control_destroy(service_handle);
+}
+
+static void __data_usage_btn_on_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ log_print(NET_POPUP, "__data_usage_btn_on_cb()");
+ Evas_Object *popup = (Evas_Object *)data;
+
+ __net_popup_init_dbus();
+ __net_popup_send_data_usage_msg(data_usage_app_id, data_usage_iftype);
+ __net_popup_deinit_dbus();
+
+ __data_usage_notification(NOTIFICATION_TYPE_ONGOING,
+ NOTIFICATION_LY_ONGOING_EVENT,
+ STC_NOTIFICATION_RESTRICTION_ON_TITLE,
+ "IDS_SM_TMBODY_MOBILE_DATA_LIMIT_EXCEEDED_ABB",
+ NULL, NULL, NULL);
-static int __net_popup_create(void *data)
-{
- log_print(NET_POPUP, "__net_popup_create()\n");
+ if (popup)
+ evas_object_del(popup);
+ if (obj)
+ evas_object_del(obj);
- bindtextdomain(PACKAGE, LOCALEDIR);
+ g_free(data_usage_app_id);
+ g_free(data_usage_iftype);
- return 0;
+ elm_exit();
}
-static int __net_popup_terminate(void *data)
+static void __data_usage_btn_ok_cb(void *data, Evas_Object *obj, void *event_info)
{
- return 0;
+ log_print(NET_POPUP, "__data_usage_btn_ok_cb()");
+ Evas_Object *popup = (Evas_Object *)data;
+
+ __data_usage_notification(NOTIFICATION_TYPE_ONGOING,
+ NOTIFICATION_LY_ONGOING_EVENT,
+ STC_NOTIFICATION_RESTRICTION_OK_TITLE,
+ "IDS_SM_HEADER_MOBILE_DATA_TURNED_OFF_ABB2",
+ STC_NOTIFICATION_RESTRICTION_OK_CONTENT,
+ "IDS_SM_SBODY_TAP_HERE_TO_TURN_IT_ON_AGAIN_ABB",
+ DATA_USAGE_APPID);
+
+ if (popup)
+ evas_object_del(popup);
+ if (obj)
+ evas_object_del(obj);
+
+ g_free(data_usage_app_id);
+ g_free(data_usage_iftype);
+
+ elm_exit();
}
-static int __net_popup_pause(void *data)
+static void __net_popup_show_popup_with_user_resp(app_control_h request,
+ void *data)
{
- return 0;
+ log_print(NET_POPUP, "__net_popup_show_popup_with_user_resp()\n");
+
+ Evas_Object *win;
+ Evas_Object *popup;
+ Evas_Object *layout;
+ Evas_Object *label;
+ Evas_Object *btn1;
+ Evas_Object *btn2;
+ int ret = 0;
+
+ ret = app_control_get_extra_data(request, "_SYSPOPUP_CONTENT_", &resp_popup_mode);
+ if (APP_CONTROL_ERROR_NONE != ret)
+ log_print(NET_POPUP, "Failed to get _SYSPOPUP_CONTENT_ ret = %d", ret);
+
+ secure_log_print(NET_POPUP, "_SYSPOPUP_CONTENT_ = %s\n", resp_popup_mode);
+
+ win = __net_popup_create_win();
+ evas_object_show(win);
+
+ popup = elm_popup_add(win);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+
+ if (g_strcmp0(resp_popup_mode, "TETHERING_TYPE_WIFI") == 0 ||
+ g_strcmp0(resp_popup_mode, "TETHERING_TYPE_WIFI_AP") == 0) {
+ log_print(NET_POPUP, "Drawing Wi-Fi Tethering OFF popup");
+
+ __net_popup_init_dbus();
+ elm_object_part_text_set(popup, "title,text", ALERT_STR_WIFI);
+
+ layout = elm_layout_add(popup);
+ elm_layout_file_set(layout, NETPOPUP_EDJ, "popup");
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+
+ label = elm_label_add(popup);
+ elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
+ elm_object_text_set(label, ALERT_STR_WIFI_MOBILE_AP_ON);
+ evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(label);
+
+ elm_object_part_content_set(layout, "elm.swallow.content", label);
+ evas_object_show(layout);
+ elm_object_style_set(label, "popup/default");
+ eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _btn_no_cb, popup);
+ elm_object_content_set(popup, label);
+
+ btn1 = elm_button_add(popup);
+ elm_object_style_set(btn1, "popup");
+ elm_object_text_set(btn1, ALERT_STR_CANCEL);
+ elm_object_part_content_set(popup, "button1", btn1);
+ evas_object_smart_callback_add(btn1, "clicked",
+ _btn_no_cb, popup);
+
+ btn2 = elm_button_add(popup);
+ elm_object_style_set(btn2, "popup");
+ elm_object_text_set(btn2, ALERT_STR_OK);
+ elm_object_part_content_set(popup, "button2", btn2);
+
+ if (g_strcmp0(resp_popup_mode, "TETHERING_TYPE_WIFI") == 0)
+ evas_object_smart_callback_add(btn2, "clicked",
+ _tethering_wifi_btn_yes_cb, popup);
+ else if (g_strcmp0(resp_popup_mode, "TETHERING_TYPE_WIFI_AP") == 0)
+ evas_object_smart_callback_add(btn2, "clicked",
+ _tethering_wifi_ap_btn_yes_cb, popup);
+
+ evas_object_show(popup);
+ evas_object_show(win);
+ __net_popup_deinit_dbus();
+ }
}
-static int __net_popup_resume(void *data)
+static void __net_popup_show_vpn_popup(app_control_h request, void *data)
{
- return 0;
+ Evas_Object *win;
+ Evas_Object *popup;
+ Evas_Object *button1;
+ Evas_Object *button2;
+ char *type = NULL;
+ char *title = NULL;
+ char *content = NULL;
+ char *ok_btn = NULL;
+ void *ok_cb = NULL;
+
+ log_print(NET_POPUP, "__net_popup_show_vpn_popup");
+
+ int ret = app_control_get_extra_data(request, APP_CONTROL_DATA_TYPE, &type);
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ log_print(NET_POPUP, "Failed to get APP_CONTROL_DATA_TYPE ret = %d", ret);
+ elm_exit();
+ return;
+ }
+
+ ret = app_control_get_extra_data(request, APP_CONTROL_DATA_NAME, &iface_name);
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ log_print(NET_POPUP, "Failed to get APP_CONTROL_DATA_NAME ret = %d", ret);
+ elm_exit();
+ return;
+ }
+ log_print(NET_POPUP, "type(%s) name(%s)", type, iface_name);
+
+ if (strcmp(type, "up") == 0) {
+ title = ALERT_STR_VPN_CONNECT_TITLE;
+ content = ALERT_STR_VPN_CONNECT_CONTENT;
+ ok_btn = ALERT_STR_VPN_CONNECT_BUTTON;
+ ok_cb = _vpn_btn_connect_cb;
+ } else if (strcmp(type, "down") == 0) {
+ title = ALERT_STR_VPN_DISCONNECT_TITLE;
+ content = ALERT_STR_VPN_DISCONNECT_CONTENT;
+ ok_btn = ALERT_STR_VPN_DISCONNECT_BUTTON;
+ ok_cb = _vpn_btn_disconnect_cb;
+ } else {
+ log_print(NET_POPUP, "Invalid appcontrol value");
+ elm_exit();
+ return;
+ }
+
+ log_print(NET_POPUP, "title(%s) content(%s) ok(%s)", title, content, ok_btn);
+
+ win = __net_popup_create_win();
+
+ popup = elm_popup_add(win);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ elm_object_text_set(popup, content);
+ elm_object_part_text_set(popup, "title,text", title);
+
+ /* Cancel button */
+ button1 = elm_button_add(popup);
+ elm_object_style_set(button1, "bottom");
+ elm_object_text_set(button1, ALERT_STR_CANCEL);
+ elm_object_part_content_set(popup, "button1", button1);
+ evas_object_smart_callback_add(button1, "clicked", _vpn_btn_no_cb, popup);
+
+ /* OK button */
+ button2 = elm_button_add(popup);
+ elm_object_style_set(button2, "bottom");
+ elm_object_text_set(button2, ok_btn);
+ elm_object_part_content_set(popup, "button2", button2);
+ evas_object_smart_callback_add(button2, "clicked", ok_cb, popup);
+
+ evas_object_show(popup);
+ evas_object_show(win);
+
+ return;
}
-static int __net_popup_reset(bundle *b, void *data)
+static void __net_popup_show_warning_noti(app_control_h request, void *data)
{
- log_print(NET_POPUP, "__net_popup_reset()\n");
+ log_print(NET_POPUP, "__net_popup_show_warning_noti()\n");
- const char* type = bundle_get_val(b, "_SYSPOPUP_TYPE_");
+ int ret = app_control_get_extra_data(request, "_APP_ID_", &data_usage_app_id);
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ log_print(NET_POPUP, "Failed to get _APP_ID_ ret = %d", ret);
+ elm_exit();
+ return;
+ }
- if (type == NULL) {
+ if (strcmp(data_usage_app_id, STC_TOTAL_DATACALL) &&
+ strcmp(data_usage_app_id, STC_TOTAL_WIFI) &&
+ strcmp(data_usage_app_id, STC_TOTAL_BLUETOOTH)) {
+ log_print(NET_POPUP, "It's not total data usage [%s]", data_usage_app_id);
+ g_free(data_usage_app_id);
elm_exit();
- return 0;
+ return;
}
- log_print(NET_POPUP, "type = %s\n", type);
+ __data_usage_notification(NOTIFICATION_TYPE_ONGOING,
+ NOTIFICATION_LY_ONGOING_EVENT,
+ STC_NOTIFICATION_WARNING_TITLE,
+ "IDS_COM_BODY_DATA_USAGE_WARNING",
+ STC_NOTIFICATION_WARNING_CONTENT,
+ "IDS_SM_SBODY_TAP_HERE_TO_VIEW_YOUR_DATA_USAGE_ABB",
+ DATA_USAGE_APPID);
+}
- if (g_str_equal(type, "notification")) {
- __net_popup_show_tickernoti(b, data);
- elm_exit();
- } else if (g_str_equal(type, "popup")) {
- __net_popup_show_popup(b, data);
- } else if (g_str_equal(type, "add_found_ap_noti")) {
- __net_popup_add_found_ap_noti();
- elm_exit();
- } else if (g_str_equal(type, "del_found_ap_noti")) {
- __net_popup_del_found_ap_noti();
- elm_exit();
- } else if (g_str_equal(type, "add_manual_network_fail_noti")) {
- __net_popup_add_manual_network_fail_noti(b);
- elm_exit();
- } else if (g_str_equal(type, "del_manual_network_fail_noti")) {
- __net_popup_del_manual_network_fail_noti();
+static void __net_popup_show_restriction_noti(app_control_h request, void *data)
+{
+ Evas_Object *win;
+ Evas_Object *popup;
+ Evas_Object *button1;
+ Evas_Object *button2;
+ char *title = NULL;
+ char *content = NULL;
+ char *limit = NULL;
+ char *on_btn = NULL;
+ char *ok_btn = NULL;
+ char buf[ALERT_STR_LEN_MAX] = "";
+
+ log_print(NET_POPUP, "__net_popup_show_data_usage_popup");
+
+ int ret = app_control_get_extra_data(request, "_APP_ID_", &data_usage_app_id);
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ log_print(NET_POPUP, "Failed to get _APP_ID_ ret = %d", ret);
elm_exit();
- } else if (g_str_equal(type, "add_restricted_state_noti")) {
- __net_popup_add_restricted_state_noti(b);
+ return;
+ }
+
+ if (strcmp(data_usage_app_id, STC_TOTAL_DATACALL) &&
+ strcmp(data_usage_app_id, STC_TOTAL_WIFI) &&
+ strcmp(data_usage_app_id, STC_TOTAL_BLUETOOTH)) {
+ log_print(NET_POPUP, "It's not total data usage [%s]", data_usage_app_id);
+ g_free(data_usage_app_id);
elm_exit();
- } else if (g_str_equal(type, "del_restricted_state_noti")) {
- __net_popup_del_restricted_state_noti();
+ return;
+ }
+
+ ret = app_control_get_extra_data(request, "_IF_TYPE_", &data_usage_iftype);
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ log_print(NET_POPUP, "Failed to get _IF_TYPE_ ret = %d", ret);
+ g_free(data_usage_app_id);
elm_exit();
- } else {
- __net_popup_show_tickernoti(b, data);
+ return;
+ }
+
+ ret = app_control_get_extra_data(request, "_RESTRICTION_LIMIT_", &limit);
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ log_print(NET_POPUP, "Failed to get _RESTRICTION_LIMIT_ ret = %d", ret);
+ g_free(data_usage_app_id);
+ g_free(data_usage_iftype);
elm_exit();
+ return;
}
- return 0;
-}
+ title = ALERT_STR_DATA_USAGE_TITLE;
+ g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_DATA_USAGE_CONTENT, limit);
+ content = buf;
+ on_btn = ALERT_STR_DATA_USAGE_TURN_ON_BUTTON;
+ ok_btn = ALERT_STR_OK;
-static void _ok_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
- if (data)
- evas_object_del(data);
- elm_exit();
-}
+ log_print(NET_POPUP, "title(%s) content(%s) app_id(%s) iftype(%s) limit(%s)",
+ title, content, data_usage_app_id, data_usage_iftype, limit);
-static int __net_popup_show_tickernoti(bundle *b, void *data)
-{
- const char* mode = bundle_get_val(b, "_SYSPOPUP_CONTENT_");
- if (mode == NULL) {
- return 0;
- }
+ win = __net_popup_create_win();
- log_print(NET_POPUP, "content = %s\n", mode);
+ popup = elm_popup_add(win);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- if (strcmp(mode, "connected") == 0) {
- status_message_post(ALERT_STR_MOBILE_NETWORKS_CHARGE);
- log_print(NET_POPUP, "alert 3g\n");
- } else if (strcmp(mode, "fail to connect") == 0) {
- status_message_post(ALERT_STR_ERR_UNAVAILABLE);
- log_print(NET_POPUP, "alert err\n");
- } else if (strcmp(mode, "unable to connect") == 0) {
- status_message_post(ALERT_STR_ERR_CONNECT);
- log_print(NET_POPUP, "alert unable to connect\n");
- } else if (strcmp(mode, "not support") == 0) {
- status_message_post(ALERT_STR_ERR_NOT_SUPPORT);
- log_print(NET_POPUP, "alert not support\n");
- } else if (strcmp(mode, "wifi restricted") == 0) {
- status_message_post(ALERT_STR_RESTRICTED_USE_WIFI);
- log_print(NET_POPUP, "alert wifi restricted\n");
- } else if (strcmp(mode, "wifi connected") == 0) {
- char buf[ALERT_STR_LEN_MAX] = "";
- char *ap_name = (char *)bundle_get_val(b, "_AP_NAME_");
+ elm_object_text_set(popup, content);
+ elm_object_part_text_set(popup, "title,text", title);
- if (ap_name != NULL)
- snprintf(buf, ALERT_STR_LEN_MAX, "%s %s", ap_name, ALERT_STR_WIFI_CONNECTED);
- else
- snprintf(buf, ALERT_STR_LEN_MAX, "%s", ALERT_STR_WIFI_CONNECTED);
+ /* ON button */
+ button1 = elm_button_add(popup);
+ elm_object_style_set(button1, "bottom");
+ elm_object_text_set(button1, on_btn);
+ elm_object_part_content_set(popup, "button1", button1);
+ evas_object_smart_callback_add(button1, "clicked", __data_usage_btn_on_cb, popup);
- status_message_post(buf);
+ /* OK button */
+ button2 = elm_button_add(popup);
+ elm_object_style_set(button2, "bottom");
+ elm_object_text_set(button2, ok_btn);
+ elm_object_part_content_set(popup, "button2", button2);
+ evas_object_smart_callback_add(button2, "clicked", __data_usage_btn_ok_cb, popup);
- log_print(NET_POPUP, "alert wifi connected\n");
- } else {
- status_message_post(mode);
- log_print(NET_POPUP, "%s\n", mode);
- }
+ evas_object_show(popup);
+ evas_object_show(win);
- return 0;
+ return;
}
-static int __net_popup_show_popup(bundle *b, void *data)
+static int __net_popup_show_popup(app_control_h request, void *data)
{
+ log_print(NET_POPUP, "__net_popup_show_popup()\n");
+
Evas_Object *win;
Evas_Object *popup;
Evas_Object *button;
+ int ret = 0;
+ char *mode = NULL;
- const char* mode = bundle_get_val(b, "_SYSPOPUP_CONTENT_");
-
- if (mode == NULL) {
+ ret = app_control_get_extra_data(request, "_SYSPOPUP_CONTENT_", &mode);
+ if (APP_CONTROL_ERROR_NONE != ret) {
+ log_print(NET_POPUP, "Failed to get _SYSPOPUP_CONTENT_ ret = %d", ret);
+ g_free(mode);
elm_exit();
return 0;
}
- log_print(NET_POPUP, "content = %s\n", mode);
+ secure_log_print(NET_POPUP, "_SYSPOPUP_CONTENT_ = %s\n", mode);
- win = elm_win_add(NULL, PACKAGE, ELM_WIN_BASIC);
- elm_win_alpha_set(win, EINA_TRUE);
- elm_win_borderless_set(win, EINA_TRUE);
+ win = __net_popup_create_win();
popup = elm_popup_add(win);
evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
} else if (strcmp(mode, "unable to connect") == 0) {
elm_object_text_set(popup, ALERT_STR_ERR_CONNECT);
log_print(NET_POPUP, "alert unable to connect\n");
+ } else if (strcmp(mode, "wrong password") == 0) {
+ elm_object_text_set(popup, ALERT_STR_ERR_WRONG_PASSWORD);
+ log_print(NET_POPUP, "alert wrong password\n");
} else if (strcmp(mode, "not support") == 0) {
elm_object_text_set(popup, ALERT_STR_ERR_NOT_SUPPORT);
log_print(NET_POPUP, "alert not support\n");
} else if (strcmp(mode, "wifi restricted") == 0) {
elm_object_text_set(popup, ALERT_STR_RESTRICTED_USE_WIFI);
log_print(NET_POPUP, "alert wifi restricted\n");
+ } else if (strcmp(mode, "no ap found") == 0) {
+ elm_object_text_set(popup, ALERT_STR_NO_AP_FOUND);
+ log_print(NET_POPUP, "alert no ap found\n");
} else if (strcmp(mode, "wifi connected") == 0) {
char buf[ALERT_STR_LEN_MAX] = "";
- char *ap_name = (char *)bundle_get_val(b, "_AP_NAME_");
+ char *ap_name = NULL;
+
+ ret = app_control_get_extra_data(request, "_AP_NAME_", &ap_name);
if (ap_name != NULL)
- snprintf(buf, ALERT_STR_LEN_MAX, "%s %s", ap_name, ALERT_STR_WIFI_CONNECTED);
+ g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_WIFI_CONNECTED, ap_name);
else
- snprintf(buf, ALERT_STR_LEN_MAX, "%s", ALERT_STR_WIFI_CONNECTED);
+ g_snprintf(buf, ALERT_STR_LEN_MAX, ALERT_STR_WIFI_CONNECTED, "");
elm_object_text_set(popup, buf);
log_print(NET_POPUP, "alert wifi connected\n");
+ g_free(ap_name);
} else {
elm_object_text_set(popup, mode);
log_print(NET_POPUP, "%s\n", mode);
}
button = elm_button_add(popup);
- elm_object_text_set(button, "OK");
+ elm_object_style_set(button, "popup");
+ elm_object_text_set(button, ALERT_STR_OK);
elm_object_part_content_set(popup, "button1", button);
evas_object_smart_callback_add(button, "clicked", _ok_button_clicked_cb, popup);
evas_object_show(popup);
evas_object_show(win);
+ g_free(mode);
return 0;
}
static void __net_popup_add_found_ap_noti(void)
{
- int noti_flags = 0;
+ log_print(NET_POPUP, "__net_popup_add_found_ap_noti()\n");
+
+ int ret = 0, noti_flags = 0;
+ char icon_path[ICON_PATH_LEN];
notification_h noti = NULL;
notification_list_h noti_list = NULL;
notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
- bundle *b = NULL;
+ app_control_h service_handle = NULL;
- notification_get_detail_list("org.tizen.net-popup", NOTIFICATION_GROUP_ID_NONE,
+ notification_get_detail_list(NET_POPUP_APPID, NOTIFICATION_GROUP_ID_NONE,
NOTIFICATION_PRIV_ID_NONE, -1, ¬i_list);
if (noti_list != NULL) {
notification_free_list(noti_list);
return;
}
- noti = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_NONE,
- NOTIFICATION_PRIV_ID_NONE);
+ noti = notification_create(NOTIFICATION_TYPE_ONGOING);
if (noti == NULL) {
- log_print(NET_POPUP, "fail to create notification");
+ log_print(NET_POPUP, "Failed to create notification");
return;
}
noti_err = notification_set_time(noti, time(NULL));
- if(noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_set_time : %d", noti_err);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to notification_set_time : %d", noti_err);
goto error;
}
- noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
- NETCONFIG_NOTIFICATION_WIFI_ICON);
- if(noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_set_image : %d", noti_err);
+ g_snprintf(icon_path, sizeof(icon_path), "%s%s", QP_PRELOAD_NOTI_ICON_PATH, "/noti_wifi_in_range.png");
+ noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, icon_path);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to notification_set_image : %d", noti_err);
goto error;
}
noti_err = notification_set_layout(noti, NOTIFICATION_LY_ONGOING_EVENT);
if (noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_set_layout : %d", noti_err);
+ log_print(NET_POPUP, "Failed to notification_set_layout : %d", noti_err);
goto error;
}
noti_err = notification_set_text_domain(noti, PACKAGE,
LOCALEDIR);
- if(noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_set_text_domain : %d", noti_err);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to notification_set_text_domain : %d", noti_err);
goto error;
}
"IDS_COM_BODY_WI_FI_NETWORKS_AVAILABLE",
NOTIFICATION_VARIABLE_TYPE_NONE);
if (noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_set_title : %d", noti_err);
+ log_print(NET_POPUP, "Failed to notification_set_title : %d", noti_err);
goto error;
}
noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
NETCONFIG_NOTIFICATION_WIFI_FOUND_CONTENT,
- "IDS_WIFI_BODY_OPEN_WI_FI_SETTINGS_ABB",
+ "IDS_WIFI_SBODY_TAP_HERE_TO_CONNECT",
NOTIFICATION_VARIABLE_TYPE_NONE);
if (noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_set_content : %d", noti_err);
+ log_print(NET_POPUP, "Failed to notification_set_content: %d", noti_err);
goto error;
}
- noti_flags = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY;
+ noti_flags = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_INDICATOR;
noti_err = notification_set_display_applist(noti, noti_flags);
- if(noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_set_display_applist : %d", noti_err);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to notification_set_display_applist: %d", noti_err);
goto error;
}
- b = bundle_create();
- bundle_add(b, "_INTERNAL_SYSPOPUP_NAME_", "wifi-qs");
+ ret = app_control_create(&service_handle);
+ log_print(NET_POPUP, "Service create ret[%d]", ret);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ goto error;
+
+ ret = app_control_set_app_id(service_handle, NET_WIFIQS_APPID);
+ log_print(NET_POPUP, "Service set app id ret = %d", ret);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ goto error;
- appsvc_set_pkgname(b, "net.wifi-qs");
+ ret = app_control_add_extra_data(service_handle, "caller", "notification");
+ log_print(NET_POPUP, "Service data addition ret = %d", ret);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ goto error;
- noti_err = notification_set_execute_option(noti,
- NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, "Launch", NULL, b);
+ noti_err = notification_set_launch_option(noti,
+ NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, service_handle);
if (noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_set_execute_option");
+ log_print(NET_POPUP, "Failed to notification_set_launch_option");
goto error;
}
- noti_err = notification_insert(noti, NULL);
+ noti_err = notification_post(noti);
if (noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_insert");
+ log_print(NET_POPUP, "Failed to insert notification[error# is %d]", noti_err);
goto error;
}
log_print(NET_POPUP, "Successfully added notification");
error:
- if (b != NULL)
- bundle_free(b);
if (noti != NULL)
notification_free(noti);
+
+ if (service_handle)
+ app_control_destroy(service_handle);
}
static void __net_popup_del_found_ap_noti(void)
{
+ log_print(NET_POPUP, "__net_popup_del_found_ap_noti()\n");
+
notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
- noti_err = notification_delete_all_by_type("org.tizen.net-popup",
- NOTIFICATION_TYPE_ONGOING);
+ noti_err = notification_delete_all(NOTIFICATION_TYPE_ONGOING);
if (noti_err != NOTIFICATION_ERROR_NONE) {
log_print(NET_POPUP, "fail to notification_delete_by_priv_id");
return;
log_print(NET_POPUP, "Successfully deleted notification");
}
-static void __net_popup_add_manual_network_fail_noti(bundle *b)
+static void __net_popup_add_ip_conflict_noti(app_control_h request)
{
+ log_print(NET_POPUP, "__net_popup_add_portal_noti()\n");
+
+ int ret = 0;
int noti_flags = 0;
+ char *mac = NULL;
+ char icon_path[ICON_PATH_LEN];
notification_h noti = NULL;
+ app_control_h service_handle = NULL;
notification_list_h noti_list = NULL;
notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
- char *buf;
- const char *type;
- char *tmp = NETCONFIG_NOTIFICATION_MANUAL_NETWORK_FAIL_NOT_AVAILABLE;
- if (!b || !tmp) {
- log_print(NET_POPUP, "failed, bundle=%p, tmp=%p", b, tmp);
- return;
- }
-
- type = bundle_get_val(b, "_SYSPOPUP_NETWORK_NAME_");
- if (!type) {
- log_print(NET_POPUP, "failed, type=%p", type);
- return;
- }
+ ret = app_control_get_extra_data(request, "_MAC_ADDRESS_", &mac);
- buf = g_strdup_printf(tmp, type);
- if (!buf) {
- log_print(NET_POPUP, "failed, buf=%p", buf);
+ if (mac == NULL || ret != APP_CONTROL_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to retrieve mac address!!");
+ g_free(mac);
return;
}
- /* Tickernoti */
- status_message_post(buf);
+ log_print(NET_POPUP, "Successfully added notification");
- notification_get_detail_list("setting-network-efl",
- NOTIFICATION_GROUP_ID_NONE,
+ notification_get_detail_list(NET_POPUP_APPID, NOTIFICATION_GROUP_ID_NONE,
NOTIFICATION_PRIV_ID_NONE, -1, ¬i_list);
if (noti_list != NULL) {
notification_free_list(noti_list);
- __net_popup_del_manual_network_fail_noti();
+ g_free(mac);
+ return;
}
- noti = notification_new(NOTIFICATION_TYPE_ONGOING,
- NOTIFICATION_GROUP_ID_NONE,
- NOTIFICATION_PRIV_ID_NONE);
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
if (noti == NULL) {
log_print(NET_POPUP, "fail to create notification");
+ g_free(mac);
+ return;
+ }
+
+ noti_err = notification_set_time(noti, time(NULL));
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_time : %d", noti_err);
goto error;
}
- noti_err = notification_set_pkgname(noti, "setting-network-efl");
- if(noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_set_pkgname : %d", noti_err);
+ noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
+ NETCONFIG_NOTIFICATION_WIFI_ICON_LITE);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_image : %d", noti_err);
goto error;
}
- noti_err = notification_set_time(noti, time(NULL));
- if(noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_set_time : %d", noti_err);
+ g_snprintf(icon_path, sizeof(icon_path), "%s%s", QP_PRELOAD_NOTI_ICON_PATH, "/noti_wifi_in_range_ongoing.png");
+ noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, icon_path);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_image : %d", noti_err);
goto error;
}
- noti_err = notification_set_layout(noti, NOTIFICATION_LY_ONGOING_EVENT);
- if(noti_err != NOTIFICATION_ERROR_NONE) {
+ noti_err = notification_set_layout(noti, NOTIFICATION_LY_NOTI_EVENT_MULTIPLE);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
log_print(NET_POPUP, "fail to notification_set_layout : %d", noti_err);
goto error;
}
+ noti_err = notification_set_text_domain(noti, PACKAGE,
+ LOCALEDIR);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_text_domain : %d", noti_err);
+ goto error;
+ }
+
noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
- NETCONFIG_NOTIFICATION_MANUAL_NETWORK_FAIL_NO_SERVICE,
- NULL,
+ NETCONFIG_NOTIFICATION_IP_CONFLICT_TITLE,
+ "IDS_IP_CONFLICT",
NOTIFICATION_VARIABLE_TYPE_NONE);
if (noti_err != NOTIFICATION_ERROR_NONE) {
log_print(NET_POPUP, "fail to notification_set_title : %d", noti_err);
}
noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
- buf, NULL,
+ NETCONFIG_NOTIFICATION_WIFI_PORTAL_CONTENT,
+ NETCONFIG_NOTIFICATION_WIFI_PORTAL_CONTENT,
+ NOTIFICATION_VARIABLE_TYPE_STRING, mac,
NOTIFICATION_VARIABLE_TYPE_NONE);
if (noti_err != NOTIFICATION_ERROR_NONE) {
log_print(NET_POPUP, "fail to notification_set_content : %d", noti_err);
goto error;
}
- noti_flags = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY;
+ noti_flags = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_INDICATOR;
noti_err = notification_set_display_applist(noti, noti_flags);
- if(noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_set_display_applist : %d",
- noti_err);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_display_applist : %d", noti_err);
+ goto error;
+ }
+
+ ret = app_control_create(&service_handle);
+ log_print(NET_POPUP, "service create ret[%d]", ret);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ goto error;
+
+ ret = app_control_set_app_id(service_handle, WIFI_EFL_UG);
+ log_print(NET_POPUP, "Service set app id ret = %d", ret);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ goto error;
+
+ ret = app_control_add_extra_data(service_handle, "caller", "notification");
+ log_print(NET_POPUP, "Service data addition ret = %d", ret);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ goto error;
+
+ noti_err = notification_set_launch_option(noti,
+ NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, service_handle);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_launch_option");
goto error;
}
- noti_err = notification_insert(noti, NULL);
+ noti_err = notification_post(noti);
if (noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_insert");
+ log_print(NET_POPUP, "fail to notification_post");
goto error;
}
log_print(NET_POPUP, "Successfully added notification");
error:
+ g_free(mac);
if (noti != NULL)
notification_free(noti);
- if (buf)
- g_free (buf);
+ if (service_handle != NULL)
+ app_control_destroy(service_handle);
}
-static void __net_popup_del_manual_network_fail_noti(void)
+static void __net_popup_add_portal_noti(app_control_h request)
{
+ log_print(NET_POPUP, "__net_popup_add_portal_noti()\n");
+
+ int ret = 0;
+ int noti_flags = 0;
+ char *ap_name = NULL;
+ char icon_path[ICON_PATH_LEN];
+ notification_h noti = NULL;
+ app_control_h service_handle = NULL;
+ notification_list_h noti_list = NULL;
notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
- noti_err = notification_delete_all_by_type("setting-network-efl",
- NOTIFICATION_TYPE_ONGOING);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_delete_by_priv_id");
+ ret = app_control_get_extra_data(request, "_AP_NAME_", &ap_name);
+
+ if (ap_name == NULL || ret != APP_CONTROL_ERROR_NONE) {
+ log_print(NET_POPUP, "Failed to retrieve connected AP name!!");
+ g_free(ap_name);
return;
}
- log_print(NET_POPUP, "Successfully deleted notification");
-}
-
-static void __net_popup_add_restricted_state_noti_real (const char *pkgname,
- const char *text)
-{
- notification_h noti;
- notification_error_e noti_err;
+ log_print(NET_POPUP, "Successfully added notification");
- if (!pkgname || !text)
+ notification_get_detail_list(NET_POPUP_APPID, NOTIFICATION_GROUP_ID_NONE,
+ NOTIFICATION_PRIV_ID_NONE, -1, ¬i_list);
+ if (noti_list != NULL) {
+ notification_free_list(noti_list);
+ g_free(ap_name);
return;
+ }
- /* Tickernoti */
- status_message_post(text);
-
- noti = notification_new(NOTIFICATION_TYPE_ONGOING,
- NOTIFICATION_GROUP_ID_NONE,
- NOTIFICATION_PRIV_ID_NONE);
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
if (noti == NULL) {
log_print(NET_POPUP, "fail to create notification");
+ g_free(ap_name);
+ return;
+ }
+
+ noti_err = notification_set_time(noti, time(NULL));
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_time : %d", noti_err);
goto error;
}
- noti_err = notification_set_property(noti,
- NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
+ noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
+ NETCONFIG_NOTIFICATION_WIFI_ICON);
if (noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_set_property : %d", noti_err);
+ log_print(NET_POPUP, "fail to notification_set_image : %d", noti_err);
goto error;
}
- noti_err = notification_set_pkgname(noti, pkgname);
+ g_snprintf(icon_path, sizeof(icon_path), "%s%s", QP_PRELOAD_NOTI_ICON_PATH, "/noti_wifi_in_range.png");
+ noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, icon_path);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_image : %d", noti_err);
+ goto error;
+ }
+ noti_err = notification_set_layout(noti, NOTIFICATION_LY_NOTI_EVENT_MULTIPLE);
if (noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_set_pkgname : %d", noti_err);
+ log_print(NET_POPUP, "fail to notification_set_layout : %d", noti_err);
goto error;
}
- noti_err = notification_set_time(noti, time(NULL));
+ noti_err = notification_set_text_domain(noti, PACKAGE,
+ LOCALEDIR);
if (noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_set_time : %d", noti_err);
+ log_print(NET_POPUP, "fail to notification_set_text_domain : %d", noti_err);
goto error;
}
- noti_err = notification_set_layout(noti, NOTIFICATION_LY_ONGOING_EVENT);
+ noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
+ NETCONFIG_NOTIFICATION_WIFI_PORTAL_TITLE,
+ "IDS_WIFI_HEADER_SIGN_IN_TO_WI_FI_NETWORK_ABB",
+ NOTIFICATION_VARIABLE_TYPE_NONE);
if (noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_set_layout : %d", noti_err);
+ log_print(NET_POPUP, "fail to notification_set_title : %d", noti_err);
goto error;
}
noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
- text, NULL,
+ NETCONFIG_NOTIFICATION_WIFI_PORTAL_CONTENT,
+ NETCONFIG_NOTIFICATION_WIFI_PORTAL_CONTENT,
+ NOTIFICATION_VARIABLE_TYPE_STRING, ap_name,
NOTIFICATION_VARIABLE_TYPE_NONE);
if (noti_err != NOTIFICATION_ERROR_NONE) {
log_print(NET_POPUP, "fail to notification_set_content : %d", noti_err);
goto error;
}
- noti_err = notification_set_display_applist(noti,
- NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY);
+ noti_flags = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_INDICATOR;
+ noti_err = notification_set_display_applist(noti, noti_flags);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_set_display_applist : %d", noti_err);
+ goto error;
+ }
+
+ ret = app_control_create(&service_handle);
+ log_print(NET_POPUP, "service create ret[%d]", ret);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ goto error;
+
+ ret = app_control_set_operation(service_handle, APP_CONTROL_OPERATION_VIEW);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ goto error;
+
+ log_print(NET_POPUP, "service set operation is successful");
+
+ ret = app_control_set_uri(service_handle, "http://www.google.com");
+
+ if (ret != APP_CONTROL_ERROR_NONE)
+ goto error;
+
+ noti_err = notification_set_launch_option(noti,
+ NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, service_handle);
if (noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_set_display_applist : %d",
- noti_err);
+ log_print(NET_POPUP, "fail to notification_set_launch_option");
goto error;
}
- noti_err = notification_insert(noti, NULL);
+ noti_err = notification_post(noti);
if (noti_err != NOTIFICATION_ERROR_NONE) {
- log_print(NET_POPUP, "fail to notification_insert");
+ log_print(NET_POPUP, "fail to notification_post");
goto error;
}
log_print(NET_POPUP, "Successfully added notification");
error:
+ g_free(ap_name);
if (noti != NULL)
notification_free(noti);
+
+ if (service_handle != NULL)
+ app_control_destroy(service_handle);
}
-static void __net_popup_add_restricted_state_noti(bundle *b)
+static void __net_popup_del_ip_conflict_noti(void)
{
- const char *text_cs;
- const char *text_ps;
+ log_print(NET_POPUP, "__net_popup_del_ip_conflict_noti()\n");
+
+ notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
- if (!b) {
- log_print(NET_POPUP, "failed, bundle=%p", b);
+ noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_delete_all");
return;
}
- __net_popup_del_restricted_state_noti();
-
- text_cs = bundle_get_val(b, "_SYSPOPUP_NETWORK_NAME_");
- if (text_cs)
- __net_popup_add_restricted_state_noti_real (
- "org.tizen.net-popup.restricted_state_cs", text_cs);
-
- text_ps = bundle_get_val(b, "_SYSPOPUP_NETWORK_NAME2_");
- if (text_ps)
- __net_popup_add_restricted_state_noti_real (
- "org.tizen.net-popup.restricted_state_ps", text_ps);
-
- if (!text_cs && !text_ps)
- log_print(NET_POPUP, "failed, text_cs=%p, text_ps=%p",
- text_cs, text_ps);
+ log_print(NET_POPUP, "Successfully deleted notification");
}
-static void __net_popup_del_restricted_state_noti(void)
+static void __net_popup_del_portal_noti(void)
{
+ log_print(NET_POPUP, "__net_popup_del_portal_noti()\n");
+
notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
- noti_err = notification_delete_all_by_type("org.tizen.net-popup.restricted_state_cs",
- NOTIFICATION_TYPE_ONGOING);
- if (noti_err != NOTIFICATION_ERROR_NONE)
- log_print(NET_POPUP, "fail to notification_delete_by_priv_id");
- else
- log_print(NET_POPUP, "Successfully deleted cs notification");
+ noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ log_print(NET_POPUP, "fail to notification_delete_all");
+ return;
+ }
- noti_err = notification_delete_all_by_type("org.tizen.net-popup.restricted_state_ps",
- NOTIFICATION_TYPE_ONGOING);
- if (noti_err != NOTIFICATION_ERROR_NONE)
- log_print(NET_POPUP, "fail to notification_delete_by_priv_id");
- else
- log_print(NET_POPUP, "Successfully deleted ps notification");
+ log_print(NET_POPUP, "Successfully deleted notification");
}
-int main(int argc, char *argv[])
+EXPORT_API int main(int argc, char *argv[])
{
- struct appcore_ops ops = {
- .create = __net_popup_create,
- .terminate = __net_popup_terminate,
- .pause = __net_popup_pause,
- .resume = __net_popup_resume,
- .reset = __net_popup_reset,
- };
+ log_print(NET_POPUP, "main()\n");
+
+ __net_popup_get_tizen_profile();
+
+ if (g_profile == TIZEN_PROFILE_MOBILE) {
+ ui_app_lifecycle_callback_s app_callback = {
+ .create = __net_popup_create,
+ .terminate = __net_popup_terminate,
+ .pause = __net_popup_pause,
+ .resume = __net_popup_resume,
+ .app_control = __net_popup_service_cb,
+ };
+
+ return ui_app_main(argc, argv, &app_callback, NULL);
+ } else if (g_profile == TIZEN_PROFILE_WEARABLE) {
+ return net_popup_w_init(argc, argv);
+ }
- return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
+ return 0;
}
-