From: sy1124.kim Date: Fri, 15 Apr 2016 07:12:29 +0000 (+0900) Subject: Remove mobile menu X-Git-Tag: submit/tizen/20160415.095530^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F05%2F66105%2F2;p=profile%2Fcommon%2Fapps%2Fnative%2Fsettings.git Remove mobile menu Change-Id: I2239e0b22a9b774ccec75a93359f7262c6ef0a7d Signed-off-by: Hyunjee Kim --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ef28a4..0a85b93 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,9 +16,6 @@ SET(CMAKE_SKIP_BUILD_RPATH true) #set variable SET(SETTING_PROFILE setting-profile) -SET(SETTING_CONNECTIVITY setting-connectivity) -SET(SETTING_SECURITY setting-security) -SET(SETTING_LOCKTYPE setting-locktype) SET(SETTING_DISPLAY setting-display) SET(SETTING_APPLICATIONS setting-applications) SET(SETTING_MORECONNECTIONS setting-moreconnections) @@ -26,42 +23,28 @@ SET(SETTING_TIME setting-time) SET(SETTING_PHONE setting-phone) SET(SETTING_PASSWORD setting-password) SET(SETTING_COMMON setting-common) -SET(SETTING_NETWORK setting-network) SET(SETTING_ABOUT setting-about) SET(SETTING_FONT setting-font) SET(SETTING_STORAGE setting-storage) SET(SETTING_FILEVIEW setting-fileview) SET(SETTING_RINGTONE setting-ringtone) SET(SETTING_APPMGR setting-appmgr) -SET(SETTING_FLIGHTMODE setting-flightmode) -#SET(SETTING_ACCESSIBILITY setting-accessibility) SET(SETTING_PROFILE_UG setting-profile-efl) -SET(SETTING_DEVELOPEROPTION_UG setting-developeroption-efl) -SET(SETTING_SECURITY_UG setting-security-efl) -SET(SETTING_LOCKTYPE_UG setting-locktype-efl) SET(SETTING_DISPLAY_UG setting-display-efl) SET(SETTING_APPLICATIONS_UG setting-applications-efl) -SET(SETTING_MORECONNECTIONS_UG setting-moreconnections-efl) SET(SETTING_TIME_UG setting-time-efl) SET(SETTING_PHONE_UG setting-phone-efl) -SET(SETTING_NETWORK_UG setting-network-efl) SET(SETTING_ABOUT_UG setting-about-efl) SET(SETTING_FILEVIEW_UG setting-fileview-efl) SET(SETTING_RINGTONE_UG setting-ringtone-efl) -SET(SETTING_PASSWORD_UG setting-password-efl) SET(SETTING_FONT_UG setting-font-efl) SET(SETTING_STORAGE_UG setting-storage-efl) SET(SETTING_MANAGE_APPS_UG setting-manage-applications-efl) -SET(SETTING_FLIGHTMODE_UG setting-flightmode-efl) -#SET(SETTING_ACCESSIBILITY_UG setting-accessibility-efl) - SET(LIB_SETTING_COMMON setting-common) - -#SET(GC_SECTIONS_FLAGS "-fdata-sections -ffunction-sections -Wl,--gc-sections -Werror-implicit-function-declaration -Wparentheses -feliminate-unused-debug-types -pipe -Wall -Wp, -D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -fmessage-length=0 -fdiagnostics-color=never -Wno-deprecated-declarations -Werror-implicit-function-declaration") SET(GC_SECTIONS_FLAGS "-fdata-sections -ffunction-sections -Wl,--gc-sections") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GC_SECTIONS_FLAGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GC_SECTIONS_FLAGS}") @@ -111,21 +94,10 @@ ADD_SUBDIRECTORY(src) # all UGs for Setting itself ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_STORAGE}) ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_PHONE}) -ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_CONNECTIVITY}) ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_DISPLAY}) -ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_NETWORK}) ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_APPLICATIONS}) -ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_MORECONNECTIONS}) ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_PROFILE}) -ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_SECURITY}) -ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_LOCKTYPE}) ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_TIME}) ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_ABOUT}) -ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_PASSWORD}) ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_FONT}) -#ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_FILEVIEW}) ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_RINGTONE}) -#ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_APPMGR}) -ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_FLIGHTMODE}) -#ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_ACCESSIBILITY}) - diff --git a/org.tizen.setting.xml.in b/org.tizen.setting.xml.in index 69c04e2..d68518f 100755 --- a/org.tizen.setting.xml.in +++ b/org.tizen.setting.xml.in @@ -61,206 +61,88 @@ - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - - - - - - - - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - - - - - - - + @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png + + + + + + + + + + - - - - - - + + + + + + - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - - - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - + @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png + + - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - - + @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png + + + + + - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - - - - - - - - - - - - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - - - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - - - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - + @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png + + + + - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - - - - - + + + - - + + + + - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - + + @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png + + + + - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - + + @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png + + + + - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - + @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png + + - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - + @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png + + - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - - - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - - - - - + + - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - @TZ_SYS_RO_ICONS@/default/small/org.tizen.setting.png - - http://tizen.org/privilege/appmanager.launch http://tizen.org/privilege/appmanager.kill diff --git a/setting-accessibility/CMakeLists.txt b/setting-accessibility/CMakeLists.txt deleted file mode 100644 index 39b66a7..0000000 --- a/setting-accessibility/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${SETTING_COMMON}/include) - -FILE(GLOB ACC_SRCS *.c) - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs_acc REQUIRED elementary ui-gadget-1 capi-appfw-application - evas dlog edje glib-2.0 appcore-efl eina appsvc capi-appfw-app-manager - vconf app2sd json-glib-1.0 efl-extension libtzplatform-config) - -FOREACH(flag ${pkgs_acc_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Werror-implicit-function-declaration") -SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") - -IF("${ARCH}" STREQUAL "arm") - ADD_DEFINITIONS("-DTARGET") - MESSAGE("add -DTARGET") -ENDIF("${ARCH}" STREQUAL "arm") - -ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") - -ADD_LIBRARY(${SETTING_ACCESSIBILITY_UG} SHARED ${ACC_SRCS}) -TARGET_LINK_LIBRARIES(${SETTING_ACCESSIBILITY_UG} ${LIB_SETTING_COMMON}) -TARGET_LINK_LIBRARIES(${SETTING_ACCESSIBILITY_UG} ${pkgs_appmgr_LDFLAGS}) - -INSTALL(TARGETS ${SETTING_ACCESSIBILITY_UG} DESTINATION ${PREFIX}/lib/ug) diff --git a/setting-accessibility/setting-accessibility-main.c b/setting-accessibility/setting-accessibility-main.c deleted file mode 100644 index 805f258..0000000 --- a/setting-accessibility/setting-accessibility-main.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * accessibility - * - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Contact: Tomasz Olszak - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "setting-accessibility-main.h" -#include "setting-accessibility-screen-reader.h" - -static int setting_accessibility_main_create(void *cb); -static int setting_accessibility_main_destroy(void *cb); -static int setting_accessibility_main_update(void *cb); -static int setting_accessibility_main_cleanup(void *cb); - -setting_view setting_view_accessibility_main = { - .create = setting_accessibility_main_create, - .destroy = setting_accessibility_main_destroy, - .update = setting_accessibility_main_update, - .cleanup = setting_accessibility_main_cleanup, -}; - -static void setting_accessibility_screen_reader_key_change_vconf_cb(keynode_t *key, void *user_data) -{ - SETTING_TRACE_BEGIN; - Setting_GenGroupItem_Data *screen_reader_item = user_data; - if (screen_reader_item->sub_desc) - free(screen_reader_item->sub_desc); - screen_reader_item->sub_desc = strdup(vconf_keynode_get_bool(key) ? _(DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_ON) : _(DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_OFF)); - - elm_genlist_item_update(screen_reader_item->item); - - SETTING_TRACE_END; -} - - -/** -* @brief Do process when clicking '<-' button -* -* @param data application context -* @param obj evas object -* @param event_info event type -*/ -static Eina_Bool -setting_accessibility_main_click_softkey_back_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - setting_retvm_if(data == NULL, EINA_FALSE, "Data parameter is NULL"); - SettingAccessibilityUG *ad = (SettingAccessibilityUG *) data; - if (ad->empty_flag) { - return EINA_FALSE; - } - vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, setting_accessibility_screen_reader_key_change_vconf_cb); - /* Send destroy request */ - ug_destroy_me(ad->ug); - SETTING_TRACE_END; - return EINA_FALSE; -} - -static void setting_accessibility_vision_screen_reader_mouse_up_Gendial_list_cb(void *data, - Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - SettingAccessibilityUG *ad = (SettingAccessibilityUG *)data; - elm_genlist_item_selected_set(item, 0); - setting_accessibility_screen_reader_page_create(ad); - SETTING_TRACE_END; -} - -/** - * @brief create main view genlist items - * - * @param data application data - * - * @return FALSE for call it once and then destory the timer, TRUE for always call it when the timer is reached. - */ -int setting_accessibility_main_generate_genlist(void *data) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingAccessibilityUG *ad = (SettingAccessibilityUG *) data; - Evas_Object *scroller = ad->genlist; - (void)setting_create_Gendial_field_titleItem(scroller, &(itc_group_item), _(DEVOPTION_STR_ACCESSIBILITY_VISION), NULL); - - int screen_reader = 0; - vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &screen_reader); - - Setting_GenGroupItem_Data *screen_reader_item = - setting_create_Gendial_field_def(scroller, &itc_2text, - setting_accessibility_vision_screen_reader_mouse_up_Gendial_list_cb, - ad, SWALLOW_Type_INVALID, NULL, - NULL, 1, _(DEVOPTION_STR_ACCESSIBILITY_SCREENREADER), - screen_reader ? _(DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_ON) : _(DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_OFF), - NULL); - int vconf_ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS,setting_accessibility_screen_reader_key_change_vconf_cb,screen_reader_item); - if (vconf_ret != 0) { - SETTING_TRACE("FAIL: vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS)"); - return SETTING_RETURN_FAIL; - } - screen_reader_item->userdata = ad; - __BACK_POINTER_SET(screen_reader_item); - - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - - -static int setting_accessibility_main_create(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - SettingAccessibilityUG *ad = (SettingAccessibilityUG *) cb; - Evas_Object *scroller = elm_genlist_add(ad->win_main_layout); - retvm_if(scroller == NULL, SETTING_DRAW_ERR_FAIL_SCROLLER, - "Cannot set scroller object as contento of layout"); - elm_object_style_set(scroller, "dialogue"); - elm_genlist_clear(scroller); /* first to clear list */ - ad->genlist = scroller; - ad->ly_main = - setting_create_layout_navi_bar(ad->win_main_layout, ad->win_get, - KeyStr_Accessibility, - _("IDS_ST_BUTTON_BACK"), - (setting_call_back_func)setting_accessibility_main_click_softkey_back_cb, - ad, scroller, - &ad->navi_bar, NULL); - ad->navi_item = elm_naviframe_top_item_get(ad->navi_bar); - - setting_accessibility_main_generate_genlist((void *)ad); - setting_view_accessibility_main.is_create = 1; - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -static int setting_accessibility_main_destroy(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - setting_view_accessibility_main.is_create = 0; - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -static int setting_accessibility_main_update(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -static int setting_accessibility_main_cleanup(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - - diff --git a/setting-accessibility/setting-accessibility-main.h b/setting-accessibility/setting-accessibility-main.h deleted file mode 100644 index 4c9300e..0000000 --- a/setting-accessibility/setting-accessibility-main.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * accessibility - * - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Contact: Tomasz Olszak - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_ACCESSIBILITY_MAIN_H__ -#define __SETTING_ACCESSIBILITY_MAIN_H__ - -#include "setting-accessibility.h" - - - - - -#endif /*__SETTING_ACCESSIBILITY_MAIN_H__ */ diff --git a/setting-accessibility/setting-accessibility-screen-reader-settings.c b/setting-accessibility/setting-accessibility-screen-reader-settings.c deleted file mode 100644 index 968cb23..0000000 --- a/setting-accessibility/setting-accessibility-screen-reader-settings.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * accessibility - * - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Contact: Tomasz Olszak - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include - -#include "setting-accessibility-screen-reader-settings.h" - -#define POPUP_CONTENT_BASE_SIZE 126 - -typedef struct { - char *label; - char *vconf_key; - int *status; -} vconf_check_data_s; - - - -vconf_check_data_s vconf_check_data[] = { - { - .label = DEVOPTION_STR_ACCESSIBILITY_INDICATOR_TIME, - .vconf_key = VCONFKEY_SETAPPL_ACCESSIBILITY_TTS_INDICATOR_INFORMATION_TIME, - .status = NULL - }, - { - .label = DEVOPTION_STR_ACCESSIBILITY_INDICATOR_BATTERY, - .vconf_key = VCONFKEY_SETAPPL_ACCESSIBILITY_TTS_INDICATOR_INFORMATION_BATTERY, - .status = NULL - }, - { - .label = DEVOPTION_STR_ACCESSIBILITY_INDICATOR_BLUETOOTH, - .vconf_key = VCONFKEY_SETAPPL_ACCESSIBILITY_TTS_INDICATOR_INFORMATION_BLUETOOTH, - .status = NULL - }, - { - .label = DEVOPTION_STR_ACCESSIBILITY_INDICATOR_SIGNAL_STRENGTH, - .vconf_key = VCONFKEY_SETAPPL_ACCESSIBILITY_TTS_INDICATOR_INFORMATION_SIGNAL_STRENGHT, - .status = NULL - }, - { - .label = DEVOPTION_STR_ACCESSIBILITY_INDICATOR_DATE, - .vconf_key = VCONFKEY_SETAPPL_ACCESSIBILITY_TTS_INDICATOR_INFORMATION_DATE, - .status = NULL - }, - { - .label = DEVOPTION_STR_ACCESSIBILITY_INDICATOR_UNREAD_NOTIFICATIONS, - .vconf_key = VCONFKEY_SETAPPL_ACCESSIBILITY_TTS_INDICATOR_INFORMATION_MISSED_EVENTS, - .status = NULL - } -}; -static Eina_List *items = NULL; - - - - - -static Eina_Bool __setting_accessibility_screen_reader_settings_page_hide(void *data, Elm_Object_Item *it) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(data == NULL, EINA_TRUE); - SettingAccessibilityUG *ad = (SettingAccessibilityUG *) data; - elm_naviframe_item_pop(ad->navi_bar); - SETTING_TRACE_END; - return EINA_TRUE; -} - -static Eina_Bool _vconf_key_value_get(char *key) -{ - retvm_if(!key, EINA_FALSE, "Key is NULL"); - int value = 0; - int ret = vconf_get_bool(key, &value); - if (ret != 0) { - LOGE("Failed to get vconf bool value %s. Error: %d", key, ret); - return EINA_FALSE; - } - return (value != 0); -} - -static void _vconf_key_value_set(char *key, int value) -{ - retm_if(!key, "key == NULL"); - - int ret = vconf_set_bool(key, value); - - - if (ret != 0) { - LOGE("Failed to set vconf key %s. Error: %d", key, ret); - return; - } -} - -static void _vconf_key_foreach_check_set(void) -{ - int i; - int size = sizeof(vconf_check_data) / sizeof(vconf_check_data[0]); - int status = 0; - char *key = NULL; - - for (i = 0; i < size; ++i) { - key = vconf_check_data[i].vconf_key; - status = *(vconf_check_data[i].status); - _vconf_key_value_set(key, status); - } -} - -static void _cancel_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN - Evas_Object *popup = (Evas_Object *)data; - retm_if(!popup, "popup == NULL"); - evas_object_del(popup); - SETTING_TRACE_END -} - -static void _done_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN - Evas_Object *popup = (Evas_Object *)data; - retm_if(!popup, "popup == NULL"); - evas_object_del(popup); - - - _vconf_key_foreach_check_set(); - SETTING_TRACE_END -} - -static void _check_state_changed_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN - if (!data) { - LOGD("data == NULL"); - return; - } - - Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *)data; - item_data->chk_status = elm_check_state_get(obj); - LOGE("Check changed: %s; status: %d, %p", item_data->keyStr, item_data->chk_status, &item_data->chk_status); - - SETTING_TRACE_END -} - - -static void _list_item_clicked_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN - - Elm_Object_Item *item = (Elm_Object_Item *)event_info; - retm_if(!item, "item == NULL"); - - elm_genlist_item_selected_set(item, EINA_FALSE); - - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) elm_object_item_data_get(item); - retm_if(!list_item, "list_item == NULL"); - - LOGI("ITEM SELECTED: %s", list_item->keyStr); - setting_update_gl_item_chk_status(list_item, !list_item->chk_status); - - SETTING_TRACE_END -} - -static void setting_accessibility_screen_reader_settings_status_bar_info_mouse_up_Gendial_list_cb(void *data, - Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Invalid argument: data is NULL"); - retm_if(event_info == NULL, "Invalid argument: event_info is NULL"); - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - SettingAccessibilityUG *ad = (SettingAccessibilityUG *)data; - Evas_Object *popup; - Evas_Object *box; - Evas_Object *genlist; - Setting_GenGroupItem_Data *screenreader_checkbox = NULL; - int i; - int size = sizeof(vconf_check_data) / sizeof(vconf_check_data[0]); - int status; - - elm_genlist_item_selected_set(item, EINA_FALSE); - - popup = elm_popup_add(ad->win_main_layout); - elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); - /* eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL); */ - elm_object_part_text_set(popup, "title,text", _(DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_SETTINGS_STATUS_BAR_INFORMATION)); - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - /* box */ - box = elm_box_add(popup); - evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - /* genlist */ - genlist = elm_genlist_add(box); - evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); - - for (i = 0; i < size; ++i) { - status = _vconf_key_value_get(vconf_check_data[i].vconf_key); - - screenreader_checkbox = setting_create_Gendial_field_def(genlist, &itc_1text_1icon, - _list_item_clicked_cb, - ad, SWALLOW_Type_1ICON_1RADIO, NULL, - NULL, status, _(vconf_check_data[i].label), - NULL, _check_state_changed_cb); - - vconf_check_data[i].status = &screenreader_checkbox->chk_status; - items = eina_list_append(items, screenreader_checkbox); - } - - elm_scroller_movement_block_set(genlist, ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL | ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL); - elm_scroller_policy_set(genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); - - evas_object_show(genlist); - elm_box_pack_end(box, genlist); - evas_object_size_hint_min_set(box, -1, ELM_SCALE_SIZE(POPUP_CONTENT_BASE_SIZE) * size); - evas_object_size_hint_max_set(box, -1, ELM_SCALE_SIZE(POPUP_CONTENT_BASE_SIZE) * size); - elm_object_content_set(popup, box); - - const char *btnCancelText = "Cancel"; - const char *btnDoneText = "Done"; - - Evas_Object *btnCancel = setting_create_button(popup, btnCancelText, NULL, _cancel_button_clicked_cb, popup); - elm_object_style_set(btnCancel, "popup"); - elm_object_part_content_set(popup, _("button1"), btnCancel); - evas_object_data_set(popup, _("button1"), btnCancelText); - - Evas_Object *btnDone = setting_create_button(popup, btnDoneText, NULL, _done_button_clicked_cb, popup); - elm_object_style_set(btnDone, "popup"); - - elm_object_part_content_set(popup, _("button2"), btnDone); - evas_object_data_set(popup, _("button2"), btnDoneText); - - eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _cancel_button_clicked_cb, popup); - - evas_object_show(popup); - - SETTING_TRACE_END; -} - -void setting_accessibility_screen_reader_settings_page_create(SettingAccessibilityUG *data) -{ - SettingAccessibilityUG *ad = (SettingAccessibilityUG *) data; - Evas_Object *genlist = elm_genlist_add(ad->navi_bar); - retm_if(genlist == NULL, "Cannot set genlist object as content of layout"); - elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); - elm_object_style_set(genlist, "dialogue"); - elm_genlist_clear(genlist); - - - (void)setting_create_Gendial_field_titleItem(genlist, &(itc_group_item), _(DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_SETTINGS_SPEECH), NULL); - (void)setting_create_Gendial_field_titleItem(genlist, &(itc_group_item), _(DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_SETTINGS_OTHER_FEEDBACK), NULL); - - Setting_GenGroupItem_Data *status_bar_information_item = - setting_create_Gendial_field_def(genlist, &itc_1text, - setting_accessibility_screen_reader_settings_status_bar_info_mouse_up_Gendial_list_cb, - ad, SWALLOW_Type_INVALID, NULL, - NULL, 1, _(DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_SETTINGS_STATUS_BAR_INFORMATION), - NULL, - NULL); - - status_bar_information_item->userdata = ad; - __BACK_POINTER_SET(status_bar_information_item); - - - Setting_GenGroupItem_Data *multiline_status_bar_information_description = - setting_create_Gendial_field_def(genlist, &itc_multiline_text, - NULL, - ad, SWALLOW_Type_INVALID, NULL, - NULL, 0, - _(DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_SETTINGS_STATUS_BAR_INFORMATION_DESCRIPTION), NULL, NULL); - multiline_status_bar_information_description->userdata = ad; - __BACK_POINTER_SET(multiline_status_bar_information_description); - - - Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->navi_bar, _(DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_SETTINGS), NULL, NULL, genlist, NULL); - elm_object_item_domain_text_translatable_set(navi_it, SETTING_PACKAGE, EINA_TRUE); - - elm_naviframe_item_pop_cb_set(navi_it, (Elm_Naviframe_Item_Pop_Cb)__setting_accessibility_screen_reader_settings_page_hide, ad); -} diff --git a/setting-accessibility/setting-accessibility-screen-reader-settings.h b/setting-accessibility/setting-accessibility-screen-reader-settings.h deleted file mode 100644 index 1ec78a4..0000000 --- a/setting-accessibility/setting-accessibility-screen-reader-settings.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef SETTING_ACCESSIBILITY_SCREEN_READER_SETTINGS_H -#define SETTING_ACCESSIBILITY_SCREEN_READER_SETTINGS_H - -#include "setting-accessibility.h" - -void setting_accessibility_screen_reader_settings_page_create(SettingAccessibilityUG *data); - -#endif /* SETTING_ACCESSIBILITY_SCREEN_READER_SETTINGS_H */ - diff --git a/setting-accessibility/setting-accessibility-screen-reader.c b/setting-accessibility/setting-accessibility-screen-reader.c deleted file mode 100644 index 505c0a3..0000000 --- a/setting-accessibility/setting-accessibility-screen-reader.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * accessibility - * - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Contact: Tomasz Olszak - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "setting-accessibility-screen-reader.h" -#include "setting-accessibility-screen-reader-settings.h" - -static void screen_reader_key_change_vconf_cb(keynode_t *node, void *user_data) -{ - SETTING_TRACE_BEGIN; - Setting_GenGroupItem_Data *screenReaderItem = user_data; - //SETTING_TRACE_DEBUG("check_status: %i, node->value.i: %i", screenReaderItem->chk_status, node->value.i); - /* I don't know why following code does not update check box to checked/unchecked */ -// setting_update_gl_item_chk_status(screenReaderItem, node->value.b ? 1 : 0); - elm_genlist_item_update(screenReaderItem->item); - SETTING_TRACE_END; -} - -static Eina_Bool __setting_accessibility_screen_reader_page_hide(void *data, Elm_Object_Item *it) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(data == NULL, EINA_TRUE); - SettingAccessibilityUG *ad = (SettingAccessibilityUG *) data; - vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, screen_reader_key_change_vconf_cb); - elm_naviframe_item_pop(ad->navi_bar); - SETTING_TRACE_END; - return EINA_TRUE; -} - -static void setting_accessibility_main_chk_screenreader_vconf_update(int state) -{ - vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, state ? 1 : 0); -} - -static void setting_accessibility_main_chk_screenreader_cb(void *data, - Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data; - - list_item->chk_status = elm_check_state_get(obj); /* for genlist update status */ - - SETTING_TRACE_DEBUG("check_status: %i", list_item->chk_status); - setting_accessibility_main_chk_screenreader_vconf_update(list_item->chk_status); - SETTING_TRACE_END; -} -static void setting_accessibility_screenreader_settings_mouse_up_Gendial_list_cb(void *data, - Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Invalid argument: data is NULL"); - retm_if(event_info == NULL, "Invalid argument: event_info is NULL"); - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - SettingAccessibilityUG *ad = (SettingAccessibilityUG *)data; - - elm_genlist_item_selected_set(item, 0); - - setting_accessibility_screen_reader_settings_page_create(ad); - - SETTING_TRACE_END; -} - -static void setting_accessibility_screenreader_mouse_up_Gendial_list_cb(void *data, - Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Invalid argument: data is NULL"); - retm_if(event_info == NULL, "Invalid argument: event_info is NULL"); - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - - elm_genlist_item_selected_set(item, 0); - - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) elm_object_item_data_get(item); - setting_retm_if(data == NULL, "Data parameter is NULL"); - setting_update_gl_item_chk_status(list_item, list_item->chk_status ? 0 : 1); - setting_accessibility_main_chk_screenreader_vconf_update(list_item->chk_status ? 1 : 0); - SETTING_TRACE_END; -} - -void setting_accessibility_screen_reader_page_create(SettingAccessibilityUG *data) -{ - SettingAccessibilityUG *ad = (SettingAccessibilityUG *) data; - Evas_Object *genlist = elm_genlist_add(ad->navi_bar); - retm_if(genlist == NULL, "Cannot set genlist object as content of layout"); - elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); - elm_object_style_set(genlist, "dialogue"); - elm_genlist_clear(genlist); - - Setting_GenGroupItem_Data *screenreader_checkbox = - setting_create_Gendial_field_def(genlist, &itc_1text_1icon, - setting_accessibility_screenreader_mouse_up_Gendial_list_cb, - ad, SWALLOW_Type_1ICON_1RADIO, NULL, - NULL, 1, _(DEVOPTION_STR_ACCESSIBILITY_SCREENREADER), - NULL, setting_accessibility_main_chk_screenreader_cb); - screenreader_checkbox->userdata = ad; - __BACK_POINTER_SET(screenreader_checkbox); - int screen_reader = 0; - vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &screen_reader); - screenreader_checkbox->chk_status = screen_reader ? 1 : 0; - /*---------------------------------------------------------------------------------------------- */ - int vconf_ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, - screen_reader_key_change_vconf_cb, screenreader_checkbox); - if (vconf_ret != 0) { - SETTING_TRACE("FAIL: vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS)"); - return ; - } - - Setting_GenGroupItem_Data *multiline_screen_reader_comment = - setting_create_Gendial_field_def(genlist, &itc_multiline_text, - NULL, - ad, SWALLOW_Type_INVALID, NULL, - NULL, 0, - _(DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_DESCRIPTION), NULL, NULL); - multiline_screen_reader_comment->userdata = ad; - __BACK_POINTER_SET(multiline_screen_reader_comment); - - Setting_GenGroupItem_Data *screen_reader_settings = - setting_create_Gendial_field_def(genlist, &itc_1text, - setting_accessibility_screenreader_settings_mouse_up_Gendial_list_cb, - ad, SWALLOW_Type_INVALID, NULL, - NULL, 0, - DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_SETTINGS, NULL, NULL); - screen_reader_settings->userdata = ad; - __BACK_POINTER_SET(screen_reader_settings); - - Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->navi_bar, _(DEVOPTION_STR_ACCESSIBILITY_SCREENREADER), NULL, NULL, genlist, NULL); - elm_object_item_domain_text_translatable_set(navi_it, SETTING_PACKAGE, EINA_TRUE); - - elm_naviframe_item_pop_cb_set(navi_it, (Elm_Naviframe_Item_Pop_Cb)__setting_accessibility_screen_reader_page_hide, ad); -} diff --git a/setting-accessibility/setting-accessibility-screen-reader.h b/setting-accessibility/setting-accessibility-screen-reader.h deleted file mode 100644 index a86e6c4..0000000 --- a/setting-accessibility/setting-accessibility-screen-reader.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef SETTINGACCESSIBILITYSCREENREADER_H -#define SETTINGACCESSIBILITYSCREENREADER_H - -#include "setting-accessibility.h" - -void setting_accessibility_screen_reader_page_create(SettingAccessibilityUG *data); - -#endif /* SETTINGACCESSIBILITYSCREENREADER_H */ - diff --git a/setting-accessibility/setting-accessibility.c b/setting-accessibility/setting-accessibility.c deleted file mode 100755 index bfbe798..0000000 --- a/setting-accessibility/setting-accessibility.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * accessibility - * - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Contact: Tomasz Olszak - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "setting-accessibility.h" -#include -#include - -#ifndef UG_MODULE_API -#define UG_MODULE_API __attribute__ ((visibility("default"))) -#endif - -static void *setting_accessibility_ug_on_create(ui_gadget_h ug, - enum ug_mode mode, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - setting_retvm_if((NULL == priv), NULL, "NULL == priv"); - SettingAccessibilityUG *accessibilityUG = priv; - accessibilityUG->ug = ug; - accessibilityUG->win_main_layout = (Evas_Object *) ug_get_parent_layout(ug); - accessibilityUG->win_get = (Evas_Object *) ug_get_window(); - evas_object_show(accessibilityUG->win_main_layout); - accessibilityUG->evas = evas_object_evas_get(accessibilityUG->win_main_layout); - - setting_retvm_if(accessibilityUG->win_main_layout == NULL, NULL, - "cannot get main window "); - setting_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR); - - /* register view node table */ - setting_view_node_table_intialize(); - setting_view_node_table_register(&setting_view_accessibility_main, NULL); - - - setting_view_node_set_cur_view(&setting_view_accessibility_main); - setting_view_create(&setting_view_accessibility_main, (void *)accessibilityUG); - - return accessibilityUG->ly_main; -} - -void setting_accessibility_ug_on_start(ui_gadget_h ug, app_control_h app_control, void *priv) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE_END; -} - -void setting_accessibility_ug_on_pause(ui_gadget_h ug, app_control_h app_control, void *priv) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE_END; -} - -void setting_accessibility_ug_on_resume(ui_gadget_h ug, app_control_h app_control, void *priv) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE_END; -} - -void setting_accessibility_ug_on_destroy(ui_gadget_h ug, app_control_h app_control, void *priv) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE_END; -} - -void setting_accessibility_ug_on_message(ui_gadget_h ug, app_control_h msg, app_control_h app_control, void *priv) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE_END; -} -void setting_accessibility_ug_on_event(ui_gadget_h ug, enum ug_event event, app_control_h app_control, void *priv) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE_END; -} - -void setting_accessibility_ug_on_key_event(ui_gadget_h ug, enum ug_key_event event, - app_control_h app_control, void *priv) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE_END; -} - -UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops) -{ - SETTING_TRACE_BEGIN; - - SettingAccessibilityUG *accessibilityUG = - calloc(1, sizeof(SettingAccessibilityUG)); - setting_retvm_if(!accessibilityUG, -1, - "Create SettingAccessibilityUG obj failed"); - - ops->create = setting_accessibility_ug_on_create; - ops->start = setting_accessibility_ug_on_start; - ops->pause = setting_accessibility_ug_on_pause; - ops->resume = setting_accessibility_ug_on_resume; - ops->destroy = setting_accessibility_ug_on_destroy; - ops->message = setting_accessibility_ug_on_message; - ops->event = setting_accessibility_ug_on_event; - ops->key_event = setting_accessibility_ug_on_key_event; - ops->priv = accessibilityUG; - ops->opt = UG_OPT_INDICATOR_ENABLE; - - SETTING_TRACE_END; - return 0; -} - -UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops) -{ - SETTING_TRACE_BEGIN; - - struct SettingAccessibilityUG *accessibilityUG; - setting_retm_if(!ops, "ops == NULL"); - - accessibilityUG = ops->priv; - if (accessibilityUG) { - FREE(accessibilityUG); - } - - SETTING_TRACE_END; -} - -UG_MODULE_API int setting_plugin_search_init(app_control_h service, void *priv, - char **applocale) -{ - SETTING_TRACE_BEGIN; - int i, size; - Setting_Cfg_Node_T *node; - Eina_List **pplist = priv; - const Setting_Cfg_Node_T search_configs[] = { - {_(DEVOPTION_STR_ACCESSIBILITY_MAGNIFIER), NULL, NULL, 0, Cfg_Item_unResetable, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, - {_(DEVOPTION_STR_ACCESSIBILITY_SCREENREADER), NULL, NULL, 0, Cfg_Item_unResetable, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, - }; - - retv_if(NULL == priv, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - retv_if(NULL == applocale, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - *applocale = strdup("setting:"_TZ_SYS_RO_APP"/org.tizen.setting/res/locale"); - - size = sizeof(search_configs) / sizeof(Setting_Cfg_Node_T); - - for (i = 0; i < size; i++) { - node = setting_plugin_search_item_subindex_add( - search_configs[i].key_name, - "viewtype:accessibility", - IMG_USBconnection, - search_configs[i].item_type, - search_configs[i].data, - "Accessibility"); - - *pplist = eina_list_append(*pplist, node); - } - - SETTING_TRACE_END; - return 0; -} - diff --git a/setting-accessibility/setting-accessibility.h b/setting-accessibility/setting-accessibility.h deleted file mode 100644 index 6397fc2..0000000 --- a/setting-accessibility/setting-accessibility.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * accessibility - * - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Contact: Tomasz Olszak - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_ACCESSIBILITY_H__ -#define __SETTING_ACCESSIBILITY_H__ - -#include - -#include -#include - -#define DEVOPTION_STR_ACCESSIBILITY_VISION "IDS_ST_HEADER_VISION" -#define DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_SETTINGS_SPEECH "IDS_ST_BODY_SPEECH" -#define DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_ON "IDS_ST_BODY_ON" -#define DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_OFF "IDS_ST_BODY_OFF" -#define DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_SETTINGS "IDS_ST_OPT_SETTINGS" - -#define DEVOPTION_STR_ACCESSIBILITY_MAGNIFIER "IDS_ST_BODY_MAGNIFIER" -#define DEVOPTION_STR_ACCESSIBILITY_SCREENREADER "IDS_ST_MBODY_SCREEN_READER_HTTS" -#define DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_DESCRIPTION "While Screen reader is enabled, your device provides spoken feedback." \ - " For example, Screen reader tells you what you can tap, select, or enable." \ - " Basic interactions include tapping an item to select it and double tapping the item to enable its function." //english only translation -#define DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_SETTINGS_OTHER_FEEDBACK "IDS_ACCS_OPT_OTHER_FEEDBACK_TTS" -#define DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_SETTINGS_STATUS_BAR_INFORMATION "IDS_ACCS_TMBODY_STATUS_BAR_INFORMATION" -#define DEVOPTION_STR_ACCESSIBILITY_SCREEN_READER_SETTINGS_STATUS_BAR_INFORMATION_DESCRIPTION \ - "IDS_ACCS_SBODY_SELECT_WHICH_INFORMATION_FROM_INDICATORS_SHOWN_ON_THE_STATUS_BAR_WILL_BE_READ_OUT_WHEN_YOU_TRIPLE_TAP_THE_SCREEN_WITH_TWO_FINGERS_MSG" - -#define DEVOPTION_STR_ACCESSIBILITY_INDICATOR_TIME "IDS_ST_HEADER_TIME" -#define DEVOPTION_STR_ACCESSIBILITY_INDICATOR_BATTERY "IDS_ST_BODY_BATTERY" -#define DEVOPTION_STR_ACCESSIBILITY_INDICATOR_BLUETOOTH "IDS_ST_BODY_BLUETOOTH" -#define DEVOPTION_STR_ACCESSIBILITY_INDICATOR_DATE "IDS_ST_BODY_DATE" -#define DEVOPTION_STR_ACCESSIBILITY_INDICATOR_SIGNAL_STRENGTH "IDS_ST_BODY_SIGNAL_STRENGTH" -#define DEVOPTION_STR_ACCESSIBILITY_INDICATOR_UNREAD_NOTIFICATIONS "IDS_SCR_BODY_PD_UNREAD_NOTIFICATIONS" - - -typedef struct _SettingAccessibilityUG SettingAccessibilityUG; - -struct _SettingAccessibilityUG { - ui_gadget_h ug; - - Elm_Genlist_Item_Class itc_1text; - - /* add more variables here (move your appdata to here) */ - Evas *evas; - Evas_Object *win_main_layout; - Evas_Object *win_get; - Evas_Object *navi_bar; - Evas_Object *ly_main; - Elm_Object_Item *navi_item; - - Evas_Object *genlist; - - bool empty_flag; -}; - -extern setting_view setting_view_accessibility_main; - -#endif /*__SETTING_ACCESSIBILITY_H__ */ diff --git a/setting-common/src/setting-cfg.c b/setting-common/src/setting-cfg.c index 5d17f8d..0fcad19 100644 --- a/setting-common/src/setting-cfg.c +++ b/setting-common/src/setting-cfg.c @@ -181,21 +181,6 @@ static Setting_Cfg_Node_T s_cfg_node_array[] = { {KeyStr_Connections, NULL, "move://Tab2.top", Cfg_Item_Pos_Level0, 0, 0, Cfg_Item_Title_Node, NULL, NULL, NULL, uuid_Connectivity, 0, NULL}, {KeyStr_WiFi, IMG_WiFi, "wifi-efl-ug", Cfg_Item_Pos_Level0, Cfg_Item_Resetable, 0, Cfg_Item_AppLauncher_Node, NULL, KeyStr_Connections, &wifi_tfunc, uuid_WiFi, 0, "wifi-efl-ug"}, {KeyStr_Bluetooth, IMG_Bluetooth, "ug-bluetooth-efl", Cfg_Item_Pos_Level0, Cfg_Item_Resetable, 0, Cfg_Item_AppLauncher_Node, NULL, KeyStr_Connections, &bluetooth_tfunc, uuid_Bluetooth, 0, "ug-bluetooth-efl"}, -#ifdef TIZEN_BUILD_TARGET - {KeyStr_FlightMode, IMG_FlightMode, "setting-flightmode-efl", Cfg_Item_Pos_Level0, Cfg_Item_unResetable, 0, Cfg_Item_Ui_Node_Toggle, NULL, KeyStr_Connections, &flightmode_tfunc, uuid_FlightMode, 0, NULL}, -#endif - -#ifdef TIZEN_BUILD_TARGET - {KeyStr_MobileAP, IMG_MobileAP, "ug-setting-mobileap-efl", Cfg_Item_Pos_Level0, Cfg_Item_Resetable, 0, Cfg_Item_AppLauncher_Node, NULL, KeyStr_Connections, NULL, uuid_MobileAP, 0, NULL}, -#ifdef _M0 - {KeyStr_NFC, IMG_NFC, "setting-nfc-efl|type:nfc", Cfg_Item_Pos_Level0, Cfg_Item_unResetable, 0, Cfg_Item_Ug_Node_Toggle, NULL, KeyStr_Connections, &nfc_tfunc, uuid_NFC, 0, "setting-nfc-efl"}, -#endif -#endif -#ifdef TIZEN_BUILD_TARGET - {KeyStr_MobileNetworks, IMG_Network, "setting-network-efl", Cfg_Item_Pos_Level0, Cfg_Item_Resetable, 0, Cfg_Item_Ug_Node, NULL, KeyStr_Connections, NULL, uuid_Network, 0, NULL}, -#endif - /*More connections */ - {KeyStr_MoreConnections, IMG_More_Connections, "setting-moreconnections-efl", Cfg_Item_Pos_Level0, Cfg_Item_Resetable, 0, Cfg_Item_Ug_Node, NULL, KeyStr_Connections, NULL, uuid_Network, 0, NULL}, /* Group:Device */ {KeyStr_Device, NULL, "move://Tab3.top", Cfg_Item_Pos_Level0, 0, 0, Cfg_Item_Title_Node, NULL, NULL, NULL, uuid_SoundDisplay, 0, NULL}, @@ -203,16 +188,6 @@ static Setting_Cfg_Node_T s_cfg_node_array[] = { {KeyStr_Display, IMG_Display, "setting-display-efl|viewtype:main", Cfg_Item_Pos_Level0, Cfg_Item_Resetable, 0, Cfg_Item_Ug_Node, NULL, KeyStr_Device, NULL, uuid_Display, 0, "org.tizen.setting.display"}, {KeyStr_ApplicationsItem, IMG_Applications, "setting-applications-efl", Cfg_Item_Pos_Level0, Cfg_Item_Resetable, 0, Cfg_Item_Ug_Node, NULL, KeyStr_Device, NULL, uuid_Display, 0, "org.tizen.setting.display"}, - /* Group: Personal */ - {KeyStr_Personal, NULL, "move://Tab3.top", Cfg_Item_Pos_Level0, 0, 0, Cfg_Item_Title_Node, NULL, NULL, NULL, uuid_Personal, 0, NULL}, - {KeyStr_Wallpaper, IMG_Wallpaper, "org.tizen.wallpaper-ui-service", Cfg_Item_Pos_Level0, Cfg_Item_Resetable, 0, Cfg_Item_AppLauncher_Node, NULL, KeyStr_Personal, NULL, uuid_HomeAndLockscreen, 0, "org.tizen.setting.wallpaper-ui-service"}, - {KeyStr_LockScreen, IMG_LockedScreen, "setting-security-efl", Cfg_Item_Pos_Level0, Cfg_Item_Resetable, 0, Cfg_Item_AppLauncher_Node, NULL, KeyStr_Personal, NULL, uuid_LockedScreen, 0, "ug-lockscreen-options-efl"}, -#if 0 - /*Accessbility - not supported since 2015.8.12 */ - {KeyStr_Accessibility, IMG_Accessibility, "setting-accessibility-efl", Cfg_Item_Pos_Level0, Cfg_Item_unResetable, 0, Cfg_Item_AppLauncher_Node, NULL, KeyStr_Personal, NULL, uuid_Accounts, 0, "setting-accessibility-efl"}, -#endif - {KeyStr_Accounts, IMG_Accounts, "setting-myaccount-efl|mode:account_list", Cfg_Item_Pos_Level0, Cfg_Item_unResetable, 0, Cfg_Item_AppLauncher_Node, NULL, KeyStr_Personal, NULL, uuid_Accounts, 0, "setting-myaccount-efl"}, - /* Group: System */ {KeyStr_System, NULL, "move://Tab4.top", Cfg_Item_Pos_Level0, 0, 0, Cfg_Item_Title_Node, NULL, NULL, NULL, uuid_DeviceMange, 0, NULL}, {KeyStr_LanguageInput, IMG_LanguageInput, "setting-phone-efl|viewtype:language", Cfg_Item_Pos_Level0, Cfg_Item_Resetable, 0, Cfg_Item_AppLauncher_Node, NULL, KeyStr_System, NULL, uuid_LanguageKeyboard, 0, "org.tizen.setting.language"}, diff --git a/setting-connectivity/CMakeLists.txt b/setting-connectivity/CMakeLists.txt deleted file mode 100755 index d2f06fd..0000000 --- a/setting-connectivity/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${SETTING_COMMON}/include) - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs_connectivity REQUIRED evas elementary appcore-common appcore-efl -ui-gadget-1 capi-appfw-application capi-system-runtime-info capi-appfw-app-manager json-glib-1.0 libtzplatform-config) - -FOREACH(flag ${pkgs_connectivity_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Werror-implicit-function-declaration") -SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") - -IF("${ARCH}" STREQUAL "arm") - ADD_DEFINITIONS("-DTARGET") - MESSAGE("add -DTARGET") -ENDIF("${ARCH}" STREQUAL "arm") - -ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") -ADD_DEFINITIONS("-DSLP_DEBUG") -ADD_DEFINITIONS("-shared") - -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib") - -ADD_LIBRARY(${SETTING_DEVELOPEROPTION_UG} SHARED - ./src/setting-connectivity.c -# ./src/setting-connectivity-usb.c - ./src/setting-connectivity-usb-help.c - ) - -TARGET_LINK_LIBRARIES(${SETTING_DEVELOPEROPTION_UG} -L${CMAKE_BINARY_DIR}/${SETTING_COMMON} -lsetting-common) -TARGET_LINK_LIBRARIES(${SETTING_DEVELOPEROPTION_UG} ${pkgs_connectivity_LDFLAGS}) - -INSTALL(TARGETS ${SETTING_DEVELOPEROPTION_UG} DESTINATION ${PREFIX}/lib/ug) diff --git a/setting-connectivity/include/setting-connectivity-usb-help.h b/setting-connectivity/include/setting-connectivity-usb-help.h deleted file mode 100755 index ba3b5ad..0000000 --- a/setting-connectivity/include/setting-connectivity-usb-help.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_CONNECTIVITY_USB_HELP_H__ -#define __SETTING_CONNECTIVITY_USB_HELP_H__ - -#include - -static void setting_connectivity_usb_help_click_back_cb(void *data, - Evas_Object *obj, - void *event_info); - -#endif /* __SETTING_CONNECTIVITY_USB_HELP_H__ */ diff --git a/setting-connectivity/include/setting-connectivity-usb.h b/setting-connectivity/include/setting-connectivity-usb.h deleted file mode 100755 index 42b2e5b..0000000 --- a/setting-connectivity/include/setting-connectivity-usb.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_CONNECTIVITY_USB_H__ -#define __SETTING_CONNECTIVITY_USB_H__ - -#include - -#define NUM_PROGRESSBAR 4 - -#define SETTING_USB_DEBUGGING_DESC "IDS_ST_BODY_DEBUGGING_MODE_LAUNCHES_WHEN_USB_IS_CONNECTED" - -enum progressbar_status { - STATE_NONE = 0x00, - STATE_PROGRESSBAR -}; - -typedef struct _button_status button_status; - -struct _button_status { - Evas_Object *progressbar; /* progressbar */ - Elm_Object_Item *item; /* button */ - int pstate; /* progressbar status to show or hide */ -}; - -static void setting_connectivity_usb_click_softkey_cancel_cb(void *data, - Evas_Object *obj, - void *event_info); -#ifdef HELP_UG_EXIST -static void setting_connectivity_usb_click_softkey_set_cb(void *data, - Evas_Object *obj, - void *event_info); -#endif - -#endif /* __SETTING_CONNECTIVITY_USB_H__ */ diff --git a/setting-connectivity/include/setting-connectivity.h b/setting-connectivity/include/setting-connectivity.h deleted file mode 100644 index df55ee1..0000000 --- a/setting-connectivity/include/setting-connectivity.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_CONNECTIVITY_H__ -#define __SETTING_CONNECTIVITY_H__ - - - -#include -#include - -#include - -#include -#include - -#include - - -#define DEVOPTION_STR_USB_DEBUGGING "IDS_ST_BODY_USB_DEBUGGING" -#define DEVOPTION_STR_SHOW_CPU_USAGE "IDS_ST_MBODY_SHOW_CPU_USAGE" -#define DEVOPTION_STR_RENDERTING_ENGINE "IDS_ST_BODY_DEFAULT_RENDERING_ENGINE" -#define DEVOPTION_STR_LIMIT_BACKGROUND_PRECESS "IDS_ST_BODY_LIMIT_BACKGROUND_PROCESSES" -#define DEVOPTION_STR_CRASH_VIEWER "IDS_ST_BODY_CRASH_VIEWER" - -enum mode_change { - CHANGE_COMPLETE = 0, - IN_MODE_CHANGE, - IN_MODE_CHANGE_NONE -}; - -enum usb_connection_status { - USB_DISCONNECTED = 0, - USB_CONNECTED, - GETTING_STATUS_FAIL -}; - -typedef struct _SettingConnectivityUG SettingConnectivityUG; - -/** - * Setting Connectivity UG context - * all UG function has void* as an agument. this is casted back to SettingConnectivityUG - * and the functions access app context. - */ -struct _SettingConnectivityUG { - ui_gadget_h ug; - - /* add more variables here (move your appdata to here) */ - Evas *evas; - Evas_Object *win_main_layout; - Evas_Object *win_get; - Evas_Object *navi_bar; - - Evas_Object *ly_usb; - Evas_Object *chk_con; - - Evas_Object *pop; - - Evas_Object *view_layout; - Evas_Object *selectioninfo_popup; - - Setting_GenGroupItem_Data *debug_mode; /* debug mode */ - Setting_GenGroupItem_Data *cpu_usage; /* Show CPU Usage */ - Setting_GenGroupItem_Data *gpu_render; /* Force GPU Rendering */ - Setting_GenGroupItem_Data *bg_processes; /* Limit background processes */ - - /*****/ - setting_view *view_to_load; - - Elm_Genlist_Item_Class itc_title; - Elm_Genlist_Item_Class itc_1text; - Elm_Genlist_Item_Class itc_1text_1progress; - Elm_Genlist_Item_Class itc_1text_1icon; - Elm_Genlist_Item_Class itc_1text_1icon_gen; - Elm_Genlist_Item_Class itc_2text_3; - Elm_Genlist_Item_Class itc_group_item; - Elm_Genlist_Item_Class itc_help_style; - Elm_Genlist_Item_Class itc_2text_3_parent; - Elm_Genlist_Item_Class itc_1icon_1text_sub; - - int noti_fd; - Eina_Bool blockUI; - -}; - -extern setting_view setting_view_connectivity_usb; -extern setting_view setting_view_connectivity_usb_help; - -int check_usb_jack_status(); -void set_usb_mode_default(); - -#endif /* __SETTING_CONNECTIVITY_H__ */ diff --git a/setting-connectivity/src/setting-connectivity-usb-help.c b/setting-connectivity/src/setting-connectivity-usb-help.c deleted file mode 100644 index 91f3544..0000000 --- a/setting-connectivity/src/setting-connectivity-usb-help.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include -#define HELP_LEN 2048 - -static int setting_connectivity_usb_help_create(void *cb); -static int setting_connectivity_usb_help_destroy(void *cb); -static int setting_connectivity_usb_help_update(void *cb); -static int setting_connectivity_usb_help_cleanup(void *cb); - -setting_view setting_view_connectivity_usb_help = { - .create = setting_connectivity_usb_help_create, - .destroy = setting_connectivity_usb_help_destroy, - .update = setting_connectivity_usb_help_update, - .cleanup = setting_connectivity_usb_help_cleanup, -}; - -/* *************************************************** - * - *basic func - * - ***************************************************/ - -static int setting_connectivity_usb_help_create(void *cb) -{ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingConnectivityUG *ad = (SettingConnectivityUG *) cb; - - char samsung_kies_help[HELP_LEN]; - char mass_storage_help[HELP_LEN]; - char debugging_mode_help[HELP_LEN]; - - char* kies_help_mk = evas_textblock_text_utf8_to_markup(NULL, _("IDS_ST_BODY_SAMSUNG_KIES_CONNECTION_CONNECTING_USB_HELP_MSG")); - char* storage_help_mk = evas_textblock_text_utf8_to_markup(NULL, _("IDS_ST_BODY_MASS_STORAGE_HELP_MSG")); - char* debugmode_help_mk = evas_textblock_text_utf8_to_markup(NULL, _("IDS_ST_BODY_USB_DEBUGGING_IS_INTENDED_FOR_DEVELOPMENT_PURPOSES_ONLY_MSG")); - - snprintf(samsung_kies_help, HELP_LEN, - "%s%s%s%s", "", _("IDS_ST_HEADER_SAMSUNG_KIES"), "
", kies_help_mk); - snprintf(mass_storage_help, HELP_LEN, - "%s%s%s%s", "", _("IDS_ST_OPT_MASS_STORAGE_ABB"), "
", storage_help_mk); - snprintf(debugging_mode_help, HELP_LEN, - "%s%s%s%s", "", _("IDS_ST_BODY_USB_DEBUGGING"), "
", debugmode_help_mk); - - FREE(kies_help_mk); - FREE(storage_help_mk); - FREE(debugmode_help_mk); - - Evas_Object *genlist; - setting_push_layout_navi_bar_genlist(ad->win_main_layout, - ad->win_get, - "IDS_ST_HEADER_HELP", - _("IDS_ST_BUTTON_BACK"), - NULL, - setting_connectivity_usb_help_click_back_cb, - NULL, ad, &genlist, - ad->navi_bar); - - char *strsamsung_kies_help = samsung_kies_help; - char *strmass_storage_help = mass_storage_help; - char *strdebugging_mode_help = debugging_mode_help; - ADD_GL_LABLE(genlist, strsamsung_kies_help); - ADD_GL_LABLE(genlist, strmass_storage_help); - ADD_GL_LABLE(genlist, strdebugging_mode_help); - - setting_view_connectivity_usb_help.is_create = 1; - - return SETTING_RETURN_SUCCESS; -} - -static int setting_connectivity_usb_help_destroy(void *cb) -{ - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingConnectivityUG *ad = (SettingConnectivityUG *) cb; - - if (setting_view_connectivity_usb_help.is_create) { - elm_naviframe_item_pop(ad->navi_bar); - setting_view_connectivity_usb_help.is_create = 0; - } - - return SETTING_RETURN_SUCCESS; -} - -static int setting_connectivity_usb_help_update(void *cb) -{ - return SETTING_RETURN_SUCCESS; -} - -static int setting_connectivity_usb_help_cleanup(void *cb) -{ - return setting_connectivity_usb_help_destroy(cb); -} - -/* *************************************************** - * - *call back func - * - ***************************************************/ - -static void -setting_connectivity_usb_help_click_back_cb(void *data, Evas_Object *obj, - void *event_info) -{ - /* error check */ - setting_retm_if(data == NULL, " Data parameter is NULL"); - - SettingConnectivityUG *ad = (SettingConnectivityUG *) data; - setting_view_change(&setting_view_connectivity_usb_help, - &setting_view_connectivity_usb, ad); -} diff --git a/setting-connectivity/src/setting-connectivity-usb.c b/setting-connectivity/src/setting-connectivity-usb.c deleted file mode 100644 index c05ac12..0000000 --- a/setting-connectivity/src/setting-connectivity-usb.c +++ /dev/null @@ -1,952 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include - - -#define GROUP_MAX 30 -#define USB_BTN_NO 0 -#define SETTING_CPU_USAGE_PKG_NAME "org.tizen.dispcpuinfo" - -#define DIAGNOSTICS_USAGE_STR "IDS_ST_BODY_CRASH_VIEWER" -#define DEBUG_MODE_POPUP_TITLE "IDS_ST_HEADER_ALLOW_USB_DEBUGGING_Q_ABB" -#define DEBUG_MODE_POPUP_TEXT "IDS_ST_BODY_USB_DEBUGGING_IS_INTENDED_FOR_DEVELOPMENT_PURPOSES_ONLY_MSG" -#define DEFAULT_RENDERING_ENGINE_STR "IDS_ST_BODY_DEFAULT_RENDERING_ENGINE" -#if 0 -#define SOFTWARE_STR "IDS_ST_BODY_SOFTWARE" -#define HARDWARE_STR "IDS_ST_BODY_HARDWARE" -#else -#define NONE_STR "NONE" /* -1 */ -#define SOFTWARE_STR "OFF" /* 0 */ -#define HARDWARE_STR "ON" /* 1 */ -#endif -#define CONNECTTIVITY_SELECT_INFO_POPUP_STR "IDS_HS_HEADER_USB_DEBUGGING_CONNECTED" - -static char *bgprocess_list[] = { - "IDS_ST_HEADER_STANDARD_LIMIT_ABB", - "IDS_ST_HEADER_NO_BACKGROUND_PROCESSES_ABB", - "IDS_ST_HEADER_1_PROCESS_AT_MOST_ABB", - "IDS_ST_HEADER_2_PROCESSES_AT_MOST_ABB", - "IDS_ST_HEADER_3_PROCESSES_AT_MOST_ABB", - "IDS_ST_HEADER_4_PROCESSES_AT_MOST_ABB", -}; - -static int setting_connectivity_usb_create(void *cb); -static int setting_connectivity_usb_destroy(void *cb); -static int setting_connectivity_usb_update(void *cb); -static int setting_connectivity_usb_cleanup(void *cb); - -static void debug_mode_change_vconf_cb(keynode_t *key, void *data); -static void in_mode_change_vconf_cb(keynode_t *key, void *data); -static void unload_popup(void *data); -void load_usb_connection_popup(void *data); - -/* This is pointer to indicate progressbars*/ -/*static button_status button[NUM_PROGRESSBAR]; */ - -/* These variables are for the popup */ - -setting_view setting_view_connectivity_usb = { - .create = setting_connectivity_usb_create, - .destroy = setting_connectivity_usb_destroy, - .update = setting_connectivity_usb_update, - .cleanup = setting_connectivity_usb_cleanup, -}; - -static void __setting_processes_sub_list_sel_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(event_info == NULL, "Invalid argument: event info is NULL"); - Elm_Object_Item *subitem = (Elm_Object_Item *) event_info; - Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subitem); - elm_genlist_item_selected_set(subitem, 0); - Setting_GenGroupItem_Data *data_subItem = - elm_object_item_data_get(subitem); - Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */ - ret_if(NULL == data_subItem || NULL == data_parentItem); - - elm_radio_value_set(data_subItem->rgd, data_subItem->chk_status); - int err; - setting_set_int_slp_key(data_parentItem->int_slp_setting_binded, - data_subItem->chk_status, &err); - setting_retm_if(0 != err, "Set vconf error[%d]", data_parentItem->int_slp_setting_binded); - - data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr)); - elm_object_item_data_set(data_parentItem->item, data_parentItem); - elm_genlist_item_update(data_parentItem->item); - elm_object_item_signal_emit(data_parentItem->item, "elm,state,top", ""); - elm_genlist_item_expanded_set(parentItem, EINA_FALSE); -} - -#if 1 -static void __setting_devoptions_main_sub_list_sel_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(event_info == NULL, "Invalid argument: event info is NULL"); - - Elm_Object_Item *subitem = (Elm_Object_Item *) event_info; - Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subitem); - elm_genlist_item_selected_set(subitem, 0); - Setting_GenGroupItem_Data *data_subItem = elm_object_item_data_get(subitem); - Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */ - ret_if(NULL == data_subItem || NULL == data_parentItem); - - elm_radio_value_set(data_subItem->rgd, data_subItem->chk_status); - SETTING_TRACE("data_subItem->chk_status = %d", data_subItem->chk_status); - - if (data_subItem->chk_status == 0) { /* none */ - vconf_set_int(VCONFKEY_SETAPPL_APP_HW_ACCELERATION, SETTING_HW_ACCELERATION_NONE); - } else if (data_subItem->chk_status == 1) { /* software */ - elm_config_engine_set("software_x11"); /*deprecated API*/ - vconf_set_int(VCONFKEY_SETAPPL_APP_HW_ACCELERATION, SETTING_RENDERING_ENGINE_SW); - elm_config_save(); - } else if (data_subItem->chk_status == 2) { /* hardware */ - elm_config_engine_set("opengl_x11"); /*deprecated API*/ - vconf_set_int(VCONFKEY_SETAPPL_APP_HW_ACCELERATION, SETTING_RENDERING_ENGINE_HW); - elm_config_save(); - } - data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr)); - elm_object_item_data_set(data_parentItem->item, data_parentItem); - elm_genlist_item_update(data_parentItem->item); - elm_object_item_signal_emit(data_parentItem->item, "elm,state,top", ""); - elm_genlist_item_expanded_set(parentItem, EINA_FALSE); -} -#endif - -static char* _get_graphic_engine() -{ - /* Get GPU Rendering state */ - const char *engine_str = NULL; - engine_str = elm_config_engine_get(); /*deprecated API*/ - char *render_engine = NULL; - if (engine_str) { - SETTING_TRACE("engine_str is %s", engine_str); - if (0 == safeStrCmp(engine_str, "opengl_x11")) { - render_engine = HARDWARE_STR; - } else if (0 == safeStrCmp(engine_str, "software_x11")) { - render_engine = SOFTWARE_STR; - } else { - SETTING_TRACE_ERROR("engine_str is wrong"); - render_engine = NONE_STR; - } - return strdup(render_engine); - } else { - SETTING_TRACE_ERROR("engine_str is NULL"); - return NULL; - } -} - - - -static void __setting_devoptions_main_exp_cb(void *data, Evas_Object *obj, void *event_info) -{ - ret_if(NULL == data || NULL == event_info); - SETTING_TRACE_BEGIN; - SettingConnectivityUG *ad = (SettingConnectivityUG *) data; - - Elm_Object_Item *parentItem = event_info; /*parent item */ - Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /*parent data */ - Evas_Object *scroller = elm_object_item_widget_get(parentItem); - - Evas_Object *rgd; - - if (data_parentItem) { - if (data_parentItem == ad->bg_processes) { - /*elm_object_item_signal_emit(parentItem, "elm,state,top", ""); */ - rgd = elm_radio_add(scroller); - elm_radio_value_set(rgd, -1); - - setting_create_Gendial_exp_sub_field(scroller, - &itc_1text_1icon, - __setting_processes_sub_list_sel_cb, ad, parentItem, - SWALLOW_Type_1RADIO, rgd, - 0, _(bgprocess_list[0]), - NULL); - setting_create_Gendial_exp_sub_field(scroller, - &itc_1text_1icon, - __setting_processes_sub_list_sel_cb, ad, parentItem, - SWALLOW_Type_1RADIO, rgd, - 1, _(bgprocess_list[1]), - NULL); - setting_create_Gendial_exp_sub_field(scroller, - &itc_1text_1icon, - __setting_processes_sub_list_sel_cb, ad, parentItem, - SWALLOW_Type_1RADIO, rgd, - 2, _(bgprocess_list[2]), - NULL); - setting_create_Gendial_exp_sub_field(scroller, - &itc_1text_1icon, - __setting_processes_sub_list_sel_cb, ad, parentItem, - SWALLOW_Type_1RADIO, rgd, - 3, _(bgprocess_list[3]), - NULL); - setting_create_Gendial_exp_sub_field(scroller, - &itc_1text_1icon, - __setting_processes_sub_list_sel_cb, ad, parentItem, - SWALLOW_Type_1RADIO, rgd, - 4, _(bgprocess_list[4]), - NULL); - setting_create_Gendial_exp_sub_field(scroller, - &itc_1text_1icon, - __setting_processes_sub_list_sel_cb, ad, parentItem, - SWALLOW_Type_1RADIO, rgd, - 5, _(bgprocess_list[5]), - NULL); - - setting_update_chk_status(rgd, data_parentItem->int_slp_setting_binded); - } else if (data_parentItem == ad->gpu_render) { - /*elm_object_item_signal_emit(parentItem, "elm,state,top", ""); */ - rgd = elm_radio_add(scroller); - elm_radio_value_set(rgd, -1); - - setting_create_Gendial_exp_sub_field(scroller, - &itc_1text_1icon, - __setting_devoptions_main_sub_list_sel_cb, ad, parentItem, - SWALLOW_Type_1RADIO, rgd, - /*NONE*/0, "NONE", - NULL); - - setting_create_Gendial_exp_sub_field(scroller, - &itc_1text_1icon, - __setting_devoptions_main_sub_list_sel_cb, ad, parentItem, - SWALLOW_Type_1RADIO, rgd, - /*SOFTWARE*/1, "OFF", - NULL); - setting_create_Gendial_exp_sub_field(scroller, - &itc_1text_1icon, - __setting_devoptions_main_sub_list_sel_cb, ad, parentItem, - SWALLOW_Type_1RADIO, rgd, - /*HARDWARE*/2, "ON", - NULL); - const char *render_engine = _get_graphic_engine(); // on, off, none - if (!safeStrCmp("NONE", render_engine)) { - vconf_set_int(ad->bg_processes->int_slp_setting_binded, SETTING_HW_ACCELERATION_NONE); - elm_radio_value_set(rgd, 0); - } else if (!safeStrCmp("OFF", render_engine)) { - vconf_set_int(ad->bg_processes->int_slp_setting_binded, SETTING_HW_ACCELERATION_OFF); - elm_radio_value_set(rgd, 1); - } else if (!safeStrCmp("ON", render_engine)) { - vconf_set_int(ad->bg_processes->int_slp_setting_binded, SETTING_HW_ACCELERATION_ON); - elm_radio_value_set(rgd, 2); - } else { - SETTING_TRACE_ERROR("ERROR here for selection of render_engine"); - } - FREE(render_engine); - } - } -} - -static int setting_connectivity_change_debug_mode_toggle(SettingConnectivityUG *ad) -{ - SETTING_TRACE_BEGIN; - if (!ad) return -1; - - int ret = -1; - int debugMode = 0; - ret = vconf_get_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, &debugMode); - if (ret != 0) { - SETTING_TRACE("FAIL: vconf_get_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL)"); - return -1; - } - SETTING_TRACE("debugMode: %d", debugMode); - - setting_update_gl_item_chk_status(ad->debug_mode, EINA_FALSE); - if (debugMode == 0) { - if (USB_CONNECTED == check_usb_jack_status()) { - ret = vconf_set_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 1); - if (ret != 0) { - SETTING_TRACE("FAIL: vconf_set_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL)"); - return -1; - } - setting_create_popup(ad, ad->view_layout, NULL, CONNECTTIVITY_SELECT_INFO_POPUP_STR, - NULL, 3, false, false, 0); - } else { - load_usb_connection_popup(ad); - } - } else { - ret = vconf_set_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 0); - if (ret != 0) { - SETTING_TRACE("FAIL: vconf_set_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL)"); - return -1; - } - - if (ad->selectioninfo_popup) { - evas_object_del(ad->selectioninfo_popup); - ad->selectioninfo_popup = NULL; - } - } - - SETTING_TRACE_END; - return 0; -} - -static void setting_connectivity_main_chk_usb_debug_cb(void *data, - Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data; - SettingConnectivityUG *ad = list_item->userdata; - - if (0 > setting_connectivity_change_debug_mode_toggle(ad)) { - SETTING_TRACE("FAIL: setting_connectivity_change_debug_mode_toggle()"); - } - - SETTING_TRACE_END; -} - -static void setting_connectivity_usb_mouse_up_Gendial_list_cb(void *data, - Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Invalid argument: data is NULL"); - retm_if(event_info == NULL, "Invalid argument: event_info is NULL"); - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - SettingConnectivityUG *ad = (SettingConnectivityUG *)data; - - elm_genlist_item_selected_set(item, 0); - - if (0 > setting_connectivity_change_debug_mode_toggle(ad)) { - SETTING_TRACE("FAIL: setting_connectivity_change_debug_mode_toggle()"); - } - - SETTING_TRACE_END; -} - -static void setting_connectivity_main_chk_btn_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - /*error check */ - retm_if(data == NULL, "Data parameter is NULL"); - - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data; - - list_item->chk_status = elm_check_state_get(obj); /* for genlist update status */ - - int opposite = (list_item->chk_status == 1) ? SETTING_ON_OFF_BTN_ON : SETTING_ON_OFF_BTN_OFF; - - SETTING_TRACE("list_item->keyStr = %s", list_item->keyStr); - if (!safeStrCmp("IDS_ST_MBODY_SHOW_CPU_USAGE", list_item->keyStr)) { - if (opposite) { - app_launcher(SETTING_CPU_USAGE_PKG_NAME); - } else { - #if 0 - bool running_flag = FALSE; - int ret = app_manager_is_running(SETTING_CPU_USAGE_PKG_NAME, &running_flag); - setting_retm_if(ret != 0, "fail to call app_manager_is_running"); - if (running_flag) { - app_context_h context = NULL; - ret = app_manager_get_app_context(SETTING_CPU_USAGE_PKG_NAME, &context); - setting_retm_if(ret != 0, "fail to call app_manager_get_app_context"); - int ret = app_manager_terminate_app(context); - if (ret == 0) { - SETTING_TRACE("===== app_manager_terminate_app successed."); - } else { - SETTING_TRACE_ERROR("===== app_manager_terminate_app fail."); - } - } - #endif - } - } else { - /* do nothing */ - } - /*app_launcher("org.tizen.dispcpuinfo"); */ -} - -static void setting_connectivity_usb_mouse_up_Gendial_CPU_usage_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - - /* error check */ - retm_if(event_info == NULL, "Invalid argument: event info is NULL"); - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - elm_genlist_item_selected_set(item, 0); - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) elm_object_item_data_get(item); - - setting_retm_if(data == NULL, "Data parameter is NULL"); - /*SettingConnectivityUG *ad = (SettingConnectivityUG *) data; */ - - if (list_item) { - setting_update_gl_item_chk_status(list_item, !(list_item->chk_status)); - - if (list_item->chk_status) { - vconf_set_bool("db/setting/show_cpu_info", 1); - app_launcher(SETTING_CPU_USAGE_PKG_NAME); - } else { - vconf_set_bool("db/setting/show_cpu_info", 0); - } - } - /*app_launcher("org.tizen.dispcpuinfo"); */ - SETTING_TRACE_END; -} - -static void __setting_connectivity_usb_dia_usage_mouse_up_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - setting_retm_if(data == NULL, "Data parameter is NULL"); - - retm_if(event_info == NULL, "Invalid argument: event info is NULL"); - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - elm_genlist_item_selected_set(item, 0); - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) elm_object_item_data_get(item); - - /* SettingAboutUG *ad = (SettingAboutUG *) data; */ - - if (list_item) - SETTING_TRACE("clicking item[%s]", _(list_item->keyStr)); - - app_launcher("org.tizen.crash-viewer"); -} - -char *get_bg_processes() -{ - int value; - int err; - int ret = setting_get_int_slp_key(INT_SLP_SETTING_DEVOPTION_BGPROCESS, &value, &err); - if (ret != 0) { - SETTING_TRACE_ERROR("get vconf failed"); - } - - if (value >= 0 && value < sizeof(bgprocess_list) / sizeof(bgprocess_list[0])) - return _(bgprocess_list[value]); - else { - return _(bgprocess_list[0]); /* error proc */ - } -} - -/** - * To create the usb main view - * - *@param cb - * - *@return - */ -static int setting_connectivity_usb_create(void *cb) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE("Start USB utilities\n"); - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingConnectivityUG *ad = (SettingConnectivityUG *) cb; - Evas_Object *scroller = NULL; - - int vconf_ret = -1; - int err = -1; - - Evas_Object *view_layout = elm_layout_add(ad->win_main_layout); - elm_layout_file_set(view_layout, SETTING_THEME_EDJ_NAME, "selinfo_bottom"); - evas_object_size_hint_weight_set(view_layout, EVAS_HINT_EXPAND, 0.0); - ad->view_layout = view_layout; - - /* win_main of the popup */ -#ifdef HELP_UG_EXIST - ad->ly_usb = - setting_create_layout_navi_bar_genlist(ad->win_main_layout, - ad->win_get, - KeyStr_DeveloperOption, - dgettext("sys_string", "IDS_ST_BUTTON_BACK"), - _("IDS_ST_HEADER_HELP"), - setting_connectivity_usb_click_softkey_cancel_cb, - setting_connectivity_usb_click_softkey_set_cb, - ad, &scroller, - &ad->navi_bar); -#else - ad->ly_usb = - setting_create_layout_navi_bar(ad->win_main_layout, ad->win_get, - KeyStr_DeveloperOption, - _("IDS_ST_BUTTON_BACK"), - setting_connectivity_usb_click_softkey_cancel_cb, - ad, view_layout, - &ad->navi_bar, NULL); -#endif - - SETTING_TRACE("before init\n"); - - scroller = elm_genlist_add(ad->win_main_layout); - retvm_if(scroller == NULL, SETTING_DRAW_ERR_FAIL_SCROLLER, - "Cannot set scroller object as contento of layout"); - elm_object_style_set(scroller, "dialogue"); - elm_genlist_clear(scroller); /* first to clear list */ - evas_object_smart_callback_add(scroller, "realized", __gl_realized_cb, NULL); - - elm_object_part_content_set(view_layout, "elm.swallow.contents", scroller); - - /*button[SETTING_USB_DEBUG_MODE].item = NULL; */ - /*button[SETTING_USB_DEBUG_MODE].pstate = STATE_NONE; */ - setting_enable_expandable_genlist(scroller, ad, __setting_devoptions_main_exp_cb, NULL); - - Elm_Object_Item *item = NULL;; -#if 1 - /* [UI] separator */ - item = elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - - /* [UI] USB debugging */ - int vconf_val; - int toggle_dbg = 0; - - err = vconf_get_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, &toggle_dbg); - if (err != 0) { - SETTING_TRACE_ERROR("FAIL: vconf_get_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL)"); - /* set debug mode to true to find the problem*/ - toggle_dbg = 1; - } - SETTING_TRACE("toggle_dbg: %d", toggle_dbg); - - ad->debug_mode = - setting_create_Gendial_field_def(scroller, &itc_1text_1icon, - setting_connectivity_usb_mouse_up_Gendial_list_cb, - ad, SWALLOW_Type_1ICON_1RADIO, NULL, - NULL, toggle_dbg, "IDS_ST_BODY_USB_DEBUGGING", - NULL, setting_connectivity_main_chk_usb_debug_cb); - - if (ad->debug_mode) { - ad->debug_mode->userdata = ad; - __BACK_POINTER_SET(ad->debug_mode); - /*button[SETTING_USB_DEBUG_MODE].item = ad->debug_mode->item; */ - } else { - SETTING_TRACE_ERROR("ad->debug_mode is NULL"); - return SETTING_RETURN_FAIL; - } - - ADD_GL_HELP(scroller, SETTING_USB_DEBUGGING_DESC); -#endif - - SETTING_TRACE("Second item of Second group is set\n"); - - - if (!isEmulBin()) { - /* [UI] Show CPU Usage */ - bool running_flag = FALSE; - int ret = app_manager_is_running(SETTING_CPU_USAGE_PKG_NAME, &running_flag); - setting_retvm_if(ret != 0, SETTING_RETURN_FAIL, "fail to call app_manager_is_running"); - if (running_flag) { - vconf_val = 1; - } else { - vconf_val = 0; - } - - ad->cpu_usage = - setting_create_Gendial_field_def(scroller, &itc_1text_1icon, - setting_connectivity_usb_mouse_up_Gendial_CPU_usage_cb, - ad, SWALLOW_Type_1ICON_1RADIO, NULL, - NULL, vconf_val, "IDS_ST_MBODY_SHOW_CPU_USAGE", - NULL, setting_connectivity_main_chk_btn_cb); - if (ad->cpu_usage) { - ad->cpu_usage->userdata = ad; - __BACK_POINTER_SET(ad->cpu_usage); - /*setting_disable_genlist_item(ad->cpu_usage->item); */ - } else { - SETTING_TRACE_ERROR("ad->cpu_usage is NULL"); - return SETTING_RETURN_FAIL; - } - - /* [UI] help text */ - ADD_GL_HELP(scroller, "IDS_ST_BODY_SCREEN_OVERLAY_SHOWING_CURRENT_CPU_USAGE_ABB"); - -#if 1 - /* Get GPU Rendering state */ - - const char *render_engine = _get_graphic_engine(); - - /* [UI] Force GPU rendering */ - ad->gpu_render = setting_create_Gendial_exp_parent_field(scroller, - &(ad->itc_2text_3_parent), - NULL, NULL, SWALLOW_Type_INVALID, - DEFAULT_RENDERING_ENGINE_STR, _(render_engine)); - if (ad->gpu_render) { - __BACK_POINTER_SET(ad->gpu_render); - ad->gpu_render->userdata = ad; - ad->gpu_render->int_slp_setting_binded = INT_SLP_SETTING_DEVOPTION_BGPROCESS; - /*setting_disable_genlist_item(ad->gpu_render->item); */ - } else { - SETTING_TRACE_ERROR("ad->gpu_render is NULL"); - return SETTING_RETURN_FAIL; - } - FREE(render_engine); - /* [UI] help text */ - ADD_GL_HELP(scroller, "IDS_ST_POP_USE_2D_HARDWARE_OR_SOFTWARE_ACCELERATION_IN_APPLICATIONS"); -#endif - /* NEWCODE: */ - - /* [UI] expandble list - Automatic answering */ - char *bgproc = get_bg_processes(); - ad->bg_processes = - setting_create_Gendial_exp_parent_field(scroller, - &(ad->itc_2text_3_parent), - NULL, NULL, - SWALLOW_Type_INVALID, - "IDS_ST_BODY_LIMIT_BACKGROUND_PROCESSES", - bgproc); - - /* [UI] Limit background processes */ - if (ad->bg_processes) { - __BACK_POINTER_SET(ad->bg_processes); - ad->bg_processes->userdata = ad; - ad->bg_processes->int_slp_setting_binded = VCONFKEY_SETAPPL_APP_HW_ACCELERATION; - } else { - SETTING_TRACE_ERROR("ad->bg_processes is NULL"); - return SETTING_RETURN_FAIL; - } - - item = elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - - /* [UI] Diagnostics and Usage */ - setting_create_Gendial_field_def(scroller, &(ad->itc_1text), - __setting_connectivity_usb_dia_usage_mouse_up_cb, - ad, SWALLOW_Type_INVALID, NULL, NULL, - 0, DIAGNOSTICS_USAGE_STR, - NULL, NULL); - } - - item = elm_genlist_item_append(scroller, &itc_bottom_seperator, NULL, NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - - /*---------------------------------------------------------------------------------------------- */ - /* Registering callback function for VCONFKEY_SETAPPL_USB_MODE_INT */ - vconf_ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, - debug_mode_change_vconf_cb, ad); - if (vconf_ret != 0) { - SETTING_TRACE("FAIL: vconf_notify_key_changed(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL)"); - return SETTING_RETURN_FAIL; - } - - /* Registering callback function for VCONFKEY_SETAPPL_USB_IN_MODE_CHANGE */ - vconf_ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_USB_IN_MODE_CHANGE, - in_mode_change_vconf_cb, ad); - if (vconf_ret != 0) { - SETTING_TRACE("FAIL: vconf_notify_key_changed(VCONFKEY_SETAPPL_USB_IN_MODE_CHANGE)\n"); - return SETTING_RETURN_FAIL; - } - - int val; - vconf_ret = vconf_get_int(VCONFKEY_SETAPPL_USB_IN_MODE_CHANGE, &val); - if (vconf_ret == 0 && val == IN_MODE_CHANGE) { - SETTING_TRACE("ad->blockUI: EINA_TRUE\n"); - ad->blockUI = EINA_TRUE; - } else { /* val == CHANGE_COMPLETE */ - SETTING_TRACE("ad->blockUI: EINA_FALSE\n"); - ad->blockUI = EINA_FALSE; - } - - setting_view_connectivity_usb.is_create = 1; - setting_view_update(&setting_view_connectivity_usb, ad); - - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -/** - * This callback function is called when USB-setting changes VCONFKEY_SETAPPL_USB_IN_MODE_CHANGE - * - *@param data - */ -static void in_mode_change_vconf_cb(keynode_t *key, void *data) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(NULL == data, "ERROR:The parameter(data) is NULL\n"); - SettingConnectivityUG *ad = (SettingConnectivityUG *) data; - SETTING_TRACE("ad->blockUI: %d\n", ad->blockUI); - - int in_mode_change; - int ret = -1; - - ret = vconf_get_int(VCONFKEY_SETAPPL_USB_IN_MODE_CHANGE, &in_mode_change); - setting_retm_if(ret != 0, "vconf_get_int(VCONFKEY_SETAPPL_USB_IN_MODE_CHANGE\n"); - - if (CHANGE_COMPLETE == in_mode_change) { - SETTING_TRACE("ad->blockUI: EINA_FALSE\n"); - ad->blockUI = EINA_FALSE; - } else if (IN_MODE_CHANGE == in_mode_change) { - SETTING_TRACE("ad->blockUI: EINA_TRUE\n"); - ad->blockUI = EINA_TRUE; - } else { - SETTING_TRACE("Getting in_mode_change failed\n"); - } - - SETTING_TRACE_END; -} - -/** - * When VCONFKEY_SETAPPL_USB_MODE_INT is changed, all buttons are enabled - * - *@param key - *@param data - */ -static void debug_mode_change_vconf_cb(keynode_t *key, void *data) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(NULL == data, "ERROR:The parameter(data) is NULL\n"); - SettingConnectivityUG *ad = (SettingConnectivityUG *)data; - - int ret = -1; - int debugMode = 0; - - ret = vconf_get_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, &debugMode); - setting_retm_if(ret != 0, "ERROR: vconf_get_int(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL)"); - SETTING_TRACE("debugMode: %d", debugMode); - - if (debugMode == 1) { - setting_update_gl_item_chk_status(ad->debug_mode, EINA_TRUE); - } else if (debugMode == 0) { - setting_update_gl_item_chk_status(ad->debug_mode, EINA_FALSE); - } else { - SETTING_TRACE("ERROR: debugMode value is improper"); - } - - /* Unblock setting UI */ - SETTING_TRACE("ad->blockUI: EINA_FALSE\n"); - ad->blockUI = EINA_FALSE; - - SETTING_TRACE_END; -} - -/** - * To destory the view of usb - * - *@param cb - * - *@return - */ -static int setting_connectivity_usb_destroy(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingConnectivityUG *ad = (SettingConnectivityUG *) cb; - if (!setting_view_connectivity_usb.is_create) - return SETTING_RETURN_SUCCESS; - - setting_view_connectivity_usb.is_create = 0; - int vconf_ret = -1; - int num_err = 0; - - /* Removing the popup if the popup is loaded */ - unload_popup(ad); - - /*if (ad->selectioninfo_popup) { - evas_object_del(ad->selectioninfo_popup); - ad->selectioninfo_popup = NULL; - }*/ - - - /* Closing vconf trace */ - vconf_ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, - debug_mode_change_vconf_cb); - - if (vconf_ret != 0) { - SETTING_TRACE("FAIL: vconf_ignore_key_changed(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL)"); - num_err++; - } - - vconf_ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_USB_IN_MODE_CHANGE, in_mode_change_vconf_cb); - - if (vconf_ret != 0) { - SETTING_TRACE("FAIL: vconf_ignore_key_changed(VCONFKEY_SETAPPL_USB_MODE_INT)\n"); - num_err++; - } - - - if (ad->ly_usb != NULL) { - evas_object_del(ad->ly_usb); - } - - SETTING_TRACE_END; - if (num_err > 0) { - SETTING_TRACE("ERROR: the number of errors to destroy is %d\n", num_err); - return SETTING_RETURN_FAIL; - } else { - return SETTING_RETURN_SUCCESS; - } - -} - -/** - * To update the view of usb - * - *@param cb - * - *@return - */ -static int setting_connectivity_usb_update(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - SettingConnectivityUG *ad = (SettingConnectivityUG *) cb; - - if (ad->ly_usb != NULL) { - evas_object_show(ad->ly_usb); - } - - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -/** - * To cleanup the view of usb - * - *@param cb - * - *@return - */ -static int setting_connectivity_usb_cleanup(void *cb) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -/** - * Do process when clicking '<-' button - * - *@param data - *@param obj - *@param event_info - */ -static void -setting_connectivity_usb_click_softkey_cancel_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - setting_retm_if(data == NULL, "Data parameter is NULL"); - - SettingConnectivityUG *ad = (SettingConnectivityUG *) data; - - /* Not to block back(->) button */ - /* Send destroy request */ - ug_destroy_me(ad->ug); - - SETTING_TRACE_END; -} - -/** - * Do process when clicking 'Help' button - * - *@param data - *@param obj - *@param event_info - */ -#ifdef HELP_UG_EXIST -static void -setting_connectivity_usb_click_softkey_set_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - setting_retm_if(data == NULL, "Data parameter is NULL"); - - SettingConnectivityUG *ad = (SettingConnectivityUG *) data; - - /* Send destroy request */ - setting_view_change(&setting_view_connectivity_usb, - &setting_view_connectivity_usb_help, ad); - SETTING_TRACE_END; -} -#endif - - -/** - * Here is for loading popup - */ - -/** - * unload popup - */ -static void unload_popup(void *data) -{ - SETTING_TRACE_BEGIN; - SettingConnectivityUG *ad = (SettingConnectivityUG *)data; - - /*ad->pop */ - if (ad->pop) { - evas_object_del(ad->pop); - ad->pop = NULL; - } else { - SETTING_TRACE("ad->pop == NULL\n"); - } - - - SETTING_TRACE_END; -} - -/** - * Callback function to respond pushing cancel button of the usb connection popup - */ -static void debug_mode_resp_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - SettingConnectivityUG *ad = (SettingConnectivityUG *)data; - - int resp_type = btn_type(obj); - if (resp_type == POPUP_RESPONSE_OK) { - /* do nothing */ - int ret = vconf_set_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 1); - if (ret != 0) { - SETTING_TRACE("FAIL: vconf_set_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL)"); - return; - } - setting_create_popup(ad, ad->view_layout, NULL, - CONNECTTIVITY_SELECT_INFO_POPUP_STR, NULL, - 3, false, false, 0); - } else if (resp_type == POPUP_RESPONSE_CANCEL) { - /* rollback */ - /*setting_update_gl_item_chk_status(ad->debug_mode, 0); */ - if (ad->debug_mode) { - ad->debug_mode->chk_status = 0; - elm_genlist_item_fields_update(ad->debug_mode->item, "*", ELM_GENLIST_ITEM_FIELD_CONTENT); - } - } - - unload_popup(ad); - SETTING_TRACE_END; -} - -/** - * When a button on USB utilities is pushed, - * this function makes a popup if USB cable is not connected - */ -void load_usb_connection_popup(void *data) -{ - SETTING_TRACE_BEGIN; - SettingConnectivityUG *ad = (SettingConnectivityUG *)data; - - unload_popup(ad); - ad->pop = setting_create_popup(ad, ad->win_get, NULL, - _(DEBUG_MODE_POPUP_TEXT), - debug_mode_resp_cb, - 0, false, false, 2, - _("IDS_ST_BUTTON_CANCEL_ABB"), _("IDS_ST_BUTTON_ENABLE")); - - if (!(ad->pop)) SETTING_TRACE("FAIL: setting_create_popup()"); - - SETTING_TRACE_END; -} diff --git a/setting-connectivity/src/setting-connectivity.c b/setting-connectivity/src/setting-connectivity.c deleted file mode 100755 index 9647f3f..0000000 --- a/setting-connectivity/src/setting-connectivity.c +++ /dev/null @@ -1,318 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/** - *@defgroup setting-connectivity - *UG creation code for setting-connectivity - */ - -#include -#include - -#ifndef UG_MODULE_API -#define UG_MODULE_API __attribute__ ((visibility("default"))) -#endif - -#define USB_BTN_NO 0 - -/** - * This function checks the USB connection status - */ -int check_usb_jack_status() -{ - SETTING_TRACE_BEGIN; - bool usb_connection = false; - int ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_USB_CONNECTED, &usb_connection); - if (ret == RUNTIME_INFO_ERROR_NONE && usb_connection == true) { - return USB_CONNECTED; /* USB is connected */ - } else { - return USB_DISCONNECTED; /* USB is disconnected */ - } -} - -setting_view *__get_connective_view_to_load(app_control_h service) -{ - SETTING_TRACE_BEGIN; - char *viewtype = NULL; - - app_control_get_extra_data(service, "viewtype", &viewtype); - if (!viewtype) - return NULL; - - SETTING_TRACE("viewtype:%s", viewtype); - - if (!safeStrCmp(viewtype, "usb")) { - FREE(viewtype); - return &setting_view_connectivity_usb; - } else { - FREE(viewtype); - return NULL; /* &setting_view_connective_main; */ - } - -} - -Evas_Object *__get_connective_layout_to_return(app_control_h service, void *priv) -{ - SETTING_TRACE_BEGIN; - SettingConnectivityUG *connectiveUG = priv; - char *viewtype = NULL; - - app_control_get_extra_data(service, "viewtype", &viewtype); - if (!viewtype) - return NULL; - - SETTING_TRACE("viewtype:%s", viewtype); - - if (!safeStrCmp(viewtype, "usb")) { - FREE(viewtype); - return connectiveUG->ly_usb; - } else { - FREE(viewtype); - return NULL; /* &setting_view_connective_main; */ - } - -} - -static void setting_connective_ug_cb_resize(void *data, Evas *e, - Evas_Object *obj, void *event_info) -{ - SettingConnectivityUG *ad = (SettingConnectivityUG *) data; - /* setting_view_update(&setting_view_about_main, ad); */ - setting_view_update(ad->view_to_load, ad); -} - -static void *setting_connective_ug_on_create(ui_gadget_h ug, - enum ug_mode mode, app_control_h service, - void *priv) -{ - setting_retvm_if((!priv), NULL, "!priv"); - - SettingConnectivityUG *connectiveUG = priv; - connectiveUG->ug = ug; - - connectiveUG->win_main_layout = - (Evas_Object *) ug_get_parent_layout(ug); - connectiveUG->win_get = (Evas_Object *) ug_get_window(); - evas_object_show(connectiveUG->win_main_layout); - connectiveUG->evas = - evas_object_evas_get(connectiveUG->win_main_layout); - - setting_retvm_if(connectiveUG->win_main_layout == NULL, NULL, - "cannot get main window "); - - setting_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR); - - /* register view node table */ - setting_view_node_table_intialize(); - setting_view_node_table_register(&setting_view_connectivity_usb, NULL); - setting_view_node_table_register(&setting_view_connectivity_usb_help, - &setting_view_connectivity_usb); - - /* creating a view. */ - setting_create_Gendial_itc(SETTING_GENLIST_GROUP_INDEX_STYLE, &(connectiveUG->itc_title)); - setting_create_Gendial_itc(SETTING_GENLIST_ICON_1LINE_STYLE, &(connectiveUG->itc_1text)); - setting_create_Gendial_itc(SETTING_GENLIST_ICON_1LINE_STYLE, &(connectiveUG->itc_1text_1icon)); - setting_create_Gendial_itc(SETTING_GENLIST_ICON_1LINE_STYLE, &(connectiveUG->itc_1text_1icon_gen)); /* toggle */ - setting_create_Gendial_itc(SETTING_GENLIST_ICON_1LINE_STYLE, &(connectiveUG->itc_1icon_1text_sub)); - setting_create_Gendial_itc("dialogue/2text.3", &(connectiveUG->itc_2text_3)); - setting_create_Gendial_itc(SETTING_GENLIST_2LINE_STYLE, &(connectiveUG->itc_2text_3_parent)); - setting_create_Gendial_itc("multiline_sub", &(connectiveUG->itc_help_style)); - - connectiveUG->view_to_load = __get_connective_view_to_load(service); - setting_retvm_if(NULL == connectiveUG->view_to_load, NULL, - "NULL == connectiveUG->view_to_load"); - setting_view_node_set_cur_view(connectiveUG->view_to_load); - setting_view_create(connectiveUG->view_to_load, (void *)connectiveUG); - evas_object_event_callback_add(connectiveUG->win_main_layout, - EVAS_CALLBACK_RESIZE, - setting_connective_ug_cb_resize, - connectiveUG); - return __get_connective_layout_to_return(service, connectiveUG); -} - -static void setting_connective_ug_on_start(ui_gadget_h ug, app_control_h service, - void *priv) -{ -} - -static void setting_connective_ug_on_pause(ui_gadget_h ug, app_control_h service, - void *priv) -{ -} - -static void setting_connective_ug_on_resume(ui_gadget_h ug, app_control_h service, - void *priv) -{ -} - -static void setting_connective_ug_on_destroy(ui_gadget_h ug, - app_control_h service, void *priv) -{ - SETTING_TRACE_BEGIN; - setting_retm_if((!priv), "!priv"); - SettingConnectivityUG *connectiveUG = priv; - - evas_object_event_callback_del(connectiveUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_connective_ug_cb_resize); /* fix flash issue for gallery */ - connectiveUG->ug = ug; - - /* called when this shared gadget is terminated. similar with app_exit */ - if (&setting_view_connectivity_usb == connectiveUG->view_to_load) { - setting_view_destroy(&setting_view_connectivity_usb_help, - connectiveUG); - setting_view_destroy(&setting_view_connectivity_usb, - connectiveUG); - } - - if (NULL != ug_get_layout(connectiveUG->ug)) { - evas_object_hide((Evas_Object *) - ug_get_layout(connectiveUG->ug)); - evas_object_del((Evas_Object *) - ug_get_layout(connectiveUG->ug)); - } - - SETTING_TRACE_END; -} - -static void setting_connective_ug_on_message(ui_gadget_h ug, app_control_h msg, - app_control_h service, void *priv) -{ - SETTING_TRACE_BEGIN; -} - -static void setting_connective_ug_on_event(ui_gadget_h ug, - enum ug_event event, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - switch (event) { - case UG_EVENT_LOW_MEMORY: - break; - case UG_EVENT_LOW_BATTERY: - break; - case UG_EVENT_LANG_CHANGE: - break; - case UG_EVENT_ROTATE_PORTRAIT: - break; - case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN: - break; - case UG_EVENT_ROTATE_LANDSCAPE: - break; - case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN: - break; - case UG_EVENT_REGION_CHANGE: - break; - default: - break; - } -} - -static void setting_connective_ug_on_key_event(ui_gadget_h ug, - enum ug_key_event event, - app_control_h service, void *priv) -{ - SETTING_TRACE_BEGIN; - SettingConnectivityUG *ad = (SettingConnectivityUG *) priv; - - switch (event) { - case UG_KEY_EVENT_END: { - if (elm_naviframe_top_item_get(ad->navi_bar) == - elm_naviframe_bottom_item_get(ad->navi_bar)) { - ug_destroy_me(ug); - } else { - /* elm_naviframe_item_pop(ad->navi_bar); */ - setting_view_cb_at_endKey(ad); - } - } - break; - default: - break; - } -} - -UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops) -{ - SETTING_TRACE_BEGIN; - SettingConnectivityUG *connectiveUG = - calloc(1, sizeof(SettingConnectivityUG)); - setting_retvm_if(!connectiveUG, -1, - "Create SettingConnectivityUG obj failed"); - - ops->create = setting_connective_ug_on_create; - ops->start = setting_connective_ug_on_start; - ops->pause = setting_connective_ug_on_pause; - ops->resume = setting_connective_ug_on_resume; - ops->destroy = setting_connective_ug_on_destroy; - ops->message = setting_connective_ug_on_message; - ops->event = setting_connective_ug_on_event; - ops->key_event = setting_connective_ug_on_key_event; - ops->priv = connectiveUG; - ops->opt = UG_OPT_INDICATOR_ENABLE; - - return 0; -} - -UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops) -{ - SETTING_TRACE_BEGIN; - struct SettingConnectivityUG *connectiveUG; - setting_retm_if(!ops, "ops == NULL"); - - connectiveUG = ops->priv; - if (connectiveUG) { - FREE(connectiveUG); - } -} - -UG_MODULE_API int setting_plugin_search_init(app_control_h service, void *priv, - char **applocale) -{ - int i, size; - Setting_Cfg_Node_T *node; - Eina_List **pplist = priv; - const Setting_Cfg_Node_T search_configs[] = { - {DEVOPTION_STR_USB_DEBUGGING, NULL, NULL, 0, Cfg_Item_unResetable, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, - {DEVOPTION_STR_SHOW_CPU_USAGE, NULL, NULL, 0, Cfg_Item_unResetable, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, - {DEVOPTION_STR_RENDERTING_ENGINE, NULL, NULL, 0, Cfg_Item_unResetable, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, - {DEVOPTION_STR_LIMIT_BACKGROUND_PRECESS, NULL, NULL, 0, Cfg_Item_unResetable, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, - {DEVOPTION_STR_CRASH_VIEWER, NULL, NULL, 0, Cfg_Item_unResetable, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL} - }; - - retv_if(NULL == priv, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - retv_if(NULL == applocale, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - *applocale = strdup("setting:"_TZ_SYS_RO_APP"/org.tizen.setting/res/locale"); - - size = sizeof(search_configs) / sizeof(Setting_Cfg_Node_T); - - for (i = 0; i < size; i++) { - node = setting_plugin_search_item_subindex_add( - search_configs[i].key_name, - "viewtype:usb", - IMG_USBconnection, - search_configs[i].item_type, - search_configs[i].data, - "Developer options"); - - *pplist = eina_list_append(*pplist, node); - } - return 0; -} - diff --git a/setting-flightmode/CMakeLists.txt b/setting-flightmode/CMakeLists.txt deleted file mode 100644 index 7dc1afa..0000000 --- a/setting-flightmode/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${SETTING_COMMON}/include) - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs_flightmode REQUIRED elementary ecore edje evas appcore-common appcore-efl ui-gadget-1 dlog aul json-glib-1.0 -pkgmgr-info tapi notification libtzplatform-config) - -FOREACH(flag ${pkgs_flightmode_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Werror-implicit-function-declaration") -SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") - -IF("${ARCH}" STREQUAL "arm") - ADD_DEFINITIONS("-DTARGET") - MESSAGE("add -DTARGET") -ENDIF("${ARCH}" STREQUAL "arm") - -ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") -ADD_DEFINITIONS("-DSLP_DEBUG") -ADD_DEFINITIONS("-shared") - -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib") - -ADD_LIBRARY(${SETTING_FLIGHTMODE_UG} SHARED - ./src/setting-flightmode.c - ./src/setting-flightmode-main.c - ) - -TARGET_LINK_LIBRARIES(${SETTING_FLIGHTMODE_UG} -L${CMAKE_BINARY_DIR}/${SETTING_COMMON} -lsetting-common) -TARGET_LINK_LIBRARIES(${SETTING_FLIGHTMODE_UG} ${pkgs_flightmode_LDFLAGS}) - -INSTALL(TARGETS ${SETTING_FLIGHTMODE_UG} DESTINATION ${PREFIX}/lib/ug) diff --git a/setting-flightmode/include/setting-flightmode-main.h b/setting-flightmode/include/setting-flightmode-main.h deleted file mode 100644 index 87a2de7..0000000 --- a/setting-flightmode/include/setting-flightmode-main.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_FLIGHTMODE_MAIN_H__ -#define __SETTING_FLIGHTMODE_MAIN_H__ - -#include - -static Eina_Bool setting_flightmode_main_click_softkey_back_cb(void *data, Elm_Object_Item *it); -static void setting_flightmode_main_list_Gendial_mouse_up_cb(void *data, Evas_Object *obj, void *event_info); -static void setting_flightmode_main_chk_btn_cb(void *data, Evas_Object *obj, void *event_info); - -#endif /* __SETTING_FLIGHTMODE_MAIN_H__ */ diff --git a/setting-flightmode/include/setting-flightmode.h b/setting-flightmode/include/setting-flightmode.h deleted file mode 100644 index 7d7aff1..0000000 --- a/setting-flightmode/include/setting-flightmode.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_FLIGHTMODE_H__ -#define __SETTING_FLIGHTMODE_H__ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -typedef struct _SettingFlightModeUG SettingFlightModeUG; - -typedef enum _MODE_OPEARTION { - MODE_INVALID = 0, /*< There is no request waiting for processing */ - MODE_ENTER = 1, /*< Some "flightmode enter" request is waiting for processing */ - MODE_LEAVE, /*< Some "flightmode leave" request is waiting for processing */ -} MODE_OPEARTION; - - -struct _SettingFlightModeUG { - ui_gadget_h ug; - ui_gadget_h ug_loading; - /* add more variables here (move your appdata to here) */ - app_control_h bundle_data; /**< when loading this UG, bundle is stored */ - - Evas *evas; - Evas_Object *win_main_layout; - Evas_Object *win_get; - Evas_Object *bg; - Evas_Object *ly_main; - Evas_Object *navi_bar; /* for navigation effect */ - Evas_Object *scroller; - Evas_Object *popup_flight_mode; - - Eina_List *app_list; - Eina_List *app_check_list; - Elm_Genlist_Item_Class itc_1text_2icon; - Setting_GenGroupItem_Data *data_flightmode; - - /* UI elements - view main */ - setting_view *view_to_load; - - /*notification hander */ - int noti_id; - - /** - * vars for flightmode - */ - TapiHandle *handle; - bool b_fm_requesting; /**< whether some request is processing. 1:yes, 0:no */ - MODE_OPEARTION fm_waiting_op; -}; - -extern setting_view setting_view_flightmode_main; -#endif diff --git a/setting-flightmode/src/setting-flightmode-main.c b/setting-flightmode/src/setting-flightmode-main.c deleted file mode 100644 index d14df4d..0000000 --- a/setting-flightmode/src/setting-flightmode-main.c +++ /dev/null @@ -1,379 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include - -static int setting_flightmode_main_create(void *cb); -static int setting_flightmode_main_destroy(void *cb); -static int setting_flightmode_main_update(void *cb); -static int setting_flightmode_main_cleanup(void *cb); - -setting_view setting_view_flightmode_main = { - .create = setting_flightmode_main_create, - .destroy = setting_flightmode_main_destroy, - .update = setting_flightmode_main_update, - .cleanup = setting_flightmode_main_cleanup, -}; - -static void setting_flightmode_main_tapi_event_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - ret_if(!user_data); - SettingFlightModeUG *ad = (SettingFlightModeUG *) user_data; - ad->b_fm_requesting = FALSE; - SETTING_TRACE("result:%d", result); - - if (ad->popup_flight_mode) { - evas_object_del(ad->popup_flight_mode); - ad->popup_flight_mode = NULL; - } - int err = 0; - switch (result) { - case TAPI_POWER_FLIGHT_MODE_RESP_ON: - - setting_set_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE, - SETTING_ON_OFF_BTN_ON, &err); - - /*If Setting has validate operation (fm_waiting_op == MODE_LEAVE) to process, process it. */ - /*Otherwise, do nothing */ - if (MODE_LEAVE == ad->fm_waiting_op) { - /*Send the latest operation */ - ad->fm_waiting_op = MODE_INVALID; - err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE, setting_flightmode_main_tapi_event_cb, ad); - setting_retm_if(err != TAPI_API_SUCCESS, - "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***"); - - /*sucessfully sent, */ - ad->b_fm_requesting = TRUE; - - } - break; - - case TAPI_POWER_FLIGHT_MODE_RESP_OFF: - - setting_set_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE, - SETTING_ON_OFF_BTN_OFF, &err); - - /*If Setting has validate operation (here, fm_waiting_op == MODE_ENTER) to process,process it. */ - /*Otherwise, do nothing */ - if (MODE_ENTER == ad->fm_waiting_op) { - /*Send the latest operation */ - ad->fm_waiting_op = MODE_INVALID; - err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER, setting_flightmode_main_tapi_event_cb, ad); - setting_retm_if(err != TAPI_API_SUCCESS, - "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***"); - - /*sucessfully sent, */ - ad->b_fm_requesting = TRUE; - } - - break; - - case TAPI_POWER_FLIGHT_MODE_RESP_FAIL: - /*Setting has a validate operation to process, Send the operation request */ - if (MODE_ENTER == ad->fm_waiting_op) { - ad->fm_waiting_op = MODE_INVALID; - err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER, setting_flightmode_main_tapi_event_cb, ad); - - setting_retm_if(err != TAPI_API_SUCCESS, - "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***"); - ad->b_fm_requesting = TRUE; - } else if (MODE_LEAVE == ad->fm_waiting_op) { - ad->fm_waiting_op = MODE_INVALID; - err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE, setting_flightmode_main_tapi_event_cb, ad); - - setting_retm_if(err != TAPI_API_SUCCESS, - "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***"); - ad->b_fm_requesting = TRUE; - } else { /*Current requset is the last one, Setting needs to notify user */ - setting_create_popup(ad, ad->win_get, - "IDS_ST_POP_ERROR", - "IDS_ST_POP_UNABLE_TO_TURN_ON_FLIGHT_MODE_VODA", - NULL, POPUP_INTERVAL, - FALSE, FALSE, 0); - - /*It is need to rollback the status, */ - setting_update_gl_item_chk_status(ad->data_flightmode, !(ad->data_flightmode->chk_status)); - return; - } - - /*sucessfully sent, */ - ad->b_fm_requesting = TRUE; - - break; - - case TAPI_POWER_FLIGHT_MODE_RESP_MAX: - setting_create_popup(ad, ad->win_get, - "IDS_ST_POP_ERROR", - "IDS_IM_POP_UNEXPECTED_ERROR", - NULL, POPUP_INTERVAL, FALSE, FALSE, 0); - - /*It is need to rollback the status, */ - setting_update_gl_item_chk_status(ad->data_flightmode, !(ad->data_flightmode->chk_status)); - break; - default: - /* do nothing */ - break; - } - return; -} - -void __alternate_flight_mode(Evas_Object *check, void *data) -{ - SETTING_TRACE_BEGIN; - int ret; - Eina_Bool status = elm_check_state_get(check); - SETTING_TRACE("flight mode status : %d", status); - /*SettingFlightModeUG *ad = (SettingFlightModeUG *) data; */ - ret_if(!data); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) data; - SettingFlightModeUG *ad = list_item->userdata; - - if (!ad->handle) { - SETTING_TRACE("ad->handle is NULL, something error happended in TAPI"); - return; - } - - /*Check whether some requestion is processing by TAPI */ - if (ad->b_fm_requesting) { - /*Do nothing, just mark the lastest operation.. */ - SETTING_TRACE("Some requestion is processing by TAPI, wait to process"); - ad->fm_waiting_op = status ? MODE_ENTER : MODE_LEAVE; - return; - } - /*otherwise, invalid waiting operation and send requsetion to TAPI: */ - ad->fm_waiting_op = MODE_INVALID; - if (status) { - ret = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER, setting_flightmode_main_tapi_event_cb, ad); - setting_retm_if(ret != TAPI_API_SUCCESS, - "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***"); - } else { - ret = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE, setting_flightmode_main_tapi_event_cb, ad); - setting_retm_if(ret != TAPI_API_SUCCESS, - "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***"); - } - - /*sucessfully sent, */ - ad->b_fm_requesting = TRUE; - /*SETTING_TRACE_END; */ -} - -static void _flightmode_vconf_change_cb(keynode_t *key, void *data) -{ - setting_retm_if(NULL == data, "NULL == data"); - SettingFlightModeUG *ad = (SettingFlightModeUG *) data; - int status = vconf_keynode_get_bool(key); - char *vconf_name = vconf_keynode_get_name(key); - - if (!safeStrCmp(vconf_name, VCONFKEY_TELEPHONY_FLIGHT_MODE)) { - ad->data_flightmode->chk_status = status; - elm_check_state_set(ad->data_flightmode->eo_check, status); - } else { - SETTING_TRACE_ERROR("vconf_name is wrong"); - } -} - - -/* *************************************************** - ** - **basic func - ** - ****************************************************/ -static int setting_flightmode_main_create(void *cb) -{ - SETTING_TRACE_BEGIN; - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingFlightModeUG *ad = (SettingFlightModeUG *) cb; - - ad->handle = tel_init(NULL); - if (!ad->handle) { - SETTING_TRACE_ERROR("*** [ERR] tel_init failed ***"); - setting_create_popup(ad, ad->win_main_layout, _("IDS_ST_BODY_FLIGHT_MODE"), _("tel_init() failed"), NULL, 0, false, false, 0); - /*return SETTING_RETURN_FAIL; */ - } else { - SETTING_TRACE("tel_init ok[handle:%p]", ad->handle); - } - - Evas_Object *genlist; - ad->ly_main = - setting_create_layout_navi_bar_genlist(ad->win_main_layout, - ad->win_get, - "IDS_ST_BODY_FLIGHT_MODE", - _("IDS_ST_BUTTON_BACK"), - NULL, - setting_flightmode_main_click_softkey_back_cb, - NULL, - ad, - &genlist, - &(ad->navi_bar)); - - /* add - flightmode setting menu list */ - int value, err, ret; - ret = setting_get_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE, &value, &err); - if (ret != 0) { - SETTING_TRACE_ERROR("get vconf failed"); - } - - /* create flightmode_mode */ - ad->data_flightmode = setting_create_Gendial_field_def(genlist, - &(itc_1text_1icon), - setting_flightmode_main_list_Gendial_mouse_up_cb, - ad, - SWALLOW_Type_1ICON_1RADIO, - NULL, - NULL, - value, - "IDS_ST_BODY_FLIGHT_MODE", - NULL, - setting_flightmode_main_chk_btn_cb); - - if (ad->data_flightmode) { - ad->data_flightmode->userdata = ad; - __BACK_POINTER_SET(ad->data_flightmode); - } - - ADD_GL_HELP_NO_SEP(genlist, "IDS_ST_BODY_FLIGHT_MODE_DISABLES_CALLING_AND_MESSAGING_FUNCTIONS_AND_TURNS_OFF_MOBILE_DATA_AND_CONNECTIVITY_FUNCTIONS_MSG"); - - ret = vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE, _flightmode_vconf_change_cb, ad); - if (ret != 0) { - SETTING_TRACE_ERROR("call vconf_notify_key_changed failed"); - } - - /* update info */ - setting_view_flightmode_main.is_create = 1; - return SETTING_RETURN_SUCCESS; -} - -static int setting_flightmode_main_destroy(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - SettingFlightModeUG *ad = (SettingFlightModeUG *) cb; - - if (ad->popup_flight_mode) { - evas_object_del(ad->popup_flight_mode); - ad->popup_flight_mode = NULL; - } - - int ret = vconf_ignore_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE, _flightmode_vconf_change_cb); - if (ret != 0) { - SETTING_TRACE_ERROR("call vconf_ignore_key_changed failed"); - } - - if (ad->handle) { - int tapi_ret = tel_deinit(ad->handle); - if (tapi_ret != TAPI_API_SUCCESS) { - SETTING_TRACE_DEBUG("*** [ERR] tel_deinit. [%d] ***", tapi_ret); - } else { - SETTING_TRACE("*** tel_deinit OK "); - } - ad->handle = NULL; - } - - if (ad->ly_main != NULL) { - evas_object_del(ad->ly_main); - setting_view_flightmode_main.is_create = 0; - } - return SETTING_RETURN_SUCCESS; -} - -static int setting_flightmode_main_update(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - return SETTING_RETURN_SUCCESS; -} - -static int setting_flightmode_main_cleanup(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingFlightModeUG *ad = (SettingFlightModeUG *) cb; - return setting_flightmode_main_destroy(ad); -} - -/* *************************************************** - ** - **call back func - ** - ****************************************************/ -static Eina_Bool setting_flightmode_main_click_softkey_back_cb(void *data, Elm_Object_Item *it) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retvm_if(data == NULL, FALSE, "Data parameter is NULL"); - SettingFlightModeUG *ad = (SettingFlightModeUG *) data; - - /* Send destroy request */ - ug_destroy_me(ad->ug); - SETTING_TRACE_END; - return EINA_FALSE; -} - -static void setting_flightmode_main_list_Gendial_mouse_up_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - setting_retm_if(data == NULL, "Data parameter is NULL"); - - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - elm_genlist_item_selected_set(item, 0); - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)elm_object_item_data_get(item); - - if (list_item) { - list_item->chk_status = !list_item->chk_status; - elm_check_state_set(list_item->eo_check, list_item->chk_status); - setting_flightmode_main_chk_btn_cb(list_item, list_item->eo_check, NULL); - } -} - -static void setting_flightmode_main_chk_btn_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(data == NULL, "Data parameter is NULL"); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) data; - SettingFlightModeUG *ad = list_item->userdata; - retm_if(ad == NULL, "ad parameter is NULL"); - list_item->chk_status = elm_check_state_get(obj);/* for genlist update status */ - - if (list_item->chk_status) { - list_item->chk_status = EINA_TRUE; - elm_check_state_set(list_item->eo_check, EINA_TRUE); - __alternate_flight_mode(list_item->eo_check, data); - - } else { - list_item->chk_status = EINA_FALSE; - elm_check_state_set(list_item->eo_check, EINA_FALSE); - __alternate_flight_mode(list_item->eo_check, data); - } -} - - diff --git a/setting-flightmode/src/setting-flightmode.c b/setting-flightmode/src/setting-flightmode.c deleted file mode 100644 index bce369a..0000000 --- a/setting-flightmode/src/setting-flightmode.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include - -#ifndef UG_MODULE_API -#define UG_MODULE_API __attribute__ ((visibility("default"))) -#endif - -static void setting_flightmode_ug_cb_resize(void *data, Evas *e, - Evas_Object *obj, void *event_info) -{ - SettingFlightModeUG *ad = (SettingFlightModeUG *) data; - setting_view_update(&setting_view_flightmode_main, ad); -} - -setting_view *__get_flightmode_view_to_load(void *data, app_control_h service) -{ - SETTING_TRACE_BEGIN; - setting_retvm_if((!data), NULL, "data is NULL"); - - setting_view_node_table_intialize(); - - /* default action */ - setting_view_node_table_register(&setting_view_flightmode_main, NULL); - return &setting_view_flightmode_main; -} - -static void *setting_flightmode_ug_on_create(ui_gadget_h ug, - enum ug_mode mode, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - setting_retvm_if((!priv), NULL, "!priv"); - SettingFlightModeUG *flightmodeUG = priv; - flightmodeUG->ug = ug; - flightmodeUG->bundle_data = service; - setting_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR); - - flightmodeUG->win_main_layout = (Evas_Object *) ug_get_parent_layout(ug); - flightmodeUG->win_get = (Evas_Object *) ug_get_window(); - - evas_object_show(flightmodeUG->win_main_layout); - flightmodeUG->evas = evas_object_evas_get(flightmodeUG->win_main_layout); - - setting_retvm_if(flightmodeUG->win_main_layout == NULL, NULL, - "cannot get main window "); - - /* register view node table */ - flightmodeUG->view_to_load = __get_flightmode_view_to_load(flightmodeUG, service); - setting_retvm_if(NULL == flightmodeUG->view_to_load, NULL, "NULL == flightmodeUG->view_to_load"); - - setting_create_Gendial_itc("dialogue/1text.2icon", &(flightmodeUG->itc_1text_2icon)); - - /* creating a view. */ - setting_view_node_set_cur_view(flightmodeUG->view_to_load); - setting_view_create(flightmodeUG->view_to_load, (void *)flightmodeUG); - - evas_object_event_callback_add(flightmodeUG->win_main_layout, - EVAS_CALLBACK_RESIZE, - setting_flightmode_ug_cb_resize, flightmodeUG); - - /*---------------------------------------------------------------- */ - /* add genlist */ - /*---------------------------------------------------------------- */ - return flightmodeUG->ly_main; -} - -static void setting_flightmode_ug_on_start(ui_gadget_h ug, app_control_h service, - void *priv) -{ -} - -static void setting_flightmode_ug_on_pause(ui_gadget_h ug, app_control_h service, - void *priv) -{ -} - -static void setting_flightmode_ug_on_resume(ui_gadget_h ug, app_control_h service, - void *priv) -{ -} - -static void setting_flightmode_ug_on_destroy(ui_gadget_h ug, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - setting_retm_if((!priv), "!priv"); - SettingFlightModeUG *flightmodeUG = priv; - evas_object_event_callback_del(flightmodeUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_flightmode_ug_cb_resize); /*fix flash issue for gallery */ - flightmodeUG->ug = ug; - if (flightmodeUG->bg) { - evas_object_del(flightmodeUG->bg); - } - flightmodeUG->bg = NULL; - - /* called when this shared gadget is terminated. similar with app_exit */ - setting_view_destroy(&setting_view_flightmode_main, flightmodeUG); - - if (NULL != ug_get_layout(flightmodeUG->ug)) { - evas_object_hide((Evas_Object *) ug_get_layout(flightmodeUG->ug)); - evas_object_del((Evas_Object *) ug_get_layout(flightmodeUG->ug)); - } -} - -static void setting_flightmode_ug_on_message(ui_gadget_h ug, app_control_h msg, - app_control_h service, void *priv) -{ - SETTING_TRACE_BEGIN; -} - -static void setting_flightmode_ug_on_event(ui_gadget_h ug, - enum ug_event event, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - switch (event) { - case UG_EVENT_LOW_MEMORY: - break; - case UG_EVENT_LOW_BATTERY: - break; - case UG_EVENT_LANG_CHANGE: - break; - case UG_EVENT_ROTATE_PORTRAIT: - break; - case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN: - break; - case UG_EVENT_ROTATE_LANDSCAPE: - break; - case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN: - break; - case UG_EVENT_REGION_CHANGE: - break; - default: - break; - } -} - -static void setting_flightmode_ug_on_key_event(ui_gadget_h ug, - enum ug_key_event event, - app_control_h service, void *priv) -{ - SETTING_TRACE_BEGIN; - SettingFlightModeUG *ad = (SettingFlightModeUG *) priv; - - switch (event) { - case UG_KEY_EVENT_END: { - if (elm_naviframe_top_item_get(ad->navi_bar) == - elm_naviframe_bottom_item_get(ad-> - navi_bar)) { - ug_destroy_me(ug); - } else { - - setting_view_cb_at_endKey(ad); - } - } - break; - default: - break; - } -} - -UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops) -{ - SETTING_TRACE_BEGIN; - SettingFlightModeUG *flightmodeUG = calloc(1, sizeof(SettingFlightModeUG)); - setting_retvm_if(!flightmodeUG, -1, "Create SettingFlightModeUG obj failed"); - - ops->create = setting_flightmode_ug_on_create; - ops->start = setting_flightmode_ug_on_start; - ops->pause = setting_flightmode_ug_on_pause; - ops->resume = setting_flightmode_ug_on_resume; - ops->destroy = setting_flightmode_ug_on_destroy; - ops->message = setting_flightmode_ug_on_message; - ops->event = setting_flightmode_ug_on_event; - ops->key_event = setting_flightmode_ug_on_key_event; - ops->priv = flightmodeUG; - ops->opt = UG_OPT_INDICATOR_ENABLE; - return 0; -} - -UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops) -{ - SETTING_TRACE_BEGIN; - struct SettingFlightModeUG *flightmodeUG; - setting_retm_if(!ops, "ops == NULL"); - - flightmodeUG = ops->priv; - if (flightmodeUG) { - FREE(flightmodeUG); - } -} - -/* *************************************************** -** -** general func -** -** **************************************************/ - -/** -* Reset function to 'reset' the settings of the UG, it will be invoked by 'Reset' UG -* -* @param[in] data -* @param[in] priv -*/ - diff --git a/setting-locktype/CMakeLists.txt b/setting-locktype/CMakeLists.txt deleted file mode 100755 index 8bbfeb2..0000000 --- a/setting-locktype/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${SETTING_COMMON}/include) - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs_locktype REQUIRED ecore evas elementary dlog efl-extension json-glib-1.0 -ui-gadget-1 capi-appfw-application appcore-common ail -deviced pkgmgr-info libtzplatform-config -) - -FOREACH(flag ${pkgs_locktype_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Werror-implicit-function-declaration") -SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") - -IF("${ARCH}" STREQUAL "arm") - ADD_DEFINITIONS("-DTARGET") - MESSAGE("add -DTARGET") -ENDIF("${ARCH}" STREQUAL "arm") - -ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") -ADD_DEFINITIONS("-DSLP_DEBUG") -ADD_DEFINITIONS("-shared") - -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib") - -ADD_LIBRARY(${SETTING_LOCKTYPE_UG} SHARED - ./src/setting-locktype.c - ./src/setting-locktype-main.c - ) - -TARGET_LINK_LIBRARIES(${SETTING_LOCKTYPE_UG} -L${CMAKE_BINARY_DIR}/${SETTING_COMMON} -lsetting-common) -TARGET_LINK_LIBRARIES(${SETTING_LOCKTYPE_UG} ${pkgs_locktype_LDFLAGS}) - -INSTALL(TARGETS ${SETTING_LOCKTYPE_UG} DESTINATION ${PREFIX}/lib/ug) diff --git a/setting-locktype/include/setting-locktype-main.h b/setting-locktype/include/setting-locktype-main.h deleted file mode 100644 index 313f2d3..0000000 --- a/setting-locktype/include/setting-locktype-main.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_LOCKTYPE_MAIN_H__ -#define __SETTING_LOCKTYPE_MAIN_H__ - -#include - -typedef struct _openlock_appdata openlock_appdata; - -struct _openlock_appdata { - openlock_appdata *prev; - openlock_appdata *next; - - char *pkg_name; - char *app_name; - int index; -}; - -Eina_Bool setting_locktype_main_click_softkey_back_cb(void *data, Elm_Object_Item *it); - -static void -setting_locktype_main_click_radio_cb(void *data, Evas_Object *obj, void *event_info); -static void -setting_locktype_main_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj, void *event_info); - -#endif diff --git a/setting-locktype/include/setting-locktype.h b/setting-locktype/include/setting-locktype.h deleted file mode 100644 index 7dbf48f..0000000 --- a/setting-locktype/include/setting-locktype.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_LOCKTYPE_H__ -#define __SETTING_LOCKTYPE_H__ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/*#include */ -/*#include */ - - -/*///////////////////face and voice unlock */ -#define SET_AS_LOCK_STR "IDS_ST_SK_SET_LITE"/*"Set as lock" */ -#define CONTINUE_STR "Continue" -#define SET_UP_STR "Set it up" -#define ADAPT_VOICE_STR "Adapt Voice" - -#define About_Motion_Unlock_Str "IDS_ST_HEADER_MOTION_UNLOCK" -#define About_Face_Unlock_Str "About Face Unlock" -#define Setup_Face_Unlock_Str "Set up Face Unlock" -#define Voice_Record_BtnStr "Voice record icon" -#define Put_Face_Str "Put your face here" -#define Show_Face_Str "Show your face" - -#define Motion_Unlock_Guildtext "Unlock device using motion

"\ - "Tap and hold the screen then tilt the device "\ - "towards you to unlock it. If the screen does not unlock, "\ - "try tiling the device more. When learn about tilt or motion "\ - "lock are set,motion activation will be automatically enabled "\ - "in Settings" - -#define Motion_Unlock_Guildtext1 "IDS_ST_HEADER_UNLOCK_DEVICE_USING_MOTION_ABB" -#define Motion_Unlock_Guildtext2 "IDS_ST_BODY_TAP_AND_HOLD_THE_SCREEN_THEN_TILT_THE_DEVICE_TOWARDS_YOU_TO_UNLOCK_IT_IF_THE_SCREEN_DOES_NOT_UNLOCK_TRY_TILTING_THE_DEVICE_MORE" -#define Motion_Unlock_Guildtext3 "IDS_ST_BODY_WHEN_LEARN_ABOUT_TILT_OR_MOTION_UNLOCK_ARE_SET_MOTION_ACTIVATION_WILL_BE_AUTOMATICALLY_ENABLED_IN_SETTINGS" - -#define Face_Unlock_Warring "Warning

"\ - "Do not use face unlock while driving, it may distract you from "\ - "the road and cause an accident" - -#define Face_Unlock_Warring2 "Look at your phone to Unlock it

"\ - "Keep these things in mind
"\ - ".Face Unlock is less secure than PIN or password.

"\ - ".Someone who looks similar to you could unlock your phone.

"\ - ".The data used to identify your face is kept private on the phone." - -#define Face_Unlock_Warring3 "For best results:

"\ - ".Find an indoor spot that is not too bright or too dim.

"\ - ".Hold the phone at eye level." - -#define Voice_Unlock_Guildtext "Tap button below then say voice command you want to use for Unlock 4 times all at once" -#define Voice_Unlock_Guildtext2 "Use 3-5 syllable words and maintain constant intonation.

"\ - "All background music and recording will stop when you unlock the device using Face and voice
" -#define Voice_Recognized_text "Recognised. Now you can use your own voice command for Unlock.

"\ - "For assuring higher security. You can adapt voice command by tapping 'Adapt voice' button." - -#define Adapt_voice_Str "Adapt Voice" - -#define Finish_Setup_Face "You've finished!

"\ - "To unlock your phone, just look at it.

"\ - "Tip : improve face matching by having your face capture in different "\ - "conditions." - -#define Speak_Now_Str "Speak now" - -#define Keystr_ScreenLockType "IDS_ST_BODY_SCREEN_LOCK_TYPE" -#define Keystr_LockScreenOptions "IDS_ST_BODY_LOCK_SCREEN_OPTIONS" -#define Keystr_Swipe "IDS_ST_MBODY_SWIPE" -#define Keystr_FaceAndVoice "IDS_ST_BODY_FACE_AND_VOICE" -#define Keystr_FingerPrint "Fingerprint" - - -typedef struct _SettingLocktypeUG SettingLocktypeUG; - -struct _locktype_item { - int pw_type_num; - char *pw_type_string; - int (*passwd_handler)(SettingLocktypeUG *ad, void *data); -}; - -#define MAX_VOICE_TIME 4 -#define MAX_SEC_PROFILE_NUM 100 - -enum { - SETTING_LOCKTYPE_PW_PASSWORD, - SETTING_LOCKTYPE_PW_SIMPLE_PASSWD, - SETTING_LOCKTYPE_PW_CHANGE_PASSWD, - SETTING_LOCKTYPE_PW_CHANGE_SIMPLE_PASSWD, - SETTING_LOCKTYPE_PW_MAX -}; - -enum { - SETTING_LOCKTYPE_VIEWTYPE_MAIN, - SETTING_LOCKTYPE_VIEWTYPE_ENCRYPTION, - SETTING_LOCKTYPE_VIEWTYPE_RECOVERY, /* In case that recovery password using tizen account, lockscreen can call locktype */ -}; - -/** - * Setting Security UG context - * all UG function has void* as an agument. this is casted back to SettingSecurityUG - * and the functions access app context. - */ -struct _SettingLocktypeUG { - ui_gadget_h ug; - - /* add more variables here (move your appdata to here) */ - Evas *evas; - Evas_Object *win_main_layout; - Evas_Object *win_get; - Evas_Object *notify; - Evas_Object *video_ly; - Evas_Object *video_ly_show_face_btn; - Evas_Object *video_ly_content_face; - Ecore_Timer *update_timer; - Evas_Object *image[MAX_VOICE_TIME]; - int processed_img_num; - Evas_Object *record_genlist; - Elm_Object_Item *screen_lock_main_item; - char *selected_lock_type; - - Evas_Object *ly_guild; - Evas_Object *ly_main; - Evas_Object *navi_bar; - ui_gadget_h ug_passwd; - ui_gadget_h ug_loading; - Evas_Object *genlist; - Evas_Object *save_popup; - - Elm_Genlist_Item_Class itc_1text; - Elm_Genlist_Item_Class itc_bg_1icon; - Elm_Genlist_Item_Class itc_1text_1icon; - Elm_Genlist_Item_Class itc_seperator; - Elm_Genlist_Item_Class itc_2text_2; - Elm_Genlist_Item_Class itc_1icon; - Elm_Genlist_Item_Class itc_group_item; - Elm_Genlist_Item_Class itc_2text_3_parent; - - int pw_type; - - Evas_Object *lock_type_rd; - Setting_GenGroupItem_Data *data_sl_simple_pw; - Setting_GenGroupItem_Data *data_sl_pw; - - int old_type; - Setting_GenGroupItem_Data *data_locktype_none; - Setting_GenGroupItem_Data *data_locktype_swipe; - Setting_GenGroupItem_Data *data_locktype_fingerprint; - Setting_GenGroupItem_Data *data_locktype_motion; - Setting_GenGroupItem_Data *data_locktype_face; - Setting_GenGroupItem_Data *data_locktype_simple; - Setting_GenGroupItem_Data *data_locktype_password; - Setting_GenGroupItem_Data *data_locktype_3rd[128]; - - Ecore_Timer *update_locktype_timer; - bool cur_enc_mode; - bool ug_is_destroying; - int viewtype; - char *caller; - char *input_pwd; -}; - -extern setting_view setting_view_locktype_main; - - -void setting_locktype_result_password_ug_cb(ui_gadget_h ug, - app_control_h service, void *priv); -gboolean setting_locktype_create_password_sg(void *data); -void setting_locktype_destroy_password_ug_cb(ui_gadget_h ug, - void *priv); -void setting_locktype_layout_passwd_ug_cb(ui_gadget_h ug, - enum ug_mode mode, void *priv); - -#endif diff --git a/setting-locktype/src/setting-locktype-main.c b/setting-locktype/src/setting-locktype-main.c deleted file mode 100644 index 68c8594..0000000 --- a/setting-locktype/src/setting-locktype-main.c +++ /dev/null @@ -1,781 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include -#include -#include -#include - -#include -#include -#include -#include -#if SUPPORT_ENCRYPTION -#include -#endif - -#define TBD 0 - -static int setting_locktype_main_create(void *cb); -static int setting_locktype_main_destroy(void *cb); -static int setting_locktype_main_update(void *cb); -static int setting_locktype_main_cleanup(void *cb); - -#if 0 -static void __record_btn_click_cb(void *data, Evas_Object *obj, void *event_info); -#endif - -setting_view setting_view_locktype_main = { - .create = setting_locktype_main_create, - .destroy = setting_locktype_main_destroy, - .update = setting_locktype_main_update, - .cleanup = setting_locktype_main_cleanup, -}; - -openlock_appdata *lockapp_data = NULL; - -/* *************************************************** - ** - **basic func - ** - ****************************************************/ - -static int __get_lockapp_index_from_appname(char *app_name) -{ - SETTING_TRACE_BEGIN; - if (app_name == NULL) - return SETTING_RETURN_FAIL; - - openlock_appdata *item = lockapp_data; - for (; item != NULL; item = item->next) { - if (safeStrCmp(item->app_name, app_name) == 0) - return item->index; - } - return SETTING_RETURN_FAIL; -} -static char *__get_lockapp_pkgname_from_appname(char *app_name) -{ - SETTING_TRACE_BEGIN; - if (app_name == NULL) - return NULL; - - openlock_appdata *item = lockapp_data; - for (; item != NULL; item = item->next) { - if (safeStrCmp(item->app_name, app_name) == 0) - return item->pkg_name; - } - return NULL; -} - -int __get_appinfo_cb(pkgmgrinfo_appinfo_h appinfo, void *user_data) -{ - SETTING_TRACE_BEGIN; - if (!appinfo) { - SETTING_TRACE_DEBUG("handle is NULL"); - return -1; - } - - openlock_appdata *item = lockapp_data; - openlock_appdata *new_item = NULL; - char *app_name = NULL; - char *app_id = NULL; - ail_appinfo_h handle; - int ret = 0; - - ret = pkgmgrinfo_appinfo_get_appid(appinfo, &app_id); - if (ret != 0) { - SETTING_TRACE_DEBUG("pkgmgrinfo_appinfo_get_appid() returns error"); - return -1; - } - - if (!app_id) { - SETTING_TRACE_DEBUG("app_id is NULL"); - return -1; - } - - SETTING_TRACE_DEBUG("app_id %s", app_id); - - ret = ail_get_appinfo(app_id, &handle); - if (ret != AIL_ERROR_OK) { - SETTING_TRACE_DEBUG("ail_get_appinfo() returns error"); - ail_destroy_appinfo(handle); - return -1; - } - - ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &app_name); - if (!app_name) { - SETTING_TRACE_DEBUG("ail_appinfo_get_str() returns error"); - ail_destroy_appinfo(handle); - return -1; - } - - SETTING_TRACE_DEBUG("app_name %s", app_name); - - while (item->next != NULL) - item = item->next; - - if (item->index == 0 && item->pkg_name == NULL) { - SETTING_TRACE_DEBUG("first app"); - /* first app */ - item->pkg_name = (char *)strdup(app_id); - item->app_name = (char *)strdup(app_name); - - if (app_id && app_name) - SETTING_TRACE_DEBUG("app info %d %s %s", item->index, item->pkg_name, item->app_name); - } else { - SETTING_TRACE_DEBUG("create new"); - /* create new */ - new_item = (openlock_appdata *)malloc(sizeof(openlock_appdata)); - if (new_item != NULL) { - memset(new_item, 0x00, sizeof(openlock_appdata)); - new_item->pkg_name = (char *)strdup(app_id); - new_item->app_name = (char *)strdup(app_name); - new_item->index = item->index + 1; - new_item->prev = item; - item->next = new_item; - - if (app_id && app_name) - SETTING_TRACE_DEBUG("app info %d %s %s", new_item->index, new_item->pkg_name, new_item->app_name); - } else { - SETTING_TRACE_DEBUG("malloc() failed"); - } - } - /*FREE(app_id); */ - /*FREE(app_name); */ - ail_destroy_appinfo(handle); - SETTING_TRACE_END; - return 0; -} - -#if 0 -static int __add_3rd_party_lock(void *data) -{ - SETTING_TRACE_BEGIN; - retv_if(data == NULL, -1); - - int ret_index = -1; - SettingLocktypeUG *ad = (SettingLocktypeUG *) data; - - /* Get info from AIL */ - pkgmgrinfo_appinfo_filter_h filter = NULL; - int ret = 0; - int count = -1; - - ret = pkgmgrinfo_appinfo_filter_create(&filter); - if (ret > 0) { - SETTING_TRACE_DEBUG("pkgmgrinfo_appinfo_filter_create() failed"); - return ret_index; - } - ret = pkgmgrinfo_appinfo_filter_add_string(filter, PMINFO_APPINFO_PROP_APP_CATEGORY, "http://tizen.org/category/lockapp"); - ret = pkgmgrinfo_appinfo_filter_count(filter, &count); - SETTING_TRACE_DEBUG("There is/are %d 3rd lock app(s)", count); - if (count <= 0) { - SETTING_TRACE_DEBUG("No 3rd lock app"); - pkgmgrinfo_appinfo_filter_destroy(filter); - filter = NULL; - return ret_index; - } - - /* delete if already exist. */ - if (lockapp_data) { - openlock_appdata *list = lockapp_data; - while (list != NULL) { - openlock_appdata *cur = list; - FREE(list->app_name); - FREE(list->pkg_name); - list = list->next; - FREE(cur); - } - lockapp_data = NULL; - } - - lockapp_data = (openlock_appdata *)malloc(sizeof(openlock_appdata)); - if (lockapp_data == NULL) { - SETTING_TRACE_DEBUG("malloc() failed"); - FREE(filter); - return ret_index; - } - memset(lockapp_data, 0x00, sizeof(openlock_appdata)); - lockapp_data->prev = NULL; - lockapp_data->next = NULL; - lockapp_data->pkg_name = NULL; - lockapp_data->app_name = NULL; - lockapp_data->index = 0; - - ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(filter, __get_appinfo_cb, NULL); - SETTING_TRACE("ret:%d", ret); - pkgmgrinfo_appinfo_filter_destroy(filter); - filter = NULL; - - /* Add to genlist */ - openlock_appdata *list = lockapp_data; - int index = 0; - for (index = 0; index < count; index++) { - ad->data_locktype_3rd[index] = setting_create_Gendial_field_1radio(ad->genlist, - &(itc_1text_1icon_3), - setting_locktype_main_mouse_up_Gendial_list_cb, /*add to sel_cb */ - ad, /* sel data */ - SWALLOW_Type_1RADIO, - ad->lock_type_rd, SETTING_SCREEN_LOCK_TYPE_OTHER + index, - list->app_name, - NULL); - if (ad->data_locktype_3rd[index]) { - ad->data_locktype_3rd[index]->userdata = ad; - } else { - SETTING_TRACE_ERROR("item_data is NULL"); - } - - char *open_lock_name = NULL; - open_lock_name = vconf_get_str(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR); - if (safeStrCmp(open_lock_name, list->app_name) == 0) - ret_index = index; - FREE(open_lock_name); - - list = list->next; - } - SETTING_TRACE_END; - FREE(filter); - return ret_index; -} -#endif - -static void __change_simple_password_cb(void *data, Evas_Object *obj, void *event_info) -{ - retm_if(data == NULL, "Data parameter is NULL"); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) data; - /* for update */ - - SettingLocktypeUG *ad = (SettingLocktypeUG *)list_item->userdata; - if (ad == NULL) - return; - - ad->pw_type = SETTING_LOCKTYPE_PW_CHANGE_SIMPLE_PASSWD; - setting_locktype_create_password_sg(ad); -} - -static void __change_password_cb(void *data, Evas_Object *obj, void *event_info) -{ - retm_if(data == NULL, "Data parameter is NULL"); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) data; - /* for update */ - - SettingLocktypeUG *ad = (SettingLocktypeUG *)list_item->userdata; - if (ad == NULL) - return; - - ad->pw_type = SETTING_LOCKTYPE_PW_CHANGE_PASSWD; - setting_locktype_create_password_sg(ad); -} - -void __add_locktype_items(void *data) -{ - SETTING_TRACE_BEGIN; - ret_if(data == NULL); - - SettingLocktypeUG *ad = (SettingLocktypeUG *) data; - - Evas_Object *radio; - - - int locktype = 0; - vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype); - SETTING_TRACE("locktype is %d", locktype); - - radio = elm_radio_add(ad->genlist); - if (radio) { - elm_radio_state_value_set(radio, -1); - ad->lock_type_rd = radio; - } - - evas_object_smart_callback_add(ad->genlist, "realized", __gl_realized_cb, NULL); - - /* to do : radio menu */ - /* 0) None */ - if (!isEmulBin()) { - ad->data_locktype_none = - setting_create_Gendial_field_def(ad->genlist, - &(itc_1text_1icon_3), - setting_locktype_main_mouse_up_Gendial_list_cb, /*add to sel_cb */ - ad, /* sel data */ - SWALLOW_Type_INVALID, - NULL, NULL, SETTING_SCREEN_LOCK_TYPE_NONE, - "IDS_ST_BODY_NONE", - NULL, NULL); - if (ad->data_locktype_none) { - ad->data_locktype_none->userdata = ad; - } else { - SETTING_TRACE_ERROR("item_data is NULL"); - } - } - - /* 1) swipe */ - ad->data_locktype_swipe = - setting_create_Gendial_field_def(ad->genlist, - &(itc_1text_1icon_3), - setting_locktype_main_mouse_up_Gendial_list_cb, /*add to sel_cb */ - ad, /* sel data */ - SWALLOW_Type_INVALID, - NULL, NULL, SETTING_SCREEN_LOCK_TYPE_SWIPE, - Keystr_Swipe, - NULL, NULL); - if (ad->data_locktype_swipe) { - ad->data_locktype_swipe->userdata = ad; - } else { - SETTING_TRACE_ERROR("item_data is NULL"); - } - - if (!isEmulBin()) { - /* 4) simple password */ - ad->data_locktype_simple = - setting_create_Gendial_field_def(ad->genlist, - &(itc_1text_1icon_3), - setting_locktype_main_mouse_up_Gendial_list_cb, /*add to sel_cb */ - ad, /* sel data */ - SWALLOW_Type_INVALID, - NULL, NULL, SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD, - "IDS_ST_BODY_SIMPLE_PASSWORD", - NULL, NULL); - if (ad->data_locktype_simple) { - ad->data_locktype_simple->userdata = ad; - } else { - SETTING_TRACE_ERROR("item_data is NULL"); - } - - /* 5) password */ - ad->data_locktype_password = - setting_create_Gendial_field_def(ad->genlist, - &(itc_1text_1icon_3), - setting_locktype_main_mouse_up_Gendial_list_cb, /*add to sel_cb */ - ad, /* sel data */ - SWALLOW_Type_INVALID, - NULL, NULL, SETTING_SCREEN_LOCK_TYPE_PASSWORD, - "IDS_ST_BODY_PASSWORD", - NULL, NULL); - if (ad->data_locktype_password) { - ad->data_locktype_password->userdata = ad; - } else { - SETTING_TRACE_ERROR("item_data is NULL"); - } - } - -#if 0 - int index = -1; - /* Add 3rd party lock apps in list. */ - index = __add_3rd_party_lock(ad); - - if (index < 0) - elm_radio_value_set(radio, locktype); - else - elm_radio_value_set(radio, locktype + index); -#endif - /* End */ - elm_radio_value_set(radio, locktype); - - - SETTING_TRACE_END; -} - - -static void __lock_type_key_changed_cb(keynode_t *key, void *data) -{ - ret_if(data == NULL); - - SettingLocktypeUG *ad = data; - - char *vconf_name = vconf_keynode_get_name(key); - - if (!safeStrCmp(vconf_name, VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT)) { - /*status = vconf_keynode_get_int(key); */ - if (ad->ug_passwd) { - ad->ug_is_destroying = TRUE; - setting_ug_destroy(ad->ug_passwd); - } - - if (ad->genlist) { - elm_genlist_clear(ad->genlist); - __add_locktype_items(ad); - } - } - /*ug_destroy_me(ad->ug); */ -} - - -static int setting_locktype_main_create(void *cb) -{ - SETTING_TRACE_BEGIN; - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingLocktypeUG *ad = (SettingLocktypeUG *) cb; - - /* add basic layout */ - - Evas_Object *scroller = NULL; - ad->ly_main = setting_create_layout_navi_bar_genlist(ad->win_main_layout, - ad->win_get, - "IDS_ST_BODY_SCREEN_LOCK_TYPE", - _("IDS_ST_BUTTON_BACK"), - NULL, - (setting_call_back_func)setting_locktype_main_click_softkey_back_cb, - NULL, ad, &scroller, - &(ad->navi_bar)); - ad->screen_lock_main_item = elm_naviframe_top_item_get(ad->navi_bar); - - ad->genlist = scroller; - - __add_locktype_items(ad); - - vconf_notify_key_changed(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, __lock_type_key_changed_cb, ad); - - setting_view_locktype_main.is_create = 1; - return SETTING_RETURN_SUCCESS; -} - -static int setting_locktype_main_destroy(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingLocktypeUG *ad = (SettingLocktypeUG *) cb; - - if (ad->notify) { - evas_object_del(ad->notify); - ad->notify = NULL; - } - - (void)vconf_ignore_key_changed(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, __lock_type_key_changed_cb); - - evas_object_del(ad->ly_main); - ad->screen_lock_main_item = NULL; - - setting_view_locktype_main.is_create = 0; - - return SETTING_RETURN_SUCCESS; -} - -static int setting_locktype_main_update(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - /*__update_locktype_items_status(cb); */ - - return SETTING_RETURN_SUCCESS; -} - -static int setting_locktype_main_cleanup(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - return SETTING_RETURN_SUCCESS; -} - -/* *************************************************** - ** - **call back func - ** - ****************************************************/ - -const char *motion_img[] = { - SETTING_ICON_PATH_CFG "motions/unlock_illust_01.png", - SETTING_ICON_PATH_CFG "motions/unlock_illust_02.png", - NULL -}; - -#if 0 - -static void -__motion_set_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE("[HYEJIN] __motion_guild_ly_cb() start. "); - /* error check */ - retm_if(data == NULL, "[Setting > Security] Data parameter is NULL"); - SettingLocktypeUG *ad = (SettingLocktypeUG *) data; - - elm_naviframe_item_pop(ad->navi_bar); - ug_destroy_me(ad->ug); -} - -static void -__motion_cancel_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE("[HYEJIN] __motion_guild_ly_cb() start. "); - /* error check */ - retm_if(data == NULL, "[Setting > Security] Data parameter is NULL"); - SettingLocktypeUG *ad = (SettingLocktypeUG *) data; - - elm_naviframe_item_pop(ad->navi_bar); - ug_destroy_me(ad->ug); -} -#endif - - -static void -setting_locktype_main_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - setting_retm_if(data == NULL, "Data parameter is NULL"); - - retm_if(event_info == NULL, "Invalid argument: event info is NULL"); - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - elm_genlist_item_selected_set(item, 0); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) elm_object_item_data_get(item); - SettingLocktypeUG *ad = (SettingLocktypeUG *) data; - setting_retm_if(NULL == list_item, "list_item is NULL"); - - int lock_type = list_item->chk_status; - SETTING_TRACE("clicking item[%s - %d] ", _(list_item->keyStr), lock_type); - - int old_type; - vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &old_type); - - ad->selected_lock_type = list_item->keyStr; - -#if 0 - /* If lock_type is same with old_lock_type, return. */ - if (lock_type == old_type) { - SETTING_TRACE_DEBUG("[Screen Lock Type] Selected same type"); - return; - } -#endif - int index = -1; - char *pkg_name = NULL; - - switch (lock_type) { - case SETTING_SCREEN_LOCK_TYPE_NONE: - case SETTING_SCREEN_LOCK_TYPE_SWIPE: - /* To do : Call security-server API. pw : 0000 */ - if (old_type == SETTING_SCREEN_LOCK_TYPE_PASSWORD - || old_type == SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD) { -#if SECURITY_SERVER - int result = security_server_set_pwd(ad->input_pwd, "0000", 0, 0); - SETTING_TRACE_DEBUG("set_pwd result : %d", result); -#endif - -#if 0 - uid_t user = 5000; - int ckmc_ret = CKMC_ERROR_NONE; - ckmc_ret = ckmc_change_user_password(user, ad->input_pwd, NULL); - SETTING_TRACE("ckmc_change_user_password() returns %d", ckmc_ret); -#endif - } - if (vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, lock_type) == 0) { - /* set radio */ - elm_radio_value_set(list_item->eo_check, lock_type); - } - /*SETTING_TRACE_DEBUG("PASS #1"); */ - ug_destroy_me(ad->ug); - break; -#if 0 - case SETTING_SCREEN_LOCK_TYPE_MOTION: - ad->old_type = old_type; - setting_create_guild_layout(ad->navi_bar, - _(About_Motion_Unlock_Str), - _("IDS_ST_BUTTON_CANCEL_ABB"), _(SET_AS_LOCK_STR), NULL, - __motion_cancel_cb, __motion_set_cb, NULL, - _("IDS_LCKSCN_BODY_TAP_AND_HOLD_THE_SCREEN_THEN_TILT_THE_DEVICE_TOWARDS_YOU_TO_UNLOCK_IT_MSG"), - (char **)motion_img, - NULL, - NULL, - NULL, ad); - break; -#endif - case SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD: - if(SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD == old_type){ - __change_simple_password_cb(list_item,NULL,NULL); - } else { - ad->pw_type = SETTING_LOCKTYPE_PW_SIMPLE_PASSWD; - if(old_type != SETTING_SCREEN_LOCK_TYPE_PASSWORD) - { - FREE(ad->input_pwd); - ad->input_pwd = (char*)strdup("0000"); - } - setting_locktype_create_password_sg(ad); - } - break; - case SETTING_SCREEN_LOCK_TYPE_PASSWORD: - if(SETTING_SCREEN_LOCK_TYPE_PASSWORD == old_type){ - __change_password_cb(list_item,NULL,NULL); - }else{ - ad->pw_type = SETTING_LOCKTYPE_PW_PASSWORD; - if(old_type != SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD) - { - FREE(ad->input_pwd); - ad->input_pwd = (char*)strdup("0000"); - } - setting_locktype_create_password_sg(ad); - } - break; - case SETTING_SCREEN_LOCK_TYPE_OTHER: - if (old_type == SETTING_SCREEN_LOCK_TYPE_PASSWORD - || old_type == SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD) { -#if SECURITY_SERVER - int result = security_server_set_pwd(ad->input_pwd, "0000", 0, 0); - SETTING_TRACE_DEBUG("set_pwd result : %d", result); -#endif -#if 0 - uid_t user = 5000; - int ckmc_ret = CKMC_ERROR_NONE; - ckmc_ret = ckmc_change_user_password(user, ad->input_pwd, NULL); - SETTING_TRACE("ckmc_change_user_password() returns %d", ckmc_ret); -#endif - } - index = __get_lockapp_index_from_appname(list_item->keyStr); - pkg_name = __get_lockapp_pkgname_from_appname(list_item->keyStr); - SETTING_TRACE_DEBUG("3rd lock selected. index[%d] pkg_name[%s]", index, pkg_name); - vconf_set_str(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, pkg_name); - vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, lock_type); - /* set radio */ - elm_radio_value_set(list_item->eo_check, lock_type + index); - ug_destroy_me(ad->ug); - break; - default: - break; - } -} - -#if 0 -static void -setting_locktype_main_click_radio_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(data == NULL, "Data parameter is NULL"); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) data; - SettingLocktypeUG *ad = list_item->userdata; - - int lock_type = elm_radio_value_get(obj); - int old_type = 0; - - vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &old_type); - - if (old_type == lock_type) - return; - - switch (lock_type) { - case SETTING_SCREEN_LOCK_TYPE_NONE: - case SETTING_SCREEN_LOCK_TYPE_SWIPE: - /* To do : Call security-server API. pw : 0000 */ - if (old_type == SETTING_SCREEN_LOCK_TYPE_PASSWORD - || old_type == SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD) { -#if SECURITY_SERVER - int result = security_server_set_pwd(ad->input_pwd, "0000", 0, 0); - SETTING_TRACE_DEBUG("set_pwd result : %d", result); -#endif -#if 0 - uid_t user = 5000; - int ckmc_ret = CKMC_ERROR_NONE; - ckmc_ret = ckmc_change_user_password(user, ad->input_pwd, NULL); - SETTING_TRACE("ckmc_change_user_password() returns %d", ckmc_ret); -#endif - } - vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, lock_type); - ug_destroy_me(ad->ug); - break; -#if 0 - case SETTING_SCREEN_LOCK_TYPE_MOTION: - ad->old_type = old_type; - elm_radio_value_set(obj, old_type); - setting_create_guild_layout(ad->navi_bar, - _(About_Motion_Unlock_Str), - _("IDS_ST_BUTTON_CANCEL_ABB"), _(SET_AS_LOCK_STR), NULL, - __motion_cancel_cb, __motion_set_cb, NULL, - _("IDS_LCKSCN_BODY_TAP_AND_HOLD_THE_SCREEN_THEN_TILT_THE_DEVICE_TOWARDS_YOU_TO_UNLOCK_IT_MSG"), - (char **)motion_img, - NULL, - NULL, - NULL, ad); - break; -#endif - case SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD: - elm_radio_value_set(obj, old_type); - ad->pw_type = SETTING_SEC_PW_SIMPLE_PASSWD; - if (old_type != SETTING_SCREEN_LOCK_TYPE_PASSWORD) { - FREE(ad->input_pwd); - ad->input_pwd = (char *)strdup("0000"); - } - setting_locktype_create_password_sg(ad); - break; - case SETTING_SCREEN_LOCK_TYPE_PASSWORD: - elm_radio_value_set(obj, old_type); - ad->pw_type = SETTING_SEC_PW_PASSWORD; - if (old_type != SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD) { - FREE(ad->input_pwd); - ad->input_pwd = (char *)strdup("0000"); - } - setting_locktype_create_password_sg(ad); - break; - case SETTING_SCREEN_LOCK_TYPE_OTHER: { - int index = -1; - char *pkg_name = NULL; - if (old_type == SETTING_SCREEN_LOCK_TYPE_PASSWORD - || old_type == SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD) { -#if SECURITY_SERVER - int result = security_server_set_pwd(ad->input_pwd, "0000", 0, 0); - SETTING_TRACE_DEBUG("set_pwd result : %d", result); -#endif -#if 0 - uid_t user = 5000; - int ckmc_ret = CKMC_ERROR_NONE; - ckmc_ret = ckmc_change_user_password(user, ad->input_pwd, NULL); - SETTING_TRACE("ckmc_change_user_password() returns %d", ckmc_ret); -#endif - } - index = __get_lockapp_index_from_appname(list_item->keyStr); - pkg_name = __get_lockapp_pkgname_from_appname(list_item->keyStr); - SETTING_TRACE_DEBUG("3rd lock selected. index[%d] pkg_name[%s]", index, pkg_name); - vconf_set_str(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, pkg_name); - vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, lock_type); - /* set radio */ - elm_radio_value_set(list_item->eo_check, lock_type + index); - ug_destroy_me(ad->ug); - } - break; - default: - break; - } -} -#endif - -Eina_Bool setting_locktype_main_click_softkey_back_cb(void *data, Elm_Object_Item *it) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retvm_if(data == NULL, EINA_FALSE, "[Setting > Security] Data parameter is NULL"); - - SettingLocktypeUG *ad = (SettingLocktypeUG *) data; - if (ad->ug_passwd) { - return EINA_FALSE; - } - /* Send destroy request */ - ug_destroy_me(ad->ug); - SETTING_TRACE_END; - return EINA_TRUE; -} diff --git a/setting-locktype/src/setting-locktype.c b/setting-locktype/src/setting-locktype.c deleted file mode 100644 index 2c6066c..0000000 --- a/setting-locktype/src/setting-locktype.c +++ /dev/null @@ -1,465 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/** - *@defgroup setting-security - *UG creation code for setting-security - */ - -#include -#include - -#define Max_Passwd_View_Type_Len 64 -#ifndef UG_MODULE_API -#define UG_MODULE_API __attribute__ ((visibility("default"))) -#endif - -void setting_locktype_ug_popup_resp_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - - SettingLocktypeUG *ad = (SettingLocktypeUG *)data; - if (ad->save_popup) { - evas_object_del(ad->save_popup); - ad->save_popup = NULL; - } - ug_destroy_me(ad->ug); -} - -int pwd_handler_do_nothing(SettingLocktypeUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - /*SettingLocktypeUG *ad = (SettingLocktypeUG *)data; */ - /* DO NOTHING */ - return 0; -} - -int pwd_handler_sec_pw_passwd(SettingLocktypeUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - SettingLocktypeUG *ad = (SettingLocktypeUG *)data; - - if (vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_PASSWORD) == 0) { - /* set radio */ - if (ad->lock_type_rd) - elm_radio_value_set(ad->lock_type_rd, SETTING_SCREEN_LOCK_TYPE_PASSWORD); - - ad->save_popup = setting_create_popup(ad, ad->win_get, NULL, "IDS_ST_POP_NEW_PASSWD_SAVED", - setting_locktype_ug_popup_resp_cb, - POPUP_INTERVAL, FALSE, FALSE, 0); - } else { - SETTING_TRACE_ERROR("setting vconf value failed : screen_lock_type"); - } - - return 0; -} - -int pwd_handler_sec_pw_simple_passwd(SettingLocktypeUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - SettingLocktypeUG *ad = (SettingLocktypeUG *)data; - - SETTING_TRACE("ad->selected_lock_type:%s", ad->selected_lock_type); - /*'face and voice ' and 'simple password' share the same PASSWD_TYPE and callback function */ - int lock_type = SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD; - if (vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, lock_type) == 0) { - /* set radio */ - if (ad->lock_type_rd) - elm_radio_value_set(ad->lock_type_rd, lock_type); - - ad->save_popup = setting_create_popup(ad, ad->win_get, NULL, "IDS_ST_POP_NEW_PASSWD_SAVED", - setting_locktype_ug_popup_resp_cb, - POPUP_INTERVAL, FALSE, FALSE, 0); - } else { - SETTING_TRACE_ERROR("setting vconf value failed : screen_lock_type"); - } - return 0; -} - -static struct _locktype_item locktype_table[] = { - { SETTING_LOCKTYPE_PW_PASSWORD, "SETTING_PW_TYPE_SET_PASSWORD", pwd_handler_sec_pw_passwd }, - { SETTING_LOCKTYPE_PW_SIMPLE_PASSWD, "SETTING_PW_TYPE_SET_SIMPLE_PASSWORD", pwd_handler_sec_pw_simple_passwd }, - { SETTING_LOCKTYPE_PW_CHANGE_PASSWD, "SETTING_PW_TYPE_SET_PASSWORD", pwd_handler_sec_pw_passwd }, - { SETTING_LOCKTYPE_PW_CHANGE_SIMPLE_PASSWD, "SETTING_PW_TYPE_SET_SIMPLE_PASSWORD", pwd_handler_sec_pw_simple_passwd }, - /*------------------------------------------------------------------------------------------------------------*/ - { SETTING_LOCKTYPE_PW_MAX, NULL, pwd_handler_do_nothing} -}; - -static void setting_locktype_ug_cb_resize(void *data, Evas *e, - Evas_Object *obj, void *event_info) -{ - ret_if(data == NULL); - - SettingLocktypeUG *ad = (SettingLocktypeUG *) data; /* ad is point to data */ - setting_view_update(&setting_view_locktype_main, ad); -} - -static void *setting_locktype_ug_on_create(ui_gadget_h ug, - enum ug_mode mode, app_control_h service, - void *priv) -{ - setting_retvm_if((!priv), NULL, "!priv"); - - SettingLocktypeUG *locktypeUG = priv; - locktypeUG->ug = ug; - - locktypeUG->win_main_layout = (Evas_Object *) ug_get_parent_layout(ug); - locktypeUG->win_get = (Evas_Object *) ug_get_window(); - evas_object_show(locktypeUG->win_main_layout); - locktypeUG->evas = evas_object_evas_get(locktypeUG->win_main_layout); - - setting_retvm_if(locktypeUG->win_main_layout == NULL, NULL, - "[Setting >> About] cannot get main window "); - - /*setting_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR); */ - bindtextdomain(SETTING_PACKAGE, SETTING_LOCALEDIR); - - /* register view node table */ - setting_view_node_table_intialize(); - setting_view_node_table_register(&setting_view_locktype_main, NULL); - - setting_create_Gendial_itc("dialogue/1text", &(locktypeUG->itc_1text)); - setting_create_Gendial_itc("multiline/1text", &(locktypeUG->itc_bg_1icon)); - setting_create_Gendial_itc("dialogue/2text.3", &(locktypeUG->itc_2text_2)); - setting_create_Gendial_itc("dialogue/1text.1icon", &(locktypeUG->itc_1text_1icon)); - setting_create_Gendial_itc("dialogue/title", &(locktypeUG->itc_group_item)); - setting_create_Gendial_itc("dialogue/2text.3/expandable", &(locktypeUG->itc_2text_3_parent)); - - - locktypeUG->input_pwd = NULL; - locktypeUG->notify = NULL; - - app_control_get_extra_data(service, "current", &(locktypeUG->input_pwd)); - app_control_get_extra_data(service, "caller", &(locktypeUG->caller)); - if (locktypeUG->caller && !safeStrCmp(locktypeUG->caller, "encryption")) { - locktypeUG->viewtype = SETTING_LOCKTYPE_VIEWTYPE_ENCRYPTION; - } else if (locktypeUG->caller && !safeStrCmp(locktypeUG->caller, "lockscreen")) { - locktypeUG->viewtype = SETTING_LOCKTYPE_VIEWTYPE_RECOVERY; - vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE); -#if SECURITY_SERVER - int result = security_server_reset_pwd("0000", 0, 0); - SETTING_TRACE_DEBUG("reset_pwd result : %d", result); -#endif - } else { - locktypeUG->viewtype = SETTING_LOCKTYPE_VIEWTYPE_MAIN; - } - FREE(locktypeUG->caller); - - setting_view_node_set_cur_view(&setting_view_locktype_main); - setting_view_create(&setting_view_locktype_main, (void *)locktypeUG); - evas_object_event_callback_add(locktypeUG->win_main_layout, - EVAS_CALLBACK_RESIZE, - setting_locktype_ug_cb_resize, locktypeUG); - - return locktypeUG->ly_main; -} - -static void setting_locktype_ug_on_start(ui_gadget_h ug, app_control_h service, - void *priv) -{ -} - -static void setting_locktype_ug_on_pause(ui_gadget_h ug, app_control_h service, - void *priv) -{ -} - -static void setting_locktype_ug_on_resume(ui_gadget_h ug, app_control_h service, - void *priv) -{ -} - -static void setting_locktype_ug_on_destroy(ui_gadget_h ug, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - setting_retm_if((!priv), "!priv"); - SettingLocktypeUG *locktypeUG = priv; - locktypeUG->ug = ug; - - evas_object_event_callback_del(locktypeUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_locktype_ug_cb_resize); /* fix flash issue for gallery */ - - if (locktypeUG->save_popup) { - evas_object_del(locktypeUG->save_popup); - locktypeUG->save_popup = NULL; - } - - setting_view_destroy(&setting_view_locktype_main, locktypeUG); - - FREE(locktypeUG->input_pwd); - - if (NULL != ug_get_layout(locktypeUG->ug)) { - evas_object_hide((Evas_Object *) ug_get_layout(locktypeUG->ug)); - evas_object_del((Evas_Object *) ug_get_layout(locktypeUG->ug)); - } - - SETTING_TRACE_END; -} - -static void setting_locktype_ug_on_message(ui_gadget_h ug, app_control_h msg, - app_control_h service, void *priv) -{ - -} - -static void setting_locktype_ug_on_event(ui_gadget_h ug, - enum ug_event event, app_control_h service, - void *priv) -{ - switch (event) { - case UG_EVENT_LOW_MEMORY: - break; - case UG_EVENT_LOW_BATTERY: - break; - case UG_EVENT_LANG_CHANGE: - break; - case UG_EVENT_ROTATE_PORTRAIT: - break; - case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN: - break; - case UG_EVENT_ROTATE_LANDSCAPE: - break; - case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN: - break; - case UG_EVENT_REGION_CHANGE: - break; - default: - break; - } -} - -static void setting_locktype_ug_on_key_event(ui_gadget_h ug, - enum ug_key_event event, - app_control_h service, void *priv) -{ - if (!priv) - return; - SettingLocktypeUG *ad = (SettingLocktypeUG *) priv; /* ad is point to priv */ - switch (event) { - case UG_KEY_EVENT_END: { - if (elm_naviframe_top_item_get(ad->navi_bar) == - elm_naviframe_bottom_item_get(ad->navi_bar)) { - ug_destroy_me(ug); - } else { - /* elm_naviframe_item_pop(ad->navi_bar); */ - setting_view_cb_at_endKey(ad); - } - } - break; - - default: - break; - } -} - -UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops) -{ - SettingLocktypeUG *locktypeUG = calloc(1, sizeof(SettingLocktypeUG)); - setting_retvm_if(!locktypeUG, -1, - "Create SettingLocktypeUG obj failed"); - - memset(locktypeUG, 0x00, sizeof(SettingLocktypeUG)); - - ops->create = setting_locktype_ug_on_create; - ops->start = setting_locktype_ug_on_start; - ops->pause = setting_locktype_ug_on_pause; - ops->resume = setting_locktype_ug_on_resume; - ops->destroy = setting_locktype_ug_on_destroy; - ops->message = setting_locktype_ug_on_message; - ops->event = setting_locktype_ug_on_event; - ops->key_event = setting_locktype_ug_on_key_event; - ops->priv = locktypeUG; - ops->opt = UG_OPT_INDICATOR_ENABLE; - - return 0; -} - -UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops) -{ - struct SettingLocktypeUG *locktypeUG; - setting_retm_if(!ops, "ops == NULL"); - - locktypeUG = ops->priv; - if (locktypeUG) - FREE(locktypeUG); -} - -/* *************************************************** - * - *general func - * - ***************************************************/ - -void setting_locktype_layout_passwd_ug_cb(ui_gadget_h ug, - enum ug_mode mode, void *priv) -{ - if (!priv) - return; - - Evas_Object *base = ug_get_layout(ug); - if (!base) - return; - - switch (mode) { - case UG_MODE_FULLVIEW: - evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - evas_object_show(base); - break; - default: - break; - } - - return; -} - -void setting_locktype_destroy_password_ug_cb(ui_gadget_h ug, - void *priv) -{ - SETTING_TRACE_BEGIN; - ret_if(priv == NULL); - SettingLocktypeUG *ad = (SettingLocktypeUG *) priv; - - if (ad->ly_main) - elm_object_tree_focus_allow_set(ad->ly_main, EINA_TRUE); - if (ug) { - ug_destroy(ug); - } -} - -void setting_locktype_end_password_ug_cb(ui_gadget_h ug, - void *priv) -{ - SETTING_TRACE_BEGIN; - ret_if(priv == NULL); - SettingLocktypeUG *ad = (SettingLocktypeUG *) priv; - ad->ug_passwd = NULL; -} - -gboolean setting_locktype_create_password_sg(void *data) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(data == NULL, FALSE); - - SettingLocktypeUG *ad = (SettingLocktypeUG *) data; /* ad is point to data */ - - /* prevent the ug from being loaded again due to window event queuing */ - /* added by JTS: CQ H0100135346 */ - if (ad->ug_passwd) { - SETTING_TRACE("Password UG is already loaded."); - return FALSE; - } - - if ((ad->pw_type < 0) || (ad->pw_type > SETTING_LOCKTYPE_PW_MAX)) - return FALSE; - - char str[Max_Passwd_View_Type_Len + 1] = { 0, }; - safeCopyStr(str, locktype_table[ad->pw_type].pw_type_string, Max_Passwd_View_Type_Len); - - struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs)); - - if (!cbs) - return FALSE; - cbs->layout_cb = setting_locktype_layout_passwd_ug_cb; - cbs->result_cb = setting_locktype_result_password_ug_cb; - cbs->destroy_cb = setting_locktype_destroy_password_ug_cb; - cbs->end_cb = setting_locktype_end_password_ug_cb; - cbs->priv = (void *)ad; - - app_control_h svc; - if (app_control_create(&svc)) { - FREE(cbs); - return FALSE; - } - - app_control_add_extra_data(svc, "viewtype", str); - if (ad->viewtype == SETTING_LOCKTYPE_VIEWTYPE_ENCRYPTION) - app_control_add_extra_data(svc, "encryption", "TRUE"); - - if (ad->input_pwd) - app_control_add_extra_data(svc, "current", ad->input_pwd); - - elm_object_tree_focus_allow_set(ad->ly_main, EINA_FALSE); - ad->ug_passwd = setting_ug_create(ad->ug, "setting-password-efl", UG_MODE_FULLVIEW, svc, cbs); - if (NULL == ad->ug_passwd) { /* error handling */ - evas_object_show(ad->ly_main); - } - - app_control_destroy(svc); - FREE(cbs); - - return TRUE; -} - -/* *************************************************** - * - *call back func - * - ***************************************************/ -/* -1 on fail */ -/* 0~n on success */ -int _get_locktype_table_index(char *name) -{ - int i = 0; - - for (i = 0; i < SETTING_LOCKTYPE_PW_MAX; i++) { - if (0 == safeStrCmp(name, locktype_table[i].pw_type_string)) - return i; - } - return -1; -} - -void -setting_locktype_result_password_ug_cb(ui_gadget_h ug, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(priv == NULL, "Data paremeter is NULL"); - - SettingLocktypeUG *ad = (SettingLocktypeUG *) priv; /* ad is point to priv */ - - char *result = NULL; - - app_control_get_extra_data(service, "result", &result); - - /* divided pw view type */ - SETTING_TRACE("ad->pw_type: %d result :%s", ad->pw_type, result); - ret_if(NULL == result); - - if (safeStrCmp(result, "Cancel")) { - int index = _get_locktype_table_index(result); - - if (index != -1) { - locktype_table[index].passwd_handler(ad, NULL); - ad->pw_type = locktype_table[index].pw_type_num; - } else { - SETTING_TRACE_ERROR("no table entry"); - } - } - - evas_object_show(ad->ly_main); - FREE(result); - SETTING_TRACE_END; -} - diff --git a/setting-moreconnections/CMakeLists.txt b/setting-moreconnections/CMakeLists.txt deleted file mode 100644 index 677b895..0000000 --- a/setting-moreconnections/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${SETTING_COMMON}/include) - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs_moreconnections REQUIRED - elementary - ecore - edje - evas - appcore-common - appcore-efl - ui-gadget-1 - capi-appfw-application - dlog - capi-system-device - deviced - efl-extension - #capi-location-manager - json-glib-1.0 - libtzplatform-config) - -FOREACH(flag ${pkgs_moreconnections_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Werror-implicit-function-declaration") -SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") -IF("${ARCH}" STREQUAL "arm") - ADD_DEFINITIONS("-DTARGET") - MESSAGE("add -DTARGET") -ENDIF("${ARCH}" STREQUAL "arm") - -ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") -ADD_DEFINITIONS("-DSLP_DEBUG") -ADD_DEFINITIONS("-shared") - -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib") - -ADD_LIBRARY(${SETTING_MORECONNECTIONS_UG} SHARED - ./src/setting-moreconnections.c - ./src/setting-moreconnections-main.c - ) - -TARGET_LINK_LIBRARIES(${SETTING_MORECONNECTIONS_UG} -L${CMAKE_BINARY_DIR}/${SETTING_COMMON} -lsetting-common) -TARGET_LINK_LIBRARIES(${SETTING_MORECONNECTIONS_UG} ${pkgs_moreconnections_LDFLAGS}) - -INSTALL(TARGETS ${SETTING_MORECONNECTIONS_UG} DESTINATION ${PREFIX}/lib/ug) diff --git a/setting-moreconnections/include/setting-moreconnections-main.h b/setting-moreconnections/include/setting-moreconnections-main.h deleted file mode 100644 index b26484b..0000000 --- a/setting-moreconnections/include/setting-moreconnections-main.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_MORECONNECTIONS_MAIN_H__ -#define __SETTING_MORECONNECTIONS_MAIN_H__ - -#include - -static void setting_moreconnections_main_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj, void *event_info); -static Eina_Bool setting_moreconnections_main_click_softkey_back_cb(void *data, Evas_Object *obj, void *event_info); - -#endif /* __SETTING_MORECONNECTIONS_MAIN_H__ */ diff --git a/setting-moreconnections/include/setting-moreconnections.h b/setting-moreconnections/include/setting-moreconnections.h deleted file mode 100644 index c5611a1..0000000 --- a/setting-moreconnections/include/setting-moreconnections.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_MORECONNECTIONS_H__ -#define __SETTING_MORECONNECTIONS_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -//#include - -#define KeyStr_On "IDS_ST_BODY_ON" -#define KeyStr_Off "IDS_ST_BODY_ALERTTYPE_OFF" -#define KeyStr_LocationService "IDS_LBS_BODY_LOCATION_SERVICE" -#define KeyStr_VPN "IDS_ST_BODY_VPN" - -typedef struct _SettingMoreConnectionsUG SettingMoreConnectionsUG; - -/** - * Setting MoreConnections UG context - * all UG function has void* as an agument. this is casted back to SettingMoreConnectionsUG - * and the functions access app context. - */ -struct _SettingMoreConnectionsUG { - ui_gadget_h ug; - - /* add more variables here (move your appdata to here) */ - Evas *evas; - Evas_Object *win_main_layout; - Evas_Object *win_get; - - Evas_Object *ly_main; - - /* for navigation effect */ - Evas_Object *navi_bar; - Elm_Object_Item *navi_item; - - /* genlist */ - Evas_Object *genlist; - Setting_GenGroupItem_Data *location_service; - Setting_GenGroupItem_Data *VPN; - - /* item class */ - Elm_Genlist_Item_Class itc_2text_2; - Elm_Genlist_Item_Class itc_1text; - - bool empty_flag; - -}; - -extern setting_view setting_view_moreconnections_main; -char *setting_location_is_enable(void *data); -void setting_moreconnections_layout_ug_cb(ui_gadget_h ug, enum ug_mode mode, void *priv); - -#endif /* __SETTING_MORECONNECTIONS_H__ */ diff --git a/setting-moreconnections/src/setting-moreconnections-main.c b/setting-moreconnections/src/setting-moreconnections-main.c deleted file mode 100644 index 7c037b3..0000000 --- a/setting-moreconnections/src/setting-moreconnections-main.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "setting-moreconnections-main.h" - -static int setting_moreconnections_main_create(void *cb); -static int setting_moreconnections_main_destroy(void *cb); -static int setting_moreconnections_main_update(void *cb); -static int setting_moreconnections_main_cleanup(void *cb); - -setting_view setting_view_moreconnections_main = { - .create = setting_moreconnections_main_create, - .destroy = setting_moreconnections_main_destroy, - .update = setting_moreconnections_main_update, - .cleanup = setting_moreconnections_main_cleanup, -}; - -/************************************************ - * @brief Do process when clicking '<-' button - * - * @param data application context - * @param obj evas object - * @param event_info event type - ************************************************/ -static Eina_Bool -setting_moreconnections_main_click_softkey_back_cb(void *data, Evas_Object *obj, - void *event_info) -{ - setting_retvm_if(data == NULL, EINA_FALSE, "Data parameter is NULL"); - SettingMoreConnectionsUG *ad = (SettingMoreConnectionsUG *) data; - if (ad->empty_flag) { - return EINA_FALSE; - } - /* Send destroy request */ - ug_destroy_me(ad->ug); - SETTING_TRACE_END; - return EINA_FALSE; -} - -static void setting_moreconnections_main_mouse_up_Gendial_list_cb(void *data, - Evas_Object *obj, void *event_info) -{ - setting_retm_if(NULL == data, "data is NULL"); - setting_retm_if(NULL == event_info, "event_info is NULL"); - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - elm_genlist_item_selected_set(item, 0); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) elm_object_item_data_get(item); - - //SettingMoreConnectionsUG *ad = (SettingMoreConnectionsUG *)data; - - SETTING_TRACE("clicking item[%s]", _(list_item->keyStr)); - - if (!safeStrCmp(KeyStr_LocationService, list_item->keyStr)) { - app_launcher("org.tizen.setting-location"); - } -} - -/** - * @brief aboutUG vconf changed callback - * - * @param key the changed vconf key node. - * @param data application data - * @param event_info event type - */ -static void __setting_moreconnections_main_vconf_changed_cb(keynode_t *key, void *data) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(NULL == key, "key is NULL"); - setting_retm_if(NULL == data, "data is NULL"); - SettingMoreConnectionsUG *ad = (SettingMoreConnectionsUG *) data; - - int status = vconf_keynode_get_int(key); - char *vconf_name = vconf_keynode_get_name(key); - - if (!safeStrCmp(vconf_name, VCONFKEY_LOCATION_USE_MY_LOCATION)) { - SETTING_TRACE("status: %d", status); - char *sub_desc = setting_location_is_enable(data); - ad->location_service->sub_desc = (char *)strdup(sub_desc); - elm_object_item_data_set(ad->location_service->item, ad->location_service); - elm_genlist_item_update(ad->location_service->item); - } else { - SETTING_TRACE_ERROR("vconf_name is error"); - } -} - -char *setting_location_is_enable(void *data) -{ - SETTING_TRACE_BEGIN; - -#if 0 - bool is_enabled = FALSE; - int ret = location_manager_is_enabled_method(LOCATIONS_METHOD_HYBRID, &is_enabled); - SETTING_TRACE("hybrid: %d, ", is_enabled); - - if (true == is_enabled) - return KeyStr_On; - else if (false == is_enabled) - return KeyStr_Off; - else - return SETTING_VCONF_ERR_RETURN_STR_NULL; -#else - int is_enabled = -1; - if (0 != vconf_get_int(VCONFKEY_LOCATION_USE_MY_LOCATION, &is_enabled)) - SETTING_TRACE_ERROR("Fail to get vconf"); - - if (1 == is_enabled) - return KeyStr_On; - else if (0 == is_enabled) - return KeyStr_Off; - else - return KeyStr_Off; // @todo : need to check and modify - old return was KeyStr_OffSETTING_VCONF_ERR_RETURN_STR_NULL -#endif -} - -/************************************************** - * @brief create main view genlist items - * @param data application data - * @return FALSE for call it once and then destory the timer, TRUE for always call it when the timer is reached. - **************************************************/ -int setting_moreconnections_main_generate_genlist(void *data) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - SettingMoreConnectionsUG *ad = (SettingMoreConnectionsUG *) data; - - Evas_Object *scroller = ad->genlist; - - char *sub_desc = setting_location_is_enable(data); - - ad->location_service = setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2), - setting_moreconnections_main_mouse_up_Gendial_list_cb, - ad, SWALLOW_Type_INVALID, - NULL, NULL, 0, - KeyStr_LocationService, sub_desc, NULL); - if (ad->location_service) { - ad->location_service->sub_desc = (char *)strdup(sub_desc); - ad->location_service->userdata = ad; - } else { - SETTING_TRACE_ERROR("ad->location_service is NULL"); - } - -#if 0 - /* VPN */ - ad->VPN = setting_create_Gendial_field_def(scroller, &(ad->itc_1text), - setting_moreconnections_main_mouse_up_Gendial_list_cb, - ad, SWALLOW_Type_INVALID, - NULL, NULL, 0, - KeyStr_VPN, NULL, NULL); - if (ad->VPN) { - ad->VPN->userdata = ad; - } else { - SETTING_TRACE_ERROR("ad->VPN is NULL"); - } -#endif - - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -/*************************************************** - * - * basic func - * - ***************************************************/ -static int setting_moreconnections_main_create(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - SettingMoreConnectionsUG *ad = (SettingMoreConnectionsUG *) cb; - Evas_Object *scroller = elm_genlist_add(ad->win_main_layout); - setting_retvm_if(NULL == scroller, SETTING_DRAW_ERR_FAIL_SCROLLER, - "Scroller is NULL"); - elm_object_style_set(scroller, "dialogue"); - elm_genlist_clear(scroller); - - ad->genlist = scroller; - ad->ly_main = - setting_create_layout_navi_bar_genlist(ad->win_main_layout, - ad->win_get, - KeyStr_MoreConnectionSetting, - NULL,/* Arrow Back button */ - NULL, - (setting_call_back_func)setting_moreconnections_main_click_softkey_back_cb, - NULL, ad, &scroller, - &(ad->navi_bar)); - ad->genlist = scroller; - - setting_moreconnections_main_generate_genlist((void *)ad); - - int ret = vconf_notify_key_changed(VCONFKEY_LOCATION_USE_MY_LOCATION, __setting_moreconnections_main_vconf_changed_cb, ad); - if (ret != 0) { - SETTING_TRACE_ERROR(" >>>>>>>>>>>>>> call vconf_notify_key_changed failed"); - } else { - SETTING_TRACE_ERROR(" >>>>>>>>>>>>>> call vconf_notify_key_changed succeeded"); - } - - setting_view_moreconnections_main.is_create = 1; - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -static int setting_moreconnections_main_destroy(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - retv_if(!(setting_view_moreconnections_main.is_create), SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingMoreConnectionsUG *ad = (SettingMoreConnectionsUG *) cb; - - int ret = vconf_ignore_key_changed(VCONFKEY_LOCATION_USE_MY_LOCATION, __setting_moreconnections_main_vconf_changed_cb); - if (ret != 0) { - SETTING_TRACE_ERROR(" >>>>>>>>>>>>>> call vconf_ignore_key_changed failed"); - } else { - SETTING_TRACE_ERROR(" >>>>>>>>>>>>>> call vconf_ignore_key_changed succeeded"); - } - - if (ad->ly_main != NULL) { - evas_object_del(ad->ly_main); - ad->ly_main = NULL; - } - - - setting_view_moreconnections_main.is_create = 0; - - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -static int setting_moreconnections_main_update(void *cb) -{ - SETTING_TRACE_BEGIN; - return SETTING_RETURN_SUCCESS; -} - -static int setting_moreconnections_main_cleanup(void *cb) -{ - SETTING_TRACE_BEGIN; - return SETTING_RETURN_SUCCESS; -} diff --git a/setting-moreconnections/src/setting-moreconnections.c b/setting-moreconnections/src/setting-moreconnections.c deleted file mode 100644 index 760a7d4..0000000 --- a/setting-moreconnections/src/setting-moreconnections.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "setting-moreconnections.h" - -#ifndef UG_MODULE_API -#define UG_MODULE_API __attribute__ ((visibility("default"))) -#endif - -static void *setting_moreconnections_ug_on_create(ui_gadget_h ug, - enum ug_mode mode, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - setting_retvm_if((!priv), NULL, "!priv"); - - SettingMoreConnectionsUG *moreconnectionsUG = priv; - moreconnectionsUG->ug = ug; - moreconnectionsUG->win_main_layout = (Evas_Object *) ug_get_parent_layout(ug); - moreconnectionsUG->win_get = (Evas_Object *) ug_get_window(); - - moreconnectionsUG->evas = evas_object_evas_get(moreconnectionsUG->win_main_layout); - - setting_retvm_if(moreconnectionsUG->win_main_layout == NULL, NULL, - "cannot get main window "); - setting_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR); - - /* register view node table */ - setting_view_node_table_intialize(); - setting_view_node_table_register(&setting_view_moreconnections_main, NULL); - - /* creating a view. */ - setting_create_Gendial_itc(SETTING_GENLIST_2LINE_STYLE, &(moreconnectionsUG->itc_2text_2)); - setting_create_Gendial_itc(SETTING_GENLIST_ICON_1LINE_STYLE, &(moreconnectionsUG->itc_1text)); - - setting_view_node_set_cur_view(&setting_view_moreconnections_main); - setting_view_create(&setting_view_moreconnections_main, (void *)moreconnectionsUG); - - return moreconnectionsUG->ly_main; -} - -static void setting_moreconnections_ug_on_start(ui_gadget_h ug, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE_END; -} - -static void setting_moreconnections_ug_on_pause(ui_gadget_h ug, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE_END; -} - -static void setting_moreconnections_ug_on_resume(ui_gadget_h ug, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - setting_retm_if((!priv), "!priv"); - - SettingMoreConnectionsUG *moreconnectionsUG = priv; - setting_view_create(&setting_view_moreconnections_main, (void *)moreconnectionsUG); - - if (moreconnectionsUG->location_service) { - char *sub_desc = setting_location_is_enable(priv); - moreconnectionsUG->location_service->sub_desc = (char *)strdup(sub_desc); - elm_object_item_data_set(moreconnectionsUG->location_service->item, moreconnectionsUG->location_service); - elm_genlist_item_update(moreconnectionsUG->location_service->item); - } - - SETTING_TRACE_END; -} - -static void setting_moreconnections_ug_on_destroy(ui_gadget_h ug, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - SettingMoreConnectionsUG *moreconnectionsUG = priv; - - - /* called when this shared gadget is terminated. similar with app_exit */ - setting_view_destroy(&setting_view_moreconnections_main, moreconnectionsUG); - - SETTING_TRACE_END; -} - -static void setting_moreconnections_ug_on_message(ui_gadget_h ug, app_control_h msg, - app_control_h service, void *priv) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE_END; -} - -static void setting_moreconnections_ug_on_event(ui_gadget_h ug, - enum ug_event event, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE_END; -} - -static void setting_moreconnections_ug_on_key_event(ui_gadget_h ug, - enum ug_key_event event, - app_control_h service, void *priv) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE_END; -} - -UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops) -{ - SETTING_TRACE_BEGIN; - SettingMoreConnectionsUG *moreconnectionsUG = calloc(1, sizeof(SettingMoreConnectionsUG)); - setting_retvm_if(!moreconnectionsUG, -1, "Create SettingMoreConnectionsUG obj failed"); - - memset(moreconnectionsUG, 0x00, sizeof(SettingMoreConnectionsUG)); - - ops->create = setting_moreconnections_ug_on_create; - ops->start = setting_moreconnections_ug_on_start; - ops->pause = setting_moreconnections_ug_on_pause; - ops->resume = setting_moreconnections_ug_on_resume; - ops->destroy = setting_moreconnections_ug_on_destroy; - ops->message = setting_moreconnections_ug_on_message; - ops->event = setting_moreconnections_ug_on_event; - ops->key_event = setting_moreconnections_ug_on_key_event; - ops->priv = moreconnectionsUG; - ops->opt = UG_OPT_INDICATOR_ENABLE; - - return 0; -} - -UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops) -{ - SETTING_TRACE_BEGIN; - struct SettingMoreConnectionsUG *moreconnectionsUG; - setting_retm_if(!ops, "ops == NULL"); - - moreconnectionsUG = ops->priv; - if (moreconnectionsUG) { - FREE(moreconnectionsUG); - } -} diff --git a/setting-network/CMakeLists.txt b/setting-network/CMakeLists.txt deleted file mode 100755 index 5e12150..0000000 --- a/setting-network/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${SETTING_COMMON}/include) - - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs_network REQUIRED elementary evas ecore ecore-imf eina edje -appcore-common appcore-efl -ui-gadget-1 capi-appfw-application -capi-network-connection -tapi dlog efl-extension -capi-system-system-settings -notification json-glib-1.0 eventsystem callmgr_client libtzplatform-config) - -FOREACH(flag ${pkgs_network_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Werror-implicit-function-declaration") -SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") - -IF("${ARCH}" STREQUAL "arm") - ADD_DEFINITIONS("-DTARGET") - MESSAGE("add -DTARGET") -ENDIF("${ARCH}" STREQUAL "arm") - -ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") -ADD_DEFINITIONS("-DSLP_DEBUG") -ADD_DEFINITIONS("-shared") - -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib") - -ADD_LIBRARY(${SETTING_NETWORK_UG} SHARED - ./src/setting-network.c - ./src/setting-network-main.c - ./src/setting-network-select-network.c - ./src/setting-network-con.c - ./src/setting-network-con-list.c - ./src/setting-network-profile-delete.c - ./src/setting-network-connection-create.c - ) - -TARGET_LINK_LIBRARIES(${SETTING_NETWORK_UG} -L${CMAKE_BINARY_DIR}/${SETTING_COMMON} -lsetting-common) -TARGET_LINK_LIBRARIES(${SETTING_NETWORK_UG} ${pkgs_network_LDFLAGS}) - -INSTALL(TARGETS ${SETTING_NETWORK_UG} DESTINATION ${PREFIX}/lib/ug) diff --git a/setting-network/include/setting-network-con-list.h b/setting-network/include/setting-network-con-list.h deleted file mode 100644 index d5b9cb7..0000000 --- a/setting-network/include/setting-network-con-list.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_NETWORK_CON_LIST_CREATE_H__ -#define __SETTING_NETWORK_CON_LIST_CREATE_H__ - -#include -static void setting_network_con_list_item_Gendial_mouse_up_cb(void *data, Evas_Object *obj, void *event_info); -static void setting_network_con_list_go_button_cb(void *data, Evas_Object *obj, void *event_info); -static Eina_Bool setting_network_con_list_click_softkey_cancel_cb(void *data, Elm_Object_Item *it); -static void setting_network_con_list_click_softkey_create_cb(void *data, Evas_Object *obj, void *event_info); -static void setting_network_con_list_click_softkey_delete_cb(void *data, Evas_Object *obj, void *event_info); -#endif /* __SETTING_NETWORK_CON_LIST_CREATE_H__ */ diff --git a/setting-network/include/setting-network-con.h b/setting-network/include/setting-network-con.h deleted file mode 100755 index db622ed..0000000 --- a/setting-network/include/setting-network-con.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_NETWORK_CON_CREATE_H__ -#define __SETTING_NETWORK_CON_CREATE_H__ - -#include -/*static void setting_network_con_click_softkey_create_cb(void *data, Evas_Object *obj, void *event_info); */ -static void setting_network_con_click_softkey_reset_cb(void *data, Evas_Object *obj, void *event_info); -static void setting_network_con_reset_popup_cb(void *data, Evas_Object *obj, void *event_info); - -static Eina_Bool setting_network_con_click_softkey_cancel_cb(void *data, Elm_Object_Item *it); -static void setting_network_con_item_Gendial_mouse_up_cb(void *data, Evas_Object *obj, void *event_info); - -#endif /* __SETTING_NETWORK_CON_CREATE_H__ */ diff --git a/setting-network/include/setting-network-connection-create.h b/setting-network/include/setting-network-connection-create.h deleted file mode 100755 index 5c4488a..0000000 --- a/setting-network/include/setting-network-connection-create.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_NETWORK_CONNECTION_CREATE_H__ -#define __SETTING_NETWORK_CONNECTION_CREATE_H__ - -#include -static void setting_network_connection_check_entry_empty(SettingNetworkUG *ad); -static void setting_network_connection_display_auth_type(SettingNetworkUG * - ad, - int auth_type); - -static void setting_network_connection_entry_changed_cb(void *data, - Evas_Object *obj, - void *event_info); -static void setting_network_connection_click_softkey_save_cb(void *data, - Evas_Object * - obj, void - *event_info); -static void setting_network_connection_click_softkey_cancel_cb(void *data, - Evas_Object - *obj, void - *event_info); -static Eina_Bool setting_network_connection_click_softkey_back_cb(void *data, Elm_Object_Item *it); -/* -static void setting_network_connection_click_softkey_done_cb(void *data, - Evas_Object *obj, - void *event_info); */ -static void setting_network_connection_hide_input_pannel(void *data); -static void setting_network_connection_entry_next_activated_cb(void *data, Evas_Object *obj, void *event_info); - - -#endif /* __SETTING_NETWORK_CONNECTION_CREATE_H__ */ diff --git a/setting-network/include/setting-network-main.h b/setting-network/include/setting-network-main.h deleted file mode 100644 index 1cd51d4..0000000 --- a/setting-network/include/setting-network-main.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_NETWORK_MAIN_H__ -#define __SETTING_NETWORK_MAIN_H__ - -#include -#include - -void setting_network_get_preferred_network_list(void); - -#endif /* __SETTING_NETWORK_MAIN_H__ */ diff --git a/setting-network/include/setting-network-profile-delete.h b/setting-network/include/setting-network-profile-delete.h deleted file mode 100644 index 29632a9..0000000 --- a/setting-network/include/setting-network-profile-delete.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_NETWORK_PROFILE_DELETE_H__ -#define __SETTING_NETWORK_PROFILE_DELETE_H__ - -#include -static void setting_network_profile_delete_mouse_up_cb(void *data, - Evas_Object *obj, - void *event_info); -static void setting_network_profile_delete_check_cb(void *data, - Evas_Object *obj, - void *event_info); - -static Eina_Bool setting_network_profile_delete_click_softkey_cancel_cb(void *data, Elm_Object_Item *it); - -static void -setting_network_profile_delete_click_softkey_delete_cb(void *data, - Evas_Object * - obj, void - *event_info); -static void -setting_network_profile_delete_click_softkey_select_all_cb(void *data, - Evas_Object * - obj, void - *event_info); - -#endif /* __SETTING_NETWORK_PROFILE_DELETE_H__ */ diff --git a/setting-network/include/setting-network-select-network.h b/setting-network/include/setting-network-select-network.h deleted file mode 100755 index 3b9910f..0000000 --- a/setting-network/include/setting-network-select-network.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_NETWORK_SELECT_NETWORK_H__ -#define __SETTING_NETWORK_SELECT_NETWORK_H__ - -#include - -static void setting_network_select_network_click_softkey_cancel_cb(void *data, - Evas_Object *obj, - void *event_info); - -#endif /* __SETTING_NETWORK_SELECT_NETWORK_H__ */ diff --git a/setting-network/include/setting-network.h b/setting-network/include/setting-network.h deleted file mode 100755 index 05525c5..0000000 --- a/setting-network/include/setting-network.h +++ /dev/null @@ -1,378 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_NETWORK_H__ -#define __SETTING_NETWORK_H__ - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include - - -#define UI_NETWORK_MODE - - -/*#include */ - -#define TIME_TO_TURN_OFF_3G 2 - -/*for new metwork mode */ -#define Keystr_NetBrand_Auto "IDS_CST_OPT_GSM_WCDMA_HAUTO_CONNECT"/*"GSM/WCDMA (auto connect)" */ -#define Keystr_NetBrand_Auto_WCDMA_GSM "IDS_CST_OPT_GSM_WCDMA_HAUTO_CONNECT"/*"GSM/WCDMA (auto connect)" */ - -#define Keystr_NetBrand_WCDMA "IDS_ST_MBODY_WCDMA_ONLY" -#define Keystr_NetBrand_LTE_WCDMA "LTE/3G" - -#define Keystr_NetBrand_GSM "IDS_ST_MBODY_GSM_ONLY" -/*************************************************** // */ -#define KeyStr_UserID "IDS_ST_BODY_USER_ID" - -#define SUPPORT_CON_RESET -/*#define NET_CON_RESET_DBUS_PARA "--system --print-reply --dest=com.tcore.ps / com.tcore.ps.master.ResetProfile" */ -#define NET_CON_RESET_DBUS_PARA "--system --print-reply --dest=com.tcore.ps / com.tcore.ps.master.ResetProfile int32:0" - -#define Data_packet_Sub_desc "IDS_ST_BODY_ENABLE_DATA_ACCESS_OVER_MOBILE_NETWORK" -#define Data_packet_Popup_desc "IDS_ST_POP_MOBILE_DATA_ENABLED_CONNECTING_TO_MOBILE_NETWORKS_MAY_INCUR_EXTRA_CHARGES_DEPENDING_ON_YOUR_DATA_PLAN_CONTINUE_Q" -#define SETTING_NETWORK_DATA_ROMING_DESC "IDS_COM_BODY_CONNECT_TO_DATA_SERVICES_WHEN_ROAMING" -#define SETTING_NETWORK_DATA_ROMING_OFF_DESC "IDS_ST_BODY_WHEN_DATA_ROAMING_IS_DISABLED_APPLICATIONS_THAT_USE_THE_DATA_CONNECTION_MAY_NOT_WORK" - -#define SETTING_NETWORK_USE_PACKET_DATA_OFF_DESC "IDS_ST_BODY_USING_MOBILE_DATA_MAY_RESULT_IN_ADDITIONAL_CHARGES_CONTINUE_Q" -#define SETTING_NETWORK_USE_PACKET_DATA_ON_DESC "IDS_ST_POP_ROAMING_WILL_INCUR_EXTRA_CHARGES_CONTINUE_Q" - - -/* Unable to search networks during data service activated. Do you want to disconnect the data service and search available network? */ -#define SETTING_NETWORK_SEARCH_3G_ON_DESC "IDS_ST_POP_UNABLE_TO_SEARCH_NETWORKS_DURING_DATA_SERVICE_ACTIVATED_DO_YOU_WANT_TO_DISCONNECT_THE_DATA_SERVICE_AND_SEARCH_AVAILABLE_NETWORK_Q" -#define SETTING_NETWORK_CHANGE_3G_ON_DESC "IDS_ST_POP_UNABLE_TO_CHANGE_NETWORKS_WHILE_DATA_SERVICE_IN_USE_STOP_USING_CURRENT_DATA_SERVICE_AND_SELECT_ANOTHER_AVAILABLE_NETWORK_Q" - -#define SETTING_NETWORK_SEARCHING_NETWORK "IDS_ST_POP_SEARCHING_NETWORK_ING" -#define KeyStr_Network_Mobile_Data_Has_Been_Disabled_Msg "IDS_ST_POP_MOBILE_DATA_HAS_BEEN_DISABLED_MSG" -#define KeyStr_Network_Turn_Off_Mobile_Data "IDS_ST_HEADER_TURN_OFF_MOBILE_DATA" -#define KeyStr_Network_Turn_On_Mobile_Data "IDS_ST_HEADER_TURN_ON_MOBILE_DATA" - -#define CONNECTION_DSC "IDS_ST_BODY_CONNECTIONS" -#define KeyStr_Reset_Def "IDS_ST_BODY_RESET_TO_DEFAULT" -#define KeyStr_Edit "IDS_ST_BODY_EDIT" -#define KeyStr_Saved "IDS_ST_BODY_SAVED" -#define keyStr_Searched "IDS_SSEARCH_POP_SEARCHED" -#define keyStr_Failed_Searched "IDS_ST_POP_NETWORK_SEARCH_FAILED" -#define keyStr_Failed_Select_Network "IDS_COM_BODY_YOUR_SIM_CARD_DOES_NOT_ALLOW_A_CONNECTION_TO_THIS_NETWORK" -#define keyStr_Failed_Get_PreferNetwork "Get preferred network failed" -#define keyStr_Forbidden_Network _("IDS_ST_BODY_FORBIDDEN_NETWORK") -#define keyStr_OK _("IDS_ST_BUTTON_OK_ABB") -#define keyStr_CANCEL _("IDS_ST_BUTTON_CANCEL_ABB2") - -#define KeyStr_No_Profile _("IDS_ST_BODY_EMPTY") -#define keyStr_No_Other_Network "IDS_ST_BODY_THERE_ARE_NO_NETWORKS_NEARBY" - -#define Insert_Profile_Name_desc "Please input Profile name !" /*IDS_ST_BODY_ACCESS_NAME */ -#define Insert_Access_Name_desc "Please input Access name !" /*IDS_ST_BODY_ACCESS_NAME */ -#define Insert_User_Name_Desc "Please input User ID !" /*IDS_ST_BODY_USERNAME */ -#define Invok_API_Failed_Desc "Failed to invoke API" -#define SETTING_NETWORK_NOT_ALLOWED_WITH_TETHERING "Unable to change APN when tethering is enabled" -#define SETTING_NETWORK_DOT "IDS_WIFI_BODY_DOT" -#define SETTING_NETWORK_CONTINUE "IDS_COM_OPT_CONTINUE_Q" - -/*in the feture */ -#define NotifyStr_PDP_OFF "PDP will be disabled to find network nearby" -#define Keystr_UNKNOWN_NETWORK _("IDS_ST_OPT_UNTITLED_NETWORK") - -/*#define WHITELIST_DIR_PATH _TZ_SYS_DATA"/setting/lteon_netlist.xml" */ -#define WHITELIST_DIR_PATH "/opt/system/csc/usr/network/lteon_netlist.xml" - - -#define SETTING_ADD_PROFILE_INDEX -1 -#define Invoking_TAPI_Timeout 8 -#define COUNTRY_CODE_LEN 3 -#define NETWORK_CODE_LEN 3 -#define PRE_NETWORK_NAME_MAX 256 - -#define SETTING_NETWORK_POP_RESPONSE_ACTION_CANCEL 10 /* the popupresponse action ID */ -#define SETTING_NETWORK_SUBS_ID_NET_LEN 7 -typedef enum { - SETTING_NETWORK_PREFERRED_NETWORK_NONE, - SETTING_NETWORK_PREFERRED_NETWORK_NEW, - SETTING_NETWORK_PREFERRED_NETWORK_EDIT, - SETTING_NETWORK_PREFERRED_NETWORK_LIST, - SETTING_NETWORK_PREFERRED_NETWORK_DELETE, - -} setting_network_preferred_network_operation_type_t; - -typedef struct _SettingNetworkUG SettingNetworkUG; - -struct gl_network_data { - int index; - char name[PRE_NETWORK_NAME_MAX]; -}; - -typedef enum { - ERROR_STATE = 0, - MAIN_ONLY = 1, - CONNECTIONS_MAIN = 2, - CREATE_CONNECTIONS_MAIN = 3, - CREATE_CONLIST_CONNECTIONS_MAIN = 4 -} setting_network_view_type_t; - -#define MAX_PROFILE_NUM 100 -/** - * Setting Network UG context - * all UG function has void* as an agument. this is casted back to SettingNetworkUG - * and the functions access app context. - */ -struct _SettingNetworkUG { - ui_gadget_h ug; - TapiHandle *handle; - connection_h connection; - connection_profile_h sel_profile_h; - setting_view *profile_topper_view; - - /*xmlDocPtr whitelist_doc; */ - /*xmlNodePtr whitelist_root_node; */ - void *whitelist_doc; - void *whitelist_root_node; - -#if SUPPORT_TETHERING - tethering_h th_main; - tethering_h th_connections; - tethering_h th_conlists; - tethering_h th_concreate; -#endif - int profile_service_type; - - /* add more variables here (move your appdata to here) */ - Evas *evas; - Evas_Object *win_main_layout; - Evas_Object *win_get; - Evas_Object *navi_bar; - - Evas_Object* network_mode_popup; - - Evas_Object *popup_concreate; - Evas_Object *popup_conlist; - Evas_Object *popup_conreset; - Evas_Object *popup_conreset_complete; - Evas_Object *popup; - Evas_Object *popup_chk; - - Evas_Object *popup_auth_type; - Evas_Object *popup_data_on; - Evas_Object *popup_data_off; - - /*connection, */ - Elm_Object_Item *navi_it; - Elm_Object_Item *navi_it_con_list; - Elm_Object_Item *navi_it_profile_del_list; - Evas_Object *bottom_btn; - - /*connection-create */ - Evas_Object *con_create_gl; /* connection create */ - - /*Evas_Object *conformant; */ - Evas_Object *back_btn; - Evas_Object *l_button; - Evas_Object *r_button; - /*Evas_Object *m_button; */ - - bool has_form_changed; - Evas_Object *genlist; - Evas_Object *genlist_sel_network; - Evas_Object *connections_gl; /* genlist in connections view */ - Evas_Object *con_list_gl; /* genlist in connections view */ - int cur_profile_num; - - Evas_Object *network_ug_pop; - Evas_Object *network_select_registering_pop; - Evas_Object *controllbar; - - char *view_type_string; - - Evas_Object *ly_main; - unsigned int subs_id_net[SETTING_NETWORK_SUBS_ID_NET_LEN]; - - Evas_Point point_down; - - Setting_GenGroupItem_Data *data_auto_network_item; - Setting_GenGroupItem_Data *data_search_network_item; - - bool b_searching_network; - bool b_set_auto_network; - bool b_set_manul_network; - bool b_trigged_by_searching; - bool b_trigged_by_modechanging; - bool b_restore_3g_status; - bool b_restore_roaming_status; - - Setting_GenGroupItem_Data *data_sel_net; -#ifdef UI_NETWORK_MODE - Setting_GenGroupItem_Data *data_net_mode; -#endif - Setting_GenGroupItem_Data *data_connection; - Setting_GenGroupItem_Data *data_mobile_data; - Setting_GenGroupItem_Data *data_roaming; - Setting_GenGroupItem_Data *data_srv_type; - Setting_GenGroupItem_Data *internet_conn; - Setting_GenGroupItem_Data *mms_conn; - Setting_GenGroupItem_Data *selected_profile; - - Setting_GenGroupItem_Data *lte_wcdma_gsm; - Setting_GenGroupItem_Data *wcdma_gsm; - Setting_GenGroupItem_Data *wcdma_only; - Setting_GenGroupItem_Data *gsm_only; - - Evas_Object *chk_sel; - Evas_Object *chk_mode; - Evas_Object *pop_gsm; - Evas_Object *chk_3gcon; - - int sel_net; /**< like vconf key:VCONFKEY_SETAPPL_SELECT_NETWORK_INT */ - int sel_act; /**< like vconf key:VCONFKEY_SETAPPL_SELECT_OLD_NT_ACT */ - char *sel_network; -#ifdef UI_NETWORK_MODE - int net_mode; /* like vconf key */ -#endif - - TelNetworkPlmnList_t plmn_info; - - int is_show_user; - char *con_name; - char *access_name; - - Evas_Object *chk_type; - - char *ed_profile_name_desc; - char *ed_acs_name_desc; - char *ed_auth_type_desc; - char *ed_user_name_desc; - char *ed_pwd_desc; - char *ed_pxy_addr_desc; - char *ed_pxy_port_desc; - char *ed_hm_url_desc; - int chkType; - int srvType; - bool is_editable; - Elm_Object_Item *item_above_user_name; - Elm_Object_Item *item_above_proxy_add; - - Setting_GenGroupItem_Data *data_user_name; - Setting_GenGroupItem_Data *data_pwd; - Setting_GenGroupItem_Data *data_acs_name; - Setting_GenGroupItem_Data *data_profile_name; - Setting_GenGroupItem_Data *data_pxy_addr; - Setting_GenGroupItem_Data *data_pxy_port; - Setting_GenGroupItem_Data *data_hm_url; - Setting_GenGroupItem_Data *data_auth_type; - Setting_GenGroupItem_Data *data_type_nor; - Setting_GenGroupItem_Data *data_type_sec; - Setting_GenGroupItem_Data *data_type_none; - - Evas_Object *scl_edit; - - Evas_Object *gl_profile_del; - Eina_List *profile_list; - Eina_List *profile_del_list; - - /* Preferred network network list for genlist */ - Evas_Object *gl_network; - Elm_Genlist_Item_Class itc; - - Evas_Object *selInfoPop; - Evas_Object *selInfoPop_layout; - Evas_Object *rdg; - - - /* Delete */ - Setting_GenGroupItem_Data *data_delete_all; - /**********************************************/ - setting_view *view_to_load; - Ecore_Timer *timer; - - char *apn_internet; - char *apn_MMS; - Ecore_Idler *add_apn_idler; - Ecore_Idler *add_apn_timer; - - int is_update; - - int viewtype; - - /*dual sim */ - int sim_type; -}; - - -extern setting_view setting_view_network_main; -extern setting_view setting_view_network_select_network; -extern setting_view setting_view_network_con; -extern setting_view setting_view_network_con_list; -extern setting_view setting_view_network_connection_create; -extern setting_view setting_view_network_profile_delete; - -const char *setting_network_get_act_str(TelNetworkSystemType_t type); -void setting_network_update_sel_network(void *data); -bool setting_network_equal_profile(connection_profile_h pf1, connection_profile_h pf2); -void setting_network_reget_profile_list(void *cb); - -void setting_tapi_cancel_manual_search_cb(TapiHandle *handle, int result, void *data, void *user_data); -void setting_tapi_search_network_cb(TapiHandle *handle, int result, void *data, void *user_data); - -void setting_tapi_get_serving_network_cb(TapiHandle *handle, int result, void *data, void *user_data); -void setting_tapi_get_plmn_mode_cb(TapiHandle *handle, int result, void *data, void *user_data); -void setting_tapi_set_plmn_mode_cb(TapiHandle *handle, int result, void *data, void *user_data); - -void setting_tapi_get_band_cb(TapiHandle *handle, int result, void *data, void *user_data); -void setting_tapi_set_band_cb(TapiHandle *handle, int result, void *data, void *user_data); - -void setting_network_select_network_chk_changed(void *data, Evas_Object *obj, void *event_info); -void setting_network_Gendial_select_plmn_cb(void *data, Evas_Object *obj, void *event_info); -void setting_network_popup_delete(void *data); -int is_lte_on_feature(void *data); -char *__get_profile_name(int conType, void *data); - -void setting_network_searching_network(Setting_GenGroupItem_Data *list_item); - -void setting_network_set_state_mobile_data(ButtonState state); -int setting_network_get_state_mobile_data(); - -void setting_network_set_state_data_roaming(ButtonState state); -int setting_network_get_state_data_roaming(int* value); - - -#endif /* __SETTING_NETWORK_H__ */ diff --git a/setting-network/src/setting-network-con-list.c b/setting-network/src/setting-network-con-list.c deleted file mode 100644 index 1f59378..0000000 --- a/setting-network/src/setting-network-con-list.c +++ /dev/null @@ -1,618 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include - -static int setting_network_con_list_create(void *cb); -static int setting_network_con_list_destroy(void *cb); -static int setting_network_con_list_update(void *cb); -static int setting_network_con_list_cleanup(void *cb); -void setting_network_con_list_chk_changed(void *data, Evas_Object *obj, void *event_info); - -setting_view setting_view_network_con_list = { - .create = setting_network_con_list_create, - .destroy = setting_network_con_list_destroy, - .update = setting_network_con_list_update, - .cleanup = setting_network_con_list_cleanup, -}; - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -static Evas_Object* ctxpopup; - -static void -ctxpopup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - evas_object_del(ctxpopup); - ctxpopup = NULL; -} - -static void -move_more_ctxpopup(Evas_Object *ctxpopup) -{ - SETTING_TRACE_BEGIN; - Evas_Object *win; - Evas_Coord w, h; - int pos = -1; - - /* We convince the top widget is a window */ - win = elm_object_top_widget_get(ctxpopup); - elm_win_screen_size_get(win, NULL, NULL, &w, &h); - pos = elm_win_rotation_get(win); - - switch (pos) { - case 0: - case 180: - evas_object_move(ctxpopup, (w / 2), h); - break; - case 90: - evas_object_move(ctxpopup, (h / 2), w); - break; - case 270: - evas_object_move(ctxpopup, (h / 2), w); - break; - } -} - -static void -naviframe_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - Evas_Object *ctxpopup = data; - move_more_ctxpopup(ctxpopup); -} - -static void -more_ctxpopup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - Evas_Object *nf = data; - evas_object_event_callback_del_full(nf, EVAS_CALLBACK_RESIZE, naviframe_resize_cb, ctxpopup); -} - -static void -win_rotation_changed_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - Evas_Object *ctxpopup = data; - move_more_ctxpopup(ctxpopup); -} - -/* Icon + Text (More button style : Naviframe Toolbar) */ -static void create_ctxpopup_more_button_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - SettingNetworkUG *ad = (SettingNetworkUG *) data; - //Evas_Object *it_obj; - Evas_Object *nf = ad->navi_bar; - Evas_Object *win; - //Elm_Object_Item *it; - - if (ctxpopup != NULL) { - evas_object_del(ctxpopup); - } - - ctxpopup = elm_ctxpopup_add(nf); - elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE); - elm_object_style_set(ctxpopup, "more/default"); - eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_BACK, eext_ctxpopup_back_cb, NULL); - eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_MORE, eext_ctxpopup_back_cb, NULL); - evas_object_smart_callback_add(ctxpopup, "dismissed", ctxpopup_dismissed_cb, NULL); - evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_DEL, more_ctxpopup_del_cb, nf); - evas_object_event_callback_add(nf, EVAS_CALLBACK_RESIZE, naviframe_resize_cb, ctxpopup); - - /* We convince the top widget is a window */ - win = elm_object_top_widget_get(nf); - evas_object_smart_callback_add(win, "rotation,changed", win_rotation_changed_cb, ctxpopup); - - //--------------------------------------------------------------------------------------------- - elm_ctxpopup_item_append(ctxpopup, _("IDS_ST_BODY_MYTHEME_CREATE"), NULL, setting_network_con_list_click_softkey_create_cb, ad); - elm_ctxpopup_item_append(ctxpopup, _("IDS_ST_BODY_DELETE"), NULL, setting_network_con_list_click_softkey_delete_cb, ad); - //--------------------------------------------------------------------------------------------- - - elm_ctxpopup_direction_priority_set(ctxpopup, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN); - move_more_ctxpopup(ctxpopup); - evas_object_show(ctxpopup); -} -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - -/* *************************************************** - * - *basic func - * - ***************************************************/ -static int __con_list_recreate(void *cb) -{ - SETTING_TRACE_BEGIN; - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - Evas_Object *scroller; - scroller = ad->con_list_gl; - elm_genlist_clear(scroller); /* first to clear list */ - - Evas_Object *radio_group; - Setting_GenGroupItem_Data *item_data = NULL; - - radio_group = elm_radio_add(scroller); - elm_radio_state_value_set(radio_group, -1); - ad->rdg = radio_group; - //setting_disable_evas_object(radio_group); - - int srvType = ad->profile_service_type; - - char *def_apn = NULL; - char *def_name = NULL; - char *def_id = NULL; - connection_profile_h def_profile = NULL; - (void) connection_get_default_cellular_service_profile(ad->connection, srvType, &def_profile); - - if (def_profile) - connection_profile_get_cellular_apn(def_profile, &def_apn); - if (def_profile) - connection_profile_get_name(def_profile, &def_name); - if (def_profile) - connection_profile_get_id(def_profile, &def_id); - - SETTING_TRACE("Default profile:%p, def_apn[%s], def_name[%s], def_id[%s]", def_profile, def_apn, def_name, def_id); - - setting_network_reget_profile_list(ad); - - Eina_List *elist = NULL; - connection_profile_h profile_h = NULL; - int idx = 0; - char *id = NULL; - ad->selected_profile = NULL; - char *apn; - char *name; - char *proxy_address; - EINA_LIST_FOREACH(ad->profile_list, elist, profile_h) { - apn = name = NULL; - connection_profile_get_cellular_apn(profile_h, &apn); - connection_profile_get_name(profile_h, &name); - connection_profile_get_proxy_address(profile_h, CONNECTION_ADDRESS_FAMILY_IPV4, &proxy_address); - connection_profile_get_id(profile_h, &id); - - - item_data = (Setting_GenGroupItem_Data *) calloc(1, sizeof(Setting_GenGroupItem_Data)); - setting_retvm_if(!item_data, SETTING_RETURN_FAIL, "calloc failed"); - item_data->keyStr = (char *)g_strdup(name); - item_data->swallow_type = SWALLOW_TYPE_1RADIO_RIGHT_PROPAGATE_EVENTS_SET; - - item_data->r_swallow_path = (char *)g_strdup("reveal/extended"); - item_data->chk_status = idx; - item_data->chk_change_cb = setting_network_con_list_chk_changed; - item_data->stop_change_cb = setting_network_con_list_go_button_cb; - item_data->rgd = radio_group; - item_data->userdata = ad; - item_data->sub_desc = (char *)g_strdup(apn); - item_data->keyStr2 = (char *)g_strdup(id); - - if (idx == 0) { - ad->selected_profile = item_data; /*defaulty,it the first item */ - } - - item_data->item = - elm_genlist_item_append(scroller, &(itc_2text_2icon_3), item_data, NULL, - ELM_GENLIST_ITEM_NONE, - setting_network_con_list_item_Gendial_mouse_up_cb, ad); - - SETTING_TRACE_ERROR(">>>> chk_status : <%d>, state_value_get for %s ---> (%d) value_get[%d], ptr : %x, org(%x)", - item_data->chk_status, - item_data->keyStr, - elm_radio_state_value_get(item_data->eo_check), - elm_radio_value_get(item_data->eo_check), - item_data->chk_change_cb, - (void*)setting_network_con_list_chk_changed); - - SETTING_TRACE("profile_h:%p, apn:%s, id:%s", profile_h, apn, id); - if (!safeStrCmp(def_apn, apn) && !safeStrCmp(def_name, name) && !safeStrCmp(def_id, id)) { - SETTING_TRACE("Matched [idx:%d, apn:%s, id:%s]!", idx, apn, id); - if (srvType == CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET) { - ad->selected_profile = item_data; /*the selected item */ - elm_radio_value_set(radio_group, idx); - if (ad->internet_conn) { - G_FREE(ad->internet_conn->sub_desc); - FREE(ad->apn_internet); - ad->apn_internet = strdup(name); - ad->internet_conn->sub_desc = strdup(name); - elm_object_item_data_set(ad->internet_conn->item, ad->internet_conn); - elm_genlist_item_update(ad->internet_conn->item); - } - } - } - - G_FREE(apn); - G_FREE(name); - G_FREE(proxy_address); - G_FREE(id); - idx++; - } - - SETTING_TRACE("idx:%d", idx); - Evas_Object *toolbar = elm_object_item_part_content_get(ad->navi_it_con_list, "toolbar"); - SETTING_TRACE("elm_object_text_get(del_btn):%s", elm_object_item_text_get(elm_toolbar_last_item_get(toolbar))); - if (idx == 1) { - elm_object_item_disabled_set(elm_toolbar_last_item_get(toolbar), EINA_FALSE); - } else if (idx > 1) { - elm_object_item_disabled_set(elm_toolbar_last_item_get(toolbar), EINA_FALSE); - } else { - FREE(ad->apn_internet); - SETTING_TRACE("To disable"); - elm_object_item_disabled_set(elm_toolbar_last_item_get(toolbar), EINA_TRUE); - } - if (srvType == CONNECTION_CELLULAR_SERVICE_TYPE_MMS) { - if (idx > 0) elm_radio_value_set(radio_group, 0);/*the first one */ - if (ad->selected_profile && !isEmptyStr(ad->selected_profile->keyStr) && ad->mms_conn) { - SETTING_TRACE("ad->selected_profile->keyStr:%s", ad->selected_profile->keyStr); - G_FREE(ad->mms_conn->sub_desc); - FREE(ad->apn_MMS); - ad->apn_MMS = strdup(ad->selected_profile->keyStr); - ad->mms_conn->sub_desc = strdup(ad->selected_profile->keyStr); - elm_genlist_item_fields_update(ad->mms_conn->item, "*", ELM_GENLIST_ITEM_FIELD_TEXT); - } - } - ad->cur_profile_num = idx; - - SETTING_TRACE_END; - G_FREE(def_id); - G_FREE(def_apn); - G_FREE(def_name); - return SETTING_RETURN_SUCCESS; -} - -static int setting_network_con_list_create(void *cb) -{ - SETTING_TRACE_BEGIN; - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - - Evas_Object *scroller = elm_genlist_add(ad->win_main_layout); - retvm_if(scroller == NULL, SETTING_DRAW_ERR_FAIL_SCROLLER, - "Cannot set scroller object as contento of layout"); - - const char *title = NULL; - switch (ad->profile_service_type) { - case CONNECTION_CELLULAR_SERVICE_TYPE_MMS: - title = "IDS_ST_BODY_MMS_CONNECTIONS"; - break; - case CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET: - title = "IDS_ST_BODY_INTERNET_CONNECTION"; - break; - default: - title = ad->con_name; - break; - } - - /* [UI] Internet connection */ - /* [UI] MMS connection */ - ad->navi_it_con_list = - setting_push_layout_navi_bar(_(title), - NULL, /* ARROW STYLE */ - _("IDS_ST_BODY_DELETE"), - _("IDS_ST_BODY_MYTHEME_CREATE"), - setting_network_con_list_click_softkey_cancel_cb, - setting_network_con_list_click_softkey_delete_cb, - setting_network_con_list_click_softkey_create_cb, - ad, scroller, ad->navi_bar, NULL); - - elm_naviframe_item_pop_cb_set(ad->navi_it_con_list, - setting_network_con_list_click_softkey_cancel_cb, ad); - evas_object_smart_callback_add(scroller, "realized", __gl_realized_cb, NULL); - - - // Add ctx popup handler - Evas_Object* btn = elm_button_add(ad->navi_bar); - elm_object_style_set(btn, "naviframe/more/default"); - evas_object_smart_callback_add(btn, "clicked", create_ctxpopup_more_button_cb, ad); - elm_object_item_part_content_set(ad->navi_it_con_list, "toolbar_more_btn", btn); - - ad->con_list_gl = scroller; - elm_genlist_mode_set(ad->con_list_gl, ELM_LIST_COMPRESS); /* TNEF-4143 */ - - __con_list_recreate(ad); - - setting_view_network_con_list.is_create = 1; - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -static int setting_network_con_list_destroy(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - if (setting_view_network_con_list.is_create) { - /*ad->connections_gl = NULL; */ - setting_view_network_con_list.is_create = 0; - ad->selected_profile = NULL; - ad->navi_it_con_list = NULL; - ad->con_list_gl = NULL; - elm_naviframe_item_pop(ad->navi_bar); - } else { - SETTING_TRACE("why is this is_create == 0 ?? !!!"); - } - return SETTING_RETURN_SUCCESS; -} - -static int setting_network_con_list_update(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - __con_list_recreate(cb); - return SETTING_RETURN_SUCCESS; -} - -static int setting_network_con_list_cleanup(void *cb) -{ - SETTING_TRACE_BEGIN; - return setting_network_con_list_destroy(cb); - /*return SETTING_RETURN_SUCCESS; */ -} - -/* *************************************************** - * - *general func - * - ***************************************************/ - -/* *************************************************** - * - *call back func - * - ***************************************************/ -static void setting_network_con_list_go_button_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - Setting_GenGroupItem_Data *item_data = data; - - SettingNetworkUG *ad = item_data->userdata; - FREE(ad->access_name); - ad->access_name = strdup(item_data->keyStr2); - setting_view_change(&setting_view_network_con_list, &setting_view_network_connection_create, ad); -} - -#if 0 -static void ___network_con_set_default_cb(connection_error_e result, void *data) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(data == NULL, "Data parameter is NULL"); - Setting_GenGroupItem_Data *list_item = data; - SettingNetworkUG *ad = list_item->userdata; - setting_retm_if(ad == NULL, "ad parameter is NULL"); - if (ad->network_ug_pop) { - evas_object_del(ad->network_ug_pop); - ad->network_ug_pop = NULL; - } - - int srvType = CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION; - if (0 == safeStrCmp(ad->con_name, "IDS_ST_BODY_INTERNET_CONNECTION")) { - srvType = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET; - } else if (0 == safeStrCmp(ad->con_name, STR_SETTING_MMS_CONNECTIONS)) { - srvType = CONNECTION_CELLULAR_SERVICE_TYPE_MMS; - } - SETTING_TRACE("The result is :%d,but it is meaningless for our Setting", result); - ad->selected_profile = list_item; - if (srvType == CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET && ad->internet_conn) { - G_FREE(ad->internet_conn->sub_desc); - FREE(ad->apn_internet); - ad->apn_internet = strdup(list_item->keyStr); - ad->internet_conn->sub_desc = strdup(list_item->keyStr); - elm_object_item_data_set(ad->internet_conn->item, ad->internet_conn); - elm_genlist_item_update(ad->internet_conn->item); - } - elm_genlist_realized_items_update(ad->con_list_gl); -} -#endif - -static void __set_default_response_cb(void *data, Evas_Object *obj, - void *event_info) -{ - setting_retm_if(data == NULL, "Data parameter is NULL"); - Setting_GenGroupItem_Data *list_item = data; - SettingNetworkUG *ad = list_item->userdata; - - int srvType = CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION; - if (0 == safeStrCmp(ad->con_name, "IDS_ST_BODY_INTERNET_CONNECTION")) { - srvType = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET; - } else if (0 == safeStrCmp(ad->con_name, STR_SETTING_MMS_CONNECTIONS)) { - srvType = CONNECTION_CELLULAR_SERVICE_TYPE_MMS; - } - /*SETTING_TRACE("The result is :%d,but it is meaningless for our Setting", result); */ - ad->selected_profile = list_item; - if (srvType == CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET && ad->internet_conn) { - G_FREE(ad->internet_conn->sub_desc); - FREE(ad->apn_internet); - ad->apn_internet = strdup(list_item->keyStr); - ad->internet_conn->sub_desc = strdup(list_item->keyStr); - elm_object_item_data_set(ad->internet_conn->item, ad->internet_conn); - elm_genlist_item_update(ad->internet_conn->item); - } - elm_genlist_realized_items_update(ad->con_list_gl); - - if (obj) { - evas_object_del(obj); - obj = NULL; - } -} - - -void __set_default_profile(void *data) -{ - setting_retm_if(data == NULL, "Data parameter is NULL"); - Setting_GenGroupItem_Data *list_item = data; - SettingNetworkUG *ad = list_item->userdata; - setting_retm_if(ad == NULL, "ad parameter is NULL"); - - connection_profile_iterator_h profile_iter = NULL; - connection_profile_h profile_h = NULL; - int rv = connection_get_profile_iterator(ad->connection, CONNECTION_ITERATOR_TYPE_REGISTERED, &profile_iter); - if (rv != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get profile iterator [%d]", rv); - return; - } - - int cnt = 0; - char *apn = NULL; - char *profile_id = NULL; - connection_cellular_service_type_e service_type = CONNECTION_CELLULAR_SERVICE_TYPE_UNKNOWN; - - int srvType = CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION; - if (0 == safeStrCmp(ad->con_name, "IDS_ST_BODY_INTERNET_CONNECTION")) { - srvType = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET; - } else if (0 == safeStrCmp(ad->con_name, STR_SETTING_MMS_CONNECTIONS)) { - srvType = CONNECTION_CELLULAR_SERVICE_TYPE_MMS; - } - while (connection_profile_iterator_has_next(profile_iter)) { - if (cnt >= MAX_PROFILE_NUM) { - break; - } - if (connection_profile_iterator_next(profile_iter, &profile_h) != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get profile handle"); - break; - } - if (connection_profile_get_cellular_service_type(profile_h, &service_type) != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get service type"); - continue; - } - - connection_profile_get_cellular_apn(profile_h, &apn); - connection_profile_get_id(profile_h, &profile_id); - if (srvType != service_type) { - G_FREE(apn); - continue; - } - - SETTING_TRACE("Record[%d] profile is %s(%s)", cnt, apn, profile_id); - if (0 == safeStrCmp(profile_id, list_item->keyStr2)) { - - if (CONNECTION_CELLULAR_SERVICE_TYPE_MMS == srvType) { - setting_create_popup(ad, ad->win_get, NULL, _("IDS_MSGF_POP_UNSUPPORTED"), NULL, 0, false, false, 0); - if (ad->selected_profile) - elm_radio_value_set(list_item->eo_check, ad->selected_profile->chk_status); - break; - } else { - SETTING_TRACE("Set default[%d] as [%s], profile:%p, id:%s", srvType, apn, profile_h, profile_id); - int ret = connection_set_default_cellular_service_profile(ad->connection, srvType, profile_h); - SETTING_TRACE("The result is :%d", ret); - - if (ad->network_ug_pop) { - evas_object_del(ad->network_ug_pop); - ad->network_ug_pop = NULL; - } - if (ret != CONNECTION_ERROR_NONE) { - if (ad->selected_profile) - elm_radio_value_set(list_item->eo_check, ad->selected_profile->chk_status); - - setting_create_popup(list_item, ad->win_get, NULL, - _("IDS_CST_POP_FAILED"), NULL, - 2.0, FALSE, FALSE, 0); - return; - } - - setting_create_popup(list_item, ad->win_get, NULL, - _("IDS_ST_BUTTON2_PROCESSING_ING"), __set_default_response_cb, - 2.0, TRUE, FALSE, 0); - } - break; - } - cnt++; - } - G_FREE(apn); - G_FREE(profile_id); - -} -static void setting_network_con_list_item_Gendial_mouse_up_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - setting_retm_if(data == NULL, "Data parameter is NULL"); - - retm_if(event_info == NULL, "Invalid argument: event info is NULL"); - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - elm_genlist_item_selected_set(item, 0); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) elm_object_item_data_get(item); - setting_retm_if(NULL == list_item, "list_item is NULL"); - - - SettingNetworkUG *ad = list_item->userdata; - FREE(ad->access_name); - ad->access_name = strdup(list_item->keyStr2); - setting_view_change(&setting_view_network_con_list, &setting_view_network_connection_create, ad); -} -void setting_network_con_list_chk_changed(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL || obj == NULL, "Parameter is NULL"); - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data; - list_item->chk_status = elm_radio_value_get(obj); - __set_default_profile(list_item); - -} - -static void setting_network_con_list_click_softkey_delete_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(data == NULL, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - setting_view_change(&setting_view_network_con_list, &setting_view_network_profile_delete, ad); - if (ctxpopup != NULL) { - evas_object_del(ctxpopup); - ctxpopup = NULL; - } -} - -static void setting_network_con_list_click_softkey_create_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(data == NULL, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - FREE(ad->access_name); - setting_view_change(&setting_view_network_con_list, &setting_view_network_connection_create, ad); - if (ctxpopup != NULL) { - evas_object_del(ctxpopup); - ctxpopup = NULL; - } -} - -static Eina_Bool -setting_network_con_list_click_softkey_cancel_cb(void *data, Elm_Object_Item *it) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retvm_if(data == NULL, EINA_FALSE, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - setting_view_change(&setting_view_network_con_list, - &setting_view_network_con, ad); - return EINA_TRUE; -} diff --git a/setting-network/src/setting-network-con.c b/setting-network/src/setting-network-con.c deleted file mode 100644 index 1b5497d..0000000 --- a/setting-network/src/setting-network-con.c +++ /dev/null @@ -1,522 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include -/*#include */ - -static int setting_network_con_create(void *cb); -static int setting_network_con_destroy(void *cb); -static int setting_network_con_update(void *cb); -static int setting_network_con_cleanup(void *cb); - -setting_view setting_view_network_con = { - .create = setting_network_con_create, - .destroy = setting_network_con_destroy, - .update = setting_network_con_update, - .cleanup = setting_network_con_cleanup, -}; - -static void __setting_network_con_genlist_create(void *data) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(data == NULL, "data is NULL"); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - elm_genlist_clear(ad->connections_gl); /* first to clear list */ - - Elm_Object_Item *item = NULL; - item = elm_genlist_item_append(ad->connections_gl, &itc_seperator, NULL, NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - - /* scroller is a genlist */ - - /* [UI] Internet Connections */ - SETTING_TRACE("ad->apn_internet:%d, ad->apn_MMS:%d", ad->apn_internet, ad->apn_MMS); - ad->apn_internet = __get_profile_name(CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET, ad); - Setting_GenGroupItem_Data *internet_conn = setting_create_Gendial_field_def(ad->connections_gl, &itc_2text_3, - setting_network_con_item_Gendial_mouse_up_cb, - ad, SWALLOW_Type_INVALID, NULL, NULL, - 0, "IDS_ST_BODY_INTERNET_CONNECTION", - g_strdup(ad->apn_internet), NULL); - if (!internet_conn) { - SETTING_TRACE_ERROR("internet_conn is NULL"); - } - ad->internet_conn = internet_conn; - - if (internet_conn) { - } - ad->apn_MMS = __get_profile_name(CONNECTION_CELLULAR_SERVICE_TYPE_MMS, ad); - /* [MMS Connections] Internet Connections */ - Setting_GenGroupItem_Data *mms_conn = setting_create_Gendial_field_def(ad->connections_gl, &itc_2text_3, - setting_network_con_item_Gendial_mouse_up_cb, - ad, SWALLOW_Type_INVALID, NULL, NULL, - 0, STR_SETTING_MMS_CONNECTIONS, - g_strdup(ad->apn_MMS), NULL); - ad->mms_conn = mms_conn; - - -#ifdef ENABLED_PREFERRED_NETWORKS - setting_create_Gendial_field_def(ad->connections_gl, &itc_1text, - setting_network_con_item_Gendial_mouse_up_cb, - ad, SWALLOW_Type_INVALID, NULL, NULL, - 0, "IDS_ST_BODY_PREFERRED_NETWORKS", - NULL, NULL); -#endif -#ifdef ENABLED_2G3G_NETWORK - /* create 3g connection option */ - setting_create_Gendial_field_def(ad->connections_gl, &itc_1text, - setting_network_con_item_Gendial_mouse_up_cb, - ad, SWALLOW_Type_INVALID, NULL, NULL, - 0, "2G/3G Connection", NULL, NULL); - -#endif - - /* add other APN - if (!ad->is_update) { - if (ad->add_apn_timer) { - ecore_idler_del(ad->add_apn_timer); - ad->add_apn_timer = NULL; - } - ad->add_apn_timer = ecore_timer_add(0.5, (Ecore_Task_Cb) __add_other_apn, ad); - } else { - __add_other_apn(ad); - } - */ - /* __add_other_apn(ad); */ - SETTING_TRACE_END; - -} - -/* *************************************************** - * - *basic func - * - ***************************************************/ - -static Evas_Object* ctxpopup; - -static void -ctxpopup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - evas_object_del(ctxpopup); - ctxpopup = NULL; -} - -static void -move_more_ctxpopup(Evas_Object *ctxpopup) -{ - SETTING_TRACE_BEGIN; - Evas_Object *win; - Evas_Coord w, h; - int pos = -1; - - /* We convince the top widget is a window */ - win = elm_object_top_widget_get(ctxpopup); - elm_win_screen_size_get(win, NULL, NULL, &w, &h); - pos = elm_win_rotation_get(win); - - switch (pos) { - case 0: - case 180: - evas_object_move(ctxpopup, (w / 2), h); - break; - case 90: - evas_object_move(ctxpopup, (h / 2), w); - break; - case 270: - evas_object_move(ctxpopup, (h / 2), w); - break; - } -} - -static void -naviframe_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - Evas_Object *ctxpopup = data; - move_more_ctxpopup(ctxpopup); -} - -static void -more_ctxpopup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - Evas_Object *nf = data; - evas_object_event_callback_del_full(nf, EVAS_CALLBACK_RESIZE, naviframe_resize_cb, ctxpopup); -} - -static void -win_rotation_changed_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - Evas_Object *ctxpopup = data; - move_more_ctxpopup(ctxpopup); -} - -static void -ctxpopup_item_select_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(data == NULL, "Data parameter is NULL"); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - ad->popup_conreset = setting_create_popup(ad, ad->win_get, - NULL, _("IDS_ST_POP_RESET_TO_DEFAULT_Q"), - setting_network_con_reset_popup_cb, - 0, false, false, - 2, _("IDS_ST_BUTTON_OK"), _("IDS_ST_BUTTON_CANCEL_ABB")); - - if (ctxpopup != NULL) { - evas_object_del(ctxpopup); - ctxpopup = NULL; - } -} - - -/* Icon + Text (More button style : Naviframe Toolbar) */ -static void create_ctxpopup_more_button_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - SettingNetworkUG *ad = (SettingNetworkUG *) data; - //Evas_Object *it_obj; - Evas_Object *nf = ad->navi_bar; - Evas_Object *win; - //Elm_Object_Item *it; - - if (ctxpopup != NULL) { - evas_object_del(ctxpopup); - } - - ctxpopup = elm_ctxpopup_add(nf); - elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE); - elm_object_style_set(ctxpopup, "more/default"); - eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_BACK, eext_ctxpopup_back_cb, NULL); - eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_MORE, eext_ctxpopup_back_cb, NULL); - evas_object_smart_callback_add(ctxpopup, "dismissed", ctxpopup_dismissed_cb, NULL); - evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_DEL, more_ctxpopup_del_cb, nf); - evas_object_event_callback_add(nf, EVAS_CALLBACK_RESIZE, naviframe_resize_cb, ctxpopup); - - /* We convince the top widget is a window */ - win = elm_object_top_widget_get(nf); - evas_object_smart_callback_add(win, "rotation,changed", win_rotation_changed_cb, ctxpopup); - - elm_ctxpopup_item_append(ctxpopup, _(KeyStr_Reset_Def), NULL, ctxpopup_item_select_cb, ad); - elm_ctxpopup_direction_priority_set(ctxpopup, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN); - move_more_ctxpopup(ctxpopup); - evas_object_show(ctxpopup); -} - -/** - * Connections - */ -static int setting_network_con_create(void *cb) -{ - SETTING_TRACE_BEGIN; - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - - Evas_Object *scroller = elm_genlist_add(ad->win_main_layout); - retvm_if(scroller == NULL, SETTING_DRAW_ERR_FAIL_SCROLLER, - "Cannot set scroller object as contento of layout"); - elm_genlist_mode_set(scroller, ELM_LIST_COMPRESS); - elm_object_style_set(scroller, "dialogue"); - ad->connections_gl = scroller; - evas_object_smart_callback_add(scroller, "realized", __gl_realized_cb, NULL); - - Elm_Object_Item *navi_it = setting_push_layout_navi_bar(_("IDS_ST_BODY_CONNECTIONS"), - NULL, /* ARROR BUTTON */ - NULL, - _(KeyStr_Reset_Def), - setting_network_con_click_softkey_cancel_cb, - NULL, - setting_network_con_click_softkey_reset_cb,/*setting_network_con_click_softkey_create_cb, */ - ad, scroller, ad->navi_bar, NULL); - - elm_naviframe_item_pop_cb_set(navi_it, setting_network_con_click_softkey_cancel_cb, ad); - - __setting_network_con_genlist_create(ad); - - Evas_Object* btn = elm_button_add(ad->navi_bar); - elm_object_style_set(btn, "naviframe/more/default"); - evas_object_smart_callback_add(btn, "clicked", create_ctxpopup_more_button_cb, ad); - elm_object_item_part_content_set(navi_it, "toolbar_more_btn", btn); - - setting_view_network_con.is_create = 1; - - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -static int setting_network_con_destroy(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - ad->is_update = 0; - /*FREE(ad->con_name); */ - ad->connections_gl = NULL; - if (setting_view_network_con.is_create) { - if (ad->add_apn_timer) { - ecore_idler_del(ad->add_apn_timer); - ad->add_apn_timer = NULL; - } - - elm_naviframe_item_pop(ad->navi_bar); - setting_view_network_con.is_create = 0; - } else { - SETTING_TRACE("why is this is_create == 0 ?? !!!"); - } - - - return SETTING_RETURN_SUCCESS; -} - -static int setting_network_con_update(void *cb) -{ - SETTING_TRACE_BEGIN; - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - __setting_network_con_genlist_create(ad); - return SETTING_RETURN_SUCCESS; -} - -static int setting_network_con_cleanup(void *cb) -{ - SETTING_TRACE_BEGIN; - return setting_network_con_destroy(cb); -} - -/* *************************************************** - * - *general func - * - ***************************************************/ - -/* *************************************************** - * - *call back func - * - ***************************************************/ - -static void -setting_network_con_item_Gendial_mouse_up_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - setting_retm_if(data == NULL, "Data parameter is NULL"); - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - elm_genlist_item_selected_set(item, 0); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) elm_object_item_data_get(item); - setting_retm_if(NULL == list_item, "list_item is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - ad->profile_topper_view = NULL; - - SETTING_TRACE("clicking item[%s]", _(list_item->keyStr)); - - ad->profile_service_type = 0; - - if (!safeStrCmp("IDS_COM_BODY_NETWORK_OPERATORS", list_item->keyStr)) { - setting_view_change(&setting_view_network_con, - &setting_view_network_select_network, - ad); - } -#ifdef ENABLED_PREFERRED_NETWORKS - else if (!safeStrCmp("IDS_ST_BODY_PREFERRED_NETWORKS", - list_item->keyStr)) { - - int value = -1; - int err = -1; - - setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, - &err); - /** @todo check 'err' variable for exception handling */ - SETTING_TRACE("INT_SLP_SETTING_SIM_SLOT value:%d", value); - switch (value) { - case VCONFKEY_TELEPHONY_SIM_INSERTED: - /* To Recreate the view in order to search the perferred network again. */ - /* ret = setting_view_destroy(&setting_view_network_preferred_network, ad); */ - - setting_view_change(&setting_view_network_con, - &setting_view_network_preferred_network, - ad); - - break; - - case VCONFKEY_TELEPHONY_SIM_NOT_PRESENT: - - setting_create_popup(NULL, ad->win_get, - NULL, _(""), NULL, 0, false, false, 0);/*this code is not used now, so remove the ID which is not in po file*/ - SETTING_TRACE_DEBUG - ("%s*** [ERR] INCORRECTED SIM. sim_slot_type=%d ***%s", - SETTING_FONT_RED, value, SETTING_FONT_BLACK); - return; - - break; - - case VCONFKEY_TELEPHONY_SIM_CARD_ERROR: - case VCONFKEY_TELEPHONY_SIM_UNKNOWN: - - setting_create_popup(NULL, ad->win_get, - NULL, _("IDS_SIM_BODY_INVALID_SIM_CARD"), NULL, 0, false, false, 0); - SETTING_TRACE_DEBUG - ("%s*** [ERR] INCORRECTED SIM. sim_slot_type=%d ***%s", - SETTING_FONT_RED, value, SETTING_FONT_BLACK); - return; - - break; - default: - SETTING_TRACE("Unknown SIM information from vconf"); - break; - } - } -#endif -#ifdef ENABLED_2G3G_NETWORK - else if (!safeStrCmp("2G/3G Connection", list_item->keyStr)) { - setting_view_change(&setting_view_network_con, - &setting_view_network_3gcon, ad); - } -#endif - else if (!safeStrCmp("IDS_ST_BODY_INTERNET_CONNECTION", list_item->keyStr)) {/*connections.. */ - - FREE(ad->con_name); - SETTING_TRACE("list_item->keyStr:%s, ad->con_name:%s", list_item->keyStr, ad->con_name); - ad->con_name = strdup(list_item->keyStr); - ad->profile_service_type = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET; - setting_view_change(&setting_view_network_con, - &setting_view_network_con_list, - ad); - } else if (!safeStrCmp(STR_SETTING_MMS_CONNECTIONS, list_item->keyStr)) { - FREE(ad->con_name); - ad->profile_topper_view = &setting_view_network_con; - ad->con_name = strdup(STR_SETTING_MMS_CONNECTIONS); - ad->access_name = strdup(STR_SETTING_MMS_CONNECTIONS); - ad->profile_service_type = CONNECTION_CELLULAR_SERVICE_TYPE_MMS; - setting_view_create(&setting_view_network_connection_create, ad); - } else { - FREE(ad->con_name); - ad->profile_topper_view = &setting_view_network_con; - ad->con_name = strdup(list_item->sub_desc); - ad->access_name = strdup(list_item->sub_desc); - ad->profile_service_type = list_item->chk_status; - setting_view_create(&setting_view_network_connection_create, ad); - } - SETTING_TRACE_END; -} - -static void -setting_network_con_click_softkey_reset_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(data == NULL, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - ad->popup_conreset = setting_create_popup(ad, ad->win_get, - NULL, _("IDS_ST_POP_RESET_TO_DEFAULT_Q"), - setting_network_con_reset_popup_cb, - 0, false, false, - 2, _("IDS_ST_BUTTON_OK"), _("IDS_ST_BUTTON_CANCEL_ABB")); - return; -} - -void _reset_do_default_cb(connection_error_e result, void *user_data) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(NULL == user_data, "NULL == data"); - SettingNetworkUG *ad = (SettingNetworkUG *) user_data; - - if (ad->network_ug_pop) { - evas_object_del(ad->network_ug_pop); - ad->network_ug_pop = NULL; - } - - if (ad->popup_conreset_complete) { - evas_object_del(ad->popup_conreset_complete); - ad->popup_conreset_complete = NULL; - } - - if (result == CONNECTION_ERROR_NONE) { - SETTING_TRACE("reset successfully"); - FREE(ad->apn_internet); - FREE(ad->apn_MMS); - __setting_network_con_genlist_create(ad); - } else { - SETTING_TRACE_ERROR("failed to reset ret = %d", result); - } -} - -static void -setting_network_con_reset_popup_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - - /* error check */ - setting_retm_if(NULL == data, "NULL == data"); - - int response_type = btn_type(obj); - int ret = 0; - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - if (ad) { - evas_object_del(ad->popup_conreset); - ad->popup_conreset = NULL; - } - - if (response_type == POPUP_RESPONSE_OK) { - - // waiting popup should be here - ad->popup_conreset_complete = setting_create_popup_with_progressbar(ad, ad->win_get, - PROGRESSBAR_STYLE, NULL, IDS_ST_SK2_PLEASE_WAIT, NULL, 0, TRUE, TRUE, 0); - - if (ad->connection) { - ret = connection_reset_profile(ad->connection, CONNECTION_RESET_DEFAULT_PROFILE, - 0, _reset_do_default_cb, ad); - if (CONNECTION_ERROR_NONE == ret) { - SETTING_TRACE("Reset successfully"); - } else { - SETTING_TRACE("Failed to reset, ret = %d", ret); - } - } - } - - return; -} - -static Eina_Bool -setting_network_con_click_softkey_cancel_cb(void *data, Elm_Object_Item *it) -{ - SETTING_TRACE_BEGIN; - retvm_if(data == NULL, EINA_FALSE, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - setting_view_change(&setting_view_network_con, - &setting_view_network_main, ad); - return EINA_TRUE; -} diff --git a/setting-network/src/setting-network-connection-create.c b/setting-network/src/setting-network-connection-create.c deleted file mode 100644 index 4a6e3d7..0000000 --- a/setting-network/src/setting-network-connection-create.c +++ /dev/null @@ -1,1975 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include -#include - -#define MAX_PDP_APN_LEN_MAX 100 -#define MAX_PDP_AUTH_USERNAME_LEN_MAX 32 -#define MAX_PDP_AUTH_PASSWORD_LEN_MAX 32 -#define MAX_HOME_URL_LEN_MAX 512 -#define MAX_PROXY_LEN_MAX 64 - -static int setting_network_connection_create(void *cb); -static int setting_network_connection_destroy(void *cb); -static int setting_network_connection_update(void *cb); -static int setting_network_connection_cleanup(void *cb); - -setting_view setting_view_network_connection_create = { - .create = setting_network_connection_create, - .destroy = setting_network_connection_destroy, - .update = setting_network_connection_update, - .cleanup = setting_network_connection_cleanup, -}; - -SettingNetworkUG *g_networkUG = NULL; -#define SUPPORT_EXPANDABLE_AUTHTYPE 1 -#define URL_HEAD "http://" -#define INTERNET "IDS_ST_BODY_CONNECTIONSETTINGS_INTERNET" -#define PLUS_MMS "+ MMS" -/* *************************************************** - * - *basic func - * - ***************************************************/ - -void __sub_list_rd_change(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) data; - list_item->chk_status = elm_radio_value_get(obj); /* for update */ - - Elm_Object_Item *subItem = list_item->item; - Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subItem); - - Setting_GenGroupItem_Data *data_subItem = elm_object_item_data_get(subItem); /* subItem data */ - Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */ - - ret_if(NULL == data_subItem || NULL == data_parentItem); - - data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr)); - elm_object_item_data_set(data_parentItem->item, data_parentItem); - elm_genlist_item_update(data_parentItem->item); - - SettingNetworkUG *ad = data_parentItem->userdata; - - if (data_parentItem == ad->data_auth_type) { - elm_genlist_item_expanded_set(ad->data_auth_type->item, FALSE); - elm_genlist_item_update(ad->data_auth_type->item); - - setting_network_connection_display_auth_type(data_parentItem->userdata, list_item->chk_status); - } else if (data_parentItem == ad->data_srv_type) { - if (ad->srvType != data_subItem->chk_status) - ad->srvType = data_subItem->chk_status; - if (ad->srvType != CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET) { - if (!ad->data_hm_url) { - /*need home url */ - ad->data_hm_url = - setting_create_Gendial_field_def(obj, - &itc_editfield, - NULL, NULL, - SWALLOW_Type_LAYOUT_EDITFIELD, - NULL, NULL, 0, - "IDS_ST_BODY_HOME_URL", - (char *)ad->ed_hm_url_desc, - setting_network_connection_entry_changed_cb); - if (ad->data_hm_url) { - ad->data_hm_url->userdata = ad; - ad->data_hm_url->input_type = ELM_INPUT_PANEL_LAYOUT_URL; - ad->data_hm_url->isSinglelineFlag = TRUE; - ad->data_hm_url->limit_filter_data = calloc(1, sizeof(Elm_Entry_Filter_Accept_Set)); - if (ad->data_hm_url->limit_filter_data) { - ad->data_hm_url->limit_filter_data->max_byte_count = MAX_HOME_URL_LEN_MAX - 1; - ad->data_hm_url->win_main = ad->win_get; - } - } else { - SETTING_TRACE_ERROR("ad->data_hm_url is NULL"); - } - } - } else { - /*do need home-url */ - if (ad->data_hm_url) { - elm_object_item_del(ad->data_hm_url->item); - ad->data_hm_url = NULL; - } - } - } -} - -void __sub_list_sel_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(event_info == NULL, "Invalid argument: event info is NULL"); - Elm_Object_Item *subitem = (Elm_Object_Item *) event_info; - //Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subitem); - elm_genlist_item_selected_set(subitem, 0); - - Setting_GenGroupItem_Data *data_subItem = elm_object_item_data_get(subitem); - Setting_GenGroupItem_Data *data_parentItem = (Setting_GenGroupItem_Data *)data; - ret_if(NULL == data_subItem || NULL == data_parentItem); - - SettingNetworkUG *ad = data_parentItem->userdata; - ret_if(NULL == ad); - - int chk_status = data_subItem->chk_status; - elm_radio_value_set(data_subItem->rgd, chk_status); - - data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr)); - elm_object_item_data_set(data_parentItem->item, data_parentItem); -// elm_genlist_item_fields_update(data_parentItem->item, "*", ELM_GENLIST_ITEM_FIELD_TEXT); - - if (data_parentItem == ad->data_auth_type) - { - elm_genlist_item_expanded_set( ad->data_auth_type->item, FALSE ); - elm_genlist_item_update( ad->data_auth_type->item ); - - setting_network_connection_display_auth_type(ad, chk_status); - - //remove network mode popup - if (ad->popup_auth_type) { - evas_object_del(ad->popup_auth_type); - ad->popup_auth_type = NULL; - } - } - else if (data_parentItem == ad->data_srv_type) - { - if (ad->srvType != data_subItem->chk_status) - ad->srvType = data_subItem->chk_status; - if( ad->srvType != CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET) - { - if (!ad->data_hm_url) - { - //need home url - ad->data_hm_url = - setting_create_Gendial_field_def(obj, - &itc_editfield, - NULL, NULL, - SWALLOW_Type_LAYOUT_EDITFIELD, - NULL, NULL, 0, - "IDS_ST_BODY_HOME_URL", - (char *)ad->ed_hm_url_desc, - setting_network_connection_entry_changed_cb); - if (ad->data_hm_url) { - ad->data_hm_url->userdata = ad; - ad->data_hm_url->input_type = ELM_INPUT_PANEL_LAYOUT_URL; - ad->data_hm_url->limit_filter_data = calloc(1, sizeof(Elm_Entry_Filter_Accept_Set)); - if (ad->data_hm_url->limit_filter_data) { - ad->data_hm_url->limit_filter_data->max_byte_count = MAX_HOME_URL_LEN_MAX - 1; - ad->data_hm_url->win_main = ad->win_get; - } - } else { - SETTING_TRACE_ERROR("ad->data_hm_url is NULL"); - } - } - - } else { - /*do need home-url */ - if (ad->data_hm_url) { - elm_object_item_del(ad->data_hm_url->item); - ad->data_hm_url = NULL; - } - } - } -} - -void __auth_type_popup_del(void *data, Evas_Object *obj, void *event_info) -{ - SettingNetworkUG *ad = data; - - ret_if(data == NULL); - - evas_object_del(ad->popup_auth_type); - ad->popup_auth_type = NULL; -} - -static void __create_auth_type_popup(void *data, Evas_Object *obj, - void *event_info) -{ - ret_if(NULL == data || NULL == event_info); - SETTING_TRACE_BEGIN; - SettingNetworkUG *ad = (SettingNetworkUG *) data; - Elm_Object_Item *parentItem = event_info; /* parent item */ - elm_genlist_item_selected_set(parentItem, 0); - Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */ - - /* create popup */ - if(ad->popup_auth_type) { - evas_object_del(ad->popup_auth_type); - ad->popup_auth_type = NULL; - } - Evas_Object *scroller = NULL; - ad->popup_auth_type = setting_create_popup_with_list(&scroller, ad, ad->win_get, - data_parentItem->keyStr, - __auth_type_popup_del, - 0, false, false, 0); - _P(ad->popup_auth_type); - - Evas_Object *rgd; - - if (data_parentItem == ad->data_auth_type) { - rgd = elm_radio_add(scroller); - elm_radio_value_set(rgd, -1); - - setting_create_Gendial_field_1radio(scroller, - &itc_multiline_1text_1icon, - __sub_list_sel_cb, data_parentItem, - SWALLOW_Type_1RADIO_RIGHT, rgd, - CONNECTION_CELLULAR_AUTH_TYPE_PAP, - "IDS_ST_MBODY_PAP", - NULL); - - setting_create_Gendial_field_1radio(scroller, - &itc_multiline_1text_1icon, - __sub_list_sel_cb, data_parentItem, - SWALLOW_Type_1RADIO_RIGHT, rgd, - CONNECTION_CELLULAR_AUTH_TYPE_CHAP, - "IDS_ST_POP_CHAP", - NULL); - - setting_create_Gendial_field_1radio(scroller, - &itc_multiline_1text_1icon, - __sub_list_sel_cb, data_parentItem, - SWALLOW_Type_1RADIO_RIGHT, rgd, - CONNECTION_CELLULAR_AUTH_TYPE_NONE, - "IDS_ST_BODY_NONE", - NULL); - - elm_radio_value_set(rgd, ad->chkType); - elm_object_signal_emit(rgd, "elm,event,pass,enabled", "elm"); - } - else if (data_parentItem == ad->data_srv_type) { - rgd = elm_radio_add(scroller); - elm_radio_value_set(rgd, -1); - - setting_create_Gendial_exp_sub_field(scroller, - &itc_1icon_1text_sub, - __sub_list_sel_cb, ad, - parentItem, - SWALLOW_Type_1RADIO_RIGHT, rgd, - CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET, - "IDS_ST_BODY_INTERNET_CONNECTION", - __sub_list_rd_change); - - setting_create_Gendial_exp_sub_field(scroller, - &itc_1icon_1text_sub, - __sub_list_sel_cb, ad, - parentItem, - SWALLOW_Type_1RADIO_RIGHT, rgd, - CONNECTION_CELLULAR_SERVICE_TYPE_MMS, - STR_SETTING_MMS_CONNECTIONS, - __sub_list_rd_change); - - int r = 0; - char tmp_str[SETTING_STR_SLP_LEN + 1] = {0,}; - r = snprintf(tmp_str, SETTING_STR_SLP_LEN, "%s %s", _(INTERNET), PLUS_MMS); - if(r < 0) - SETTING_TRACE("snprintf failed"); - - setting_create_Gendial_exp_sub_field(scroller, - &itc_1icon_1text_sub, - __sub_list_sel_cb, ad, - parentItem, - SWALLOW_Type_1RADIO_RIGHT, rgd, - CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION, - tmp_str, - __sub_list_rd_change); - - elm_radio_value_set(rgd, ad->srvType); - elm_object_signal_emit(rgd, "elm,event,pass,enabled", "elm"); - } -} - -static void __setting_network_connection_exp_cb(void *data, Evas_Object *obj, - void *event_info) -{ - ret_if(NULL == data || NULL == event_info); - SETTING_TRACE_BEGIN; - SettingNetworkUG *ad = (SettingNetworkUG *) data; - Elm_Object_Item *parentItem = event_info; /* parent item */ - Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */ - Evas_Object *scroller = elm_object_item_widget_get(parentItem); - - Evas_Object *rgd; - - if (data_parentItem == ad->data_auth_type) { - rgd = elm_radio_add(scroller); - //elm_object_style_set(rgd, "list"); - elm_radio_value_set(rgd, -1); - - SETTING_TRACE("CONNECTION_CELLULAR_AUTH_TYPE_NONE : %d: ", CONNECTION_CELLULAR_AUTH_TYPE_NONE); - SETTING_TRACE("CONNECTION_CELLULAR_AUTH_TYPE_PAP : %d: ", CONNECTION_CELLULAR_AUTH_TYPE_PAP); - SETTING_TRACE("CONNECTION_CELLULAR_AUTH_TYPE_CHAP : %d: ", CONNECTION_CELLULAR_AUTH_TYPE_CHAP); - - setting_create_Gendial_exp_sub_field(scroller, - &itc_1icon_1text_sub, - __sub_list_sel_cb, ad, - parentItem, - SWALLOW_Type_1RADIO_RIGHT, rgd, - CONNECTION_CELLULAR_AUTH_TYPE_NONE, - IDS_ST_BODY_NONE, - __sub_list_rd_change); - - setting_create_Gendial_exp_sub_field(scroller, - &itc_1icon_1text_sub, - __sub_list_sel_cb, ad, - parentItem, - SWALLOW_Type_1RADIO_RIGHT, rgd, - CONNECTION_CELLULAR_AUTH_TYPE_PAP, - IDS_ST_MBODY_PAP, - __sub_list_rd_change); - - setting_create_Gendial_exp_sub_field(scroller, - &itc_1icon_1text_sub, - __sub_list_sel_cb, ad, - parentItem, - SWALLOW_Type_1RADIO_RIGHT, rgd, - CONNECTION_CELLULAR_AUTH_TYPE_CHAP, - IDS_ST_POP_CHAP, - __sub_list_rd_change); - - SETTING_TRACE(" ----------------------------->>> ad->chkType : %d ",ad->chkType); - - elm_radio_value_set(rgd, ad->chkType); - } else if (data_parentItem == ad->data_srv_type) { - rgd = elm_radio_add(scroller); - elm_radio_value_set(rgd, -1); - - setting_create_Gendial_exp_sub_field(scroller, - &itc_1icon_1text_sub, - __sub_list_sel_cb, ad, - parentItem, - SWALLOW_Type_1RADIO_RIGHT, rgd, - CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET, - "IDS_ST_BODY_INTERNET_CONNECTION", - __sub_list_rd_change); - - setting_create_Gendial_exp_sub_field(scroller, - &itc_1icon_1text_sub, - __sub_list_sel_cb, ad, - parentItem, - SWALLOW_Type_1RADIO_RIGHT, rgd, - CONNECTION_CELLULAR_SERVICE_TYPE_MMS, - STR_SETTING_MMS_CONNECTIONS, - __sub_list_rd_change); - - int r = 0; - char tmp_str[SETTING_STR_SLP_LEN + 1] = {0,}; - r = snprintf(tmp_str, SETTING_STR_SLP_LEN, "%s %s", _(INTERNET), PLUS_MMS); - if (r < 0) - SETTING_TRACE("snprintf failed"); - - setting_create_Gendial_exp_sub_field(scroller, - &itc_1icon_1text_sub, - __sub_list_sel_cb, ad, - parentItem, - SWALLOW_Type_1RADIO_RIGHT, rgd, - CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION, - tmp_str, - __sub_list_rd_change); - - elm_radio_value_set(rgd, ad->srvType); - } -} - -static Eina_Bool __connection_idler(void *data) -{ - SETTING_TRACE_BEGIN; - retv_if(!data, FALSE); - SettingNetworkUG *ad = data; - /*__genlist_disable_set(ad->scl_edit, TRUE); */ - setting_network_connection_hide_input_pannel(ad); - return FALSE; -} -void __get_connection_info(void *cb) -{ - SETTING_TRACE_BEGIN; - ret_if(cb == NULL); - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - /*int ret; */ - G_FREE(ad->ed_profile_name_desc); - G_FREE(ad->ed_acs_name_desc); - G_FREE(ad->ed_user_name_desc); - G_FREE(ad->ed_pwd_desc); - - G_FREE(ad->ed_pxy_addr_desc); - G_FREE(ad->ed_pxy_port_desc); - - G_FREE(ad->ed_hm_url_desc); - ad->ed_auth_type_desc = NULL; - ad->chkType = CONNECTION_CELLULAR_AUTH_TYPE_NONE; - - SETTING_TRACE("ad->con_name:%s, ad->profile_service_type:%d", - ad->con_name, ad->profile_service_type); - - int ServiceType = ad->profile_service_type; - char *con_name_utf8 = NULL; - if (ad->access_name) { - con_name_utf8 = strdup(ad->access_name); - } else { - con_name_utf8 = strdup(""); - } - SETTING_TRACE("con_name_utf8:%s", con_name_utf8); - - /*match with the correct profile */ - connection_profile_iterator_h profile_iter = NULL; - connection_profile_h profile_h = NULL; - char *profile_name = NULL; - char *apn = NULL; - char *profile_id = NULL; - connection_profile_type_e profile_type = CONNECTION_PROFILE_TYPE_CELLULAR; - connection_cellular_service_type_e service_type = CONNECTION_CELLULAR_SERVICE_TYPE_UNKNOWN; - int err = connection_get_profile_iterator(ad->connection, CONNECTION_ITERATOR_TYPE_REGISTERED, &profile_iter); - if (err != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get profile iterator [%d]", err); - FREE(con_name_utf8); - return; - } - - int cnt = 0; - bool found = FALSE; - while (connection_profile_iterator_has_next(profile_iter)) { - /*reset and release.. */ - G_FREE(apn); - G_FREE(profile_id); - G_FREE(profile_name); - - if (cnt >= MAX_PROFILE_NUM || connection_profile_iterator_next(profile_iter, &profile_h) != CONNECTION_ERROR_NONE) { - break; - } - - connection_profile_get_type(profile_h, &profile_type); - connection_profile_get_cellular_service_type(profile_h, &service_type); - connection_profile_get_cellular_apn(profile_h, &apn); - connection_profile_get_id(profile_h, &profile_id); - connection_profile_get_name(profile_h, &profile_name); - SETTING_TRACE("Record[%d] apn[%s], profile_id[%s], profile_name[%s], profile_type[%d], service_type[%d]", - cnt, apn, profile_id, profile_name, profile_type, service_type); - if (CONNECTION_PROFILE_TYPE_CELLULAR != profile_type) - continue; - -#if 0 - if (CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION != service_type) { - /*match with ServiceType */ - if (ServiceType == service_type) { - ad->sel_profile_h = profile_h; - found = TRUE; - break; - } - } else { /*the customer's profiles */ - if (0 == safeStrCmp(con_name_utf8, apn)) { - ad->sel_profile_h = profile_h; - found = TRUE; - break; - } - } -#endif - /*match with ServiceType */ - if (ServiceType == service_type) { - if (ServiceType == CONNECTION_CELLULAR_SERVICE_TYPE_MMS) { - - /*for MMS,it just have one profile */ - ad->sel_profile_h = profile_h; - found = TRUE; - break; - } else { - if (0 == safeStrCmp(con_name_utf8, profile_id)) { - ad->sel_profile_h = profile_h; - found = TRUE; - break; - } - } - } - - cnt++; - } - FREE(con_name_utf8); - ad->is_editable = TRUE; - if (found) { /*found sucessfully */ - SETTING_TRACE("found the following record:"); - SETTING_TRACE("\tapn:%s", apn); - SETTING_TRACE("\tprofile_id:%s", profile_id); - SETTING_TRACE("\tprofile_name:%s", profile_name); - SETTING_TRACE("\tservice_type:%d", service_type); - SETTING_TRACE("\tprofile_type:%d", profile_type); - ad->srvType = service_type; - ad->ed_profile_name_desc = profile_name; - - connection_profile_is_cellular_editable(ad->sel_profile_h, &(ad->is_editable)); - SETTING_TRACE("ad->is_editable:%d", ad->is_editable); - - /* load access name */ - connection_profile_get_cellular_apn(ad->sel_profile_h, &(ad->ed_acs_name_desc)); - connection_cellular_auth_type_e auth_type = CONNECTION_CELLULAR_AUTH_TYPE_NONE; - connection_profile_get_cellular_auth_info(ad->sel_profile_h, &auth_type, &(ad->ed_user_name_desc), &(ad->ed_pwd_desc)); - SETTING_TRACE(" ----> auth_type: (%d)", auth_type); - - ad->chkType = auth_type; - /*SETTING_TRACE("-----> radio button state: %d", elm_radio_value_get(ad->chk_type));*/ - SETTING_TRACE("----------------------> connection_profile_get_cellular_auth_info: %d", auth_type); - elm_radio_value_set(ad->chk_type, ad->chkType); - - switch (ad->chkType) { - case CONNECTION_CELLULAR_AUTH_TYPE_NONE: - ad->ed_auth_type_desc = _("IDS_ST_BODY_NONE"); - break; - case CONNECTION_CELLULAR_AUTH_TYPE_PAP: - ad->ed_auth_type_desc = _("IDS_ST_MBODY_PAP"); - break; - case CONNECTION_CELLULAR_AUTH_TYPE_CHAP: - ad->ed_auth_type_desc = _("IDS_ST_POP_CHAP"); - break; - default: - ad->chkType = CONNECTION_CELLULAR_AUTH_TYPE_NONE; - ad->ed_auth_type_desc = _("IDS_ST_BODY_NONE"); - break; - } - - - char *full_addr = NULL; - char *addr = NULL; - char *port = NULL; - /*Fix the Port 'NULL' issue when enter connection view repeatly.. */ - connection_profile_get_proxy_address(ad->sel_profile_h, CONNECTION_ADDRESS_FAMILY_IPV4, &full_addr); - SETTING_TRACE("full_addr: %s", full_addr); - char ProxyAddr[MAX_HOME_URL_LEN_MAX + 1] = {0,}; - safeCopyStr(ProxyAddr, full_addr, MAX_HOME_URL_LEN_MAX); - G_FREE(full_addr); - - /*several real format after removing "http://": */ - /* ":80", "1.1.1.1:80","1.1.1.1: ", "127.0.0.1/", "127.0.0.1" */ - full_addr = ProxyAddr; - int url_head_len = strlen(URL_HEAD); - if (0 == safeStrNCmp(full_addr, URL_HEAD, url_head_len)) { - full_addr += url_head_len; - } - addr = strsep(&full_addr, ":"); - if (NULL == full_addr) { /*format like "http://127.0.0.1/" or "http://127.0.0.1" */ - SETTING_TRACE("NULL == full_addr"); - addr = strsep(&addr, "/"); - } - - ad->ed_pxy_addr_desc = NULL; - /*proxy address support not only ip but also url, need not check the format */ - /*bool is_ip = is_ip_string(addr, &tmp); */ - if (!isEmptyStr(addr)) { - ad->ed_pxy_addr_desc = g_strdup(addr); - port = strsep(&full_addr, "/"); - } else { /*invalid format,let addr and port to be NULL. */ - addr = NULL; - } - SETTING_TRACE("addr:%s", addr); - SETTING_TRACE("port:%s", port); - SETTING_TRACE("ad->ed_pxy_addr_desc:%s", ad->ed_pxy_addr_desc); - /*ad->ed_pxy_addr_desc = g_strdup(addr); */ - ad->ed_pxy_port_desc = g_strdup(port); - // if (ad->con_type == NET_SERVICE_MMS) { /* Message Connection * / - if (!safeStrCmp(ad->con_name, STR_SETTING_MMS_CONNECTIONS)) { /* Message Connection */ - /*ad->ed_hm_url_desc = ad->prof_list[ad->prof_sel_idx].ProfileInfo.Pdp.HomeURL; */ - connection_profile_get_cellular_home_url(ad->sel_profile_h, &(ad->ed_hm_url_desc)); - } - } else { - SETTING_TRACE("Didn't find any record, to let add a new one:"); - ad->sel_profile_h = NULL; - ad->ed_auth_type_desc = _("IDS_ST_BODY_NONE"); - ad->chkType = CONNECTION_CELLULAR_AUTH_TYPE_NONE; - ad->srvType = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET; - } - - /*release the memory.. */ - G_FREE(apn); - G_FREE(profile_id); - /*G_FREE(profile_name); */ - return; -} - -static void __network_max_len_reached(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - retm_if(!elm_object_focus_get(obj), "Entry is not focused");/*notify only when entry is being focused on. */ - - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data; - list_item->maxLengthReachFlag = true; - - SETTING_TRACE("list_item->enterKeyPressFlag : %d", list_item->enterKeyPressFlag); - SettingNetworkUG *ad = list_item->userdata; - - // popup show - ad->popup = setting_create_popup(ad, ad->win_get, NULL, - "IDS_ST_TPOP_MAXIMUM_NUMBER_OF_CHARACTERS_REACHED", - NULL, 2, TRUE, FALSE, 0); -} - -/* - * Entry - activated callback (When 'Next' key in SIP touched) - */ -static void setting_network_connection_entry_next_activated_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data; - SettingNetworkUG *ad = list_item->userdata; - - Evas_Object *pObj_NextEntry = NULL; - - if (list_item == ad->data_profile_name) { - /* Profile name -> Access name */ - if (ad->data_acs_name) - pObj_NextEntry = ad->data_acs_name->eo_check; - } else if (list_item == ad->data_user_name) { - /* User name -> Password */ - if (ad->data_pwd) - pObj_NextEntry = ad->data_pwd->eo_check; - } else if (list_item == ad->data_pwd) { - /* Password -> Proxy address */ - if (ad->data_pxy_addr) - pObj_NextEntry = ad->data_pxy_addr->eo_check; - } else if (list_item == ad->data_pxy_addr) { - /* Proxy address -> Proxy port */ - if (ad->data_pxy_port) - pObj_NextEntry = ad->data_pxy_port->eo_check; - } else if (list_item == ad->data_pxy_port) { - /* Proxy port -> Home URL */ - if (ad->data_hm_url) - pObj_NextEntry = ad->data_hm_url->eo_check; - } else { - SETTING_TRACE_ERROR("list_item unknown"); - return; - } - - /* Hide & unfocus keypad */ - setting_hide_input_pannel_cb(list_item->eo_check); - - /* Focus */ - if (pObj_NextEntry != NULL) { - elm_object_focus_set(pObj_NextEntry, EINA_TRUE); - elm_entry_cursor_end_set(pObj_NextEntry); - } - - return; -} - -static void _init_context(void *cb) -{ - SETTING_TRACE_BEGIN; - ret_if(cb == NULL); - - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - - /* connection intializes */ - ad->data_profile_name = NULL; - ad->data_acs_name = NULL; - ad->data_auth_type = NULL; - ad->data_user_name = NULL; - ad->data_pwd = NULL; - ad->data_pxy_addr = NULL; - ad->data_pxy_port = NULL; - ad->data_hm_url = NULL; -} - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -static Evas_Object* ctxpopup; - -static void -ctxpopup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - evas_object_del(ctxpopup); - ctxpopup = NULL; -} - -static void -move_more_ctxpopup(Evas_Object *ctxpopup) -{ - SETTING_TRACE_BEGIN; - Evas_Object *win; - Evas_Coord w, h; - int pos = -1; - - /* We convince the top widget is a window */ - win = elm_object_top_widget_get(ctxpopup); - elm_win_screen_size_get(win, NULL, NULL, &w, &h); - pos = elm_win_rotation_get(win); - - switch (pos) { - case 0: - case 180: - evas_object_move(ctxpopup, (w / 2), h); - break; - case 90: - evas_object_move(ctxpopup, (h / 2), w); - break; - case 270: - evas_object_move(ctxpopup, (h / 2), w); - break; - } -} - -static void -naviframe_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - Evas_Object *ctxpopup = data; - move_more_ctxpopup(ctxpopup); -} - -static void -more_ctxpopup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - Evas_Object *nf = data; - evas_object_event_callback_del_full(nf, EVAS_CALLBACK_RESIZE, naviframe_resize_cb, ctxpopup); -} - -static void -win_rotation_changed_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - Evas_Object *ctxpopup = data; - move_more_ctxpopup(ctxpopup); -} - -/* Icon + Text (More button style : Naviframe Toolbar) */ -static void create_ctxpopup_more_button_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - SettingNetworkUG *ad = (SettingNetworkUG *) data; - //Evas_Object *it_obj; - Evas_Object *nf = ad->navi_bar; - Evas_Object *win; - //Elm_Object_Item *it; - - if (ctxpopup != NULL) { - evas_object_del(ctxpopup); - } - - ctxpopup = elm_ctxpopup_add(nf); - elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE); - elm_object_style_set(ctxpopup, "more/default"); - eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_BACK, eext_ctxpopup_back_cb, NULL); - eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_MORE, eext_ctxpopup_back_cb, NULL); - evas_object_smart_callback_add(ctxpopup, "dismissed", ctxpopup_dismissed_cb, NULL); - evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_DEL, more_ctxpopup_del_cb, nf); - evas_object_event_callback_add(nf, EVAS_CALLBACK_RESIZE, naviframe_resize_cb, ctxpopup); - - /* We convince the top widget is a window */ - win = elm_object_top_widget_get(nf); - evas_object_smart_callback_add(win, "rotation,changed", win_rotation_changed_cb, ctxpopup); - - //--------------------------------------------------------------------------------------------- - elm_ctxpopup_item_append(ctxpopup, _("IDS_ST_BODY_SAVE"), NULL, setting_network_connection_click_softkey_save_cb, ad); - elm_ctxpopup_item_append(ctxpopup, _("IDS_ST_BUTTON_CANCEL_ABB"), NULL, setting_network_connection_click_softkey_back_cb, ad); - //--------------------------------------------------------------------------------------------- - - elm_ctxpopup_direction_priority_set(ctxpopup, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN); - move_more_ctxpopup(ctxpopup); - evas_object_show(ctxpopup); -} -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - -static int setting_network_connection_create(void *cb) -{ - SETTING_TRACE_BEGIN; - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - setting_retvm_if(!ad->con_name, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER, "!ad->con_name") - - Evas_Object *scroller = elm_genlist_add(ad->win_main_layout); - retvm_if(scroller == NULL, SETTING_DRAW_ERR_FAIL_SCROLLER, - "Cannot set scroller object as contento of layout"); - elm_genlist_mode_set(scroller, ELM_LIST_COMPRESS); - elm_genlist_clear(scroller); /* first to clear list */ - evas_object_smart_callback_add(scroller, "realized", __gl_realized_cb, NULL); - - ad->con_create_gl = scroller; - - _init_context(ad); - - const char *title = NULL; - switch (ad->profile_service_type) { - case CONNECTION_CELLULAR_SERVICE_TYPE_MMS: - title = "IDS_ST_BODY_MMS_CONNECTIONS"; - break; - case CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET: - title = "IDS_ST_BODY_INTERNET_CONNECTION"; - break; - default: - title = ad->con_name; - break; - } - - ad->navi_it = setting_push_layout_navi_bar(_(title), - NULL, /* ARROW STYLE */ - _("IDS_ST_BODY_SAVE"), - _("IDS_ST_BUTTON_CANCEL_ABB"), - setting_network_connection_click_softkey_back_cb, - setting_network_connection_click_softkey_save_cb, - setting_network_connection_click_softkey_cancel_cb, /* setting_network_connection_click_softkey_back_cb, */ - ad, scroller, ad->navi_bar, NULL); - - elm_naviframe_item_pop_cb_set(ad->navi_it, setting_network_connection_click_softkey_back_cb, ad); - evas_object_data_set(ad->navi_bar, "sip.naviframe.title_obj", "*"); - - - // Add ctx popup handler - Evas_Object* btn = elm_button_add(ad->navi_bar); - elm_object_style_set(btn, "naviframe/more/default"); - evas_object_smart_callback_add(btn, "clicked", create_ctxpopup_more_button_cb, ad); - elm_object_item_part_content_set(ad->navi_it, "toolbar_more_btn", btn); - - retv_if(!ad->navi_it, SETTING_RETURN_FAIL); - ad->has_form_changed = FALSE; - - setting_enable_expandable_genlist(scroller, ad, - __setting_network_connection_exp_cb, - NULL); - __get_connection_info(ad); - Elm_Object_Item *item; - - item = - elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - - - if (!safeStrCmp(STR_SETTING_NEW_CONNECTIONS, ad->con_name)) { /*new a profile,need to select the "Service type" */ - ad->data_srv_type = - setting_create_Gendial_exp_parent_field(scroller, - &itc_2text_3_parent, - NULL, NULL, - SWALLOW_Type_INVALID, - _("IDS_MSGF_BODY_SERVICE_TYPE"), - _("IDS_ST_BODY_INTERNET_CONNECTION")); - /* ad->data_auth_type->int_slp_setting_binded = INT_SLP_SETTING_INVALID; */ - if (ad->data_srv_type) { - ad->data_srv_type->userdata = ad; - __BACK_POINTER_SET(ad->data_srv_type); - } else { - SETTING_TRACE_ERROR("ad->data_auth_type is NULL"); - } - } - - ad->ed_profile_name_desc = elm_entry_utf8_to_markup(ad->ed_profile_name_desc); - ad->ed_acs_name_desc = elm_entry_utf8_to_markup(ad->ed_acs_name_desc); - SETTING_TRACE("name :%s", ad->ed_profile_name_desc); - SETTING_TRACE("apn :%s", ad->ed_acs_name_desc); - - /* [UI] Profile name */ - if (!isEmptyStr(ad->ed_profile_name_desc)) { - /* Display */ - ad->data_profile_name = - setting_create_Gendial_field_def(scroller, - &itc_multiline_2text, - NULL, - ad, - SWALLOW_Type_INVALID, - NULL, - NULL, - 0, /* chk_status*/ - "IDS_ST_BODY_PROFILE_NAME", - (char *)ad->ed_profile_name_desc, /* sub_desk*/ - NULL); - } else { - /* Editor */ - ad->data_profile_name = - setting_create_Gendial_field_entry_with_return_key(scroller, - &itc_editfield, NULL, - ad, SWALLOW_Type_LAYOUT_EDITFIELD, - NULL, NULL, 0, - "IDS_ST_BODY_PROFILE_NAME", - (char *)ad->ed_profile_name_desc, - setting_network_connection_entry_changed_cb, - __network_max_len_reached, - ELM_INPUT_PANEL_LAYOUT_NORMAL, - FALSE, FALSE, - 64, 64, NULL, NULL, ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT, setting_network_connection_entry_next_activated_cb, NULL); - } - - if (ad->data_profile_name) { - __BACK_POINTER_SET(ad->data_profile_name); - ad->data_profile_name->userdata = ad; - ad->data_profile_name->win_main = ad->win_get; - ad->data_profile_name->isSinglelineFlag = TRUE; - /*there is no CAPI to set profile name,so disable it: */ - /*setting_disable_genlist_item(ad->data_profile_name->item); */ - if (!isEmptyStr(ad->ed_profile_name_desc)) { /*not create(first time) */ - elm_genlist_item_select_mode_set(ad->data_profile_name->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - - /*setting_disable_genlist_item(ad->data_profile_name->item); */ - } - } else { - SETTING_TRACE_ERROR("ad->data_acs_name is NULL"); - } - - /* [UI] Access point name */ - ad->data_acs_name = - setting_create_Gendial_field_entry_with_return_key(scroller, - &itc_editfield, NULL, - ad, SWALLOW_Type_LAYOUT_EDITFIELD, - NULL, NULL, 0, - "IDS_DLNA_BODY_ACCESS_POINT_NAME", - (char *)ad->ed_acs_name_desc, - setting_network_connection_entry_changed_cb, - __network_max_len_reached, - ELM_INPUT_PANEL_LAYOUT_NORMAL, - FALSE, FALSE, - 64, 64, NULL, NULL, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE, NULL, NULL); - if (ad->data_acs_name) { - __BACK_POINTER_SET(ad->data_acs_name); - ad->data_acs_name->userdata = ad; - ad->data_acs_name->isSinglelineFlag = TRUE; - ad->data_acs_name->win_main = ad->win_get; - } else { - SETTING_TRACE_ERROR("ad->data_acs_name is NULL"); - } - - item = - elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - - ad->data_auth_type = - setting_create_Gendial_field_def(scroller, - &itc_2text_3_parent, - __create_auth_type_popup, ad, - SWALLOW_Type_INVALID, - NULL, NULL, 0, - "IDS_ST_BODY_AUTH_TYPE", - (char *)ad->ed_auth_type_desc, NULL); - /* ad->data_auth_type->int_slp_setting_binded = INT_SLP_SETTING_INVALID; */ - if (ad->data_auth_type) { - ad->data_auth_type->userdata = ad; - __BACK_POINTER_SET(ad->data_auth_type); - } else { - SETTING_TRACE_ERROR("ad->data_auth_type is NULL"); - } - - ad->item_above_user_name = item = - elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - - ad->is_show_user = 0; - if (CONNECTION_CELLULAR_AUTH_TYPE_NONE != ad->chkType) { - /* [UI] User ID */ - ad->data_user_name = - setting_create_Gendial_field_entry_with_return_key(scroller, - &itc_editfield, - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - NULL, NULL, 0, - KeyStr_UserID, - (char *) - ad->ed_user_name_desc, - setting_network_connection_entry_changed_cb, - __network_max_len_reached, - ELM_INPUT_PANEL_LAYOUT_NORMAL, - FALSE, FALSE, - MAX_PDP_AUTH_USERNAME_LEN_MAX, MAX_PDP_AUTH_USERNAME_LEN_MAX, - NULL, NULL, ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT, setting_network_connection_entry_next_activated_cb, NULL); - if (ad->data_user_name) { - __BACK_POINTER_SET(ad->data_user_name); - ad->data_user_name->userdata = ad; - ad->data_user_name->isSinglelineFlag = TRUE; - ad->data_user_name->win_main = ad->win_get; - } else { - SETTING_TRACE_ERROR("ad->data_user_name is NULL"); - } - - /* [UI] Password */ - ad->data_pwd = - setting_create_Gendial_field_entry_with_return_key(scroller, - &itc_editfield, - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - NULL, NULL, 0, - "IDS_ST_BODY_PASSWORD", - (char *)ad->ed_pwd_desc, - setting_network_connection_entry_changed_cb, - __network_max_len_reached, - ELM_INPUT_PANEL_LAYOUT_NORMAL, - TRUE, FALSE, - MAX_PDP_AUTH_USERNAME_LEN_MAX, MAX_PDP_AUTH_USERNAME_LEN_MAX, - NULL, NULL, ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT, setting_network_connection_entry_next_activated_cb, NULL); - if (ad->data_pwd) { - __BACK_POINTER_SET(ad->data_pwd); - ad->data_pwd->userdata = ad; - ad->data_pwd->win_main = ad->win_get; - ad->data_pwd->isSinglelineFlag = TRUE; - ad->is_show_user = 1; - } else { - SETTING_TRACE_ERROR("ad->data_pwd is NULL"); - } - - ad->item_above_proxy_add = item = - elm_genlist_item_append(scroller, &itc_seperator, - NULL, NULL, ELM_GENLIST_ITEM_NONE, - NULL, NULL); - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - } - - /* [UI] Proxy address */ - ad->data_pxy_addr = - setting_create_Gendial_field_entry_with_return_key(scroller, - &itc_editfield, NULL, - ad, SWALLOW_Type_LAYOUT_EDITFIELD, - NULL, NULL, 0, - "IDS_ST_BODY_CONNECTIONSETTINGS_PROXY_ADDRESS", - (char *)ad->ed_pxy_addr_desc, - setting_network_connection_entry_changed_cb, - __network_max_len_reached, - ELM_INPUT_PANEL_LAYOUT_URL, - FALSE, FALSE, - 512, 512, NULL, NULL, ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT, setting_network_connection_entry_next_activated_cb, NULL); - if (ad->data_pxy_addr) { - __BACK_POINTER_SET(ad->data_pxy_addr); - ad->data_pxy_addr->userdata = ad; - ad->data_pxy_addr->isSinglelineFlag = TRUE; - ad->data_pxy_addr->win_main = ad->win_get; - } else { - SETTING_TRACE_ERROR("ad->data_pxy_addr is NULL"); - } - - /* Set SIP key on Next or Done if Home URL existed or not below. */ - Elm_Input_Panel_Return_Key_Type type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE; - setting_call_back_func cbFunc = NULL; - - if (!safeStrCmp(ad->con_name, STR_SETTING_MMS_CONNECTIONS)) { - type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT; - cbFunc = setting_network_connection_entry_next_activated_cb; - //SETTING_TRACE_ERROR("Enter here hwy ---> ad->con_name : %s ", ad->con_name); - } - - /* [UI] Proxy port */ - ad->data_pxy_port = - setting_create_Gendial_field_entry_with_return_key(scroller, - &itc_editfield, NULL, - ad, SWALLOW_Type_LAYOUT_EDITFIELD, - NULL, NULL, 0, - "IDS_ST_BODY_PROXY_PORT", - (char *)ad->ed_pxy_port_desc, - setting_network_connection_entry_changed_cb, - __network_max_len_reached, - ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, - FALSE, FALSE, - 0, - 5, "0123456789", NULL, type, cbFunc, NULL); - if (ad->data_pxy_port) { - ad->data_pxy_port->userdata = ad; - ad->data_pxy_port->isSinglelineFlag = TRUE; - __BACK_POINTER_SET(ad->data_pxy_port); - ad->data_pxy_port->win_main = ad->win_get; - } else { - SETTING_TRACE_ERROR("ad->data_pxy_port is NULL"); - } - - - // if current view is "MMS connection" - if (!safeStrCmp(ad->con_name, STR_SETTING_MMS_CONNECTIONS)) { /* mms Connection */ - - #if 0 - if (ad->data_pxy_port) { - ad->data_pxy_port->return_key_type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT; - //SETTING_TRACE_ERROR("ad->data_pxy_port->return_key_type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT"); - } - #endif - /* [UI] Home URL */ - ad->data_hm_url = - setting_create_Gendial_field_entry_with_return_key(scroller, - &itc_editfield, - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - NULL, NULL, 0, - "IDS_ST_BODY_HOME_URL", - (char *)ad->ed_hm_url_desc, - setting_network_connection_entry_changed_cb, - __network_max_len_reached, - ELM_INPUT_PANEL_LAYOUT_URL, - FALSE, FALSE, - 0, 521, NULL, NULL, - ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE, NULL, NULL); - if (ad->data_hm_url) { - __BACK_POINTER_SET(ad->data_hm_url); - ad->data_hm_url->userdata = ad; - ad->data_hm_url->isSinglelineFlag = TRUE; - ad->data_hm_url->win_main = ad->win_get; - ad->data_hm_url->return_key_type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE; - } else { - SETTING_TRACE_ERROR("ad->data_hm_url is NULL"); - } - /* ad->is_show_url = 1; */ - } - - setting_view_network_connection_create.is_create = 1; - ad->scl_edit = scroller; - /*__genlist_disable_set(ad->scl_edit, TRUE); */ - /*ad->is_editable = FALSE; for test */ - SETTING_TRACE("==> ad->is_editable:%d", ad->is_editable); - if (!ad->is_editable) { - /*SETTING_TRACE("xxxx....."); */ - if (ad->data_srv_type) setting_disable_genlist_item(ad->data_srv_type->item); - if (ad->data_profile_name) setting_disable_genlist_item(ad->data_profile_name->item); - if (ad->data_acs_name) setting_disable_genlist_item(ad->data_acs_name->item); - if (ad->data_auth_type) setting_disable_genlist_item(ad->data_auth_type->item); - - - if (ad->data_user_name) setting_disable_genlist_item(ad->data_user_name->item); - if (ad->data_pwd) setting_disable_genlist_item(ad->data_pwd->item); - if (ad->data_pxy_addr) setting_disable_genlist_item(ad->data_pxy_addr->item); - if (ad->data_pxy_port) setting_disable_genlist_item(ad->data_pxy_port->item); - if (ad->data_hm_url) setting_disable_genlist_item(ad->data_hm_url->item); - } - ecore_idler_add(__connection_idler, ad); - - return SETTING_RETURN_SUCCESS; -} - -static int setting_network_connection_destroy(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - - evas_object_data_set(ad->navi_bar, "sip.naviframe.title_obj", NULL); - ad->navi_it = NULL; - ad->bottom_btn = NULL; - ad->back_btn = NULL; - /*manager separatly, */ - if (ad->l_button) { - evas_object_del(ad->l_button); - ad->l_button = NULL; - } - /*if (ad->m_button) - { - evas_object_del(ad->m_button); - ad->m_button = NULL; - }*/ - if (ad->r_button) { - evas_object_del(ad->r_button); - ad->r_button = NULL; - } - /*FREE(ad->con_name); */ - G_FREE(ad->ed_profile_name_desc); - G_FREE(ad->ed_acs_name_desc); - G_FREE(ad->ed_user_name_desc); - G_FREE(ad->ed_pwd_desc); - - G_FREE(ad->ed_pxy_addr_desc); - G_FREE(ad->ed_pxy_port_desc); - - G_FREE(ad->ed_hm_url_desc); - - elm_naviframe_item_pop(ad->navi_bar); - - setting_view_network_connection_create.is_create = 0; - return SETTING_RETURN_SUCCESS; -} - -static int setting_network_connection_update(void *cb) -{ - SETTING_TRACE_BEGIN; - return SETTING_RETURN_SUCCESS; -} - -static int setting_network_connection_cleanup(void *cb) -{ - return setting_network_connection_destroy(cb); -} - -/* *************************************************** - * - *general func - * - ***************************************************/ -bool need_check_default_profile(void *data, connection_cellular_service_type_e inputtype) -{ - retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - SETTING_TRACE("inputtype:%d", inputtype); - connection_profile_iterator_h profile_iter = NULL; - connection_profile_h profile_h = NULL; - int rv = connection_get_profile_iterator(ad->connection, CONNECTION_ITERATOR_TYPE_REGISTERED, &profile_iter); - if (rv != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get profile iterator [%d]", rv); - return SETTING_RETURN_FAIL; - } - - int cnt = 0; - connection_profile_type_e profile_type = CONNECTION_PROFILE_TYPE_CELLULAR; - connection_cellular_service_type_e service_type = CONNECTION_CELLULAR_SERVICE_TYPE_UNKNOWN; - while (connection_profile_iterator_has_next(profile_iter)) { - if (cnt >= MAX_PROFILE_NUM) { - break; - } - cnt++; - if (connection_profile_iterator_next(profile_iter, &profile_h) != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get profile handle"); - break; - } - - if (connection_profile_get_type(profile_h, &profile_type) != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get profile type"); - continue; - } - if (connection_profile_get_cellular_service_type(profile_h, &service_type) != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get service type"); - continue; - } - if (CONNECTION_PROFILE_TYPE_CELLULAR == profile_type && inputtype == service_type) { - char *apn = NULL; - connection_profile_get_cellular_apn(profile_h, &apn); - SETTING_TRACE("Matched:%s", apn); - FREE(apn); - return FALSE; - } - } - return TRUE; -} - -/** - * popup - timeout and 'ok' callback - */ -static void __setting_network_connection_popup_rsp_cb(void *data, Evas_Object *obj, void *event_info) -{ - - SETTING_TRACE_BEGIN; - setting_retm_if(obj == NULL, "obj parameter is NULL"); - setting_retm_if(data == NULL, "Data parameter is NULL"); - //SettingNetworkUG *ad = (SettingNetworkUG *) data; - - // remove ctxpopup - if (ctxpopup != NULL) { - evas_object_del(ctxpopup); - ctxpopup = NULL; - } -} - - - -static int __save_connection(void *data) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - const char *profile_name = NULL; - const char *acs_name = NULL; - const char *usr_name = NULL; - const char *pwd = NULL; - const char *addr = NULL; - const char *port = NULL; - const char *home = NULL; - - if (ad->data_profile_name) - profile_name = elm_entry_markup_to_utf8(ad->data_profile_name->sub_desc); - if (ad->data_acs_name) - acs_name = elm_entry_markup_to_utf8(ad->data_acs_name->sub_desc); - if (ad->data_user_name) - usr_name = elm_entry_markup_to_utf8(ad->data_user_name->sub_desc); - if (ad->data_pwd) - pwd = elm_entry_markup_to_utf8(ad->data_pwd->sub_desc); - if (ad->data_pxy_addr) - addr = elm_entry_markup_to_utf8(ad->data_pxy_addr->sub_desc); - if (ad->data_pxy_port) - port = elm_entry_markup_to_utf8(ad->data_pxy_port->sub_desc); - - if (!profile_name) - profile_name = strdup(""); - if (!acs_name) - acs_name = strdup(""); - if (!usr_name) - usr_name = strdup(""); - if (!pwd) - pwd = strdup(""); - if (!addr) - addr = strdup(""); - if (!port) - port = strdup(""); - SETTING_TRACE("acs_name:%s", acs_name); - SETTING_TRACE("usr_name:%s", usr_name); - SETTING_TRACE("pwd:%s", pwd); - - SETTING_TRACE("addr:%s", addr); - SETTING_TRACE("port:%s", port); - SETTING_TRACE("home:%s", home); - - char sz_text[MAX_HOME_URL_LEN_MAX + 1] = { 0, }; - int type; - int ret = SETTING_RETURN_SUCCESS; - int err; - - if (!safeStrCmp(profile_name, "")) { - - char name[MAX_DISPLAY_NAME_LEN_ON_UI + 1] = {0, }; - snprintf(name, sizeof(name), _("IDS_ST_POP_ENTER_PS"), _("IDS_ST_BODY_PROFILE_NAME")); - - - setting_create_popup(ad, ad->win_get, NULL, _(name), __setting_network_connection_popup_rsp_cb, 2/*SECONDS*/, false, false, 0); - FREE(acs_name); - FREE(profile_name); - FREE(usr_name); - FREE(pwd); - FREE(addr); - FREE(port); - return SETTING_DNET_RETURN_NULL_ACCESS_NAME; - } - - if (!safeStrCmp(acs_name, "")) { - - char name[MAX_DISPLAY_NAME_LEN_ON_UI + 1] = {0, }; - snprintf(name, sizeof(name), _("IDS_ST_POP_ENTER_PS"), _("IDS_DLNA_BODY_ACCESS_POINT_NAME")); - setting_create_popup(ad, ad->win_get, NULL, _(name), __setting_network_connection_popup_rsp_cb, 2/*SECONDS*/, false, false, 0); - FREE(acs_name); - FREE(profile_name); - FREE(usr_name); - FREE(pwd); - FREE(addr); - FREE(port); - return SETTING_DNET_RETURN_NULL_ACCESS_NAME; - } - /*if (test_update_cellular_info(profile) == -1) */ - bool add_flag = FALSE;/*add a new profile */ - connection_profile_h con_info = NULL; - connection_profile_h con_info_2 = NULL;/*for MMS */ - if (ad->sel_profile_h) { - con_info = ad->sel_profile_h; - if (0 != safeStrCmp(ad->con_name, STR_SETTING_MMS_CONNECTIONS) - && 0 != safeStrCmp(ad->con_name, "IDS_ST_BODY_INTERNET_CONNECTION")) { - /*need to change con_name */ - /*FREE(ad->con_name); */ - /*ad->con_name = strdup(acs_name); */ - } - } else { - if (!safeStrCmp(ad->con_name, STR_SETTING_MMS_CONNECTIONS)) { - (void)connection_profile_create(CONNECTION_PROFILE_TYPE_CELLULAR, _(profile_name), &con_info); - (void)connection_profile_set_cellular_service_type(con_info, CONNECTION_CELLULAR_SERVICE_TYPE_MMS); - } else if (!safeStrCmp(ad->con_name, "IDS_ST_BODY_INTERNET_CONNECTION")) { - (void)connection_profile_create(CONNECTION_PROFILE_TYPE_CELLULAR, _(profile_name), &con_info); - (void)connection_profile_set_cellular_service_type(con_info, CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET); - } else { - /*need to change con_name */ - /*FREE(ad->con_name); */ - /*ad->con_name = strdup(acs_name); */ - (void)connection_profile_create(CONNECTION_PROFILE_TYPE_CELLULAR, _(profile_name), &con_info); - if (CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET == ad->srvType) { - /*Internet */ - (void)connection_profile_set_cellular_service_type(con_info, CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET); - } else if (CONNECTION_CELLULAR_SERVICE_TYPE_MMS == ad->srvType) { - /*MMS */ - (void)connection_profile_set_cellular_service_type(con_info, CONNECTION_CELLULAR_SERVICE_TYPE_MMS); - } else { /*MMS + Internet(Together) */ - (void)connection_profile_set_cellular_service_type(con_info, CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET); - (void)connection_profile_create(CONNECTION_PROFILE_TYPE_CELLULAR, _(profile_name), &con_info_2); - (void)connection_profile_set_cellular_service_type(con_info_2, CONNECTION_CELLULAR_SERVICE_TYPE_MMS); - SETTING_TRACE("con_info_2:%p", con_info_2); - } - } - - add_flag = TRUE; - } - - SETTING_TRACE("ad->con_name:%s", ad->con_name); - SETTING_TRACE("profile_name:%s", profile_name); - FREE(profile_name); - /* save access name */ - SETTING_TRACE("acs_name:%s", acs_name); - - (void) connection_profile_set_cellular_apn(con_info, acs_name); - if (con_info_2)(void)connection_profile_set_cellular_apn(con_info_2, acs_name); - FREE(acs_name); - - /* save auth type */ - type = ad->chkType; - SETTING_TRACE("-----> auth type: %d", type); - SETTING_TRACE("-----> radio button state: %d", elm_radio_value_get(ad->chk_type)); - -#ifdef OLD_AUTH_CONCEPT - /* save user name */ - if (!safeStrCmp(usr_name, "") - && CONNECTION_CELLULAR_AUTH_TYPE_NONE != type) { - setting_create_popup(ad, ad->win_get, - NULL, _(Insert_User_Name_Desc), __setting_network_connection_popup_rsp_cb, 2/*SECONDS*/, false, false, 0); - FREE(usr_name); - FREE(pwd); - FREE(addr); - FREE(port); - return SETTING_DNET_RETURN_NULL_USER_NAME; - } - - /* save password */ - if (!safeStrCmp(pwd, "") - && CONNECTION_CELLULAR_AUTH_TYPE_NONE != type) { - setting_create_popup(ad, ad->win_get, - NULL, _(""), __setting_network_connection_popup_rsp_cb,2/*SECONDS*/, false, false, 0);/*this code is not used now, so remove the ID which is not used in po file*/ - FREE(usr_name); - FREE(pwd); - FREE(addr); - FREE(port); - return SETTING_DNET_RETURN_NULL_PASSWORD; - } -#endif - (void)connection_profile_set_cellular_auth_info(con_info, type, usr_name, pwd); - if (con_info_2)(void)connection_profile_set_cellular_auth_info(con_info_2, type, usr_name, pwd); - - /* save proxy addr */ - SETTING_TRACE("addr:port[%s:%s]", addr, port); - char *output_addr = NULL; - if (isEmptyStr(addr)) { - /* check proxy port */ - if (!isEmptyStr(port)) { - setting_create_popup(ad, ad->win_get, - NULL, _("IDS_COM_BODY_ENTER_PROXY_EMPTY"), __setting_network_connection_popup_rsp_cb, 2/*SECONDS*/, false, false, 0); - FREE(usr_name); - FREE(pwd); - FREE(addr); - FREE(port); - return SETTING_DNET_RETURN_INVALID_PROXY_ADDR; - } - } else { - output_addr = g_strdup(addr); - if (isEmptyStr(port)) { - snprintf(sz_text, sizeof(sz_text), "%s", output_addr); - } else { - snprintf(sz_text, sizeof(sz_text), "%s:%s", output_addr, port); - } - } - - G_FREE(output_addr); - SETTING_TRACE("sz_text:%s", sz_text); - if (!isEmptyStr(sz_text)) { - connection_profile_set_proxy_address(con_info, CONNECTION_ADDRESS_FAMILY_IPV4, sz_text); - if (con_info_2) { - connection_profile_set_proxy_address(con_info_2, CONNECTION_ADDRESS_FAMILY_IPV4, sz_text); - } - } else { - connection_profile_set_proxy_address(con_info, CONNECTION_ADDRESS_FAMILY_IPV4, NULL); - if (con_info_2) { - connection_profile_set_proxy_address(con_info_2, CONNECTION_ADDRESS_FAMILY_IPV4, NULL); - } - } - /* save home url(message connection only) */ - if (!safeStrCmp(ad->con_name, STR_SETTING_MMS_CONNECTIONS) - || (!safeStrCmp(ad->con_name, STR_SETTING_NEW_CONNECTIONS) - && CONNECTION_CELLULAR_SERVICE_TYPE_MMS == ad->srvType)) { /* Message Connection */ - home = elm_entry_markup_to_utf8(ad->data_hm_url->sub_desc); - if (home == (char *)NULL) { - (void)connection_profile_set_cellular_home_url(con_info, URL_HEAD); - } else { - if (!safeStrCmp(home, "")) { - FREE(home); - home = strdup(URL_HEAD); - ret = SETTING_DNET_RETURN_NULL_HOMEURL; - } - (void)connection_profile_set_cellular_home_url(con_info, home); - } - } - FREE(home); - if (con_info_2) { /*creating both internet + MMS */ - home = elm_entry_markup_to_utf8(ad->data_hm_url->sub_desc); - if (home == (char *)NULL) { - (void)connection_profile_set_cellular_home_url(con_info_2, URL_HEAD); - } else { - if (!safeStrCmp(home, "")) { - FREE(home); - home = strdup(URL_HEAD); - ret = SETTING_DNET_RETURN_NULL_HOMEURL; - } - (void)connection_profile_set_cellular_home_url(con_info_2, home); - } - } - - FREE(usr_name); - FREE(pwd); - FREE(addr); - FREE(port); - FREE(home); - /*SETTING_TRACE("ad->con_type:%d", ad->con_type); */ - /* save connection */ - if (add_flag) { - SETTING_TRACE("con_info is %p, con_info_2:%p", con_info, con_info_2); - - /*Add a new profile */ - connection_cellular_service_type_e type = CONNECTION_CELLULAR_SERVICE_TYPE_UNKNOWN; - (void)connection_profile_get_cellular_service_type(con_info, &type); - - err = connection_add_profile(ad->connection, con_info); - if (err != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("*** [ERR] connection_add_profile. err=%d ***", err); - ret = SETTING_DNET_RETURN_ERR; - setting_create_popup(ad, ad->win_get, NULL, _("IDS_CST_POP_FAILED"), NULL, 0, false, false, 0); - return ret; - } - connection_profile_h tmp_profile = NULL; - (void)connection_get_default_cellular_service_profile(ad->connection, type, &tmp_profile); - /* - => if there is already default profile, after_profile will be handle of default profile. - => there is no default profile, after_profile will be handle of the profile which we have added just before. - */ - if (setting_network_equal_profile(con_info, tmp_profile)) { - SETTING_TRACE_ERROR("Going to set profile") - (void)connection_set_default_cellular_service_profile(ad->connection, type, tmp_profile); - } else { - /*nothing to do */ - } - - (void)connection_destroy(tmp_profile); - - (void)connection_profile_destroy(con_info); - - - - if (con_info_2) { /*just for MMS + internet */ - connection_cellular_service_type_e type = CONNECTION_CELLULAR_SERVICE_TYPE_UNKNOWN; - (void)connection_profile_get_cellular_service_type(con_info_2, &type); - /*Add a new profile */ - err = connection_add_profile(ad->connection, con_info_2); - if (err != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("*** [ERR] connection_add_profile. err=%d ***", err); - ret = SETTING_DNET_RETURN_ERR; - setting_create_popup(ad, ad->win_get, NULL, _("IDS_CST_POP_FAILED"), NULL, 0, false, false, 0); - return ret; - } - connection_profile_h tmp_profile = NULL; - (void)connection_get_default_cellular_service_profile(ad->connection, type, &tmp_profile); - /* - => if there is already default profile, after_profile will be handle of default profile. - => there is no default profile, after_profile will be handle of the profile which we have added just before. - */ - if (setting_network_equal_profile(con_info_2, tmp_profile)) { - SETTING_TRACE_ERROR("Going to set profile") - (void)connection_set_default_cellular_service_profile(ad->connection, type, tmp_profile); - } else { - /*nothing to do */ - } - - (void)connection_destroy(tmp_profile); - (void)connection_profile_destroy(con_info_2); - } - } else { - - err = connection_update_profile(ad->connection, con_info); - if (err != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR - ("%s*** [ERR] net_modify_profile. err=%d ***%s", - SETTING_FONT_RED, err, SETTING_FONT_BLACK); - ret = SETTING_DNET_RETURN_ERR; - setting_create_popup(ad, ad->win_get, - NULL, _("IDS_CST_POP_FAILED"), NULL, 0, false, false, 0); - } - } - return ret; -} - -/* *************************************************** - * - *call back func - * - ***************************************************/ -#if 0 -static void -setting_network_connection_click_softkey_done_cb(void *data, - Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(data == NULL, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - if (ad->data_profile_name) { - setting_hide_input_pannel_cb(ad->data_profile_name->eo_check); - } - - if (ad->data_acs_name) { - setting_hide_input_pannel_cb(ad->data_acs_name->eo_check); - } - if (ad->data_user_name) { - setting_hide_input_pannel_cb(ad->data_user_name->eo_check); - } - if (ad->data_pwd) { - setting_hide_input_pannel_cb(ad->data_pwd->eo_check); - } - if (ad->data_pxy_addr) { - setting_hide_input_pannel_cb(ad->data_pxy_addr->eo_check); - } - if (ad->data_pxy_port) { - setting_hide_input_pannel_cb(ad->data_pxy_port->eo_check); - } - if (ad->data_hm_url) { - setting_hide_input_pannel_cb(ad->data_hm_url->eo_check); - } -} -#endif - -static void __save_response_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - if (obj) { - evas_object_del(obj); - obj = NULL; - } - /*re-fetch connection info.. */ - /*__get_connection_info(ad); */ - SETTING_TRACE("ad->con_name:%s", ad->con_name); - - ad->apn_MMS = __get_profile_name(CONNECTION_CELLULAR_SERVICE_TYPE_MMS, ad); - - elm_naviframe_item_pop(ad->navi_bar); /* Call automatically setting_network_connection_click_softkey_back_cb() by registering elm_naviframe_item_pop_cb_set() */ -} - -/** - * [UI-CALLBACK] 'Save' button handler - */ -static void -setting_network_connection_click_softkey_save_cb(void *data, - Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(data == NULL, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - int ret = __save_connection(ad); - /* need special handle */ - if (SETTING_DNET_RETURN_NULL_ACCESS_NAME == ret - || SETTING_DNET_RETURN_NULL_USER_NAME == ret - || SETTING_DNET_RETURN_NULL_PASSWORD == ret - || SETTING_DNET_RETURN_INVALID_PROXY_ADDR == ret - || SETTING_DNET_RETURN_ERR == ret) { - return; - } - if (ret != SETTING_RETURN_SUCCESS) { - SETTING_TRACE_ERROR - ("%s*** [ERR] __save_connection ***%s", - SETTING_FONT_RED, SETTING_FONT_BLACK); - } - - elm_object_tree_focus_allow_set(ad->con_create_gl, EINA_FALSE); - - setting_create_popup(ad, ad->win_get, NULL, KeyStr_Saved, __save_response_cb, 1, FALSE, FALSE, 0); - - if (ctxpopup != NULL) { - evas_object_del(ctxpopup); - ctxpopup = NULL; - } -} - - -static Eina_Bool -setting_network_connection_click_softkey_back_cb(void *data, Elm_Object_Item *it) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retvm_if(data == NULL, EINA_TRUE, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - elm_object_tree_focus_allow_set(ad->con_create_gl, EINA_FALSE); - - SETTING_TRACE("ad->con_name:%s", ad->con_name); - if (!safeStrCmp(STR_SETTING_NEW_CONNECTIONS, ad->con_name) - || ad->profile_topper_view == &setting_view_network_con) { /*new a profile,need to select the "Service type" */ - /*not normal view change,need do specially */ - setting_view_cleanup(&setting_view_network_connection_create, ad); - setting_view_update(&setting_view_network_con, ad); - } else { - setting_view_change(&setting_view_network_connection_create, &setting_view_network_con_list, ad); - } - - if (ctxpopup != NULL) { - evas_object_del(ctxpopup); - ctxpopup = NULL; - } - - return EINA_TRUE; -} - -static void -setting_network_connection_click_softkey_cancel_cb(void *data, - Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(data == NULL, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - elm_naviframe_item_pop(ad->navi_bar); /* Call automatically setting_network_connection_click_softkey_back_cb() by registering elm_naviframe_item_pop_cb_set() */ -} - -static void setting_network_connection_check_entry_empty(SettingNetworkUG *ad) -{ - SETTING_TRACE_BEGIN; - if (!ad->has_form_changed) { - SETTING_TRACE_DEBUG("ad->has_form_changed == FALSE!"); - return; - } - bool isFoundEmptyEntry = FALSE; - - do { - if (ad->data_profile_name && isEmptyStr(ad->data_profile_name->sub_desc)) { - /*SETTING_TRACE("entry_str:%s", ad->data_profile_name->sub_desc); */ - isFoundEmptyEntry = TRUE; - break; - } - if (ad->data_acs_name && isEmptyStr(ad->data_acs_name->sub_desc)) { - /*SETTING_TRACE("entry_str:%s", ad->data_acs_name->sub_desc); */ - isFoundEmptyEntry = TRUE; - break; - } - if (ad->data_user_name && isEmptyStr(ad->data_user_name->sub_desc)) { - /*SETTING_TRACE("entry_str:%s", ad->data_user_name->sub_desc); */ - isFoundEmptyEntry = TRUE; - break; - } - if (ad->data_pwd && isEmptyStr(ad->data_pwd->sub_desc)) { - /*SETTING_TRACE("entry_str:%s", ad->data_pwd->sub_desc); */ - isFoundEmptyEntry = TRUE; - break; - } - if (ad->data_hm_url && isEmptyStr(ad->data_hm_url->sub_desc)) { - /*SETTING_TRACE("entry_str:%s", ad->data_hm_url->sub_desc); */ - isFoundEmptyEntry = TRUE; - break; - } - } while (0); - Evas_Object *done_btn = elm_object_item_part_content_get(ad->navi_it, NAVI_BTN_STYLE_LEFT); - if (isFoundEmptyEntry) { - if (!evas_object_pass_events_get(done_btn)) {/*it had not yet been disabled */ - setting_disable_evas_object(done_btn); - setting_dim_evas_object(done_btn, TRUE); - } else { - /*do nothing..if invoke setting_dim_evas_object many times, the done button will be dimer until it cannot be see. */ - /*refer to the API of setting_dim_evas_object(). The API is supplied by Setting itself, winset doesn't support until now as I now. */ - } - } else { - setting_enable_evas_object(done_btn); - setting_undo_dim_evas_object(done_btn, TRUE); - } -} - -static void -setting_network_connection_display_auth_type(SettingNetworkUG *ad, - int auth_type) -{ - SETTING_TRACE_BEGIN; - retm_if(ad == NULL, "Data parameter is NULL"); - if (ad->chkType == auth_type) return; - - ad->chkType = auth_type; /* for update genlist */ - if (CONNECTION_CELLULAR_AUTH_TYPE_NONE != auth_type) { /* to show */ - SETTING_TRACE("ad->is_show_user:%d", ad->is_show_user); - if (ad->is_show_user == 0) { /* do only when hiden */ - SETTING_TRACE("to create"); - - ad->data_user_name = - (Setting_GenGroupItem_Data *) calloc(1, - sizeof - (Setting_GenGroupItem_Data)); - setting_retm_if(ad->data_user_name == NULL, "calloc failed"); - ad->data_user_name->keyStr = - (char *)g_strdup(KeyStr_UserID); - ad->data_user_name->sub_desc = - (char *)g_strdup(ad->ed_user_name_desc); - ad->data_user_name->swallow_type = - SWALLOW_Type_LAYOUT_EDITFIELD; - ad->data_user_name->isSinglelineFlag = TRUE; - ad->data_user_name->userdata = ad; - - ad->data_user_name->return_key_type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT; - ad->data_user_name->activated_cb = setting_network_connection_entry_next_activated_cb; - - ad->data_user_name->maxlength_reached_cb = __network_max_len_reached; - ad->data_user_name->disable_auto_cap = EINA_TRUE; - - __BACK_POINTER_SET(ad->data_user_name); - - ad->data_user_name->chk_change_cb = - setting_network_connection_entry_changed_cb; - ad->data_user_name->limit_filter_data = calloc(1, sizeof(Elm_Entry_Filter_Accept_Set)); - if (ad->data_user_name->limit_filter_data) { - ad->data_user_name->limit_filter_data->max_byte_count = MAX_PDP_AUTH_USERNAME_LEN_MAX; - ad->data_user_name->win_main = ad->win_get; - } - ad->data_user_name->item = - elm_genlist_item_insert_after(ad->scl_edit, - &itc_editfield, - ad->data_user_name, - NULL, - ad->item_above_user_name, - ELM_GENLIST_ITEM_NONE, - NULL, ad); - - ad->data_pwd = - (Setting_GenGroupItem_Data *) calloc(1, - sizeof - (Setting_GenGroupItem_Data)); - - setting_retm_if(ad->data_pwd == NULL, "calloc failed"); - ad->data_pwd->keyStr = - (char *)g_strdup("IDS_ST_BODY_PASSWORD"); - ad->data_pwd->sub_desc = - (char *)g_strdup(ad->ed_pwd_desc); - ad->data_pwd->swallow_type = SWALLOW_Type_LAYOUT_EDITFIELD; - ad->data_pwd->userdata = ad; - ad->data_pwd->chk_change_cb = - setting_network_connection_entry_changed_cb; - ad->data_pwd->isPasswordFlag = TRUE; - ad->data_pwd->isSinglelineFlag = TRUE; - - ad->data_pwd->return_key_type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT; - ad->data_pwd->activated_cb = setting_network_connection_entry_next_activated_cb; - - ad->data_pwd->maxlength_reached_cb = __network_max_len_reached; - ad->data_pwd->disable_auto_cap = EINA_TRUE; - - __BACK_POINTER_SET(ad->data_pwd); - - /* ad->data_pwd->chk_change_cb = chk_change_cb; */ - ad->data_pwd->limit_filter_data = calloc(1, sizeof(Elm_Entry_Filter_Accept_Set)); - if (ad->data_pwd->limit_filter_data) { - ad->data_pwd->limit_filter_data->max_byte_count = MAX_PDP_AUTH_PASSWORD_LEN_MAX; - ad->data_pwd->win_main = ad->win_get; - } - ad->data_pwd->item = - elm_genlist_item_insert_after(ad->scl_edit, - &itc_editfield, - ad->data_pwd, NULL, - ad->data_user_name->item, - ELM_GENLIST_ITEM_NONE, - NULL, ad); - - ad->item_above_proxy_add = - elm_genlist_item_insert_after(ad->scl_edit, - &itc_seperator, - NULL, NULL, - ad->data_pwd->item, - ELM_GENLIST_ITEM_NONE, - NULL, NULL); - elm_genlist_item_select_mode_set - (ad->item_above_proxy_add, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - - ad->has_form_changed = TRUE; - setting_network_connection_check_entry_empty(ad); - elm_genlist_item_select_mode_set(ad->data_user_name->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - elm_genlist_item_select_mode_set(ad->data_pwd->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - /* ad->is_show_user = 1; */ - } - ad->is_show_user = 1; - } else { /* to hide */ - - SETTING_TRACE("ad->is_show_user:%d", ad->is_show_user); - if (ad->is_show_user == 1) { /* do only when shown */ - SETTING_TRACE("to destroy"); - if (ad->data_user_name) { - elm_object_item_del(ad->data_user_name->item); - ad->data_user_name = NULL; - } - if (ad->data_pwd) { - elm_object_item_del(ad->data_pwd->item); - ad->data_pwd = NULL; - } - if (ad->item_above_proxy_add) { - elm_object_item_del(ad->item_above_proxy_add); - ad->item_above_proxy_add = NULL; - } - - } - ad->has_form_changed = TRUE; - setting_network_connection_check_entry_empty(ad); - ad->is_show_user = 0; - - } -} - -static void -setting_network_connection_entry_changed_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) data; - SettingNetworkUG *ad = list_item->userdata; - const char *entry_str = elm_entry_entry_get(obj); - - if (list_item->maxLengthReachFlag && list_item->enterKeyPressFlag == false) { - #if 0 - int ret = notification_status_message_post(_("IDS_ST_TPOP_MAXIMUM_NUMBER_OF_CHARACTERS_REACHED")); - if (ret != NOTIFICATION_ERROR_NONE) - SETTING_TRACE_ERROR("notification_status_message_post() failed(%d)", ret); - ad->popup = setting_create_popup(ad, ad->win_get, NULL, - "IDS_ST_TPOP_MAXIMUM_NUMBER_OF_CHARACTERS_REACHED", - NULL, 2, TRUE, FALSE, 0); - elm_object_focus_set(list_item->eo_check, EINA_FALSE); - #endif - } - list_item->maxLengthReachFlag = FALSE; - list_item->enterKeyPressFlag = FALSE; - /*G_FREE(list_item->sub_desc);//release first */ - list_item->sub_desc = (char *)g_strdup(entry_str); - ad->has_form_changed = TRUE; - setting_network_connection_check_entry_empty(ad); -} -static void -setting_network_connection_hide_input_pannel(void *data) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - SettingNetworkUG *ad = data; - if (ad->data_profile_name && ad->data_profile_name->eo_check) { - setting_hide_input_pannel_cb(ad->data_profile_name->eo_check); - } - if (ad->data_acs_name && ad->data_acs_name->eo_check) { - setting_hide_input_pannel_cb(ad->data_acs_name->eo_check); - } - if (ad->data_user_name && ad->data_user_name->eo_check) { - setting_hide_input_pannel_cb(ad->data_user_name->eo_check); - } - if (ad->data_pwd && ad->data_pwd->eo_check) { - setting_hide_input_pannel_cb(ad->data_pwd->eo_check); - } - if (ad->data_pxy_addr && ad->data_pxy_addr->eo_check) { - setting_hide_input_pannel_cb(ad->data_pxy_addr->eo_check); - } - if (ad->data_pxy_port && ad->data_pxy_port->eo_check) { - setting_hide_input_pannel_cb(ad->data_pxy_port->eo_check); - } - if (ad->data_hm_url && ad->data_hm_url->eo_check) { - setting_hide_input_pannel_cb(ad->data_hm_url->eo_check); - } -} - diff --git a/setting-network/src/setting-network-main.c b/setting-network/src/setting-network-main.c deleted file mode 100644 index db94c54..0000000 --- a/setting-network/src/setting-network-main.c +++ /dev/null @@ -1,1494 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include -#include -#include - -#define MOBILE_DATA_WITHOUT_WIFI_STR "IDS_ST_BODY_MOBILE_DATA_WILL_BE_USED_IF_YOU_DOWNLOAD_OR_UPLOAD_DATA_WITHOUT_WI_FI_CONNECTION" -#define UMTS_MODE_WORK_OUTSIDE_STR "IDS_ST_BODY_UMTS_MODE_ONLY_WORKS_INSIDE_3G_COVERAGE_AREA" -#define BAND_OPERATE_OUTSIDE_USA_CANADA_STR "IDS_ST_BODY_THIS_BAND_MAY_NOT_WORK_OUTSIDE_THE_USA_AND_CANADA" - -#define __switch_radio_state(cur_data, dst_state, dst_key) do { \ - if (cur_data) {\ - old_status = cur_data->chk_status;\ - cur_data->chk_status = dst_state;\ - elm_radio_state_value_set(cur_data->eo_check, cur_data->chk_status);\ - if (sel_mode == old_status) {\ - sel_item_data = cur_data;\ - } \ - \ - G_FREE(cur_data->keyStr);\ - cur_data->keyStr = g_strdup(dst_key);\ - elm_genlist_item_fields_update(cur_data->item, "*", ELM_GENLIST_ITEM_FIELD_TEXT);\ - } \ - } while (0); - -static int setting_network_main_create(void *cb); -static int setting_network_main_destroy(void *cb); -static int setting_network_main_update(void *cb); -static int setting_network_main_cleanup(void *cb); - -setting_view setting_view_network_main = { - .create = setting_network_main_create, - .destroy = setting_network_main_destroy, - .update = setting_network_main_update, - .cleanup = setting_network_main_cleanup, -}; - -static void setting_network_main_item_Gendial_mouse_up_cb(void *data, - Evas_Object *obj, - void *event_info); -static void setting_network_main_click_softkey_help_cb(void *data, - Evas_Object *obj, - void *event_info); -static void setting_network_main_click_softkey_back_cb(void *data, - Evas_Object *obj, - void *event_info); -static void setting_network_main_chk_btn_cb(void *data, Evas_Object *obj, - void *event_info); -static void setting_network_use_packet_resp_cb(void *data, Evas_Object *obj, - void *event_info); -static void __setting_network_data_roaming_resp_cb(void *data, Evas_Object *obj, - void *event_info); -static void __net_restriction_mode_vconf_change_cb(keynode_t *key, void *data); - - -/* *************************************************** - * - *basic func - * - ***************************************************/ -#ifdef UI_NETWORK_MODE -static Eina_Bool __set_net_mode_on_timer(void *data) -{ - /* error check */ - SETTING_TRACE_BEGIN; - retvm_if(data == NULL, ECORE_CALLBACK_CANCEL, "Data parameter is NULL"); - Elm_Object_Item *subitem = (Elm_Object_Item *) data; - Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subitem); - retvm_if(parentItem == NULL, ECORE_CALLBACK_CANCEL, "parentItem is NULL"); - - Setting_GenGroupItem_Data *data_subItem = elm_object_item_data_get(subitem); /* parent data */ - Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */ - retvm_if(!data_subItem || !data_parentItem, ECORE_CALLBACK_CANCEL, "!data_subItem || !data_parentItem"); - - SettingNetworkUG *ad = data_parentItem->userdata; - retvm_if(ad == NULL, ECORE_CALLBACK_CANCEL, "ad is NULL"); - if (ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } - - elm_radio_value_set(ad->data_net_mode->rgd, data_subItem->chk_status); - - ad->net_mode = data_subItem->chk_status; - int tapi_ret = tel_set_network_mode(ad->handle, data_subItem->chk_status, setting_tapi_set_band_cb, ad); - if (tapi_ret != TAPI_API_SUCCESS) { - SETTING_TRACE_DEBUG - ("%s*** [ERR] tel_set_network_mode. tapi_ret=%d ***%s", - SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK); - setting_create_popup(ad, ad->win_get, NULL, _(Invok_API_Failed_Desc), NULL, POPUP_INTERVAL, FALSE, FALSE, 0); - /*rollback */ - int err = 0; - int ret = setting_get_int_slp_key(ad->data_net_mode->int_slp_setting_binded, - &(ad->net_mode), &err); - if (ret == SETTING_RETURN_FAIL) { - SETTING_TRACE_ERROR("failed to get vconf"); - } - - if (ad->net_mode == (TAPI_NETWORK_MODE_GSM | TAPI_NETWORK_MODE_WCDMA)) { - ad->net_mode = TAPI_NETWORK_MODE_AUTO; - } - elm_radio_value_set(ad->data_net_mode->rgd, ad->net_mode); - return ECORE_CALLBACK_CANCEL; - } - - /*it will be deleted in callback set by tel_set_network_mode(that is setting_tapi_set_band_cb.) */ - ad->network_ug_pop = setting_create_popup(ad, ad->win_get, NULL, - "IDS_ST_BUTTON2_PROCESSING_ING", NULL, - 0.0, TRUE, FALSE, 0); - - /*ecore_timer_del(ad->timer); */ - ad->timer = NULL; - return ECORE_CALLBACK_CANCEL; -} - -#if 0 -static Eina_Bool __set_net_mode_on_delay(void *data) -{ - /* error check */ - SETTING_TRACE_BEGIN; - - retvm_if(data == NULL, ECORE_CALLBACK_CANCEL, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *)data; - //Elm_Object_Item *subitem = (Elm_Object_Item *) data; - //Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subitem); - //retvm_if(parentItem == NULL, ECORE_CALLBACK_CANCEL, "parentItem is NULL"); - - //Setting_GenGroupItem_Data *data_subItem = elm_object_item_data_get(subitem); /* parent data */ - //Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */ - //retvm_if(!data_subItem || !data_parentItem, ECORE_CALLBACK_CANCEL, "!data_subItem || !data_parentItem"); - - retvm_if(ad == NULL, ECORE_CALLBACK_CANCEL, "ad is NULL"); - - SETTING_TRACE("tel_set_network_mode(data_subItem->chk_status=%d) run", data_subItem->chk_status); - int tapi_ret = tel_set_network_mode(ad->handle, data_subItem->chk_status, setting_tapi_set_band_cb, ad); - - if (tapi_ret != TAPI_API_SUCCESS) { - SETTING_TRACE_DEBUG - ("%s*** [ERR] tel_set_network_mode. tapi_ret=%d ***%s", - SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK); - setting_create_popup(ad, ad->win_get, NULL, Invok_API_Failed_Desc, NULL, POPUP_INTERVAL, FALSE, FALSE, 0); - /*rollback */ - int err = 0; - int ret = setting_get_int_slp_key(ad->data_net_mode->int_slp_setting_binded, &(ad->net_mode), &err); - if (ret == SETTING_RETURN_FAIL) { - SETTING_TRACE_ERROR("failed to get vconf"); - } - } else { - SETTING_TRACE("tel_set_network_mode()=TAPI_API_SUCCESS"); - } - - ad->timer = NULL; - - return ECORE_CALLBACK_CANCEL; -} - -static void __change_3g_on_resp_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - Elm_Object_Item *subitem = (Elm_Object_Item *) data; - Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subitem); - retm_if(parentItem == NULL, "parentItem is NULL"); - - Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */ - retm_if(!data_parentItem, "!data_parentItem"); - - SettingNetworkUG *ad = data_parentItem->userdata; - retm_if(ad == NULL, "ad is NULL"); - - int response_type = btn_type(obj); - if (ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } - if (POPUP_RESPONSE_OK == response_type) { - /*changing of USE_PACKET_DATA was trigged by betwork searching */ - ad->b_trigged_by_modechanging = TRUE; - /*for delay.. */ - ad->popup = setting_create_popup_with_progressbar(ad, ad->win_get, - PROGRESSBAR_STYLE, - NULL, NULL, NULL, 0, TRUE, FALSE, 0); - if (ad->timer) { - ecore_timer_del(ad->timer); - ad->timer = NULL; - } - ad->timer = ecore_timer_add(TIME_TO_TURN_OFF_3G, __set_net_mode_on_timer, subitem); - - } else if (POPUP_RESPONSE_CANCEL == response_type) { - /*rollback.. */ - int value = 0; - vconf_get_int(VCONFKEY_SETAPPL_NETWORK_MODE_INT, &value); - SETTING_TRACE("vaule:%d", value); - - if ((value & TAPI_NETWORK_MODE_GSM) && (value & TAPI_NETWORK_MODE_WCDMA)) { - SETTING_TRACE("has TAPI_NETWORK_MODE_GSM|TAPI_NETWORK_MODE_WCDMA"); - if (ad->lte_wcdma_gsm) elm_radio_value_set(ad->data_net_mode->rgd, ad->lte_wcdma_gsm->chk_status); - } else if (value & TAPI_NETWORK_MODE_GSM) { - SETTING_TRACE("has TAPI_NETWORK_MODE_WCDMA but not has TAPI_NETWORK_MODE_GSM"); - if (ad->gsm_only) elm_radio_value_set(ad->data_net_mode->rgd, ad->gsm_only->chk_status); - } else { - SETTING_TRACE("not have TAPI_NETWORK_MODE_WCDMA"); - if (ad->wcdma_only) elm_radio_value_set(ad->data_net_mode->rgd, ad->wcdma_only->chk_status); - } - /*elm_radio_value_set(ad->data_net_mode->rgd, ad->net_mode); */ - } -} -#endif - - -/** - * item in genlist on the popup 'NETWORK MODE' - */ -void __network_sub_list_sel_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(event_info == NULL, "Invalid argument: event info is NULL"); - ret_if(NULL == data); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - Elm_Object_Item *subitem = (Elm_Object_Item *) event_info; - elm_genlist_item_selected_set(subitem, 0); - - Setting_GenGroupItem_Data *data_subItem = elm_object_item_data_get(subitem); - - SETTING_TRACE("ad->net_mode=%d", ad->net_mode); - SETTING_TRACE("elm_radio_value_get(ad->data_net_mode->rgd):%d", elm_radio_value_get(ad->data_net_mode->rgd)); - SETTING_TRACE("data_subItem->chk_status=%d", data_subItem->chk_status); - - if (ad->net_mode == data_subItem->chk_status) { - SETTING_TRACE("No change"); - return; - } - - int value_use_packet; - - vconf_get_int(VCONFKEY_DNET_STATE, &value_use_packet); - - /*it will be deleted in callback set by tel_set_network_mode(that is setting_tapi_set_band_cb.) */ - ad->network_ug_pop = setting_create_popup_with_progressbar(ad, ad->win_get, PROGRESSBAR_STYLE, - NULL, "IDS_ST_BUTTON2_PROCESSING_ING", - NULL, 0.0, TRUE, FALSE, 0); - - elm_radio_value_set(ad->data_net_mode->rgd, data_subItem->chk_status); - ad->net_mode = data_subItem->chk_status; - - /*for delay.. */ - if (ad->timer) { - ecore_timer_del(ad->timer); - ad->timer = NULL; - } - - SETTING_TRACE("tel_set_network_mode(data_subItem->chk_status=%d) run", data_subItem->chk_status); - int tapi_ret = tel_set_network_mode(ad->handle, data_subItem->chk_status, setting_tapi_set_band_cb, ad); - - if (tapi_ret != TAPI_API_SUCCESS) { - SETTING_TRACE_DEBUG - ("%s*** [ERR] tel_set_network_mode. tapi_ret=%d ***%s", - SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK); - setting_create_popup(ad, ad->win_get, NULL, Invok_API_Failed_Desc, NULL, POPUP_INTERVAL, FALSE, FALSE, 0); - /*rollback */ - int err = 0; - int ret = setting_get_int_slp_key(ad->data_net_mode->int_slp_setting_binded, &(ad->net_mode), &err); - if (ret == SETTING_RETURN_FAIL) { - SETTING_TRACE_ERROR("failed to get vconf"); - } - } else { - SETTING_TRACE("tel_set_network_mode()=TAPI_API_SUCCESS"); - } - - if (ad->network_mode_popup) { - evas_object_del(ad->network_mode_popup); - ad->network_mode_popup = NULL; - } -} - -/** - * radio - chnage handler - */ -EXPORT_PUBLIC -void __network_default_rd_change(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); -} - -#endif - -/** - * VCONFKEY_3G_ENABLE : notification handler - */ -static void __3g_change_cb(keynode_t *key, void *data) -{ - SETTING_TRACE_BEGIN; - ret_if(NULL == data); - SettingNetworkUG *ad = data; - int status = vconf_keynode_get_bool(key); - char *vconf_name = vconf_keynode_get_name(key); - SETTING_TRACE("vconf_name:%s, status:%d", vconf_name, status); - - if (!safeStrCmp(vconf_name, VCONFKEY_3G_ENABLE)) { - if (ad->data_mobile_data) { - /* change 'use packet data' with the vconf value */ - ad->data_mobile_data->chk_status = status; - - /* set toggle state */ - - elm_object_item_data_set(ad->data_mobile_data->item, ad->data_mobile_data); - elm_genlist_item_update(ad->data_mobile_data->item); - } - } -} - -/** - * mobile data ON --> Data Roaming activate - * mobile data OFF --> Data Roaming de-activate - */ -static void _setting_network_activate_state_data_roaming(void *data, bool state) -{ - SETTING_TRACE_BEGIN; - ret_if(NULL == data); - SettingNetworkUG *ad = data; - - if (state == true) { - if(ad->data_roaming && ad->data_roaming->item) { - setting_enable_genlist_item(ad->data_roaming->item); - SETTING_TRACE("AFTER enable data roaming"); - } - } else { - if(ad->data_roaming && ad->data_roaming->item) { - setting_disable_genlist_item(ad->data_roaming->item); - SETTING_TRACE("AFTER disable data roaming"); - } - } -} - - -/** - * if data roaming is on, set 'use packet data' to ON - * - * VCONFKEY_SETAPPL_STATE_DATA_ROAMING_BOOL : __data_roaming_change_cb - * - * @see also vconf_notify_key_changed - */ -static void __data_roaming_change_cb(keynode_t *key, void *data) -{ - SETTING_TRACE_BEGIN; - ret_if(NULL == data); - SettingNetworkUG *ad = data; - int status = vconf_keynode_get_bool(key); - char *vconf_name = vconf_keynode_get_name(key); - SETTING_TRACE("vconf_name:%s, status:%d", vconf_name, status); - - if (!safeStrCmp(vconf_name, VCONFKEY_SETAPPL_STATE_DATA_ROAMING_BOOL) && ad->data_roaming) { - #if 0 - setting_update_gl_item_chk_status(ad->data_roaming, status); - if (status) { - int value = 0; - int err = 0; - setting_network_get_state_mobile_data(&value); - setting_retm_if(err != 0, "get vconf failed"); - if (!value) { - setting_network_set_state_mobile_data(SETTING_ON_OFF_BTN_ON); - } - } - #endif - } -} - -/** - * Vconf callback for network restriction mode (VCONFKEY_SETAPPL_NETWORK_RESTRICT_MODE) - */ -static void __net_restriction_mode_vconf_change_cb(keynode_t *key, void *data) -{ - SETTING_TRACE_BEGIN; - - ret_if(NULL == data); - - SettingNetworkUG *ad = data; - - int status = vconf_keynode_get_bool(key); - char *vconf_name = vconf_keynode_get_name(key); - - SETTING_TRACE("vconf_name:%s, status:%d", vconf_name, status); - - if (!safeStrCmp(vconf_name, VCONFKEY_SETAPPL_NETWORK_RESTRICT_MODE)) { - if (status) { - if (ad->data_mobile_data) - setting_disable_genlist_item(ad->data_mobile_data->item); - - if (ad->data_roaming) - setting_disable_genlist_item(ad->data_roaming->item); - } else { - if (ad->data_mobile_data) - setting_enable_genlist_item(ad->data_mobile_data->item); - - if (ad->data_roaming) - setting_enable_genlist_item(ad->data_roaming->item); - } - } - - return; -} - -#ifdef UI_NETWORK_MODE -#if 0 /* DISABLED CODE */ -/** - * get network name by entwork_mode vconf key - * - * featuring : docomo - * @return pointer of static variable (no free) - */ -static char *_get_network_mode_sub_desc() -{ - /* ***BEGIN*** Fixed the problem of word twinkle SAMSUNG 2010/7/21 add */ - /* hide NETWORK MODE in Emulator*/ - char *sub_des = NULL; - int value = TAPI_NETWORK_MODE_AUTO; - int k; - k = vconf_get_int(VCONFKEY_SETAPPL_NETWORK_MODE_INT, &value); - int status_3G = 0; - vconf_get_bool(VCONFKEY_3G_ENABLE, &status_3G); - int roam_status = 0; - vconf_get_bool(VCONFKEY_TELEPHONY_SVC_ROAM, &roam_status); - - if (-1 != k) { - SETTING_TRACE("VCONFKEY_SETAPPL_NETWORK_MODE_INT value:%d", value); - switch (value) { - case TAPI_NETWORK_MODE_AUTO: - case TAPI_NETWORK_MODE_LTE|TAPI_NETWORK_MODE_GSM|TAPI_NETWORK_MODE_WCDMA: { - SETTING_TRACE("_(Keystr_NetBrand_Auto):%s", _(Keystr_NetBrand_Auto)); - sub_des = _(Keystr_NetBrand_Auto); - break; - } - - case TAPI_NETWORK_MODE_GSM: - sub_des = _(Keystr_NetBrand_GSM); - break; - case TAPI_NETWORK_MODE_WCDMA: - sub_des = _(Keystr_NetBrand_WCDMA); - break; - case TAPI_NETWORK_MODE_LTE|TAPI_NETWORK_MODE_WCDMA: - sub_des = _(Keystr_NetBrand_LTE_WCDMA); - break; - case TAPI_NETWORK_MODE_GSM|TAPI_NETWORK_MODE_WCDMA: - sub_des = _(Keystr_NetBrand_Auto_WCDMA_GSM); - break; - default: - break; - } - } else { - SETTING_TRACE("VCONFKEY_SETAPPL_NETWORK_MODE_INT value:%d on success ", value); - } - return sub_des; -} -#endif -#endif - -void _get_network_selected_desc(void *data, char *sel_network_desc, int size) -{ - /* int value = 0; */ - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - ad->sel_net = TAPI_NETWORK_SELECTIONMODE_AUTOMATIC; - ad->sel_act = TAPI_NETWORK_SYSTEM_NO_SRV; - vconf_get_int(VCONFKEY_SETAPPL_SELECT_NETWORK_INT, &ad->sel_net); - vconf_get_int(VCONFKEY_SETAPPL_SELECT_OLD_NT_ACT, &ad->sel_act); - - FREE(ad->sel_network); - ad->sel_network = get_pa_select_network(); - SETTING_TRACE("pa_sel_net_name:%s", ad->sel_network); - if (!ad->sel_network) { - ad->sel_network = strndup(Keystr_UNKNOWN_NETWORK, strlen(Keystr_UNKNOWN_NETWORK) + 1); - } - SETTING_TRACE("pa_net_name:%s", ad->sel_network); - SETTING_TRACE("old act:%d", ad->sel_act); - SETTING_TRACE("old network mode:%d", ad->sel_net); - - /* TODO : value is always zero need to fix */ - /* if (TAPI_NETWORK_SELECTIONMODE_MANUAL == value) { */ - /* snprintf(sel_network_desc, size, */ - /* "%s, %s", _("IDS_ST_BODY_MANUAL"), _(ad->sel_network)); */ - /* } */ - /* else{ */ - snprintf(sel_network_desc, size, - "%s, %s", _("IDS_ST_BODY_ANSWERINGMODE_AUTOMATIC"), _(ad->sel_network)); - /* } */ -} - -static void __popup_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(NULL == data, "NULL == data"); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - const char *txt = elm_object_text_get(obj); - if (ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } - if (0 == safeStrCmp(txt, _(keyStr_OK))) { - ug_destroy_me(ad->ug); - } -} - -static void __check_sim_card(void *cb) -{ - SETTING_TRACE_BEGIN; - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - int err = 0; - int value; - setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err); - SETTING_TRACE("sim: %d", value); - switch (value) { - case VCONFKEY_TELEPHONY_SIM_NOT_PRESENT: - ad->popup = setting_create_popup(ad, ad->win_get, - NULL, _("IDS_ST_POP_INSERT_SIM_CARD_TO_ACCESS_NETWORK_SERVICES"), - __popup_cb, 0, true, true, - 1, keyStr_OK); - SETTING_TRACE("%s*** [ERR] No SIM. sim_slot_type=%d ***%s", - SETTING_FONT_RED, value, SETTING_FONT_BLACK); - return; - break; - case VCONFKEY_TELEPHONY_SIM_CARD_ERROR: - case VCONFKEY_TELEPHONY_SIM_UNKNOWN: - ad->popup = setting_create_popup(ad, ad->win_get, - NULL, _("IDS_ST_POP_INSERT_SIM_CARD_TO_ACCESS_NETWORK_SERVICES"), - __popup_cb, 0, true, true, - 1, keyStr_OK); - SETTING_TRACE("%s*** [ERR] Invalid SIM. sim_slot_type=%d ***%s", - SETTING_FONT_RED, value, SETTING_FONT_BLACK); - return; - break; - default: - break; - } -} - -static void __popup_cb2(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(NULL == data, "NULL == data"); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - const char *txt = elm_object_text_get(obj); - if (ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } - if (0 == safeStrCmp(txt, _(keyStr_OK))) { - ug_destroy_me(ad->ug); - } -} - -static void __check_flight_mode(void *cb) -{ - SETTING_TRACE_BEGIN; - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - /*check flight mode */ - int flight_mode = 0; - vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight_mode); - if (flight_mode) { - if (ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } - ad->popup = setting_create_popup(ad, ad->win_get, - NULL, "IDS_ST_BODY_FLIGHT_MODE_HAS_BEEN_ENABLED_NETWORK_SETTINGS_WILL_CLOSE", - __popup_cb2, 0, true, true, - 1, keyStr_OK); - } -} - - -void data_roaming_state_event_handler(const char *event_name, bundle *data, void *user_data) -{ - const char *data_roaming_state_set = NULL; - SETTING_TRACE("data roamings state set event(%s) received", event_name); - - data_roaming_state_set = bundle_get_val(data, EVT_KEY_DATA_ROAMING_STATE); - SETTING_TRACE("data_roaming_state_set(%s)", data_roaming_state_set); -} - -void mobile_data_state_event_handler(const char *event_name, bundle *data, void *user_data) -{ - const char *mobile_data_state_set = NULL; - SETTING_TRACE("mobile data state set event(%s) received", event_name); - - mobile_data_state_set = bundle_get_val(data, EVT_KEY_MOBILE_DATA_STATE); - SETTING_TRACE("mobile_data_state_set(%s)", mobile_data_state_set); -} - -unsigned int data_roaming_event_reg_id; -unsigned int mobile_data_event_reg_id; - - - -static void setting_network_mode_popup(void *data) -{ - - ret_if(NULL == data); - SETTING_TRACE_BEGIN; - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - Evas_Object *scroller = NULL; - ad->network_mode_popup = setting_create_popup_with_list(&scroller , ad, ad->win_get, - "Network Mode", NULL, 0, false, false, 0); - _P(ad->network_mode_popup); - //Evas_Object *parentItem = ad->network_mode_popup; - - int call_status = CM_CALL_STATUS_IDLE; - cm_client_h cm_handle = NULL; - cm_init(&cm_handle); - cm_get_call_status(cm_handle, &call_status); - cm_deinit(cm_handle); - if (CM_CALL_STATUS_IDLE != call_status) { - setting_create_popup(ad, ad->win_get, NULL, - _("IDS_CST_POP_OPERATION_NOT_ALLOWED_DURING_CALLS"), NULL, 0, false, false, 0); - return; - } - - int value = 0; - int err = 0; - Evas_Object *rdg; - - rdg = elm_radio_add(scroller); - elm_radio_value_set(rdg, -1); - - /*Need to fix */ - char *szCscFeatureValue = "all_numeric"; - char *pszStrId = NULL; - - /* LTE/WCDMA/GSM */ - if (is_lte_on_feature(ad)) { - if (strcmp(szCscFeatureValue, "all_numeric") == 0) - pszStrId = _("IDS_ST_OPT_4G_3G_2G_HAUTO_CONNECT"); - else - pszStrId = _("IDS_ST_BODY_LTE_WCDMA_GSM_NHAUTO_CONNECT"); - - ad->lte_wcdma_gsm = setting_create_Gendial_field_1radio(scroller, &itc_multiline_1text_1icon, - __network_sub_list_sel_cb, ad, - SWALLOW_Type_1RADIO_RIGHT, - rdg, TAPI_NETWORK_MODE_LTE | TAPI_NETWORK_MODE_WCDMA | TAPI_NETWORK_MODE_GSM/* chk_status */, - pszStrId, - __network_default_rd_change); - } - - /* WCDMA/GSM */ - if (strcmp(szCscFeatureValue, "all_numeric") == 0) - pszStrId = _("IDS_ST_OPT_3G_2G_HAUTO_CONNECT"); - else - pszStrId = _("IDS_ST_BODY_WCDMA_GSM_NHAUTO_CONNECT"); - - - - ad->wcdma_gsm = setting_create_Gendial_field_1radio(scroller, &itc_multiline_1text_1icon, - __network_sub_list_sel_cb, ad, - SWALLOW_Type_1RADIO_RIGHT, - rdg, - TAPI_NETWORK_MODE_WCDMA | TAPI_NETWORK_MODE_GSM, /* chk_status */ - pszStrId, - __network_default_rd_change); - - /* WCDMA */ - if (strcmp(szCscFeatureValue, "all_numeric") == 0) - pszStrId = _("IDS_ST_BODY_3G_ONLY"); - else - pszStrId = _("IDS_ST_MBODY_WCDMA_ONLY"); - - ad->wcdma_only = setting_create_Gendial_field_1radio(scroller, &itc_multiline_1text_1icon, - __network_sub_list_sel_cb, ad, - SWALLOW_Type_1RADIO_RIGHT, - rdg, - TAPI_NETWORK_MODE_WCDMA, /* chk_status */ - pszStrId, - __network_default_rd_change); - - /* GSM */ - if (strcmp(szCscFeatureValue, "all_numeric") == 0) - pszStrId = _("IDS_ST_OPT_2G_ONLY"); - else - pszStrId = _("IDS_ST_MBODY_GSM_ONLY"); - - ad->gsm_only = setting_create_Gendial_field_1radio(scroller, &itc_multiline_1text_1icon, - __network_sub_list_sel_cb, ad, - SWALLOW_Type_1RADIO_RIGHT, - rdg, - TAPI_NETWORK_MODE_GSM, /* chk_status */ - pszStrId, - __network_default_rd_change); - - setting_get_int_slp_key(INT_SLP_SETTING_NETWORK_MODE, &value, &err); - SETTING_TRACE("value: %d, err: %d", value, err); - elm_radio_value_set(rdg, value); - - - /* Selection */ - do { - if (is_lte_on_feature(ad)) { - if ((value & TAPI_NETWORK_MODE_LTE) && (value & TAPI_NETWORK_MODE_WCDMA) && (value & TAPI_NETWORK_MODE_GSM)) { - SETTING_TRACE("TAPI_NETWORK_MODE_LTE|TAPI_NETWORK_MODE_WCDMA|TAPI_NETWORK_MODE_GSM selected"); - - if (ad->lte_wcdma_gsm) { - elm_radio_value_set(ad->data_net_mode->rgd, ad->lte_wcdma_gsm->chk_status); - SETTING_TRACE("ad->lte_wcdma_gsm->chk_status=%d checked", ad->lte_wcdma_gsm->chk_status); - break; - } else - SETTING_TRACE_ERROR("ad->lte_wcdma_gsm is NULL"); - } - } - - if ((value & TAPI_NETWORK_MODE_WCDMA) && (value & TAPI_NETWORK_MODE_GSM)) { - SETTING_TRACE("TAPI_NETWORK_MODE_WCDMA|TAPI_NETWORK_MODE_GSM selected"); - - if (ad->wcdma_gsm) { - elm_radio_value_set(ad->data_net_mode->rgd, ad->wcdma_gsm->chk_status); - SETTING_TRACE("ad->wcdma_gsm->chk_status=%d checked", ad->wcdma_gsm->chk_status); - } else - SETTING_TRACE_ERROR("ad->wcdma_gsm is NULL"); - } else if (value & TAPI_NETWORK_MODE_WCDMA) { - SETTING_TRACE("TAPI_NETWORK_MODE_WCDMA selected"); - - if (ad->wcdma_only) { - elm_radio_value_set(ad->data_net_mode->rgd, ad->wcdma_only->chk_status); - SETTING_TRACE("ad->wcdma_only->chk_status=%d checked", ad->wcdma_only->chk_status); - } else - SETTING_TRACE_ERROR("ad->wcdma_only is NULL"); - } else if (value & TAPI_NETWORK_MODE_GSM) { - SETTING_TRACE("TAPI_NETWORK_MODE_GSM selected"); - - if (ad->gsm_only) { - elm_radio_value_set(ad->data_net_mode->rgd, ad->gsm_only->chk_status); - SETTING_TRACE("ad->gsm_only->chk_status=%d checked", ad->gsm_only->chk_status); - } else - SETTING_TRACE_ERROR("ad->gsm_only is NULL"); - } else - SETTING_TRACE_ERROR("TAPI_NETWORK(%d) unknown", value); - - } while (0); - - SETTING_TRACE("after value set -- value: %d, err: %d", value, err); -} - - - - -static int setting_network_main_create(void *cb) -{ - SETTING_TRACE_BEGIN; - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - Evas_Object *scroller; - - ad->ly_main = - setting_create_layout_navi_bar_genlist(ad->win_main_layout, - ad->win_get, - _("IDS_ST_BODY_NETWORK"), - //dgettext("sys_string", "IDS_ST_BUTTON_BACK"), - NULL, /* ARROW STYLE */ - NULL,/*_("IDS_ST_HEADER_HELP"), */ - setting_network_main_click_softkey_back_cb, - setting_network_main_click_softkey_help_cb, - ad, &scroller, - &ad->navi_bar); - - if (scroller) { - ad->genlist = scroller; - } else { - ad->genlist = NULL; - SETTING_TRACE("genlist is NULL ERROR COND"); - } - - evas_object_smart_callback_add(ad->genlist, "realized", __gl_realized_cb, ad); - - Elm_Object_Item *item = NULL;; - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - - // mobile data ON --> Data Roaming activate - // mobile data OFF --> Data Roaming de-activate - - /* [UI] TITLE : "Mobile Data" */ - int value_mobile_data; - - setting_network_get_state_mobile_data(&value_mobile_data); - - ad->data_mobile_data = setting_create_Gendial_field_def(scroller, &itc_1text_1icon, - setting_network_main_item_Gendial_mouse_up_cb, - ad, SWALLOW_Type_1ICON_1RADIO, NULL, - NULL, value_mobile_data, - KeyStr_UseMobileData, NULL, - setting_network_main_chk_btn_cb); - if (ad->data_mobile_data) { - ad->data_mobile_data->userdata = ad; - __BACK_POINTER_SET(ad->data_mobile_data); - } else { - SETTING_TRACE_ERROR("ad->data_mobile_data is NULL"); - } - - #ifdef OLD_GENLIST_STYLE - /* [UI] "Mobile Data" descrition */ - const char *title = Data_packet_Sub_desc; - ADD_GL_HELP(scroller, title); - #endif - - /* [UI] Data Roaming - TITLE : "Data Roaming" */ - int value_data_roaming; - setting_network_get_state_data_roaming(&value_data_roaming); - - SETTING_TRACE_ERROR(" ---> data roaming value : %d", value_data_roaming); - - ad->data_roaming = setting_create_Gendial_field_def(scroller, &(itc_1text_1icon), - setting_network_main_item_Gendial_mouse_up_cb, - ad, SWALLOW_Type_1ICON_1RADIO, NULL, - NULL, value_data_roaming, - KeyStr_DataRoaming, NULL, - setting_network_main_chk_btn_cb); - if (ad->data_roaming) { - ad->data_roaming->userdata = ad; - //ad->data_roaming->isItemDisableFlag = value_mobile_data; - __BACK_POINTER_SET(ad->data_roaming); - } else { - SETTING_TRACE_ERROR("ad->data_roaming is NULL"); - } - - - #ifdef OLD_GENLIST_STYLE - ADD_GL_HELP(scroller, SETTING_NETWORK_DATA_ROMING_DESC); - #endif - /* [UI] Network Mode */ - ad->data_net_mode = - setting_create_Gendial_field_def(scroller, - &itc_2text_3_parent, - setting_network_main_item_Gendial_mouse_up_cb, - ad, SWALLOW_Type_INVALID, NULL, NULL, - 0, "IDS_ST_BODY_NETWORK_MODE", - NULL, - NULL); - - if (ad->data_net_mode) { - ad->data_net_mode->int_slp_setting_binded = INT_SLP_SETTING_NETWORK_MODE; - __BACK_POINTER_SET(ad->data_net_mode); - } else { - SETTING_TRACE_ERROR("ad->data_net_modeis NULL"); - } - - /* Don't need to check flight mode,if flight mode is on, thw whole Network function will be disable*/ - /* ***BEGIN*** Fixed the problem of word twinkle SAMSUNG 2010/7/21 add */ - char sel_network_desc[MAX_COMMON_BUFFER_LEN] = {0,}; - _get_network_selected_desc(ad, sel_network_desc, MAX_COMMON_BUFFER_LEN); - ad->data_sel_net = setting_create_Gendial_field_def(scroller, - &itc_2text_3, - setting_network_main_item_Gendial_mouse_up_cb, - ad, SWALLOW_Type_INVALID, - NULL, NULL, 0, - "IDS_COM_BODY_NETWORK_OPERATORS", - sel_network_desc, NULL); - if (ad->data_sel_net) { - __BACK_POINTER_SET(ad->data_sel_net); - ad->data_sel_net->userdata = ad; - } else { - SETTING_TRACE_ERROR("ad->data_sel_net is NULL"); - } - - - /* [UI] Connection mode description */ - ad->data_connection = setting_create_Gendial_field_def(scroller, &itc_1text, - setting_network_main_item_Gendial_mouse_up_cb, - ad, SWALLOW_Type_INVALID, NULL, NULL, - 0, CONNECTION_DSC, - NULL, NULL); - if (ad->data_connection) { - __BACK_POINTER_SET(ad->data_connection); - ad->data_connection->userdata = ad; - } else { - SETTING_TRACE_ERROR("ad->data_connection is NULL"); - } - - vconf_notify_key_changed(VCONFKEY_3G_ENABLE, __3g_change_cb, ad); - vconf_notify_key_changed(VCONFKEY_SETAPPL_STATE_DATA_ROAMING_BOOL, __data_roaming_change_cb, ad); - vconf_notify_key_changed(VCONFKEY_SETAPPL_NETWORK_RESTRICT_MODE, __net_restriction_mode_vconf_change_cb, ad); - - setting_view_network_main.is_create = 1; - setting_view_update(&setting_view_network_main, ad); - - /*check sim card */ - __check_sim_card(ad); - __check_flight_mode(ad); - - /* eventsystem */ -#if 0 - if (ES_R_OK != eventsystem_register_event(SYS_EVENT_MOBILE_DATA_STATE, - &mobile_data_event_reg_id, - (eventsystem_handler)mobile_data_state_event_handler, cb)) { - SETTING_TRACE_ERROR("error"); - } - - if (ES_R_OK != eventsystem_register_event(SYS_EVENT_DATA_ROAMING_STATE, - &data_roaming_event_reg_id, - (eventsystem_handler)data_roaming_state_event_handler, cb)) { - SETTING_TRACE_ERROR("error"); - } -#endif - - // mobile data On -> data roaming activates - // mobile data Off -> data roaming deactivates - SETTING_TRACE(" ---> mobile-data value : %d", value_mobile_data); - if (value_mobile_data) - _setting_network_activate_state_data_roaming(ad, true); - else - _setting_network_activate_state_data_roaming(ad, false); - - return SETTING_RETURN_SUCCESS; -} - -static int setting_network_main_destroy(void *cb) -{ - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - - vconf_ignore_key_changed(VCONFKEY_3G_ENABLE, __3g_change_cb); - vconf_ignore_key_changed(VCONFKEY_SETAPPL_STATE_DATA_ROAMING_BOOL, __data_roaming_change_cb); - vconf_ignore_key_changed(VCONFKEY_SETAPPL_NETWORK_RESTRICT_MODE, __net_restriction_mode_vconf_change_cb); - - if (ad->ly_main != NULL) { - evas_object_del(ad->ly_main); - ad->ly_main = NULL; - } - if (ad->network_ug_pop) { - evas_object_del(ad->network_ug_pop); - ad->network_ug_pop = NULL; - } - if (ad->timer) { - ecore_timer_del(ad->timer); - ad->timer = NULL; - } - ad->data_sel_net = NULL;/*reset NULL after genlis destoryed with ly_main. */ - - setting_view_network_main.is_create = 0; - -#if 0 - if (ES_R_OK != eventsystem_unregister_event(mobile_data_event_reg_id)) { - SETTING_TRACE_ERROR("error"); - } - if (ES_R_OK != eventsystem_unregister_event(data_roaming_event_reg_id)) { - SETTING_TRACE_ERROR("error"); - } -#endif - return SETTING_RETURN_SUCCESS; -} - -static int setting_network_main_update(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - - if (ad->ly_main != NULL) { - evas_object_show(ad->ly_main); - } - - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -static int setting_network_main_cleanup(void *cb) -{ - /* error check */ - /* retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); */ - - /* SettingNetworkUG *ad = (SettingNetworkUG *)cb; */ - - /* all the view in view stack shared the ad->ly_main, it cannot be hided!!! */ - /* if(ad->ly_main != NULL) */ - /* { */ - /* evas_object_hide(ad->ly_main); */ - /* } */ - - return SETTING_RETURN_SUCCESS; -} - -/* *************************************************** - * - *general func - * - ***************************************************/ - -/* *************************************************** - * - *call back func - * - ***************************************************/ - -static void -setting_network_main_click_softkey_help_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(data == NULL, "Data parameter is NULL"); -} - -static void -setting_network_main_click_softkey_back_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - ug_destroy_me(ad->ug); -} - -static Eina_Bool __change_search_view_on_timer(void *data) -{ - /* error check */ - SETTING_TRACE_BEGIN; - SettingNetworkUG *ad = data; - retvm_if(ad == NULL, ECORE_CALLBACK_CANCEL, "ad is NULL"); - if (ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } - - setting_view_change(&setting_view_network_main, - &setting_view_network_select_network, - ad); - /*ecore_timer_del(ad->timer); */ - ad->timer = NULL; - return ECORE_CALLBACK_CANCEL; -} - -void __change_search_view_on_resp_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - int response_type = btn_type(obj); - if (ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } - - if (POPUP_RESPONSE_OK == response_type) { - /*changing of USE_PACKET_DATA was trigged by betwork searching */ - ad->b_trigged_by_searching = TRUE; - - /*for delay.. */ - ad->popup = setting_create_popup_with_progressbar(ad, ad->win_get, - PROGRESSBAR_STYLE, - NULL, NULL, NULL, 0, TRUE, FALSE, 0); - - if (ad->timer) { - ecore_timer_del(ad->timer); - ad->timer = NULL; - } - ad->timer = ecore_timer_add(TIME_TO_TURN_OFF_3G, __change_search_view_on_timer, ad); - - } else if (POPUP_RESPONSE_CANCEL == response_type) { - } -} - -static void _setting_network_popup_mobile_data_rollback(void *data) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(data == NULL, "Data parameter is NULL"); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - int err = 0; - int value = 0; - - setting_network_get_state_mobile_data(&value); - SETTING_TRACE("value = %d", value); - - /* rollback */ - setting_set_bool_slp_key(BOOL_SLP_SETTING_USE_PACKET_DATA, value, &err); - setting_retm_if(err != 0, "set vconf failed"); - setting_update_gl_item_chk_status(ad->data_mobile_data, value); -} - -static void _setting_network_popup_data_roaming_rollback(void *data) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(data == NULL, "Data parameter is NULL"); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - int err = 0; - int value = 0; - - //int err_data_romaing = - setting_network_get_state_data_roaming(&value); - SETTING_TRACE("value = %d", value); - - /* rollback */ - setting_get_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING, &value, &err); - setting_update_gl_item_chk_status(ad->data_roaming, value); -} - - -static void _setting_network_popup_mobile_data_hide_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(data == NULL, "Data parameter is NULL"); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - _setting_network_popup_mobile_data_rollback(ad); -// elm_popup_dismiss(obj); -} - -static void _setting_network_popup_data_roaming_hide_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(data == NULL, "Data parameter is NULL"); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - /* rollback */ - _setting_network_popup_data_roaming_rollback(ad); -// elm_popup_dismiss(obj); -} - - - - -static void -setting_network_main_item_Gendial_mouse_up_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - setting_retm_if(data == NULL, "Data parameter is NULL"); - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - elm_genlist_item_selected_set(item, 0); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) elm_object_item_data_get(item); - setting_retm_if(NULL == list_item, "list_item is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - SETTING_TRACE("clicking item[%s]", _(list_item->keyStr)); - int ret; - int reminder_flag = TRUE; - int err; - - if (!safeStrCmp("IDS_ST_BODY_NETWORK_MODE", list_item->keyStr)) { - setting_network_mode_popup(ad); - } else if (!safeStrCmp("IDS_COM_BODY_NETWORK_OPERATORS", list_item->keyStr)) { - int call_status = CM_CALL_STATUS_IDLE; - cm_client_h cm_handle = NULL; - cm_init(&cm_handle); - cm_get_call_status(cm_handle, &call_status); - cm_deinit(cm_handle); - if (CM_CALL_STATUS_IDLE != call_status) { - setting_create_popup(ad, ad->win_get, NULL, - _("IDS_CST_POP_OPERATION_NOT_ALLOWED_DURING_CALLS"), NULL, 0, false, false, 0); - return; - } - - int value_use_packet; - vconf_get_int(VCONFKEY_DNET_STATE, &value_use_packet); - - vconf_get_int(VCONFKEY_SETAPPL_SELECT_NETWORK_INT, &ad->sel_net);/*retrieve here */ - SETTING_TRACE("ad->sel_net:%d", ad->sel_net); - - ret = setting_view_change(&setting_view_network_main, - &setting_view_network_select_network, - ad); - - } else if (!safeStrCmp(KeyStr_UseMobileData, list_item->keyStr)) { - /* new status */ - setting_update_gl_item_chk_status(ad->data_mobile_data, !(list_item->chk_status)); - if (!list_item->chk_status) { - /* On -> Off */ - ret = vconf_get_bool(VCONFKEY_SETAPPL_MOBILE_DATA_OFF_REMINDER, &reminder_flag); - if (0 != ret) { - SETTING_TRACE_ERROR("Failed to get vconf value"); - } - ad->popup_data_off = setting_create_popup2(ad, - ad->win_get, - "IDS_ST_HEADER_TURN_OFF_MOBILE_DATA", - "IDS_ST_POP_UNLESS_YOU_CONNECT_TO_A_WI_FI_NETWORK_YOU_WILL_NOT_BE_ABLE_TO_USE_THE_INTERNET_EMAIL_OR_OTHER_APPS_MSG", - setting_network_use_packet_resp_cb, - _setting_network_popup_mobile_data_hide_cb, - 0, - FALSE, - FALSE, - 2, - "IDS_ST_BUTTON_DISABLE", - "IDS_ST_BUTTON_CANCEL_ABB"); - // Evas_Object *setting_create_popup2(void *data, - - /* should set data_roming as same as status of use_packet_data */ - int data_roaming_value = 0; - setting_get_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING, &data_roaming_value, &err); - setting_retm_if(err != 0, "get vconf failed"); - if (data_roaming_value) { - setting_network_set_state_mobile_data(SETTING_ON_OFF_BTN_OFF); - setting_update_gl_item_chk_status(ad->data_roaming, 0); - } - } else { - /* Off -> On */ - ret = vconf_get_bool(VCONFKEY_SETAPPL_MOBILE_DATA_ON_REMINDER, &reminder_flag); - if (0 != ret) { - SETTING_TRACE_ERROR("Failed to get vconf value"); - } - ad->popup_data_on = setting_create_popup2(ad, - ad->win_get, - "IDS_ST_HEADER_TURN_ON_MOBILE_DATA", - "IDS_ST_POP_MOBILE_DATA_WILL_BE_TURNED_ON_CONNECTING_TO_MOBILE_NETWORKS_MAY_RESULT_IN_ADDITIONAL_CHARGES_DEPENDING_ON_YOUR_PAYMENT_PLAN", - setting_network_use_packet_resp_cb, - _setting_network_popup_mobile_data_hide_cb, - 0, - FALSE, - FALSE, - 2, - "IDS_ST_BUTTON_ENABLE", - "IDS_ST_BUTTON_CANCEL_ABB"); - } - - } else if (!safeStrCmp(KeyStr_DataRoaming, list_item->keyStr)) { - setting_update_gl_item_chk_status(list_item, !(list_item->chk_status)); - - if (list_item->chk_status) { - ad->popup = setting_create_popup2(ad, ad->win_get, - "IDS_ST_HEADER_ENABLE_DATA_ROAMING", - "IDS_ST_POP_ROAMING_WILL_INCUR_EXTRA_CHARGES_CONTINUE_Q", - __setting_network_data_roaming_resp_cb, - _setting_network_popup_data_roaming_hide_cb, - 0, - FALSE, - FALSE, - 2, - "IDS_ST_BUTTON_ENABLE", - "IDS_ST_BUTTON_CANCEL_ABB"); - } - } else if (!safeStrCmp(CONNECTION_DSC, list_item->keyStr)) { - ret = setting_view_change(&setting_view_network_main, - &setting_view_network_con, ad); - } -} - -static void -setting_network_main_chk_btn_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(data == NULL, "Data parameter is NULL"); - SettingNetworkUG *ad = NULL; - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) data; - ad = list_item->userdata; - list_item->chk_status = elm_check_state_get(obj); /* for genlist update status */ - - int err; - - if (obj == ad->data_mobile_data->eo_check) { - SETTING_TRACE(" TOUCH HANDLING MOBILE DATA"); - - /* On -> Off */ - int reminder_flag = TRUE; - int ret = 0; - if (!list_item->chk_status) { - ret = vconf_get_bool(VCONFKEY_SETAPPL_MOBILE_DATA_OFF_REMINDER, &reminder_flag); - if (0 != ret) { - SETTING_TRACE_ERROR("Failed to get vconf value"); - } - ad->popup_data_off = setting_create_popup2(ad, - ad->win_get, - "IDS_ST_HEADER_TURN_OFF_MOBILE_DATA", - "IDS_ST_POP_UNLESS_YOU_CONNECT_TO_A_WI_FI_NETWORK_YOU_WILL_NOT_BE_ABLE_TO_USE_THE_INTERNET_EMAIL_OR_OTHER_APPS_MSG", - setting_network_use_packet_resp_cb, - _setting_network_popup_mobile_data_hide_cb, - 0, - FALSE, - FALSE, - 2, - "IDS_ST_BUTTON_DISABLE", - "IDS_ST_BUTTON_CANCEL_ABB"); - - /* should set data_roming as same as status of use_packet_data */ - int data_roaming_value = 0; - - setting_get_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING, &data_roaming_value, &err); - setting_retm_if(err != 0, "get vconf failed"); - if (data_roaming_value) { - setting_set_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING, SETTING_ON_OFF_BTN_OFF, &err); - setting_retm_if(err != 0, "set vconf failed"); - - setting_update_gl_item_chk_status(ad->data_roaming, 0); - } - - } else { - /* Off -> On */ - ret = vconf_get_bool(VCONFKEY_SETAPPL_MOBILE_DATA_ON_REMINDER, &reminder_flag); - if (0 != ret) { - SETTING_TRACE_ERROR("Failed to get vconf value"); - } - ad->popup_data_on = setting_create_popup2(ad, - ad->win_get, - "IDS_ST_HEADER_TURN_ON_MOBILE_DATA", - "IDS_ST_POP_MOBILE_DATA_WILL_BE_TURNED_ON_CONNECTING_TO_MOBILE_NETWORKS_MAY_RESULT_IN_ADDITIONAL_CHARGES_DEPENDING_ON_YOUR_PAYMENT_PLAN", - setting_network_use_packet_resp_cb, - _setting_network_popup_mobile_data_hide_cb, - 0, - FALSE, - FALSE, - 2, - "IDS_ST_BUTTON_ENABLE", - "IDS_ST_BUTTON_CANCEL_ABB"); - } - } else if (obj == ad->data_roaming->eo_check) { - SETTING_TRACE(" TOUCH HANDLING DATA ROAMING"); - if (list_item->chk_status) { - SETTING_TRACE(" TOUCH HANDLING DATA ROAMING - set true"); - ad->popup = setting_create_popup2(ad, ad->win_get, - "IDS_ST_HEADER_ENABLE_DATA_ROAMING", - "IDS_ST_POP_ROAMING_WILL_INCUR_EXTRA_CHARGES_CONTINUE_Q", - __setting_network_data_roaming_resp_cb, - _setting_network_popup_data_roaming_hide_cb, - 0, - FALSE, - FALSE, - 2, - "IDS_ST_BUTTON_ENABLE", - "IDS_ST_BUTTON_CANCEL_ABB"); - } else { - SETTING_TRACE(" TOUCH HANDLING DATA ROAMING - set false"); - setting_network_set_state_data_roaming(SETTING_ON_OFF_BTN_OFF); - setting_update_gl_item_chk_status(ad->data_roaming, SETTING_ON_OFF_BTN_OFF); - } - } -} - - -/** - * mobile data ON --> Data Roaming activate - * mobile data OFF --> Data Roaming de-activate - */ -static void setting_network_use_packet_resp_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - int err = 0; /* error check */ - int response_type = btn_type(obj); - int value = 0; - - setting_network_get_state_mobile_data(&value); - setting_retm_if(err != 0, "get vconf failed"); - SETTING_TRACE("value = %d", value); - - if (POPUP_RESPONSE_OK == response_type) { - - if (value == 0) { - - setting_network_set_state_mobile_data(SETTING_ON_OFF_BTN_ON); - setting_retm_if(err != 0, "set vconf failed"); - setting_update_gl_item_chk_status(ad->data_mobile_data, 1); - if (ad->popup_chk && elm_check_state_get(ad->popup_chk)) { - (void)vconf_set_bool(VCONFKEY_SETAPPL_MOBILE_DATA_ON_REMINDER, 0); - } - _setting_network_activate_state_data_roaming(ad, true); - - /* if called by other apps, destroy ug */ - if (!safeStrCmp(ad->view_type_string, "DATA_ROAMING")) { - if (ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } - ug_destroy_me(ad->ug); - return; - } - } else { // (value != 0) - - setting_network_set_state_mobile_data(SETTING_ON_OFF_BTN_OFF); - setting_retm_if(err != 0, "set vconf failed"); - setting_update_gl_item_chk_status(ad->data_mobile_data, 0); - if (ad->popup_chk && elm_check_state_get(ad->popup_chk)) { - (void)vconf_set_bool(VCONFKEY_SETAPPL_MOBILE_DATA_OFF_REMINDER, 0); - } - _setting_network_activate_state_data_roaming(ad, false); - - /* should set data_roming as same as status of use_packet_data */ - int data_roaming_value = 0; - setting_get_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING, &data_roaming_value, &err); - setting_retm_if(err != 0, "get vconf failed"); - if (data_roaming_value) { - setting_set_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING, SETTING_ON_OFF_BTN_OFF, &err); - setting_retm_if(err != 0, "set vconf failed"); - - setting_update_gl_item_chk_status(ad->data_roaming, 0); - } - } - } else if (POPUP_RESPONSE_CANCEL == response_type) { - - /* rollback */ - _setting_network_popup_mobile_data_rollback(ad); - } - if (ad->popup_data_off) { - evas_object_del(ad->popup_data_off); - ad->popup_data_off = NULL; - } - if (ad->popup_data_on) { - evas_object_del(ad->popup_data_on); - ad->popup_data_on = NULL; - } - -} - -/** - * toggle 'Data Roamding' mode as a popup callback - * @see also setting_create_popup - */ -static void __setting_network_data_roaming_resp_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - int response_type = btn_type(obj); - SETTING_TRACE("elm_object_parent_widget_get(obj):%p", elm_object_parent_widget_get(obj)); - SETTING_TRACE("obj:%p", obj); - if (POPUP_RESPONSE_OK == response_type) { - - SETTING_TRACE(" >>>> ad->data_roaming->chk_status = %d", ad->data_roaming->chk_status); - //setting_update_gl_item_chk_status(ad->data_roaming, !(ad->data_roaming->chk_status)); - - int value = 0; - int err = 0; - setting_get_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING, &value, &err); - - /* data roaming */ - if (value == 0) { - SETTING_TRACE("1 trying ON"); - setting_network_set_state_data_roaming(SETTING_ON_OFF_BTN_ON); - setting_update_gl_item_chk_status(ad->data_roaming, SETTING_ON_OFF_BTN_ON); - - /* if called by other apps, destroy ug */ - if (!safeStrCmp(ad->view_type_string, "DATA_ROAMING")) { - if (ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } - ug_destroy_me(ad->ug); - return; - } - } else { - SETTING_TRACE("2 trying OFF"); - setting_network_set_state_data_roaming(SETTING_ON_OFF_BTN_OFF); - setting_update_gl_item_chk_status(ad->data_roaming, SETTING_ON_OFF_BTN_OFF); - } - } else { - /*do nothing */ - /* rollback */ - int value = 0; - int err = 0; - setting_get_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING, &value, &err); - setting_update_gl_item_chk_status(ad->data_roaming, value); - } - - if (ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } -} - diff --git a/setting-network/src/setting-network-profile-delete.c b/setting-network/src/setting-network-profile-delete.c deleted file mode 100644 index 3b6c6a6..0000000 --- a/setting-network/src/setting-network-profile-delete.c +++ /dev/null @@ -1,641 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include - -static int setting_network_profile_delete_create(void *cb); -static int setting_network_profile_delete_destroy(void *cb); -#if 0 -static int setting_network_profile_delete_update(void *cb); -#endif -static int setting_network_profile_delete_cleanup(void *cb); - -setting_view setting_view_network_profile_delete = { - .create = setting_network_profile_delete_create, - .destroy = setting_network_profile_delete_destroy, - //.update = setting_network_profile_delete_update, - .update = NULL, - .cleanup = setting_network_profile_delete_cleanup, -}; - -/* *************************************************** - * - *basic func - * - ***************************************************/ -static void __profile_delete_list_draw(SettingNetworkUG *ad) -{ - SETTING_TRACE_BEGIN; - if (ad->profile_del_list != NULL) { - eina_list_free(ad->profile_del_list); - ad->profile_del_list = NULL; - } - elm_genlist_clear(ad->gl_profile_del); /* first to clear list */ - Elm_Object_Item *first_item; - /* item = elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL); */ - first_item = elm_genlist_item_append(ad->gl_profile_del, &itc_seperator, NULL, NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(first_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - - Eina_List *elist = NULL; - connection_profile_h profile_h = NULL; - int idx = 0; - char *id = NULL; - char *apn = NULL; - char *name = NULL; - char *proxy_address = NULL; - connection_profile_type_e profile_type = CONNECTION_PROFILE_TYPE_CELLULAR; - Setting_GenGroupItem_Data *item_data = NULL; - - setting_network_reget_profile_list(ad); - - // CREATE GENLIST 'Select All' - - // CREATE GENLIST - SETTING_TRACE("ad->profile_list:%p", ad->profile_list); - EINA_LIST_FOREACH(ad->profile_list, elist, profile_h) { - SETTING_TRACE("profile_h:%p", profile_h); - if (!profile_h) - continue; - apn = name = proxy_address = id = NULL; - connection_profile_get_cellular_apn(profile_h, &apn); - if (isEmptyStr(apn)) - continue; - connection_profile_get_name(profile_h, &name); - if (isEmptyStr(name)) - continue; - connection_profile_get_proxy_address(profile_h, CONNECTION_ADDRESS_FAMILY_IPV4, &proxy_address); - connection_profile_get_id(profile_h, &id); - - if (connection_profile_get_type(profile_h, &profile_type) != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get profile type"); - continue; - } - - SETTING_TRACE("Record[%s], profile_type:%d, service_type:%d, id:%s", - apn, profile_type, ad->profile_service_type, id); - - item_data = (Setting_GenGroupItem_Data *) calloc(1, sizeof(Setting_GenGroupItem_Data)); - if (0 == item_data) { - SETTING_TRACE_ERROR("calloc failed"); - G_FREE(apn); - return; - } - item_data->keyStr = (char *)g_strdup(name); - item_data->swallow_type = SWALLOW_Type_1CHECK_RIGHT; - item_data->r_swallow_path = (char *)g_strdup("reveal/extended"); - item_data->chk_change_cb = setting_network_profile_delete_check_cb; - item_data->userdata = ad; - item_data->sub_desc = (char *)g_strdup(apn); - item_data->belongs_to = (int) profile_h; - - item_data->item = - elm_genlist_item_append(ad->gl_profile_del, &(itc_2text_1icon_2), item_data, NULL, - ELM_GENLIST_ITEM_NONE, - setting_network_profile_delete_mouse_up_cb, ad); - ad->profile_del_list = - eina_list_append(ad->profile_del_list, item_data); - - idx++; - } - - Evas_Object *toolbar = elm_object_item_part_content_get(ad->navi_it_profile_del_list, "toolbar"); - Evas_Object *allbtn = elm_object_item_part_content_get(ad->navi_it_profile_del_list, "title_left_btn"); - SETTING_TRACE("idx:%d", idx); - if (idx == 1) { - if (allbtn) elm_object_disabled_set(allbtn, EINA_FALSE); - } else if (idx > 1) { - if (allbtn) elm_object_disabled_set(allbtn, EINA_FALSE); - } else { - if (ad->profile_list != NULL) { - eina_list_free(ad->profile_list); - ad->profile_list = NULL; - } - SETTING_TRACE("To disable"); - elm_object_item_disabled_set(elm_toolbar_last_item_get(toolbar), EINA_TRUE); - if (allbtn) elm_object_disabled_set(allbtn, EINA_TRUE); - SETTING_TRACE("To disable"); - } - G_FREE(apn); - G_FREE(name); - G_FREE(proxy_address); - G_FREE(id); - return; -} - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -static Evas_Object* ctxpopup; - -static void -ctxpopup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - evas_object_del(ctxpopup); - ctxpopup = NULL; -} - -static void -move_more_ctxpopup(Evas_Object *ctxpopup) -{ - SETTING_TRACE_BEGIN; - Evas_Object *win; - Evas_Coord w, h; - int pos = -1; - - /* We convince the top widget is a window */ - win = elm_object_top_widget_get(ctxpopup); - elm_win_screen_size_get(win, NULL, NULL, &w, &h); - pos = elm_win_rotation_get(win); - - switch (pos) { - case 0: - case 180: - evas_object_move(ctxpopup, (w / 2), h); - break; - case 90: - evas_object_move(ctxpopup, (h / 2), w); - break; - case 270: - evas_object_move(ctxpopup, (h / 2), w); - break; - } -} - -static void -naviframe_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - Evas_Object *ctxpopup = data; - move_more_ctxpopup(ctxpopup); -} - -static void -more_ctxpopup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - Evas_Object *nf = data; - evas_object_event_callback_del_full(nf, EVAS_CALLBACK_RESIZE, naviframe_resize_cb, ctxpopup); -} - -static void -win_rotation_changed_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - Evas_Object *ctxpopup = data; - move_more_ctxpopup(ctxpopup); -} - -/* Icon + Text (More button style : Naviframe Toolbar) */ -static void create_ctxpopup_more_button_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - SettingNetworkUG *ad = (SettingNetworkUG *) data; - //Evas_Object *it_obj; - Evas_Object *nf = ad->navi_bar; - Evas_Object *win; - //Elm_Object_Item *it; - - if (ctxpopup != NULL) { - evas_object_del(ctxpopup); - } - - ctxpopup = elm_ctxpopup_add(nf); - elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE); - elm_object_style_set(ctxpopup, "more/default"); - eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_BACK, eext_ctxpopup_back_cb, NULL); - eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_MORE, eext_ctxpopup_back_cb, NULL); - evas_object_smart_callback_add(ctxpopup, "dismissed", ctxpopup_dismissed_cb, NULL); - evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_DEL, more_ctxpopup_del_cb, nf); - evas_object_event_callback_add(nf, EVAS_CALLBACK_RESIZE, naviframe_resize_cb, ctxpopup); - - /* We convince the top widget is a window */ - win = elm_object_top_widget_get(nf); - evas_object_smart_callback_add(win, "rotation,changed", win_rotation_changed_cb, ctxpopup); - - //--------------------------------------------------------------------------------------------- - elm_ctxpopup_item_append(ctxpopup, _("IDS_ST_BUTTON_CANCEL_ABB"), NULL, setting_network_profile_delete_click_softkey_cancel_cb, ad); - elm_ctxpopup_item_append(ctxpopup, _("IDS_ST_BODY_DELETE"), NULL, setting_network_profile_delete_click_softkey_delete_cb, ad); - //--------------------------------------------------------------------------------------------- - - elm_ctxpopup_direction_priority_set(ctxpopup, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN); - move_more_ctxpopup(ctxpopup); - evas_object_show(ctxpopup); -} -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - -static int setting_network_profile_delete_create(void *cb) -{ - SETTING_TRACE_BEGIN; - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - - Evas_Object *scroller = elm_genlist_add(ad->win_main_layout); - retvm_if(scroller == NULL, SETTING_DRAW_ERR_FAIL_SCROLLER, - "Cannot set scroller object as contento of layout"); - elm_object_style_set(scroller, "dialogue"); - elm_genlist_clear(scroller); /* first to clear list */ - evas_object_smart_callback_add(scroller, "realized", __gl_realized_cb, NULL); - ad->gl_profile_del = scroller; - - ad->navi_it_profile_del_list = setting_push_layout_navi_bar(_(IDS_ST_BODY_DELETE), - NULL, - _(IDS_ST_BODY_DELETE), - _(IDS_ST_BUTTON_CANCEL_ABB), - setting_network_profile_delete_click_softkey_cancel_cb, - setting_network_profile_delete_click_softkey_delete_cb, - setting_network_profile_delete_click_softkey_cancel_cb, - ad, scroller, ad->navi_bar, NULL); - /*disable Delete button */ - Evas_Object *toolbar = elm_object_item_part_content_get(ad->navi_it_profile_del_list, "toolbar"); - Elm_Object_Item *it = elm_toolbar_last_item_get(toolbar); - elm_object_item_disabled_set(it, EINA_TRUE); - - Evas_Object *allbtn = elm_button_add(ad->navi_bar); - evas_object_size_hint_weight_set(allbtn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(allbtn, EVAS_HINT_FILL, 0.5); - - elm_object_text_set(allbtn, _("IDS_ST_OPT_ALL")); - evas_object_smart_callback_add(allbtn, "clicked", setting_network_profile_delete_click_softkey_select_all_cb, ad); - evas_object_show(allbtn); - elm_object_item_part_content_set(ad->navi_it_profile_del_list, "title_right_btn", allbtn); - - if (ad->navi_it_profile_del_list) { - elm_object_item_domain_text_translatable_set(ad->navi_it_profile_del_list, SETTING_PACKAGE, EINA_TRUE); - elm_naviframe_item_pop_cb_set(ad->navi_it_profile_del_list, setting_network_profile_delete_click_softkey_cancel_cb, ad); - } - - // Add ctx popup handler - Evas_Object* morebtn = elm_button_add(ad->navi_bar); - elm_object_style_set(morebtn, "naviframe/more/default"); - evas_object_smart_callback_add(morebtn, "clicked", create_ctxpopup_more_button_cb, ad); - elm_object_item_part_content_set(ad->navi_it_profile_del_list, "toolbar_more_btn", morebtn); - -#if 0 - // ADD 'SELECT ALL' - ad->data_delete_all = setting_create_Gendial_field_1radio(ad->gl_profile_del, &(ad->itc_1icon_1text_sub), - __screen_timeout_cb, ad, - SWALLOW_Type_1RADIO_RIGHT, - rdg, 4, KeyStr_Backlight_5_MIN_STR, - NULL); - if (ad->data_delete_all) { - ad->data_delete_all->userdata = ad; - __BACK_POINTER_SET(ad->data_delete_all); - } else { - SETTING_TRACE_ERROR("ad->data_delete_all is NULL"); - } -#endif - - __profile_delete_list_draw(ad); - setting_view_network_profile_delete.is_create = 1; - - return SETTING_RETURN_SUCCESS; -} - -static int setting_network_profile_delete_destroy(void *cb) -{ - SETTING_TRACE_BEGIN; - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - if (!setting_view_network_profile_delete.is_create) { - return SETTING_RETURN_SUCCESS; - } - - /* free data */ - if (ad->profile_del_list != NULL) { - eina_list_free(ad->profile_del_list); - ad->profile_del_list = NULL; - } - ad->gl_profile_del = NULL; - ad->navi_it_profile_del_list = NULL; - elm_naviframe_item_pop(ad->navi_bar); - setting_view_network_profile_delete.is_create = 0; - - return SETTING_RETURN_SUCCESS; -} - -#if 0 -static int setting_network_profile_delete_update(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - __profile_delete_list_draw(cb); - return SETTING_RETURN_SUCCESS; -} -#endif - -static int setting_network_profile_delete_cleanup(void *cb) -{ - SETTING_TRACE_BEGIN; - setting_network_profile_delete_destroy(cb); - return SETTING_RETURN_SUCCESS; -} - -/* *************************************************** - * - *general func - * - ***************************************************/ -void ___profile_selected(void *data) -{ - SettingNetworkUG *ad = data; - retm_if(ad == NULL, "Invalid argument: ad is NULL"); - Eina_List *check_list = ad->profile_del_list; - Setting_GenGroupItem_Data *item_data = NULL; - int selnum = 0; - while (check_list) { - item_data = (Setting_GenGroupItem_Data *)eina_list_data_get(check_list); - if (NULL == item_data) - continue; - - SETTING_TRACE("%s :%d", _(item_data->keyStr), item_data->chk_status); - if (item_data->chk_status) { - selnum++; - } - check_list = eina_list_next(check_list); - } - Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar); - if (navi_it) { - Evas_Object *toolbar = elm_object_item_part_content_get(navi_it, "toolbar"); - Elm_Object_Item *it = elm_toolbar_last_item_get(toolbar); - if (selnum != 0) { - char title[MAX_DISPLAY_NAME_LEN_ON_UI + 1] = {0, }; - snprintf(title, MAX_DISPLAY_NAME_LEN_ON_UI, _("IDS_ST_HEADER_PD_SELECTED"), selnum); - elm_object_item_text_set(navi_it, _(title)); - elm_object_item_disabled_set(it, EINA_FALSE); - } else { - elm_object_item_text_set(navi_it, _("IDS_ST_BODY_DELETE")); - elm_object_item_disabled_set(it, EINA_TRUE); - } - } -} - -static void -setting_network_profile_delete_check_cb(void *data, Evas_Object *obj, - void *event_info) -{ - retm_if(data == NULL, "Data parameter is NULL"); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) data; - list_item->chk_status = elm_check_state_get(obj); /* for genlist update status */ - ___profile_selected(list_item->userdata); -} - -static void -setting_network_profile_delete_mouse_up_cb(void *data, - Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(event_info == NULL, "Invalid argument: event info is NULL"); - - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - elm_genlist_item_selected_set(item, 0); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) elm_object_item_data_get(item); - setting_retm_if(NULL == list_item, "list_item is NULL"); - SETTING_TRACE("list_item->keyStr:%s", list_item->keyStr); - - setting_update_gl_item_chk_status(list_item, !(list_item->chk_status)); - ___profile_selected(list_item->userdata); -} - -/* *************************************************** - * - *call back func - * - ***************************************************/ -static Eina_Bool setting_network_profile_delete_click_softkey_cancel_cb(void *data, Elm_Object_Item *it) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retvm_if(data == NULL, FALSE, "Data parameter is NULL"); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - setting_view_change(&setting_view_network_profile_delete, - &setting_view_network_con_list, ad); - - if (ctxpopup != NULL) { - evas_object_del(ctxpopup); - ctxpopup = NULL; - } - return EINA_TRUE; -} - -static void __popup_deleted_response_cb(void *data, Evas_Object *obj, - void *event_info) -{ - retm_if(data == NULL, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - setting_view_change(&setting_view_network_profile_delete, &setting_view_network_con_list, ad); -} - -static void -setting_network_profile_delete_click_softkey_delete_cb(void *data, - Evas_Object * - obj, void - *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(data == NULL, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - Eina_List *check_list = ad->profile_del_list; - Setting_GenGroupItem_Data *item_data = NULL; - int err; - connection_profile_h profile_h; - char *name = NULL; - char *apn = NULL; - char *id = NULL; - char speciliztion[MAX_SPECIALIZITION_LEN] = { 0, }; - char *def_apn = NULL; - char *def_name = NULL; - char *def_id = NULL; - connection_profile_h def_profile = NULL; - (void) connection_get_default_cellular_service_profile(ad->connection, ad->profile_service_type, &def_profile); - if (def_profile) connection_profile_get_cellular_apn(def_profile, &def_apn); - if (def_profile) connection_profile_get_name(def_profile, &def_name); - if (def_profile) connection_profile_get_id(def_profile, &def_id); - SETTING_TRACE("Default profile:%p, def_apn[%s], def_name[%s]", def_profile, def_apn, def_name); - - bool result = TRUE; - Setting_GenGroupItem_Data *first_valid_item = NULL; - int ok_cnt = 0; - bool is_default = 0; - while (check_list) { - item_data = (Setting_GenGroupItem_Data *) eina_list_data_get(check_list); - if (NULL == item_data) { - check_list = eina_list_next(check_list); - continue; - } - SETTING_TRACE("item_data->chk_status:%d", item_data->chk_status); - if (!item_data->chk_status) { - if (!first_valid_item) first_valid_item = item_data;/*intilize at the first time */ - check_list = eina_list_next(check_list); - continue; - } - profile_h = (connection_profile_h)(item_data->belongs_to); - connection_profile_get_name(profile_h, &name); - connection_profile_get_cellular_apn(profile_h, &apn); - connection_profile_get_id(profile_h, &id); - if (!safeStrCmp(def_apn, apn) && !safeStrCmp(def_name, name) && !safeStrCmp(def_id, id)) { - is_default = TRUE; - } - if ((err = connection_remove_profile(ad->connection, profile_h)) != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("*** [ERR] connection_add_profile. err=%d ***", err); - G_FREE(name); - connection_profile_get_name(profile_h, &name); - SETTING_TRACE("name:%s", name); - if (!result) { /*already false */ - g_strlcat(speciliztion, ", ", MAX_SPECIALIZITION_LEN); - g_strlcat(speciliztion, _(name), MAX_SPECIALIZITION_LEN); - } else { - g_strlcat(speciliztion, _(name), MAX_SPECIALIZITION_LEN); - } - result = FALSE; - } else { - ok_cnt++; - if (is_default) { - if (first_valid_item) { - connection_profile_h first_profile_h = (connection_profile_h)(first_valid_item->belongs_to); - (void)connection_set_default_cellular_service_profile(ad->connection, - ad->profile_service_type, - first_profile_h); - } - } - /*eina_list_remove(ad->profile_list, profile_h); */ - } - - G_FREE(apn); - G_FREE(name); - G_FREE(id); - - check_list = eina_list_next(check_list); - } - - if (!result) { - g_strlcat(speciliztion, _(": "), MAX_SPECIALIZITION_LEN); - g_strlcat(speciliztion, _("IDS_COM_POP_DELETE_FAILED"), MAX_SPECIALIZITION_LEN); - setting_create_popup(ad, ad->win_get, NULL, _(speciliztion), NULL, 0, false, false, 0); - - if (ad->navi_it_profile_del_list) - elm_object_item_text_set(ad->navi_it_profile_del_list, _("IDS_ST_BODY_DELETE")); - - if (ok_cnt) __profile_delete_list_draw(ad); - - /*disable Delete button */ - Evas_Object *toolbar = elm_object_item_part_content_get(ad->navi_it_profile_del_list, "toolbar"); - Elm_Object_Item *it = elm_toolbar_last_item_get(toolbar); - elm_object_item_disabled_set(it, EINA_TRUE); - } - - if (result) { - setting_create_popup(ad, ad->win_get, NULL, "IDS_ST_BODY_DELETED", __popup_deleted_response_cb, 1, FALSE, FALSE, 0); - } - - if (def_profile) { - G_FREE(def_apn); - G_FREE(def_name); - G_FREE(def_id); - } - - if (ctxpopup != NULL) { - evas_object_del(ctxpopup); - ctxpopup = NULL; - } -} - -static void -setting_network_profile_delete_click_softkey_select_all_cb(void *data, - Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - SettingNetworkUG *ad = data; - Eina_List *check_list = ad->profile_del_list; - Setting_GenGroupItem_Data *item_data = NULL; - int selnum = 0; - int un_selnum = 0; - while (check_list) { - item_data = (Setting_GenGroupItem_Data *)eina_list_data_get(check_list); - if (NULL == item_data) - continue; - - SETTING_TRACE("%s :%d", _(item_data->keyStr), item_data->chk_status); - if (item_data->chk_status) { - selnum++; - } else { - un_selnum++; - } - check_list = eina_list_next(check_list); - } - SETTING_TRACE("selnum:%d, un_selnum:%d", selnum, un_selnum); - if (un_selnum == 0 && selnum != 0) { - /*current all are selected,so it need to unselect all after click the button */ - SETTING_TRACE("to unselect all"); - check_list = ad->profile_del_list; - un_selnum = 0; - while (check_list) { - item_data = (Setting_GenGroupItem_Data *)eina_list_data_get(check_list); - if (NULL == item_data) - continue; - setting_update_gl_item_chk_status(item_data, 0); - un_selnum++; - check_list = eina_list_next(check_list); - } - selnum = 0; - } else { - /*or else, to select all */ - SETTING_TRACE("to select all"); - check_list = ad->profile_del_list; - selnum = 0; - while (check_list) { - item_data = (Setting_GenGroupItem_Data *)eina_list_data_get(check_list); - if (NULL == item_data) - continue; - - setting_update_gl_item_chk_status(item_data, 1); - selnum++; - check_list = eina_list_next(check_list); - } - un_selnum = 0; - } - - if (ad->navi_it_profile_del_list) { - Evas_Object *toolbar = elm_object_item_part_content_get(ad->navi_it_profile_del_list, "toolbar"); - Elm_Object_Item *it = elm_toolbar_last_item_get(toolbar); - if (selnum != 0) { - char title[MAX_DISPLAY_NAME_LEN_ON_UI + 1] = {0, }; - snprintf(title, MAX_DISPLAY_NAME_LEN_ON_UI, _("IDS_ST_HEADER_PD_SELECTED"), selnum); - elm_object_item_text_set(ad->navi_it_profile_del_list, _(title)); - elm_object_item_disabled_set(it, EINA_FALSE); - } else { - elm_object_item_text_set(ad->navi_it_profile_del_list, _("IDS_ST_BODY_DELETE")); - elm_object_item_disabled_set(it, EINA_TRUE); - } - } - return; -} - - diff --git a/setting-network/src/setting-network-select-network.c b/setting-network/src/setting-network-select-network.c deleted file mode 100644 index d1d1554..0000000 --- a/setting-network/src/setting-network-select-network.c +++ /dev/null @@ -1,425 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include - -static int setting_network_select_network_create(void *cb); -static int setting_network_select_network_destroy(void *cb); -static int setting_network_select_network_update(void *cb); -static int setting_network_select_network_cleanup(void *cb); - -setting_view setting_view_network_select_network = { - .create = setting_network_select_network_create, - .destroy = setting_network_select_network_destroy, - .update = setting_network_select_network_update, - .cleanup = setting_network_select_network_cleanup, -}; - -/* *************************************************** - * - *basic func - * - ***************************************************/ -static void -__network_main_gl_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - ret_if(!data || !event_info); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up *)event_info; - Elm_Object_Item *selected_item = elm_genlist_at_xy_item_get(ad->genlist_sel_network, ev->output.x, ev->output.y, NULL); - ret_if(!selected_item); - Setting_GenGroupItem_Data *data_Item = elm_object_item_data_get(selected_item); - ret_if(!data_Item); - if (!safeStrCmp(data_Item->keyStr, "IDS_ST_BODY_SELECT_AUTOMATICALLY")) { - SETTING_TRACE("ev->output.x:%d, ev->output.y:%d", ev->output.x, ev->output.y); - Evas_Coord x, y, w, h; - evas_object_geometry_get(ad->data_auto_network_item->eo_check, &x, &y, &w, &h); - SETTING_TRACE("x:%d, y:%d, w:%d, h:%d", x, y, w , h); - if (x <= ev->output.x && ev->output.x <= (x + w) && y <= ev->output.y && ev->output.y <= (y + h)) { - return; - } - if (ad->data_auto_network_item->chk_status) { - char *sub_text = setting_customize_text(ad->data_auto_network_item->sub_desc, 0, BLUE_COLOR, NULL); - FREE(ad->data_auto_network_item->sub_desc); - ad->data_auto_network_item->sub_desc = (char *)g_strdup(sub_text); - FREE(sub_text); - } else { - char *sub_text = setting_customize_text(ad->data_auto_network_item->sub_desc, 0, GRAY_COLOR, NULL); - FREE(ad->data_auto_network_item->sub_desc); - ad->data_auto_network_item->sub_desc = (char *)g_strdup(sub_text); - FREE(sub_text); - } - - elm_genlist_item_fields_update(ad->data_auto_network_item->item, "*", ELM_GENLIST_ITEM_FIELD_TEXT); - } -} -static void -__network_main_gl_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - ret_if(!data || !event_info); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - Evas_Event_Mouse_Down *ev = (Evas_Event_Mouse_Down *)event_info; - ad->point_down.x = ev->output.x; - ad->point_down.y = ev->output.y; - Elm_Object_Item *selected_item = elm_genlist_at_xy_item_get(ad->genlist_sel_network, ev->output.x, ev->output.y, NULL); - ret_if(!selected_item); - Setting_GenGroupItem_Data *data_Item = elm_object_item_data_get(selected_item); - ret_if(!data_Item); - if (!safeStrCmp(data_Item->keyStr, "IDS_ST_BODY_SELECT_AUTOMATICALLY")) { - SETTING_TRACE("ev->output.x:%d, ev->output.y:%d", ev->output.x, ev->output.y); - Evas_Coord x, y, w, h; - evas_object_geometry_get(ad->data_auto_network_item->eo_check, &x, &y, &w, &h); - SETTING_TRACE("x:%d, y:%d, w:%d, h:%d", x, y, w , h); - if (x <= ev->output.x && ev->output.x <= (x + w) && y <= ev->output.y && ev->output.y <= (y + h)) { - return; - } - - char *sub_text = setting_customize_text(ad->data_auto_network_item->sub_desc, 0, WHITE_COLOR, NULL); - FREE(ad->data_auto_network_item->sub_desc); - ad->data_auto_network_item->sub_desc = (char *)g_strdup(sub_text); - FREE(sub_text); - elm_genlist_item_fields_update(ad->data_auto_network_item->item, "*", ELM_GENLIST_ITEM_FIELD_TEXT); - } - -} -static void -__network_main_gl_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - /*SETTING_TRACE_BEGIN; */ - ret_if(!data || !event_info); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - Evas_Event_Mouse_Move *ev = (Evas_Event_Mouse_Move *)event_info; - int x_offset = ev->cur.output.x - ad->point_down.x; - int y_offset = ev->cur.output.y - ad->point_down.y; - if (x_offset < 0) x_offset = -x_offset; - if (y_offset < 0) y_offset = -y_offset; - /*SETTING_TRACE("x_offset:%d, y_offset:%d", x_offset, y_offset); */ - if (x_offset <= MIN_MOVE_DISTANCE && y_offset <= MIN_MOVE_DISTANCE) { - return; - } - - /*SETTING_TRACE("xxxxxxxxxx"); */ - if (ad->data_auto_network_item->chk_status) { - char *sub_text = setting_customize_text(ad->data_auto_network_item->sub_desc, 0, BLUE_COLOR, NULL); - FREE(ad->data_auto_network_item->sub_desc); - ad->data_auto_network_item->sub_desc = (char *)g_strdup(sub_text); - FREE(sub_text); - } else { - char *sub_text = setting_customize_text(ad->data_auto_network_item->sub_desc, 0, GRAY_COLOR, NULL); - FREE(ad->data_auto_network_item->sub_desc); - ad->data_auto_network_item->sub_desc = (char *)g_strdup(sub_text); - FREE(sub_text); - } - - elm_genlist_item_fields_update(ad->data_auto_network_item->item, "*", ELM_GENLIST_ITEM_FIELD_TEXT); -} - -static int setting_network_select_network_create(void *cb) -{ - SETTING_TRACE_BEGIN; - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - if (ad->view_to_load == &setting_view_network_select_network) { - ad->ly_main = setting_create_layout_navi_bar_genlist(ad->win_main_layout, - ad->win_get, - "IDS_COM_BODY_NETWORK_OPERATORS", - _("IDS_ST_BUTTON_BACK"), NULL, - setting_network_select_network_click_softkey_cancel_cb, NULL, - ad, &ad->genlist_sel_network, &ad->navi_bar); - } else { - setting_push_layout_navi_bar_genlist(ad->win_main_layout, ad->win_get, - "IDS_COM_BODY_NETWORK_OPERATORS", - _("IDS_ST_BUTTON_BACK"), - NULL, - setting_network_select_network_click_softkey_cancel_cb, - NULL, - ad, &ad->genlist_sel_network, ad->navi_bar); - } - Elm_Object_Item *item = elm_genlist_item_append(ad->genlist_sel_network, - &(itc_seperator), NULL, NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - - /* scroller is a genlist */ - ad->chk_sel = elm_radio_add(ad->genlist_sel_network); - elm_radio_state_value_set(ad->chk_sel, -1); - vconf_get_int(VCONFKEY_SETAPPL_SELECT_NETWORK_INT, &ad->sel_net);/*retrieve here */ - SETTING_TRACE("ad->sel_net:%d", ad->sel_net); - - vconf_get_int(VCONFKEY_SETAPPL_SELECT_OLD_NT_ACT, &ad->sel_act);/*retrieve here */ - SETTING_TRACE("ad->sel_act:%d", ad->sel_act); - - FREE(ad->sel_network); - /*ad->sel_network = vconf_get_str(VCONFKEY_TELEPHONY_NWNAME); */ - ad->sel_network = get_pa_select_network(); - SETTING_TRACE("pa_sel_net_name:%s", ad->sel_network); - if (!ad->sel_network) { - ad->sel_network = strndup(Keystr_UNKNOWN_NETWORK, strlen(Keystr_UNKNOWN_NETWORK) + 1); - } - - elm_genlist_mode_set(ad->genlist_sel_network, ELM_LIST_COMPRESS); /* resolve abnormal height issue */ - - evas_object_event_callback_add(ad->genlist_sel_network, EVAS_CALLBACK_MOUSE_UP, __network_main_gl_mouse_up, ad); - evas_object_event_callback_add(ad->genlist_sel_network, EVAS_CALLBACK_MOUSE_DOWN, __network_main_gl_mouse_down, ad); - evas_object_event_callback_add(ad->genlist_sel_network, EVAS_CALLBACK_MOUSE_MOVE, __network_main_gl_mouse_move, ad); - - if (TAPI_NETWORK_SELECTIONMODE_AUTOMATIC == ad->sel_net) { - ad->data_auto_network_item = setting_create_Gendial_field_1radio( - ad->genlist_sel_network, - &(itc_1text_1icon), - setting_network_Gendial_select_plmn_cb, - ad, SWALLOW_Type_1ICON_1RADIO, - NULL, TRUE, - "IDS_ST_BODY_SELECT_AUTOMATICALLY", - setting_network_select_network_chk_changed); - setting_retvm_if(NULL == ad->data_auto_network_item, - SETTING_RETURN_FAIL, "Failed to calloc memory"); - char *sub_text = setting_customize_text(_(ad->sel_network), 0, BLUE_COLOR, NULL); - ad->data_auto_network_item->sub_desc = (char *)g_strdup(sub_text); - FREE(sub_text); - ad->data_auto_network_item->userdata = ad; - - } else if (TAPI_NETWORK_SELECTIONMODE_MANUAL == ad->sel_net) { - - ad->data_auto_network_item = setting_create_Gendial_field_1radio( - ad->genlist_sel_network, - &(itc_1text_1icon), - setting_network_Gendial_select_plmn_cb, - ad, SWALLOW_Type_1ICON_1RADIO, - NULL, FALSE, "IDS_ST_BODY_SELECT_AUTOMATICALLY", - setting_network_select_network_chk_changed); - - setting_retvm_if(NULL == ad->data_auto_network_item, SETTING_RETURN_FAIL, "Failed to calloc memory"); - /*ad->data_auto_network_item->sub_desc = (char *)g_strdup(ad->sel_network);//just a simple display */ - char *sub_text = setting_customize_text(_(ad->sel_network), 0, GRAY_COLOR, NULL); - ad->data_auto_network_item->sub_desc = (char *)g_strdup(sub_text); - FREE(sub_text); - ad->data_auto_network_item->userdata = ad; - - setting_view_network_select_network.is_create = TRUE; - - setting_network_searching_network(ad->data_auto_network_item); - - /* Searching icon appeared. - ad->data_search_network_item = setting_create_Gendial_field_1radio( - ad->genlist_sel_network, - &itc_1icon, - NULL, NULL, - SWALLOW_Type_1RADIO_1SEARCH, - ad->chk_sel, -1, NULL, NULL); - __BACK_POINTER_SET(ad->data_search_network_item); - elm_genlist_item_select_mode_set(ad->data_search_network_item->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - */ - - /* - if (0 == safeStrCmp("IDS_ST_BODY_NOSERVICE", ad->sel_network) - || 0 == safeStrCmp(_("IDS_ST_BODY_NOSERVICE"), _(ad->sel_network)) - || 0 == safeStrCmp("EMERGENCY", ad->sel_network) - || 0 == safeStrCmp(_("EMERGENCY"), ad->sel_network) - || 0 == safeStrCmp("No service", ad->sel_network) - || 0 == safeStrCmp("No service", _(ad->sel_network)) - || 0 == safeStrCmp(_("IDS_CALL_POP_CALLING_EMERG_ONLY"), _(ad->sel_network)) - || 0 == safeStrCmp("Emergency calls only", _(ad->sel_network)) - ) - { - //no service case: - ad->data_search_network_item = setting_create_Gendial_field_1radio( - ad->genlist_sel_network, - &itc_1icon, - NULL, NULL, - SWALLOW_Type_1RADIO_1SEARCH, - ad->chk_sel, -1, NULL, NULL); - __BACK_POINTER_SET(ad->data_search_network_item); - elm_genlist_item_select_mode_set(ad->data_search_network_item->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - } - else - { - //normal case: - Setting_GenGroupItem_Data *item_Data = NULL; - - char sel_network_desc[MAX_COMMON_BUFFER_LEN] = { 0, }; - - snprintf(sel_network_desc, MAX_COMMON_BUFFER_LEN, "%s",_(ad->sel_network)); - item_Data = setting_create_Gendial_field_1radio( - ad->genlist_sel_network, - &itc_multiline_1text_1icon, - setting_network_Gendial_select_plmn_cb, ad, - SWALLOW_Type_1RADIO, - ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL, - sel_network_desc, - setting_network_select_network_chk_changed); - setting_retvm_if(NULL == item_Data, SETTING_RETURN_FAIL, "Failed to calloc memory"); - item_Data->userdata = ad; - - ad->data_search_network_item = setting_create_Gendial_field_1radio( - ad->genlist_sel_network, - &itc_1icon, - NULL, NULL, - SWALLOW_Type_1RADIO_1SEARCH, - ad->chk_sel, -1, NULL, NULL); - __BACK_POINTER_SET(ad->data_search_network_item); - elm_genlist_item_select_mode_set(ad->data_search_network_item->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - elm_radio_value_set(ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL); - - } - */ - } - - setting_view_network_select_network.is_create = TRUE; - return SETTING_RETURN_SUCCESS; - /* - err_handle: - setting_view_network_select_network.is_create = TRUE; - return SETTING_RETURN_FAIL; - */ -} - -static int setting_network_select_network_destroy(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - - evas_object_event_callback_del(ad->genlist_sel_network, EVAS_CALLBACK_MOUSE_UP, __network_main_gl_mouse_up); - evas_object_event_callback_del(ad->genlist_sel_network, EVAS_CALLBACK_MOUSE_DOWN, __network_main_gl_mouse_down); - evas_object_event_callback_del(ad->genlist_sel_network, EVAS_CALLBACK_MOUSE_MOVE, __network_main_gl_mouse_move); - - if (ad->timer) { - ecore_timer_del(ad->timer); - ad->timer = NULL; - } - - if (ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } - - /*cancel the searching operation */ - if (ad->b_searching_network) { - int tapi_ret; - tapi_ret = tel_cancel_network_manual_search(ad->handle, setting_tapi_cancel_manual_search_cb, ad); - if (tapi_ret != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("*** [ERR] tel_cancel_network_manual_search. "\ - "tapi_ret=%d ***", tapi_ret); - } - ad->b_searching_network = FALSE; - } - /*roolback..*/ - if (0 != vconf_get_int(VCONFKEY_SETAPPL_SELECT_NETWORK_INT, &ad->sel_net)) { - SETTING_TRACE_ERROR("vconf get failed"); - } - - if (0 != vconf_get_int(VCONFKEY_SETAPPL_SELECT_OLD_NT_ACT, &ad->sel_act)) { - SETTING_TRACE_ERROR("vconf get failed"); - } - - FREE(ad->sel_network); - ad->sel_network = get_pa_select_network(); - if (!ad->sel_network) { - ad->sel_network = strndup(Keystr_UNKNOWN_NETWORK, strlen(Keystr_UNKNOWN_NETWORK) + 1); - } - - /*reset..*/ - ad->b_set_manul_network = FALSE; - ad->b_set_auto_network = FALSE; - setting_network_update_sel_network(ad); - - if (ad->view_to_load == &setting_view_network_select_network) { - if (ad->ly_main) { - evas_object_del(ad->ly_main); - ad->ly_main = NULL; - } - } else { - elm_naviframe_item_pop(ad->navi_bar); - } - /* elm_naviframe_item_pop(ad->navi_bar); */ - - /*Following handlers will be used by async listening callback. They must be reset after genlist is 'popuped'. */ - ad->data_auto_network_item = NULL; - /*data_sel_net was created in main view, it won't be destoryed. */ - /*ad->data_sel_net = NULL; */ - setting_view_network_select_network.is_create = FALSE; - - return SETTING_RETURN_SUCCESS; -} - -static int setting_network_select_network_update(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - /*SettingNetworkUG *ad = (SettingNetworkUG *) cb; */ - /*elm_radio_value_set(ad->chk_sel, ad->sel_net); */ - - return SETTING_RETURN_SUCCESS; -} - -static int setting_network_select_network_cleanup(void *cb) -{ - SETTING_TRACE_BEGIN; - return setting_network_select_network_destroy(cb); -} - -/* *************************************************** - * - *general func - * - ***************************************************/ - -/* *************************************************** - * - *call back func - * - ***************************************************/ - -static void -setting_network_select_network_click_softkey_cancel_cb(void *data, - Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - /* If registering.. popup is displaying, Back must be ignored. */ - if (ad->network_select_registering_pop) { - SETTING_TRACE("registering... popup is displaying. back key ignored"); - return; - } - - /* error check */ - retm_if(data == NULL, "[Setting > Network > Select] Data parameter is NULL"); - - if (ad->view_to_load == &setting_view_network_select_network) { - /* exit */ - ug_destroy_me(ad->ug); - return; - } else { - setting_view_change(&setting_view_network_select_network, - &setting_view_network_main, ad); - } - return; -} - diff --git a/setting-network/src/setting-network.c b/setting-network/src/setting-network.c deleted file mode 100755 index cb2225c..0000000 --- a/setting-network/src/setting-network.c +++ /dev/null @@ -1,2028 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include -#include -#include - -#ifndef UG_MODULE_API -#define UG_MODULE_API __attribute__ ((visibility("default"))) -#endif - - -const char *STR_SETTING_OPERATION_FAILED = "IDS_BT_POP_OPERATION_FAILED"; -static Evas_Object *__create_registering_popup(void *data); - -char *__get_profile_name(int conType, void *data) -{ - setting_retvm_if(data == NULL, NULL, "data is NULL"); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - char *def_name = NULL; - if (CONNECTION_CELLULAR_SERVICE_TYPE_MMS == conType) { - connection_profile_iterator_h profile_iter = NULL; - connection_profile_h profile_h = NULL; - - char *profile_id = NULL; - char *profile_name = NULL; - char *apn = NULL; - bool profile_bhidden = false; - connection_profile_type_e profile_type = CONNECTION_PROFILE_TYPE_CELLULAR; - connection_cellular_service_type_e service_type = CONNECTION_CELLULAR_SERVICE_TYPE_UNKNOWN; - - int rv = connection_get_profile_iterator(ad->connection, CONNECTION_ITERATOR_TYPE_REGISTERED, &profile_iter); - if (rv != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get profile iterator [%d]", rv); - return NULL; - } - - int cnt = 0; - while (connection_profile_iterator_has_next(profile_iter)) { - if (cnt >= MAX_PROFILE_NUM) { - break; - } - if (connection_profile_iterator_next(profile_iter, &profile_h) != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get profile handle"); - break; - } - - if (connection_profile_get_type(profile_h, &profile_type) != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get profile type"); - continue; - } - if (connection_profile_get_cellular_service_type(profile_h, &service_type) != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get service type"); - continue; - } - - if (connection_profile_get_name(profile_h, &profile_name) != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get profile name"); - continue; - } - - if (connection_profile_is_cellular_hidden(profile_h, &profile_bhidden) != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get profile hidden attr (true/false)"); - continue; - } - - if (connection_profile_get_cellular_apn(profile_h, &apn) != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get apn"); - G_FREE(profile_name); - continue; - } - - connection_profile_get_id(profile_h, &profile_id); - - SETTING_TRACE("Record[%d:%s] profile_handle:%s, profile_id:%s, profile_name:%s, profile_type:%d, service_type:%d", - cnt, apn, profile_h, profile_id, profile_name, profile_type, service_type); - if (CONNECTION_PROFILE_TYPE_CELLULAR != profile_type) { - G_FREE(apn); - G_FREE(profile_id); - G_FREE(profile_name); - continue; - } - if (profile_bhidden == false - && CONNECTION_CELLULAR_SERVICE_TYPE_MMS == service_type) { /*unknow, match with ad->con_name */ - FREE(def_name); /*keep the last one */ - def_name = strdup(profile_name); - } else { - SETTING_TRACE("profile hidden attribute : %d ", profile_bhidden); - } - G_FREE(apn); - G_FREE(profile_id); - G_FREE(profile_name); - cnt++; - } - - return def_name != NULL ? def_name : strdup(KeyStr_No_Profile); - } - - connection_profile_h def_profile = NULL; - (void)connection_get_default_cellular_service_profile(ad->connection, - conType, &def_profile); - if (def_profile) connection_profile_get_name(def_profile, &def_name); - - def_name = def_name != NULL ? def_name : strdup(KeyStr_No_Profile); - return def_name; -} - -static void __notify_response_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(!data, "!data"); - SettingNetworkUG *ad = data; - if (obj) { - evas_object_del(obj); - obj = NULL; - } - /* Send destroy request */ - ug_destroy_me(ad->ug); -} - -static void __selected_network_change_cb(keynode_t *key, void *data) -{ - /*SETTING_TRACE_BEGIN; */ - setting_retm_if(!data, "!data"); - SettingNetworkUG *ad = data; - char *vconf_name = vconf_keynode_get_name(key); - - if (!safeStrCmp(vconf_name, VCONFKEY_TELEPHONY_NWNAME) - || !safeStrCmp(vconf_name, VCONFKEY_TELEPHONY_SPN_DISP_CONDITION) - || !safeStrCmp(vconf_name, VCONFKEY_TELEPHONY_SPN_NAME) - || !safeStrCmp(vconf_name, VCONFKEY_TELEPHONY_SVCTYPE) - ) { - ad->sel_network = get_pa_select_network(); - if (!ad->sel_network) { - ad->sel_network = strdup(Keystr_UNKNOWN_NETWORK); - } - - if (0 != vconf_set_int(VCONFKEY_SETAPPL_SELECT_NETWORK_INT, ad->sel_net)) { - SETTING_TRACE_ERROR("vconf[%s] set failed"); - } - - if (0 != vconf_set_int(VCONFKEY_SETAPPL_SELECT_OLD_NT_ACT, ad->sel_act)) { - SETTING_TRACE_ERROR("vconf[%s] set failed"); - } - - setting_network_update_sel_network(ad); - } else if (!safeStrCmp(vconf_name, VCONFKEY_TELEPHONY_FLIGHT_MODE)) { - SETTING_TRACE("vconf_name:%s", vconf_name); - setting_create_popup(ad, ad->ly_main, NULL, "IDS_ST_BODY_FLIGHT_MODE_HAS_BEEN_ENABLED_NETWORK_SETTINGS_WILL_CLOSE", - __notify_response_cb, - POPUP_INTERVAL * 2, TRUE, FALSE, 0); - - } -} - - -static void setting_network_ug_cb_resize(void *data, Evas *e, - Evas_Object *obj, void *event_info) -{ - SettingNetworkUG *ad = (SettingNetworkUG *) data; - setting_view_update(&setting_view_network_main, ad); -} - -static setting_view *__get_network_view_to_load(void *data, app_control_h service) -{ - SETTING_TRACE_BEGIN; - setting_retvm_if((!data), NULL, "data is NULL"); - SettingNetworkUG *networkUG = (SettingNetworkUG *)data; - - setting_view_node_table_intialize(); - - if (0 == safeStrCmp(networkUG->view_type_string, "netsearch")) { - setting_view_node_table_register(&setting_view_network_select_network, NULL); - return &setting_view_network_select_network; - - } else { - setting_view_node_table_register(&setting_view_network_main, NULL); - setting_view_node_table_register(&setting_view_network_select_network, &setting_view_network_main); - - setting_view_node_table_register(&setting_view_network_con, &setting_view_network_main); - setting_view_node_table_register(&setting_view_network_con_list, &setting_view_network_con); - setting_view_node_table_register(&setting_view_network_connection_create, &setting_view_network_con_list); - setting_view_node_table_register(&setting_view_network_profile_delete, &setting_view_network_con_list); - - return &setting_view_network_main; - } -} - - - -void ___popup_view_resp_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *) data; - int err = 0; /* error check */ - int response_type = btn_type(obj); - - int value = 0; - setting_get_bool_slp_key(BOOL_SLP_SETTING_USE_PACKET_DATA, &value, &err); - setting_retm_if(err != 0, "get vconf failed"); - SETTING_TRACE("value = %d", value); - if (POPUP_RESPONSE_OK == response_type) { - if (value == 0) { - setting_set_bool_slp_key(BOOL_SLP_SETTING_USE_PACKET_DATA, - SETTING_ON_OFF_BTN_ON, &err); - setting_retm_if(err != 0, "set vconf failed"); - setting_update_gl_item_chk_status(ad->data_mobile_data, 1); - } else { - setting_set_bool_slp_key(BOOL_SLP_SETTING_USE_PACKET_DATA, - SETTING_ON_OFF_BTN_OFF, &err); - setting_retm_if(err != 0, "set vconf failed"); - - setting_update_gl_item_chk_status(ad->data_mobile_data, 0); - - /* should set data_roming as same as status of use_packet_data */ - int data_roaming_value = 0; - setting_get_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING, &data_roaming_value, &err); - setting_retm_if(err != 0, "get vconf failed"); - if (data_roaming_value) { - setting_set_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING, - SETTING_ON_OFF_BTN_OFF, &err); - setting_retm_if(err != 0, "set vconf failed"); - setting_update_gl_item_chk_status(ad->data_roaming, SETTING_ON_OFF_BTN_OFF); - } - } - } else if (POPUP_RESPONSE_CANCEL == response_type) { - /* rollback */ - setting_set_bool_slp_key(BOOL_SLP_SETTING_USE_PACKET_DATA, - value, &err); - setting_retm_if(err != 0, "set vconf failed"); - setting_update_gl_item_chk_status(ad->data_mobile_data, value); - } -#if 0 - if (ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } -#else - - evas_object_hide(ad->popup); - SETTING_TRACE("ad->ug:%p", ad->ug); - ug_destroy_me(ad->ug); -#endif -} - -static void *___load_popup_view(ui_gadget_h ug, - enum ug_mode mode, app_control_h service, - void *priv) -{ - SettingNetworkUG *ad = priv; - char *viewtype = NULL; - app_control_get_extra_data(service, "viewtype", &viewtype); - - if (!safeStrCmp(viewtype, "mobile_data")) { - int status = SETTING_ON_OFF_BTN_OFF; - int err; - setting_get_bool_slp_key(BOOL_SLP_SETTING_USE_PACKET_DATA, &status, &err); - if (status) { - /*set to off */ - ad->popup = - setting_create_popup(ad, ad->win_get, - _(KeyStr_Network_Turn_Off_Mobile_Data), - _(KeyStr_Network_Mobile_Data_Has_Been_Disabled_Msg), - ___popup_view_resp_cb, - 0, FALSE, FALSE, - 2, keyStr_OK, keyStr_CANCEL); - } else { - /*set to on */ - ad->popup = - setting_create_popup(ad, ad->win_get, - NULL, _(Data_packet_Popup_desc), - ___popup_view_resp_cb, - 0, FALSE, FALSE, - 2, _("IDS_ST_SK_YES"), _("IDS_ST_SK_NO")); - } - - } - if (viewtype) { - FREE(viewtype); - } - return ad->popup; -} - -static void *setting_network_ug_on_create(ui_gadget_h ug, - enum ug_mode mode, app_control_h service, - void *priv) -{ - setting_retvm_if((!priv), NULL, "!priv"); - - SettingNetworkUG *networkUG = priv; - networkUG->ug = ug; - - networkUG->win_main_layout = (Evas_Object *) ug_get_parent_layout(ug); - networkUG->win_get = (Evas_Object *) ug_get_window(); - - evas_object_show(networkUG->win_main_layout); - networkUG->evas = evas_object_evas_get(networkUG->win_main_layout); - - setting_retvm_if(networkUG->win_main_layout == NULL, NULL, - "cannot get main window "); -#if 1 - Evas_Object *popup_view = ___load_popup_view(ug, mode, service, priv); - if (popup_view) { - return popup_view; - } -#endif - - /* init */ - ecore_imf_init(); - - /*pass NULL to let TAPI access default module */ - networkUG->handle = tel_init(NULL); - if (!networkUG->handle) { - SETTING_TRACE_DEBUG("%s*** [ERR] tel_init. ***%s", - SETTING_FONT_RED, SETTING_FONT_BLACK); - } - - if (CONNECTION_ERROR_NONE != connection_create(&(networkUG->connection))) { - SETTING_TRACE_ERROR("***Failed to connection_create.***"); - } - - setting_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR); - - networkUG->view_type_string = NULL; - app_control_get_extra_data(service, "viewtype", &(networkUG->view_type_string)); - networkUG->view_to_load = __get_network_view_to_load(networkUG, service); - /*SETTING_TRACE("ad->whitelist_doc:%p", networkUG->whitelist_doc); */ - /*SETTING_TRACE("ad->whitelist_root_node:%p", networkUG->whitelist_root_node); */ - - /*Read information from vconf, need not check whitelist in Settings */ - /*load_XML(WHITELIST_DIR_PATH, "whiteLists", &(networkUG->whitelist_doc),&(networkUG->whitelist_root_node)); */ - - /*SETTING_TRACE("ad->whitelist_doc:%p", networkUG->whitelist_doc); */ - /*SETTING_TRACE("ad->whitelist_root_node:%p", networkUG->whitelist_root_node); */ - - /* creating a view. */ - setting_view_node_set_cur_view(networkUG->view_to_load); - /*fix load network ug repeatedly issue */ - if (networkUG->view_to_load == &setting_view_network_main - && networkUG->view_to_load->is_create) { - networkUG->view_to_load->is_create = 0; - } - setting_view_create(networkUG->view_to_load, (void *)networkUG); - - - /* register view node table */ -#ifdef UI_NETWORK_MODE - if (tel_get_network_mode(networkUG->handle, setting_tapi_get_band_cb, networkUG) != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("*** [ERR] tel_get_network_band. ***"); - } -#endif - - if (tel_get_network_selection_mode(networkUG->handle, setting_tapi_get_plmn_mode_cb, networkUG) != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("*** [ERR] tel_get_network_selection_mode. ***"); - } - - if (tel_get_network_serving(networkUG->handle, setting_tapi_get_serving_network_cb, networkUG) != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("*** [ERR] tel_get_network_serving. ***"); - } - - evas_object_event_callback_add(networkUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_network_ug_cb_resize, networkUG); - - (void)vconf_notify_key_changed(VCONFKEY_TELEPHONY_NWNAME, __selected_network_change_cb, networkUG); - (void)vconf_notify_key_changed(VCONFKEY_TELEPHONY_SPN_DISP_CONDITION, __selected_network_change_cb, networkUG); - (void)vconf_notify_key_changed(VCONFKEY_TELEPHONY_SPN_NAME, __selected_network_change_cb, networkUG); - (void)vconf_notify_key_changed(VCONFKEY_TELEPHONY_SVCTYPE, __selected_network_change_cb, networkUG); - (void)vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE, __selected_network_change_cb, networkUG); - - return networkUG->ly_main; -} - - -static void setting_network_ug_on_start(ui_gadget_h ug, app_control_h service, - void *priv) -{ - setting_retm_if((!priv), "!priv"); - - SettingNetworkUG *ad = priv; - ad->apn_internet = __get_profile_name(CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET, ad); - ad->apn_MMS = __get_profile_name(CONNECTION_CELLULAR_SERVICE_TYPE_MMS, ad); - -} - -static void setting_network_ug_on_pause(ui_gadget_h ug, app_control_h service, - void *priv) -{ -} - -static void setting_network_ug_on_resume(ui_gadget_h ug, app_control_h service, - void *priv) -{ -} - -static void setting_network_ug_on_destroy(ui_gadget_h ug, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - setting_retm_if((!priv), "!priv"); - SettingNetworkUG *networkUG = priv; - /*unload_XML(&(networkUG->whitelist_doc), &(networkUG->whitelist_root_node)); */ - - (void)vconf_ignore_key_changed(VCONFKEY_TELEPHONY_NWNAME, __selected_network_change_cb); - (void)vconf_ignore_key_changed(VCONFKEY_TELEPHONY_SPN_DISP_CONDITION, __selected_network_change_cb); - (void)vconf_ignore_key_changed(VCONFKEY_TELEPHONY_SPN_NAME, __selected_network_change_cb); - (void)vconf_ignore_key_changed(VCONFKEY_TELEPHONY_SVCTYPE, __selected_network_change_cb); - (void)vconf_ignore_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE, __selected_network_change_cb); - - evas_object_event_callback_del(networkUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_network_ug_cb_resize); /* fix flash issue for gallery */ - networkUG->ug = ug; - - if (networkUG->view_type_string) - FREE(networkUG->view_type_string); - G_FREE(networkUG->ed_pxy_addr_desc); - G_FREE(networkUG->ed_pxy_port_desc); - FREE(networkUG->sel_network); - FREE(networkUG->access_name); - FREE(networkUG->con_name); - FREE(networkUG->apn_internet); - FREE(networkUG->apn_MMS); - /* release */ - ecore_imf_shutdown(); - - /* unregister dnet client */ - if (networkUG->connection) { - connection_destroy(networkUG->connection); - networkUG->connection = NULL; - } - - if (networkUG->handle && tel_deinit(networkUG->handle) != TAPI_API_SUCCESS) { - SETTING_TRACE_DEBUG - ("%s*** [ERR] setting_network_unsubscribe_tapi_events. ***%s", - SETTING_FONT_RED, SETTING_FONT_BLACK); - } - if (networkUG->profile_list != NULL) { - eina_list_free(networkUG->profile_list); - networkUG->profile_list = NULL; - } - - setting_network_popup_delete(networkUG); - /* delete the allocated objects. */ - setting_view_destroy(&setting_view_network_select_network, networkUG); - - setting_view_destroy(&setting_view_network_con, networkUG); - setting_view_destroy(&setting_view_network_con_list, networkUG); - setting_view_destroy(&setting_view_network_connection_create, - networkUG); - setting_view_destroy(&setting_view_network_profile_delete, - networkUG); - setting_view_destroy(&setting_view_network_main, networkUG); - - if (NULL != ug_get_layout(networkUG->ug)) { - evas_object_hide((Evas_Object *) ug_get_layout(networkUG->ug)); - evas_object_del((Evas_Object *) ug_get_layout(networkUG->ug)); - } - - SETTING_TRACE_END; -} - -static void setting_network_ug_on_message(ui_gadget_h ug, app_control_h msg, - app_control_h service, void *priv) -{ -} - -static void __update_mobile_data_on_popup(void *data) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(NULL == data, "data is NULL"); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - ret_if(NULL == ad->popup_data_on); - - elm_object_text_set(ad->popup_data_on, _(Data_packet_Popup_desc)); -} - -static void __update_mobile_data_off_popup(void *data) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(NULL == data, "data is NULL"); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - ret_if(NULL == ad->popup_data_off); - - char *pop_info = NULL; - char *pop_title = NULL; - - pop_info = (char *)g_strdup(_(KeyStr_Network_Mobile_Data_Has_Been_Disabled_Msg)); - pop_title = (char *)g_strdup(_(KeyStr_Network_Turn_Off_Mobile_Data)); - - elm_object_text_set(ad->popup_data_off, _(pop_info)); - - if (pop_title) { - elm_object_part_text_set(ad->popup_data_off, "title,text", _(pop_title)); - } - G_FREE(pop_title); -} - -static void setting_network_ug_on_event(ui_gadget_h ug, - enum ug_event event, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - SettingNetworkUG *ad = (SettingNetworkUG *) priv; - - switch (event) { - case UG_EVENT_LOW_MEMORY: - break; - case UG_EVENT_LOW_BATTERY: - break; - case UG_EVENT_LANG_CHANGE: - if (ad->genlist && setting_view_network_main.is_create) { - /*update items */ - elm_genlist_realized_items_update(ad->genlist); - Elm_Object_Item *item = NULL; - Setting_GenGroupItem_Data *item_data = NULL; - if (ad->data_mobile_data) { - item = elm_genlist_item_next_get(ad->data_mobile_data->item); - if (item) { - item = elm_genlist_item_next_get(item); - } - if (item) { - item_data = (Setting_GenGroupItem_Data *)elm_object_item_data_get(item); - } - } - if (item_data) { - const char *title = Data_packet_Sub_desc; - item_data->keyStr = strdup(title); - elm_object_item_data_set(item_data->item, item_data); - elm_genlist_item_update(item_data->item); - } -#ifdef UI_NETWORK_MODE - /*update sub text */ - if (ad->handle && tel_get_network_mode(ad->handle, setting_tapi_get_band_cb, ad) != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("*** [ERR] tel_get_network_band. ***"); - } - setting_network_update_sel_network(ad); -#endif - /*update title */ - Elm_Object_Item *navi_it = elm_naviframe_bottom_item_get(ad->navi_bar); - ret_if(!navi_it); - elm_object_item_text_set(navi_it, _("IDS_ST_BODY_NETWORK")); - /*update popup */ - __update_mobile_data_on_popup(ad); - __update_mobile_data_off_popup(ad); - } - break; - case UG_EVENT_ROTATE_PORTRAIT: - break; - case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN: - break; - case UG_EVENT_ROTATE_LANDSCAPE: - break; - case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN: - break; - case UG_EVENT_REGION_CHANGE: - break; - default: - break; - } -} - -static void setting_network_ug_on_key_event(ui_gadget_h ug, - enum ug_key_event event, - app_control_h service, void *priv) -{ - SETTING_TRACE_BEGIN; - SettingNetworkUG *ad = (SettingNetworkUG *) priv; - - switch (event) { - case UG_KEY_EVENT_END: { - /* setting_network_popup_delete(ad); */ - if (elm_naviframe_top_item_get(ad->navi_bar) == - elm_naviframe_bottom_item_get(ad->navi_bar)) { - ug_destroy_me(ug); - } else { - /* elm_naviframe_item_pop(ad->navi_bar); */ - setting_view_cb_at_endKey(ad); - } - } - break; - default: - break; - } -} - -UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops) -{ - SETTING_TRACE_BEGIN; - SettingNetworkUG *networkUG = calloc(1, sizeof(SettingNetworkUG)); - setting_retvm_if(!networkUG, -1, "Create SettingNetworkUG obj failed"); - - ops->create = setting_network_ug_on_create; - ops->start = setting_network_ug_on_start; - ops->pause = setting_network_ug_on_pause; - ops->resume = setting_network_ug_on_resume; - ops->destroy = setting_network_ug_on_destroy; - ops->message = setting_network_ug_on_message; - ops->event = setting_network_ug_on_event; - ops->key_event = setting_network_ug_on_key_event; - ops->priv = networkUG; - ops->opt = UG_OPT_INDICATOR_ENABLE; - - return 0; -} - -UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops) -{ - SETTING_TRACE_BEGIN; - struct SettingNetworkUG *networkUG; - setting_retm_if(!ops, "ops == NULL"); - - networkUG = ops->priv; - FREE(networkUG); -} - -/* *************************************************** - * - *general func - * - ***************************************************/ -void setting_network_popup_delete(void *data) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(data == NULL, - "setting_network_tapi_popup_create Data parameter is NULL"); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - if (ad->network_select_registering_pop != NULL) { - evas_object_del(ad->network_select_registering_pop); - ad->network_select_registering_pop = NULL; - } - if (ad->network_ug_pop != NULL) { - evas_object_del(ad->network_ug_pop); - ad->network_ug_pop = NULL; - } - if (ad->popup != NULL) { - evas_object_del(ad->popup); - ad->popup = NULL; - } -} - -/* *************************************************** - * - *call back func - * - ***************************************************/ -#ifdef UI_NETWORK_MODE -/** - * @see also setting_tapi_set_band_cb - * @see also tel_get_network_mode - */ -void setting_tapi_get_band_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE(" - result = 0x%x", result); - ret_if(!user_data); - SettingNetworkUG *ad = user_data; - - if (ad->network_ug_pop) { - evas_object_del(ad->network_ug_pop); - ad->network_ug_pop = NULL; - } - - if (result == TAPI_NETWORK_NO_ERR) { - int band; - int temp_net_mode = 0; - memcpy(&band, data, sizeof(int)); - - SETTING_TRACE("tel_get_network_mode() callback received, band=%d", band); - - temp_net_mode = band; - - /* ***BEGIN*** Fixed the problem of word twinkle SAMSUNG 2010/7/21 modify */ - ad->net_mode = temp_net_mode; - - const char *sub_desc = NULL; - /* Need to fix */ - char *szCscFeatureValue = "all_numeric"; - - switch (ad->net_mode) { - case TAPI_NETWORK_MODE_AUTO: - case TAPI_NETWORK_MODE_LTE|TAPI_NETWORK_MODE_WCDMA|TAPI_NETWORK_MODE_GSM: - if (is_lte_on_feature(ad)) { - if (strcmp(szCscFeatureValue, "all_numeric") == 0) - sub_desc = _("IDS_ST_OPT_4G_3G_2G_HAUTO_CONNECT"); - else - sub_desc = _("IDS_ST_OPT_LTE_WCDMA_GSM_HAUTO_CONNECT"); - } - break; - case TAPI_NETWORK_MODE_WCDMA|TAPI_NETWORK_MODE_GSM: - if (strcmp(szCscFeatureValue, "all_numeric") == 0) - sub_desc = _("IDS_ST_OPT_3G_2G_HAUTO_CONNECT"); - else - sub_desc = _("IDS_ST_OPT_WCDMA_GSM_HAUTO_CONNECT"); - break; - case TAPI_NETWORK_MODE_WCDMA: - if (strcmp(szCscFeatureValue, "all_numeric") == 0) - sub_desc = _("IDS_ST_BODY_3G_ONLY"); - else - sub_desc = _("IDS_ST_MBODY_WCDMA_ONLY"); - break; - case TAPI_NETWORK_MODE_GSM: - if (strcmp(szCscFeatureValue, "all_numeric") == 0) - sub_desc = _("IDS_ST_OPT_2G_ONLY"); - else - sub_desc = _("IDS_ST_MBODY_GSM_ONLY"); - break; - /* for docomo */ - case TAPI_NETWORK_MODE_LTE|TAPI_NETWORK_MODE_WCDMA: - sub_desc = _(Keystr_NetBrand_LTE_WCDMA); - break; - default: - break; - } - - if (ad->data_net_mode) { - ad->data_net_mode->sub_desc = (char *)g_strdup(sub_desc); - elm_object_item_data_set(ad->data_net_mode->item, ad->data_net_mode); - elm_genlist_item_update(ad->data_net_mode->item); - elm_genlist_item_expanded_set(ad->data_net_mode->item, FALSE); - } - - vconf_set_int(VCONFKEY_SETAPPL_NETWORK_MODE_INT, ad->net_mode); - /*} */ - /* ****END**** Fixed the problem of word twinkle SAMSUNG 2010/7/21 modify */ - } else { - SETTING_TRACE("tel_get_network_mode() callback error(%d)", result); - } -} - -/** - * @see also tel_set_network_mode : registers this callback function - */ -void setting_tapi_set_band_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE(" - result = 0x%x , %d", result, result); - ret_if(!user_data); - SettingNetworkUG *ad = user_data; - ret_if(NULL == ad->data_net_mode); - if (ad->network_ug_pop) { - evas_object_del(ad->network_ug_pop); - ad->network_ug_pop = NULL; - } - - if (tel_get_network_mode(ad->handle, setting_tapi_get_band_cb, ad) != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("*** [ERR] tel_get_network_band. ***"); - } -} -#endif -void __back_to_previous_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - SettingNetworkUG *ad = (SettingNetworkUG *) data; - - if (obj) { - evas_object_del(obj); - obj = NULL; - } - - /*go back to previous view if set successfully */ - setting_view_change( - &setting_view_network_select_network, - &setting_view_network_main, ad); -} - -/** - * @see also __register_network - */ -void setting_tapi_set_plmn_mode_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE(" - result = 0x%x", result); - ret_if(!user_data); - SettingNetworkUG *ad = user_data; - - setting_network_popup_delete(ad); - - if ((TAPI_NETWORK_SELECTIONMODE_AUTOMATIC == ad->sel_net - && !ad->b_set_auto_network) || - (TAPI_NETWORK_SELECTIONMODE_MANUAL == ad->sel_net - && !ad->b_set_manul_network)) { - /*The requeset has already been canceled, return directly*/ - SETTING_TRACE("The requeset has already been canceled, return directly"); - return; - } - - if (result != TAPI_NETWORK_NO_ERR) { /*roolback..*/ - if (TAPI_NETWORK_SELECTIONMODE_MANUAL == ad->sel_net - && ad->data_auto_network_item && !ad->data_auto_network_item->chk_status) { - SETTING_TRACE("Need refreshing"); - setting_create_popup(ad, ad->win_get, NULL, keyStr_Failed_Select_Network, NULL, 2 * POPUP_INTERVAL, FALSE, FALSE, 0); - elm_radio_value_set(ad->chk_sel, -2); - } - - return; - } - - if (0 != vconf_set_int(VCONFKEY_SETAPPL_SELECT_NETWORK_INT, ad->sel_net)) { - SETTING_TRACE_ERROR("vconf[%s] set failed"); - } - if (0 != vconf_set_int(VCONFKEY_SETAPPL_SELECT_OLD_NT_ACT, ad->sel_act)) { - SETTING_TRACE_ERROR("vconf[%s] set failed"); - } - - ad->b_set_auto_network = FALSE; - ad->b_set_manul_network = FALSE; - setting_network_update_sel_network(ad); - - Evas_Object *popup = elm_popup_add(ad->win_get); - elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); - eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL); - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - char r_str_text[128] = { 0, }; - snprintf(r_str_text, 128, ""); - g_strlcat(r_str_text, _("IDS_ST_POP_REGISTERED"), 128); - g_strlcat(r_str_text, "", 128); - elm_object_text_set(popup, r_str_text); - elm_popup_timeout_set(popup, 2.0); - evas_object_smart_callback_add(popup, "timeout", __back_to_previous_cb, ad); - evas_object_show(popup); -} - -void setting_tapi_get_plmn_mode_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE(" - result = 0x%x", result); - ret_if(!user_data); - SettingNetworkUG *ad = user_data; - - if (result == TAPI_NETWORK_NO_ERR) { - TelNetworkSelectionMode_t sel; - memcpy(&sel, data, sizeof(TelNetworkSelectionMode_t)); - SETTING_TRACE_DEBUG("ad->sel_net[%d] %s sel[%d]", ad->sel_net, ad->sel_net == sel ? "==" : "!=", sel); - if (ad->sel_net != sel) { - ad->sel_net = sel; - vconf_set_int(VCONFKEY_SETAPPL_SELECT_NETWORK_INT, ad->sel_net); - setting_network_update_sel_network(ad); - } - } else { - } -} - -/** - * - */ -void ___sort_merge_handle(void *usrdata, TelNetworkPlmnList_t *list) -{ - SETTING_TRACE_BEGIN; - SettingNetworkUG *ad = usrdata; - int cnt = 0, tempcount=0; - ad->plmn_info.networks_count = list->networks_count; - SETTING_TRACE("list->networks_count:%d", list->networks_count); - int idx = 0; - - tempcount = list->networks_count; - for (idx = 0; idx < tempcount; idx++) { - SETTING_TRACE("[%d].network_name=%s, spn=%s, plmn=%s, plmn_id=%d, plmn_type=%d, access_technology=%d", idx, list->network_list[idx].network_name, - list->network_list[idx].service_provider_name, - list->network_list[idx].plmn, list->network_list[idx].plmn_id, - list->network_list[idx].type_of_plmn, - list->network_list[idx].access_technology); - } - SETTING_TRACE("*****************************************************"); - - int j = 0; - bool alread_exist = FALSE; - tempcount = list->networks_count; - for (idx = 0; idx < tempcount; idx++) { - alread_exist = FALSE; - for (j = 0; j < cnt; j++) { - if (0 == safeStrCmp(ad->plmn_info.network_list[j].network_name, list->network_list[idx].network_name) - || 0 == safeStrCmp(ad->plmn_info.network_list[j].plmn, list->network_list[idx].plmn)) { - alread_exist = TRUE; - break; - } - } - if (alread_exist) { - continue; - } - memcpy(&(ad->plmn_info.network_list[cnt++]), &(list->network_list[idx]), sizeof(TelNetworkIdentity_t)); - } - - SETTING_TRACE("cnt:%d, list->networks_count=%d", cnt, list->networks_count); - SETTING_TRACE("*****************************************************"); - SETTING_TRACE("After Sorted:"); - ad->plmn_info.networks_count = list->networks_count = (char)cnt; - for (idx = 0; idx < cnt; idx++) { - SETTING_TRACE("[%d]:network_name=%s,plmn=%s,plmn_id=%d,access_technology=%d", idx, - ad->plmn_info.network_list[idx].network_name, ad->plmn_info.network_list[idx].plmn, ad->plmn_info.network_list[idx].plmn_id, ad->plmn_info.network_list[idx].access_technology); - } -} - -/*special process for char '&', such as AT&T */ -void __process_special_char(char *dst, const char *src) -{ - char *temp1 = (char *)src; - char *temp2 = strchr(temp1, '&'); - char *temp = NULL; - - while (NULL != temp2) { - if (0 == safeStrNCmp(temp2, "&", strlen("&"))) { - temp = temp2 + 1; - if ('\0' == temp[0]) { - break; - } - temp2 = strchr(temp, '&'); - } else { - g_strlcat(dst, temp1, temp2 - temp1 + 1); - g_strlcat(dst, "&", MAX_SPECIALIZITION_LEN); - temp1 = temp2 + 1; - if ('\0' == temp1[0]) { - break; - } - temp2 = strchr(temp1, '&'); - } - } - if ('\0' != temp1[0]) { - g_strlcat(dst, temp1, MAX_SPECIALIZITION_LEN); - } -} - -/** - * async api call - searching network list - * - * @see also tel_search_network - */ -void setting_tapi_search_network_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - ret_if(!data || !user_data); - SettingNetworkUG *ad = user_data; - SETTING_TRACE_BEGIN; - SETTING_TRACE(" - result = %d", result); - setting_network_popup_delete(ad); - - if (!ad->b_searching_network) { - /*The requeset has already been canceled, don't do detail process*/ - return; - } - - if (ad->data_search_network_item) { - /* [ UI UPDATE ]*/ - elm_object_item_del(ad->data_search_network_item->item); - ad->data_search_network_item = NULL; - } - - ad->b_searching_network = FALSE; - int valid_cnt = 0; - if (result == TAPI_NETWORK_NO_ERR) { - int cnt = 0; - - ___sort_merge_handle(ad, data); - - Setting_GenGroupItem_Data *item_data = NULL; - - const char *pa_net_name = get_pa_select_network(); - char *cur_plmn = NULL; - tel_get_property_string(ad->handle, TAPI_PROP_NETWORK_PLMN, &cur_plmn); - SETTING_TRACE("VCONFKEY_TELEPHONY_NWNAME:pa_net_name:%s", pa_net_name); - SETTING_TRACE("cur_plmn:%s", cur_plmn); - - char name[MAX_COMMON_BUFFER_LEN] = {0, }; - while (cnt < ad->plmn_info.networks_count) { - SETTING_TRACE("network name from TAPI[%d]:%s --%s --(plmn=%s,plmn_id=%d,at=%s)", cnt, - ad->plmn_info.network_list[cnt].network_name, - ad->plmn_info.network_list[cnt].service_provider_name, - ad->plmn_info.network_list[cnt].plmn, - ad->plmn_info.network_list[cnt].plmn_id, - setting_network_get_act_str(ad->plmn_info.network_list[cnt].access_technology)); - - if (isSpaceStr(ad->plmn_info.network_list[cnt].network_name)) { - /*skip empty string. */ - cnt++; - continue; - } - - memset(name, 0, MAX_COMMON_BUFFER_LEN); - - snprintf(name, MAX_COMMON_BUFFER_LEN, "%s", - ad->plmn_info.network_list[cnt].network_name); - /*SETTING_TRACE("name:%s", name); */ - char speciliztion[MAX_COMMON_BUFFER_LEN] = {0, }; - __process_special_char(speciliztion, name); - -#if 1 - // check the code - SETTING_TRACE("name:%s", speciliztion); - item_data = setting_create_Gendial_field_1radio( - ad->genlist_sel_network, - &itc_multiline_1text_1icon, - setting_network_Gendial_select_plmn_cb, - ad, - SWALLOW_TYPE_1RADIO_RIGHT_PROPAGATE_EVENTS_SET, - ad->chk_sel, - TAPI_NETWORK_SELECTIONMODE_MANUAL + valid_cnt + 1, - speciliztion, - setting_network_select_network_chk_changed); - if (NULL == item_data) { - SETTING_TRACE_ERROR("Failed to calloc memory"); - cnt++; - continue; - } - item_data->userdata = ad; -#endif -#if 1 - if (TAPI_NETWORK_SELECTIONMODE_AUTOMATIC != ad->sel_net - && 0 == safeStrCmp(pa_net_name, ad->plmn_info.network_list[cnt].network_name) - && ad->plmn_info.network_list[cnt].access_technology == ad->sel_act) { - /* [ UI UPDATE ]*/ - elm_radio_value_set(ad->chk_sel, item_data->chk_status);/*let select nothing */ - } -#endif - cnt++; - valid_cnt++; - } - FREE(pa_net_name); - - SETTING_TRACE("Found %d valid networks in total[%d]", valid_cnt, cnt); - /*valid_cnt = 0; for test.. */ - if (valid_cnt > 0) { - /* [ UI UPDATE ]*/ - setting_create_popup(ad, ad->win_get, NULL, keyStr_Searched, NULL, POPUP_INTERVAL, FALSE, FALSE, 0); - } else { /*there is no invalid plmn nearby */ - /* [ UI UPDATE ]*/ - setting_create_popup(ad, ad->win_get, NULL, keyStr_No_Other_Network, NULL, POPUP_INTERVAL, FALSE, FALSE, 0); - } - } else { - /* [ UI UPDATE ]*/ - setting_create_popup(ad, ad->win_get, NULL, keyStr_Failed_Searched, NULL, POPUP_INTERVAL, FALSE, FALSE, 0); - } - -#if 1 - if (0 == valid_cnt && TAPI_NETWORK_SELECTIONMODE_AUTOMATIC == ad->sel_net && ad->data_auto_network_item) { - - /* [ UI UPDATE ]*/ - ad->data_auto_network_item->chk_status = TRUE; - char *sub_text = setting_customize_text(ad->data_auto_network_item->sub_desc, 0, BLUE_COLOR, NULL); - ad->data_auto_network_item->sub_desc = (char *)g_strdup(sub_text); - FREE(sub_text); - elm_object_item_data_set(ad->data_auto_network_item->item, ad->data_auto_network_item); - elm_genlist_item_update(ad->data_auto_network_item->item); - } -#endif -} - - -void setting_tapi_get_serving_network_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE(" - result = 0x%x", result); - ret_if(!user_data || !data); - SettingNetworkUG *ad = user_data; - TelNetworkServing_t *srv_nt = data; - - if (result == TAPI_NETWORK_NO_ERR) { - ad->sel_act = srv_nt->act; - vconf_set_int(VCONFKEY_SETAPPL_SELECT_OLD_NT_ACT, ad->sel_act); - - FREE(ad->sel_network); - /*ad->sel_network = vconf_get_str(VCONFKEY_TELEPHONY_NWNAME); */ - ad->sel_network = get_pa_select_network(); - if (!ad->sel_network) { - ad->sel_network = strndup(Keystr_UNKNOWN_NETWORK, strlen(Keystr_UNKNOWN_NETWORK) + 1); - } - setting_network_update_sel_network(ad); - } else { - /*if failed, do nothing.. */ - } - SETTING_TRACE_END; - -} - - -void setting_tapi_cancel_manual_search_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE(" - result = 0x%x", result); - ret_if(!user_data); - /*SettingNetworkUG *ad = user_data; */ -} - -void __register_network(Setting_GenGroupItem_Data *list_item) -{ - SETTING_TRACE_BEGIN; - ret_if(list_item == NULL); - SETTING_TRACE("process item [%s]", list_item->keyStr); - SettingNetworkUG *ad = list_item->userdata; - ret_if(ad == NULL); - - int tapi_ret = TAPI_API_INVALID_INPUT; - - /*cancel the searching operation */ - - if (ad->data_search_network_item) { - elm_object_item_del(ad->data_search_network_item->item); - ad->data_search_network_item = NULL; - } - - if (ad->b_searching_network) { - SETTING_TRACE("Sending tel_cancel_network_manual_search.."); - tapi_ret = tel_cancel_network_manual_search(ad->handle, setting_tapi_cancel_manual_search_cb, ad); - if (tapi_ret != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("*** [ERR] tel_cancel_network_manual_search. "\ - "tapi_ret=%d ***", tapi_ret); - } else { - ad->b_searching_network = FALSE; - } - } - - if (0 == safeStrCmp(list_item->keyStr, "IDS_ST_BODY_SELECT_AUTOMATICALLY")) { - ad->sel_net = TAPI_NETWORK_SELECTIONMODE_AUTOMATIC; - SETTING_TRACE("Sending tel_select_network_automatic.."); - tapi_ret = tel_select_network_automatic(ad->handle, setting_tapi_set_plmn_mode_cb, ad); - if (tapi_ret != TAPI_API_SUCCESS) { - SETTING_TRACE_DEBUG("*** [ERR] tel_select_network_automatic."\ - " tapi_ret=%d ***", tapi_ret); - } else { - - /* Display 'Registering' popup when automatic */ - SETTING_TRACE("Automatic selection, Registering..") - - if (ad->network_select_registering_pop != NULL) { - evas_object_del(ad->network_select_registering_pop); - ad->network_select_registering_pop = NULL; - } - - ad->network_select_registering_pop = __create_registering_popup(list_item); - if (ad->network_select_registering_pop) { - SETTING_TRACE("Registering popup appeared"); - } else { - SETTING_TRACE("Registering popup failed"); - } - - if (ad->data_auto_network_item) { - /*ad->data_auto_network_item->sub_desc = (char *)g_strdup("...."); */ - /*elm_genlist_item_item_class_update(ad->data_auto_network_item->item, &(itc_2text_1icon_6)); */ - char *sub_text = setting_customize_text("....", 0, BLUE_COLOR, NULL); - ad->data_auto_network_item->sub_desc = (char *)g_strdup(sub_text); - FREE(sub_text); - elm_object_item_data_set(ad->data_auto_network_item->item, ad->data_auto_network_item); - elm_genlist_item_update(ad->data_auto_network_item->item); - } - - ad->b_set_manul_network = FALSE; - ad->b_set_auto_network = TRUE; - ad->sel_act = -1;/*means "Automatic" */ - } - } else { - ad->sel_net = TAPI_NETWORK_SELECTIONMODE_MANUAL; - ad->b_set_manul_network = TRUE; - ad->b_set_auto_network = FALSE; - - int cnt = 0; - SETTING_TRACE("ad->plmn_info.networks_count:%d", - ad->plmn_info.networks_count); - char name[MAX_COMMON_BUFFER_LEN] = {0, }; - for (; cnt < ad->plmn_info.networks_count; cnt++) { - SETTING_TRACE("ad->plmn_info.network_list[cnt].network_name:%s", - ad->plmn_info.network_list[cnt].network_name); - memset(name, 0, MAX_COMMON_BUFFER_LEN); - snprintf(name, MAX_COMMON_BUFFER_LEN, "%s", - ad->plmn_info.network_list[cnt].network_name); - /*SETTING_TRACE("name:%s", name); */ - - char speciliztion[MAX_COMMON_BUFFER_LEN] = {0, }; - __process_special_char(speciliztion, name); - - SETTING_TRACE(" name:%s", speciliztion); - - if (!safeStrCmp(list_item->keyStr, speciliztion)) { - SETTING_TRACE("find the right item"); - break; - } - } - - SETTING_TRACE_DEBUG("*** [Selected PLMN] name=%s, "\ - "srv provider=%s, PLMN ID=%s, type=%d, "\ - "access tech=%d ***", - ad->plmn_info.network_list[cnt].network_name, - ad->plmn_info.network_list[cnt].service_provider_name, - ad->plmn_info.network_list[cnt].plmn, - (int)(ad->plmn_info.network_list[cnt].type_of_plmn), - (int)(ad->plmn_info.network_list[cnt].access_technology)); - - /*ASYNC API - TAPI_EVENT_NETWORK_SELECT_CNF */ - SETTING_TRACE("Sending tel_select_network_manual.."); - tapi_ret = tel_select_network_manual(ad->handle, - ad->plmn_info.network_list[cnt].plmn, - ad->plmn_info.network_list[cnt].access_technology, - setting_tapi_set_plmn_mode_cb, ad); - if (tapi_ret != TAPI_API_SUCCESS) { - SETTING_TRACE_DEBUG("%s*** [ERR] "\ - "tel_select_network_manual. "\ - "tapi_ret=%d ***%s", SETTING_FONT_RED, - tapi_ret, SETTING_FONT_BLACK); - setting_create_popup(ad, ad->win_get, NULL, "IDS_ST_BODY_FAILED_TO_SELECT_NETWORK", NULL, POPUP_INTERVAL, FALSE, FALSE, 0); - - return; - } else { - /* Display 'Registering' popup when manual */ - SETTING_TRACE("Manual selection, Registering..") - - if (ad->network_select_registering_pop != NULL) { - evas_object_del(ad->network_select_registering_pop); - ad->network_select_registering_pop = NULL; - } - - ad->network_select_registering_pop = __create_registering_popup(list_item); - if (ad->network_select_registering_pop) { - SETTING_TRACE("Registering popup appeared"); - } else { - SETTING_TRACE("Registering popup failed"); - } - - ad->sel_act = ad->plmn_info.network_list[cnt].access_technology; - FREE(ad->sel_network); - ad->sel_network = strdup(ad->plmn_info.network_list[cnt].network_name); - } - } -} - -static void __ignore_back_key_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - return; -} - -static Evas_Object *__create_registering_popup(void *data) -{ - SETTING_TRACE_BEGIN; - - retv_if(!data, NULL); - - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data; - SettingNetworkUG *ad = list_item->userdata; - - Evas_Object *popup = elm_popup_add(ad->win_get); - elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); - eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, __ignore_back_key_cb, list_item); - - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - Evas_Object *box = elm_box_add(popup); - - elm_box_horizontal_set(box, EINA_TRUE); - elm_box_align_set(box, 0.5, 0.5); - elm_box_padding_set(box, 16, 0); - - Evas_Object *progressbar = elm_progressbar_add(popup); - elm_object_style_set(progressbar, PROGRESSBAR_STYLE); - elm_progressbar_pulse(progressbar, EINA_TRUE); - evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5); - evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_progressbar_pulse(progressbar, EINA_TRUE); - evas_object_show(progressbar); - elm_box_pack_end(box, progressbar); - - Evas_Object *label = elm_label_add(popup); - elm_object_text_set(label, _("IDS_ST_POP_REGISTERING_ING")); - evas_object_show(label); - elm_box_pack_end(box, label); - - /*evas_object_show(box); */ - /*elm_object_content_set(popup, box); */ - - Evas_Object *table = elm_table_add(popup); - evas_object_show(table); - elm_table_homogeneous_set(table, EINA_FALSE); - - Evas_Object *rect_up; - rect_up = evas_object_rectangle_add(evas_object_evas_get(popup)); - evas_object_size_hint_min_set(rect_up, ELM_SCALE_SIZE(170), ELM_SCALE_SIZE(34)); - - Evas_Object *rect_down; - rect_down = evas_object_rectangle_add(evas_object_evas_get(popup)); - evas_object_size_hint_min_set(rect_down, ELM_SCALE_SIZE(100), ELM_SCALE_SIZE(34)); - - elm_table_pack(table, rect_up, 0, 0, 2, 1);/* rect as a padding */ - elm_table_pack(table, box, 1, 1, 1, 1); - elm_table_pack(table, rect_down, 2, 2, 2, 1);/* rect as a padding */ - - evas_object_show(box); - - elm_object_content_set(popup, table); - - evas_object_show(popup); - - return popup; -} - -/* - * Cancel for searching network - */ -static void __search_network_cancel_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - ret_if(!data); - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data; - SettingNetworkUG *ad = list_item->userdata; - - if (ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } - if (ad->b_searching_network) { - SETTING_TRACE("Sending tel_cancel_network_manual_search.."); - int tapi_ret = tel_cancel_network_manual_search(ad->handle, setting_tapi_cancel_manual_search_cb, ad); - if (tapi_ret != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("*** [ERR] tel_cancel_network_manual_search. "\ - "tapi_ret=%d ***", tapi_ret); - } else { - ad->b_searching_network = FALSE; - } - } - - /* Restore selection automatically */ - int sel_net; - - vconf_get_int(VCONFKEY_SETAPPL_SELECT_NETWORK_INT, &sel_net); - SETTING_TRACE("Previous selection after searching network:%d", sel_net); - - if (sel_net == TAPI_NETWORK_SELECTIONMODE_AUTOMATIC) { - list_item->chk_status = 1; - elm_genlist_item_update(list_item->item); - } -} - -Evas_Object *__create_searching_popup(void *data) -{ - SETTING_TRACE_BEGIN; - retv_if(!data, NULL); - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data; - SettingNetworkUG *ad = list_item->userdata; - - Evas_Object *popup = elm_popup_add(ad->ly_main); - elm_object_domain_translatable_part_text_set(popup, "title,text", SETTING_PACKAGE, _("IDS_ST_POP_SEARCHING_NETWORK_ING")); - - elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); - eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, __search_network_cancel_cb, list_item); - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - - Evas_Object *box = elm_box_add(popup); - - elm_box_horizontal_set(box, EINA_TRUE); - elm_box_align_set(box, 0.5, 0.5); - elm_box_padding_set(box, 16, 0); - - Evas_Object *progressbar = elm_progressbar_add(popup); - elm_object_style_set(progressbar, PROGRESSBAR_STYLE); - elm_progressbar_pulse(progressbar, EINA_TRUE); - evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5); - evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_progressbar_pulse(progressbar, EINA_TRUE); - evas_object_show(progressbar); - elm_box_pack_end(box, progressbar); - - Evas_Object *label = elm_label_add(popup); - elm_object_text_set(label, _("IDS_ST_POP_NETWORKSERVICES_SEARCHING")); - evas_object_show(label); - elm_box_pack_end(box, label); - - /*evas_object_show(box); */ - /*elm_object_content_set(popup, box); */ - - Evas_Object *table = elm_table_add(popup); - evas_object_show(table); - elm_table_homogeneous_set(table, EINA_FALSE); - - Evas_Object *rect_up; - rect_up = evas_object_rectangle_add(evas_object_evas_get(popup)); - evas_object_size_hint_min_set(rect_up, ELM_SCALE_SIZE(170), ELM_SCALE_SIZE(34)); - - Evas_Object *rect_down; - rect_down = evas_object_rectangle_add(evas_object_evas_get(popup)); - evas_object_size_hint_min_set(rect_down, ELM_SCALE_SIZE(100), ELM_SCALE_SIZE(34)); - - elm_table_pack(table, rect_up, 0, 0, 2, 1);/* rect as a padding */ - elm_table_pack(table, box, 1, 1, 1, 1); - elm_table_pack(table, rect_down, 2, 2, 2, 1);/* rect as a padding */ - - evas_object_show(box); - - elm_object_content_set(popup, table); - - /* 'cancel' button */ - Evas_Object* btn = elm_button_add(popup); - //msgid "IDS_ST_BUTTON_CANCEL_ABB" - elm_object_style_set(btn, "bottom"); - elm_object_text_set(btn, _("IDS_ST_BUTTON_CANCEL_ABB")); - elm_object_part_content_set(popup, "button1", btn); - evas_object_smart_callback_add(btn, "clicked", __search_network_cancel_cb, list_item); - - evas_object_show(popup); - - return popup; -} - -static Eina_Bool __search_net_on_timer(void *data) -{ - /* error check */ - SETTING_TRACE_BEGIN; - retv_if(data == NULL, EINA_FALSE); - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data; - SettingNetworkUG *ad = list_item->userdata; - retvm_if(ad == NULL, ECORE_CALLBACK_CANCEL, "ad is NULL"); - - /* - if (ad->popup) - { - evas_object_del(ad->popup); - ad->popup = NULL; - } - */ - - int tapi_ret; - /*searching list */ - tapi_ret = tel_search_network(ad->handle, setting_tapi_search_network_cb, ad); /*ASYNC API - TAPI_EVENT_NETWORK_SEARCH_CNF */ - if (tapi_ret != TAPI_API_SUCCESS) { /* error handling.. */ - SETTING_TRACE_ERROR("%s*** [ERR] tel_search_network. tapi_ret=%d ***%s", SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK); - setting_create_popup(ad, ad->win_get, NULL, STR_SETTING_OPERATION_FAILED, NULL, POPUP_INTERVAL, FALSE, FALSE, 0); - - /* put error handler on the end of this function. */ - /*rollback.. */ - setting_update_gl_item_chk_status(ad->data_auto_network_item, 1); - return ECORE_CALLBACK_CANCEL; - } - - ad->b_searching_network = TRUE; - /* - ad->data_search_network_item = setting_create_Gendial_field_1radio( - ad->genlist_sel_network, - &itc_1icon, - NULL, NULL, - SWALLOW_Type_1RADIO_1SEARCH, - ad->chk_sel, -1, NULL, NULL); - elm_genlist_item_select_mode_set(ad->data_search_network_item->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - */ - if (ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } - ad->popup = __create_searching_popup(list_item); - if (ad->data_auto_network_item) { - /*elm_genlist_item_item_class_update(ad->data_auto_network_item->item, &(itc_2text_1icon_7)); */ - - char *sub_text = setting_customize_text(ad->data_auto_network_item->sub_desc, 0, GRAY_COLOR, NULL); - ad->data_auto_network_item->sub_desc = (char *)g_strdup(sub_text); - FREE(sub_text); - elm_object_item_data_set(ad->data_auto_network_item->item, ad->data_auto_network_item); - elm_genlist_item_update(ad->data_auto_network_item->item); - } - - /*ecore_timer_del(ad->timer); */ - ad->timer = NULL; - return ECORE_CALLBACK_CANCEL; -} - -void __switch_automatic_on_resp_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data; - SettingNetworkUG *ad = list_item->userdata; - int response_type = btn_type(obj); - if (ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } - - if (POPUP_RESPONSE_OK == response_type) { - - /* Not used, Searching network directly. - //changing of USE_PACKET_DATA was trigged by betwork searching - ad->b_trigged_by_searching = TRUE; - - //for delay.. - ad->popup = setting_create_popup_with_progressbar(ad, ad->win_get, - PROGRESSBAR_STYLE, - NULL, NULL, NULL, 0, TRUE, FALSE, 0); - - if (ad->timer) { - ecore_timer_del(ad->timer); - ad->timer = NULL; - } - ad->timer = ecore_timer_add(TIME_TO_TURN_OFF_3G, __search_net_on_timer, list_item); - */ - - __search_net_on_timer(list_item); - - } else if (POPUP_RESPONSE_CANCEL == response_type) { - - /* Restore selection automatically */ - int sel_net, chk_status; - - vconf_get_int(VCONFKEY_SETAPPL_SELECT_NETWORK_INT, &sel_net); - SETTING_TRACE("Previous selection after searching network:%d", sel_net); - - if (sel_net == TAPI_NETWORK_SELECTIONMODE_AUTOMATIC) - chk_status = 1; - else - chk_status = 0; - - setting_update_gl_item_chk_status(ad->data_auto_network_item, chk_status); - } -} - -void __switch_automatic_network(Setting_GenGroupItem_Data *list_item) -{ - SETTING_TRACE_BEGIN; - ret_if(!list_item || !list_item->userdata || !list_item->keyStr); - ret_if(0 != safeStrCmp(list_item->keyStr, "IDS_ST_BODY_SELECT_AUTOMATICALLY")); - SettingNetworkUG *ad = list_item->userdata; - SETTING_TRACE("The value of toogle changes to be %d", list_item->chk_status); - if (list_item->chk_status) { - /* Automatic selected */ - Elm_Object_Item *last_item = elm_genlist_last_item_get(ad->genlist_sel_network); - SETTING_TRACE("ad->data_auto_network_item->item:%p", ad->data_auto_network_item->item); - for (;;) { - last_item = elm_genlist_last_item_get(ad->genlist_sel_network); - SETTING_TRACE("last_item:%p", last_item); - if (last_item == ad->data_auto_network_item->item) { - break; - } - elm_object_item_del(last_item); - } - - __register_network(list_item); - } else { - setting_network_searching_network(list_item); - } -} - -/* - * Network selection / Searching network - */ -void -setting_network_searching_network(Setting_GenGroupItem_Data *list_item) -{ - SETTING_TRACE_BEGIN; - - SettingNetworkUG *ad = list_item->userdata; - - /* Manual selected */ - /*__register_network(list_item); */ - - int value_use_packet; - vconf_get_int(VCONFKEY_DNET_STATE, &value_use_packet); - - SETTING_TRACE("ad->sel_net:%d", ad->sel_net); - if (value_use_packet != VCONFKEY_DNET_OFF) { - ad->popup = - setting_create_popup(list_item, ad->ly_main, - IDS_ST_BODY_UNABLE_TO_SCAN_FOR_NETWORKS, _(SETTING_NETWORK_SEARCH_3G_ON_DESC), - __switch_automatic_on_resp_cb, - 0, FALSE, FALSE, - 2, _("IDS_ST_BUTTON_OK"), _("IDS_ST_BUTTON_CANCEL_ABB")); - return; - } - - int tapi_ret; - /*searching list */ - tapi_ret = tel_search_network(ad->handle, setting_tapi_search_network_cb, ad); /*ASYNC API - TAPI_EVENT_NETWORK_SEARCH_CNF */ - if (tapi_ret != TAPI_API_SUCCESS) { /* error handling.. */ - SETTING_TRACE_ERROR("%s*** [ERR] tel_search_network. tapi_ret=%d ***%s", SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK); - setting_create_popup(ad, ad->win_get, NULL, STR_SETTING_OPERATION_FAILED, NULL, POPUP_INTERVAL, FALSE, FALSE, 0); - - /* put error handler on the end of this function. */ - /*rollback.. */ - setting_update_gl_item_chk_status(list_item, 1); - return; - } - - ad->b_searching_network = TRUE; - /*latest UI: show progress popup instead of progress item - ad->data_search_network_item = setting_create_Gendial_field_1radio( - ad->genlist_sel_network, - &itc_1icon, - NULL, NULL, - SWALLOW_Type_1RADIO_1SEARCH, - ad->chk_sel, -1, NULL, NULL); - elm_genlist_item_select_mode_set(ad->data_search_network_item->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - */ - if (ad->popup) { - evas_object_del(ad->popup); - ad->popup = NULL; - } - ad->popup = __create_searching_popup(list_item); - if (ad->data_auto_network_item) { - /*elm_genlist_item_item_class_update(ad->data_auto_network_item->item, &(itc_2text_1icon_7)); */ - - char *sub_text = setting_customize_text(ad->data_auto_network_item->sub_desc, 0, GRAY_COLOR, NULL); - ad->data_auto_network_item->sub_desc = (char *)g_strdup(sub_text); - FREE(sub_text); - elm_object_item_data_set(ad->data_auto_network_item->item, ad->data_auto_network_item); - elm_genlist_item_update(ad->data_auto_network_item->item); - } - - return; -} - -void setting_network_select_network_chk_changed(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL || obj == NULL, "Parameter is NULL"); - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data; - if (0 == safeStrCmp(list_item->keyStr, "IDS_ST_BODY_SELECT_AUTOMATICALLY")) { - list_item->chk_status = elm_check_state_get(obj); - __switch_automatic_network(list_item); - } else { /*"IDS_ST_BODY_SELECT_AUTOMATICALLY" */ - list_item->chk_status = elm_radio_value_get(obj); - SETTING_TRACE("[Radio index:%d] Radio checked", list_item->chk_status); - - __register_network(list_item); - } - -} - - -void setting_network_Gendial_select_plmn_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL || event_info == NULL, "Parameter is NULL"); - - SettingNetworkUG *ad = (SettingNetworkUG *)data; - Elm_Object_Item *item = (Elm_Object_Item *)event_info; - elm_genlist_item_selected_set(item, 0); - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)elm_object_item_data_get(item); - setting_retm_if(NULL == list_item, "list_item is NULL"); - - SETTING_TRACE("list_item->keyStr:%s", list_item->keyStr); - if (0 == safeStrCmp(list_item->keyStr, "IDS_ST_BODY_SELECT_AUTOMATICALLY")) { - setting_update_gl_item_chk_status(list_item, !(list_item->chk_status)); - __switch_automatic_network(list_item); - return; - } else { - if (ad->b_searching_network) { - SETTING_TRACE("Searching poup displaying, Cannot select"); - return; - } - - int chk_status = elm_radio_value_get(ad->chk_sel); - if (chk_status != list_item->chk_status) { - SETTING_TRACE("[List index:%d] List selected (radio index:%d)", list_item->chk_status, chk_status); - elm_radio_value_set(ad->chk_sel, list_item->chk_status); - __register_network(list_item); - } else { - SETTING_TRACE("[List index:%d] Skip becuase radio checked (radio index:%d)", list_item->chk_status, chk_status); - } - } -} - -/** - * [UI] update - */ -void setting_network_update_sel_network(void *data) -{ - /*SETTING_TRACE_BEGIN; */ - SettingNetworkUG *ad = data; - /*SETTING_TRACE("ad->sel_net:%d", ad->sel_net); */ - /*SETTING_TRACE("ad->sel_network:%s", ad->sel_network); */ - /*SETTING_TRACE("sel_act = [%s(%d)]", setting_network_get_act_str(ad->sel_act),ad->sel_act); */ - - if (ad->data_auto_network_item) { - if (TAPI_NETWORK_SELECTIONMODE_AUTOMATIC == ad->sel_net) { - /*SETTING_TRACE_DEBUG("After set as Automatic, update " */ - /* "ad->data_auto_network_item to be [%s]", */ - /* ad->sel_network); */ - /*ad->data_auto_network_item->sub_desc = (char *)g_strdup(_(ad->sel_network)); */ - char *sub_text = setting_customize_text(_(ad->sel_network), 0, BLUE_COLOR, NULL); - SETTING_TRACE("sub_text:%s", sub_text); - G_FREE(ad->data_auto_network_item->sub_desc); - ad->data_auto_network_item->sub_desc = (char *)g_strdup(sub_text); - elm_object_item_data_set(ad->data_auto_network_item->item, ad->data_auto_network_item); - elm_genlist_item_update(ad->data_auto_network_item->item); - elm_genlist_item_fields_update(ad->data_auto_network_item->item, "*", ELM_GENLIST_ITEM_FIELD_TEXT); - FREE(sub_text); - } else { - } - } - - if (ad->data_sel_net) { /*it indicates TAPI is not responsed in time */ - char sel_network_desc[MAX_COMMON_BUFFER_LEN] = { 0, }; - if (TAPI_NETWORK_SELECTIONMODE_AUTOMATIC == ad->sel_net) { - snprintf(sel_network_desc, MAX_COMMON_BUFFER_LEN, - "%s, %s", _("IDS_ST_BODY_ANSWERINGMODE_AUTOMATIC"), _(ad->sel_network)); - - } else { - snprintf(sel_network_desc, MAX_COMMON_BUFFER_LEN, - "%s, %s", _("IDS_ST_BODY_MANUAL"), _(ad->sel_network)); - } - - /*SETTING_TRACE("sel_network_desc:%s", sel_network_desc); */ - - G_FREE(ad->data_sel_net->sub_desc); - ad->data_sel_net->sub_desc = (char *)g_strdup(_(sel_network_desc)); - - elm_object_item_data_set(ad->data_sel_net->item, ad->data_sel_net); - elm_genlist_item_update(ad->data_sel_net->item); - } -} - -const char *setting_network_get_act_str(TelNetworkSystemType_t type) -{ - switch (type) { - case TAPI_NETWORK_SYSTEM_NO_SRV: /*0 */ - return "NO SERVICE"; - case TAPI_NETWORK_SYSTEM_GSM: /*1 */ - return "GSM"; - case TAPI_NETWORK_SYSTEM_GPRS: /*2 */ - return "GPRS"; - case TAPI_NETWORK_SYSTEM_EGPRS: /*3 */ - return "EGPRS"; - case TAPI_NETWORK_SYSTEM_PCS1900: /*4 */ - return "PCS1900"; - case TAPI_NETWORK_SYSTEM_UMTS: /*5 */ - return "WCDMA"; - case TAPI_NETWORK_SYSTEM_GSM_AND_UMTS: - return "GSM/WCDMA"; - case TAPI_NETWORK_SYSTEM_HSDPA: - return "HSDPA"; - case TAPI_NETWORK_SYSTEM_IS95A: - return "IS95A"; - case TAPI_NETWORK_SYSTEM_IS95B: - return "IS95B"; - case TAPI_NETWORK_SYSTEM_CDMA_1X: - return "CDMA 1X"; - case TAPI_NETWORK_SYSTEM_EVDO_REV_0: - return "EV-DO rev0"; - case TAPI_NETWORK_SYSTEM_1X_EVDO_REV_0_HYBRID: - return "1X and EV-DO rev0"; - case TAPI_NETWORK_SYSTEM_EVDO_REV_A: - return "EV-DO revA"; - case TAPI_NETWORK_SYSTEM_1X_EVDO_REV_A_HYBRID: - return "1X and EV-DO revA"; - case TAPI_NETWORK_SYSTEM_EVDV: - return "EV-DV"; - case TAPI_NETWORK_SYSTEM_LTE: - return "LTE"; - default: - return "NO SERVICE"; - } -} - -bool setting_network_equal_profile(connection_profile_h pf1, connection_profile_h pf2) -{ - if (!pf1 && !pf2) { - SETTING_TRACE("Both profile are NULL, return TRUE"); - return TRUE; - } else if (!pf1 || !pf2) { - SETTING_TRACE("One profile is NULL, one is not, return FALSE"); - return FALSE; - } - - connection_profile_type_e type1, type2; - connection_cellular_service_type_e srvtype1, srvtype2; - char *apn1, *apn2, *name1, *name2; - type1 = type2 = srvtype1 = srvtype2 = 0; /*intialize */ - apn1 = apn2 = name1 = name2 = NULL; - - (void)connection_profile_get_type(pf1, &type1); - (void)connection_profile_get_type(pf2, &type2); - (void)connection_profile_get_cellular_service_type(pf1, &srvtype1); - (void)connection_profile_get_cellular_service_type(pf2, &srvtype2); - - (void)connection_profile_get_cellular_apn(pf1, &apn1); - (void)connection_profile_get_cellular_apn(pf2, &apn2); - (void)connection_profile_get_name(pf1, &name1); - (void)connection_profile_get_name(pf2, &name2); - - if (type1 == type2 - && srvtype1 == srvtype2 - && 0 == safeStrCmp(apn1, apn2) - && 0 == safeStrCmp(name1, name1)) { - SETTING_TRACE("They have same key fields, return TRUE."); - FREE(apn1); - FREE(apn2); - return TRUE; - } else { - SETTING_TRACE("They don't have same key fields, return FALSE."); - FREE(apn1); - FREE(apn2); - return FALSE; - } -} - -#define MAX_ID_LEN 512 -static int __profile_item_sort_cb(const void *d1, const void *d2) -{ - SETTING_TRACE_BEGIN; - connection_profile_h pf1 = (connection_profile_h)d1; - connection_profile_h pf2 = (connection_profile_h)d2; - - if (!pf1) { - return (-1); - } - if (!pf2) { - return (1); - } - char *id_str1 = NULL; - char *id_str2 = NULL; - connection_profile_get_id(pf1, &id_str1); - connection_profile_get_id(pf2, &id_str2); - - char *name1 = NULL; - char *name2 = NULL; - connection_profile_get_name(pf1, &name1); - connection_profile_get_name(pf2, &name2); - - if (isEmptyStr(id_str1)) { - FREE(id_str1); - FREE(id_str2); - return (-1); - } - - if (isEmptyStr(id_str2)) { - FREE(id_str1); - FREE(id_str2); - return (1); - } - - char str1[MAX_ID_LEN] = {0,}; - char str2[MAX_ID_LEN] = {0,}; - safeCopyStr(str1, id_str1, MAX_ID_LEN); - safeCopyStr(str2, id_str2, MAX_ID_LEN); - G_FREE(id_str1); - G_FREE(id_str2); - /*SETTING_TRACE("str1:%s, name1:%s", str1, name1); */ - /*SETTING_TRACE("str2:%s, name2:%s", str2, name2); */ - - char *p = NULL; - /*for id1.. */ - p = safeStrRStr(str1, "_"); - if (!p) { - return (-1); - } - *p = '\0'; - p = safeStrRStr(str1, "_"); - if (!p) { - return (-1); - } - p++; - int id1 = atoi(p); - /*SETTING_TRACE("id1:%d", id1); */ - - /*for id2.. */ - p = safeStrRStr(str2, "_"); - if (!p) { - return (1); - } - *p = '\0'; - p = safeStrRStr(str2, "_"); - if (!p) { - return (1); - } - p++; - int id2 = atoi(p); - - /*SETTING_TRACE("id2:%d", id2); */ - return id1 - id2; -} - -void setting_network_reget_profile_list(void *cb) -{ - SETTING_TRACE_BEGIN; - ret_if(cb == NULL); - SettingNetworkUG *ad = (SettingNetworkUG *) cb; - if (ad->profile_list != NULL) { - eina_list_free(ad->profile_list); - ad->profile_list = NULL; - } - connection_profile_iterator_h profile_iter = NULL; - connection_profile_h profile_h = NULL; - int rv = connection_get_profile_iterator(ad->connection, CONNECTION_ITERATOR_TYPE_REGISTERED, &profile_iter); - if (rv != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get profile iterator [%d]", rv); - /*elm_object_disabled_set(del_btn, EINA_TRUE); */ - return; - } - - int cnt = 0; - connection_profile_type_e profile_type = CONNECTION_PROFILE_TYPE_CELLULAR; - connection_cellular_service_type_e service_type = CONNECTION_CELLULAR_SERVICE_TYPE_UNKNOWN; - - while (connection_profile_iterator_has_next(profile_iter)) { - if (cnt >= MAX_PROFILE_NUM) { - break; - } - if (connection_profile_iterator_next(profile_iter, &profile_h) != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get profile handle"); - break; - } - - if (connection_profile_get_type(profile_h, &profile_type) != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get profile type"); - continue; - } - if (connection_profile_get_cellular_service_type(profile_h, &service_type) != CONNECTION_ERROR_NONE) { - SETTING_TRACE_ERROR("Fail to get service type"); - continue; - } - - cnt++; - if (CONNECTION_PROFILE_TYPE_CELLULAR != profile_type || ad->profile_service_type != service_type) { - continue; - } - ad->profile_list = eina_list_sorted_insert(ad->profile_list, __profile_item_sort_cb, profile_h); - /*if (cnt > 1) break;//for test */ - } - SETTING_TRACE_END; -} - -int is_lte_on_feature(void *data) -{ - SETTING_TRACE_BEGIN; - retv_if(!data, 0); - - int ret = 0; - vconf_get_int(VCONF_KEY_PRIVATE_LTE_ON, &ret); - SETTING_TRACE("LTE feature status: %d", ret); - return ret; -} - -static Setting_Cfg_Node_T s_cfg_node_array[] = { - {"IDS_ST_MBODY_MOBILE_DATA", NULL, "viewtype:frontpage;tab:first;keyword:IDS_ST_MBODY_MOBILE_DATA", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, - {"IDS_ST_BODY_DATA_ROAMING", NULL, "viewtype:frontpage;tab:first;keyword:IDS_ST_BODY_DATA_ROAMING", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, - {"IDS_COM_BODY_NETWORK_OPERATORS", NULL, "viewtype:frontpage;tab:first;keyword:IDS_COM_BODY_NETWORK_OPERATORS", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, - {"IDS_ST_BODY_NETWORK_MODE", NULL, "viewtype:frontpage;tab:first;keyword:IDS_ST_BODY_NETWORK_MODE", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, - {"IDS_ST_BODY_CONNECTIONS", NULL, "viewtype:frontpage;tab:first;keyword:IDS_ST_BODY_CONNECTIONS", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, -}; - -UG_MODULE_API int setting_plugin_search_init(app_control_h service, void *priv, char **applocale) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE(">> setting-network-efl DB search code"); - - *applocale = strdup("setting:"_TZ_SYS_RO_APP"/org.tizen.setting/res/locale"); - - Eina_List **pplist = (Eina_List **)priv; - int i; - int size = sizeof(s_cfg_node_array) / sizeof(s_cfg_node_array[0]); - for (i = 0; i < size; i++) { - Setting_Cfg_Node_T *node = setting_plugin_search_item_subindex_add(s_cfg_node_array[i].key_name, s_cfg_node_array[i].ug_args, IMG_Network, s_cfg_node_array[i].item_type, s_cfg_node_array[i].data, "Network"); - *pplist = eina_list_append(*pplist, node); - } - return 0; -} - -int setting_network_get_state_data_roaming(int* value) -{ - SETTING_TRACE_BEGIN; - int err; - int temp; - setting_get_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING, &temp, &err); - *value = temp; - return err; -} - -/** - * "Data Romaing" - * VCONFKEY_SETAPPL_STATE_DATA_ROAMING_BOOL -BOOL_SLP_SETTING_DATA_ROAMING - */ -void setting_network_set_state_data_roaming(ButtonState state) -{ - SETTING_TRACE_BEGIN; - int err; - if (state == SETTING_ON_OFF_BTN_ON) { - setting_set_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING, SETTING_ON_OFF_BTN_ON, &err); -// setting_set_event_system(SYS_EVENT_DATA_ROAMING_STATE, EVT_KEY_DATA_ROAMING_STATE, EVT_VAL_DATA_ROAMING_ON); - } else { - setting_set_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING, SETTING_ON_OFF_BTN_OFF, &err); -// setting_set_event_system(SYS_EVENT_DATA_ROAMING_STATE, EVT_KEY_DATA_ROAMING_STATE, EVT_VAL_DATA_ROAMING_OFF); - } -} - -/** - * "Mobile Data" - * setting_set_bool_slp_key(BOOL_SLP_SETTING_USE_PACKET_DATA, - * value : SETTING_ON_OFF_BTN_OFF or SETTING_ON_OFF_BTN_ON - */ -void setting_network_set_state_mobile_data(ButtonState state) -{ - SETTING_TRACE_BEGIN; - if ( state == SETTING_ON_OFF_BTN_ON) { - system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, true); - } else if ( state == SETTING_ON_OFF_BTN_OFF) { - system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, false); - } else { - SETTING_TRACE_ERROR("do not reach here!!!"); - } -} - -int setting_network_get_state_mobile_data(int* value) -{ - SETTING_TRACE_BEGIN; - bool val; - int ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, &val); - if (ret == SYSTEM_SETTINGS_ERROR_NONE) { - int temp = (int)val; - *value = temp; - return SYSTEM_SETTINGS_ERROR_NONE; - } else { - return -1; - } -} diff --git a/setting-password/CMakeLists.txt b/setting-password/CMakeLists.txt deleted file mode 100755 index c42c88c..0000000 --- a/setting-password/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ - -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${SETTING_COMMON}/include) - - -INCLUDE(FindPkgConfig) - -pkg_check_modules(pkgs_password REQUIRED evas ecore edje elementary appcore-common -appcore-efl deviced ecore-imf -ui-gadget-1 capi-appfw-application tapi dlog -notification json-glib-1.0 -libtzplatform-config) - -FOREACH(flag ${pkgs_password_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Werror-implicit-function-declaration") -SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") - -IF("${ARCH}" STREQUAL "arm") - ADD_DEFINITIONS("-DTARGET") - MESSAGE("add -DTARGET") -ENDIF("${ARCH}" STREQUAL "arm") - -ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") -ADD_DEFINITIONS("-DSLP_DEBUG") -ADD_DEFINITIONS("-shared") - -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl, --rpath=/usr/lib") - -ADD_LIBRARY(${SETTING_PASSWORD_UG} SHARED - ./src/setting-password.c - ./src/setting-password-sim.c - ./src/setting-password-main.c - ./src/setting-password-simple.c -) - -TARGET_LINK_LIBRARIES(${SETTING_PASSWORD_UG} -L${CMAKE_BINARY_DIR}/${SETTING_COMMON} -lsetting-common) -TARGET_LINK_LIBRARIES(${SETTING_PASSWORD_UG} ${pkgs_password_LDFLAGS}) - -INSTALL(TARGETS ${SETTING_PASSWORD_UG} DESTINATION ${PREFIX}/lib/ug) - - - - diff --git a/setting-password/include/setting-password-forgot-password.h b/setting-password/include/setting-password-forgot-password.h deleted file mode 100644 index c79273d..0000000 --- a/setting-password/include/setting-password-forgot-password.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef _SETTING_PASSWORD_FORGOT_PASSWORD_H_ -#define _SETTING_PASSWORD_FORGOT_PASSWORD_H_ - -#include - - -#endif diff --git a/setting-password/include/setting-password-main.h b/setting-password/include/setting-password-main.h deleted file mode 100755 index 535718b..0000000 --- a/setting-password/include/setting-password-main.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef _SETTING_PASSWORD_MAIN_H_ -#define _SETTING_PASSWORD_MAIN_H_ - -#include - -Eina_Bool __rotate_cb(void *data); - -int setting_password_main_draw_1line_password(void *data, void *cb); -int setting_password_main_draw_2line_password(void *data, void *cb); -int setting_password_main_clear_1line_password(void *data); -int setting_password_main_clear_2line_password(void *data); -int setting_password_main_check_1line_password(void *data); -int setting_password_main_check_2line_password(void *data); - -void setting_password_main_click_softkey_done_cb(void *data, - Evas_Object *obj, - void *event_info); -void setting_password_main_click_softkey_continue_cb(void *data, Evas_Object *obj, - void *event_info); - -void setting_password_main_warning_entry_added_byte_popup(SettingPasswordUG *ad, - int min, int max); - -#endif diff --git a/setting-password/include/setting-password-sim.h b/setting-password/include/setting-password-sim.h deleted file mode 100644 index fea6470..0000000 --- a/setting-password/include/setting-password-sim.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef _SETTING_PASSWORD_SIM_H_ -#define _SETTING_PASSWORD_SIM_H_ - -#include - -int setting_password_sim_create_ui(void *data); - -static Eina_Bool __setting_password_sim_rotate_cb(void *data); - -int setting_password_sim_draw_1line_entry(void *data, void *cb); -int setting_password_sim_draw_2line_entry(void *data, void *cb); -int setting_password_sim_draw_3line_entry(void *data, void *cb); -int setting_password_sim_clear_1line_entry(void *data); -int setting_password_sim_clear_2line_entry(void *data); -int setting_password_sim_clear_3line_entry(void *data); -int setting_password_sim_check_1line_entry(void *data); -int setting_password_sim_check_2line_entry(void *data); -int setting_password_sim_check_3line_entry(void *data); - -void setting_password_sim_click_softkey_done_cb(void *data, - Evas_Object *obj, - void *event_info); -void setting_password_sim_warning_entry_added_byte_popup(SettingPasswordUG *ad, - int min, int max); - - -void setting_get_pin_lock_info_cb(TapiHandle *handle, int result, void *data, void *user_data); -void setting_get_sim_lock_info_cb(TapiHandle *handle, int result, void *data, void *user_data); - -void setting_sim_change_pins_cb(TapiHandle *handle, int result, void *data, void *user_data); -void setting_sim_verify_puks_cb(TapiHandle *handle, int result, void *data, void *user_data); -void setting_sim_facility_enable_cb(TapiHandle *handle, int result, void *data, void *user_data); -void setting_sim_facility_disable_cb(TapiHandle *handle, int result, void *data, void *user_data); - -static void setting_password_ug_display_result_popup(tapi_receive_info *result, SettingPasswordUG *ad); - -#endif diff --git a/setting-password/include/setting-password-strings.h b/setting-password/include/setting-password-strings.h deleted file mode 100644 index cfb3cf2..0000000 --- a/setting-password/include/setting-password-strings.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef _SETTING_PASSWORD_STRINGS_H_ -#define _SETTING_PASSWORD_STRINGS_H_ - -#define PASSWORD_MUST_DIGITS "Password must consist of at least %d digit(s)." -#define PASSWORD_MUST_ALPHANUMERIC "Password must consist of at least %d alphanumeric character(s)." -#define PASSWORD_MUST_NOT_MATCH_PREV "Password must not match previous passwords." -#define ENTER_ANOTHER_PASSWORD "IDS_ASEML_POP_ENTER_ANOTHER_PASSWORD" -#define PASSWORD_EXPIRED "IDS_ASEML_POP_PASSWORD_EXPIRED" -#define PASSWORD_EXPIRED_CHANGE_PASSWORD "Current password is expired. Change password." - -#define MAX_NUM_REACHED "Maxinum number of password entry attempts reached." - -#define PASSWORD_EMPTY _("IDS_ST_BODY_PASSWORD_EMPTY") -#define DCM_PIN_ATTEMPT_DESC2 "IDS_ST_BODY_PD_ATTEMPTS_REMAINING_JPN_DCM" -#define ATTEMPT_REMAINING_DESC "%d attempt remaining" /* on processing NTR */ -#define PIN_ERR_DESC _("IDS_ST_POP_INCORRECT_PIN_PD_ATTEMPTS_LEFT") /* "Incorrect PIN. %d attempts left" */ -#define PUK1_BLOCKED "IDS_ST_BODY_PUK1_BLOCKED" - -#define ATTEMPT_DESC _("IDS_ST_POP_PD_ATTEMPT_LEFT") /* "%d attempt left" */ -#define ATTEMPTS_DESC _("IDS_ST_POP_PD_ATTEMPTS_LEFT") /* "%d attempts left" */ -#define PUK1_ERR_DESC _("IDS_ST_POP_INCORRECT_PUK1_PD_ATTEMPTS_LEFT") /* "Incorrect PUK1. %d attempts left" */ -#define PUK2_ERR_DESC _("IDS_ST_POP_INCORRECT_PUK2_PD_ATTEMPTS_LEFT") /* "Incorrect PUK2. %d attempts left" */ -#define PW_ERR_DESC _("IDS_ST_POP_INCORRECT_PASSWORD") /* "Incorrect password" */ -#define PW_ERR_REUSED _("IDS_ST_BODY_UNABLE_TO_USE_CURRENT_PASSWORD") /* "Incorrect password" */ -#define PW_ERR_DELAY_DESC _("IDS_ST_BODY_ENTER_PASSWORD_AGAIN_AFTER_PD_SECONDS") /* "Please enter password again after %d seconds" */ -#define PW_NORMAL_DESC _("IDS_ST_POP_PASSWORD_MUST_CONTAIN_AT_LEAST_PD_ALPHANUMERIC_CHARACTERS") /* "Normal password : Password must contain at least %d alphanumeric characters" */ -#define PW_NORMAL_AND_CONTAIN_ALPHANUMER_DESC _("IDS_ST_BODY_PASSWORDS_MUST_CONSIST_OF_AT_LEAST_4_ALPHANUMERIC_CHARACTERS_ALSO_INCLUDING_AT_LEAST_1_ALPHABETICAL_CHARACTER") /* mdm and normal shared password : Passwords must consist of at least 4 alphanumeric characters also including at least 1 alphabetical character */ - -#define PW_SHORT_GUIDE_CURRENT "IDS_ST_BODY_CURRENT" -#define PW_SHORT_GUIDE_NEW "IDS_ST_BODY_NEW" -#define PW_SHORT_GUIDE_CONFIRM "IDS_ST_BODY_CONFIRM" - -#define PW_ST_ENTER_PW "" -#define PW_ST_NEW_PW "IDS_ST_BODY_ENTER_NEW_PASSWORD" -#define PW_ST_ENTER_PW_AGAIN "IDS_ST_BODY_ENTER_PASSWORD_AGAIN" -#define PW_ST_ENTER_CUR_PW "IDS_ST_BODY_ENTER_CURRENT_PASSWORD" - -#define PW_ST_INCORRECT_PW_TRY_AGAIN "IDS_ST_BODY_INCORRECT_PASSWORD_TRY_AGAIN" -#define PW_ST_DO_NOT_CONTAIN_SIMPLE_SEQUENCE_HELP "IDS_ST_BODY_THE_PASSWORD_MUST_NOT_CONTAIN_A_SIMPLE_SEQUENCE_HEG_1111_OR_1234" -#define PW_ST_PW_DO_NOT_MATCH "IDS_ST_POP_PASSWORDS_DO_NOT_MATCH" -#define PW_ST_INCORRECT_PW_5TIMES_HELP "Incorrect password entered 5 times
Try again in %d seconds" -#define PW_ST_PW_MAX_LENGTH_HELP "IDS_ST_BODY_PASSWORD_MUST_CONTAIN_NO_MORE_THAN_PD_CHARACTERS_ABB" -#define PW_ST_PW_MIN_LENGTH_HELP "IDS_ST_POP_PASSWORD_MUST_CONTAIN_AT_LEAST_PD_ALPHANUMERIC_CHARACTERS" -#define PW_ST_PW_MIN_LENGTH_ALPHABETIC_HELP "IDS_ST_BODY_PASSWORD_MUST_CONTAIN_AT_LEAST_PD_CHARACTERS_ABB" - - -/* Forgot password for personal mode */ -#define PW_ST_RESET_PERSONAL_MODE_HELP "IDS_ST_BODY_RESET_PERSONAL_MODE_SECURITY_SETTINGS_AND_DELETE_PERSONAL_CONTENT" -#define PW_ST_RESET_PERSONAL_MODE "IDS_ST_BODY_RESET_PERSONAL_MODE" -#define PW_ST_FORGOT_PASSWORD "IDS_ST_BODY_FORGOT_PASSWORD_SWA" -#define PW_ST_RESET_PERSONAL_MODE_POPUP_Q "IDS_ST_POP_YOUR_PERSONAL_MODE_SECURITY_SETTINGS_WILL_BE_RESET_AND_YOUR_PERSONAL_CONTENT_WILL_BE_DELETED_RESET_PERSONAL_MODE_Q" -#define PW_ST_RESET "IDS_ST_BUTTON_RESET" -#define PW_ST_CANCEL "IDS_ST_BUTTON_CANCEL_ABB" - - -#endif diff --git a/setting-password/include/setting-password.h b/setting-password/include/setting-password.h deleted file mode 100644 index 3ff0a54..0000000 --- a/setting-password/include/setting-password.h +++ /dev/null @@ -1,296 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef _SETTING_PASSWORD_H_ -#define _SETTING_PASSWORD_H_ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -/*#include */ -/*#include */ - -#define SETTING_PW_UG_NORMAL_PASSWORD_MIN_LENGTH 4 -#define SETTING_PW_UG_NORMAL_PASSWORD_MAX_LENGTH 16 -#define SETTING_PW_UG_PRIVACY_PASSWORD_MIN_LENGTH 4 -#define SETTING_PW_UG_PRIVACY_PASSWORD_MAX_LENGTH 16 -#define SETTING_PW_UG_SIM_MIN_LENGTH 4 -#define SETTING_PW_UG_SIM_MAX_LENGTH 8 -#define SETTING_PW_UG_PIN_MIN_LENGTH 4 -#define SETTING_PW_UG_PIN_MAX_LENGTH 8 -#define SETTING_PW_UG_PUK_MIN_LENGTH 4 -#define SETTING_PW_UG_PUK_MAX_LENGTH 8 -#define SETTING_PW_MAX_TITLE_LENGTH MAX_DISPLAY_NAME_LEN_ON_UI - -#define PW_NORMAL_CONTAIN_ALPHANUMERIC 4 -#define PW_ERR_DELAY_TIME 30 -#define ATTEMPT_INFINITE 999999 - -typedef enum { - SETTING_PW_TYPE_PASSWORD = 1, /* Final type to verify current password */ - SETTING_PW_TYPE_SET_PASSWORD, /* This view type is used when click "password" and "change password" items in screen lock type view */ - SETTING_PW_TYPE_SIMPLE_PASSWORD, /* Final type to verify current simple password */ - SETTING_PW_TYPE_SET_SIMPLE_PASSWORD, /* This view type is used when click "simple password" and "change simple password" items in screen lock type view */ - SETTING_PW_TYPE_ENTER_LOCK_TYPE, /* This view type is used when enter screen lock type menu to verify current password lock type */ - SETTING_PW_TYPE_SIM_LOCK_ON = 6, /* No use : Do not support SIM LOCK */ - SETTING_PW_TYPE_SIM_LOCK_OFF, /* No use : Do not support SIM LOCK */ - SETTING_PW_TYPE_PIN_LOCK_ON, /* This view type is used when try to turn PIN LOCK on */ - SETTING_PW_TYPE_PIN_LOCK_OFF, /* This view type is used when try to turn PIN LOCK off */ - SETTING_PW_TYPE_CHANGE_PIN, - SETTING_PW_TYPE_CHANGE_PIN2 = 11, - SETTING_PW_TYPE_PIN_BLOCKED, /* No use : PIN1 must be unblocked through pwlock app */ - SETTING_PW_TYPE_PIN2_BLOCKED, - SETTING_PW_TYPE_MAX, -} setting_pw_type; - -typedef enum { - SETTING_PW_ERROR_INVALID_LENGTH = -1, /* if length of password is wrong, */ - SETTING_PW_ERROR_INCLUDE_NO_LETTER = -2, /* if password that user enter has no letter, */ - SETTING_PW_ERROR_NO_MATCH_WITH_POLICY = -3, /* if password that user enter does not match with policy, */ - SETTING_PW_ERROR_NO_MATCH_MIN_COMPLEX = -4, /* if password that user enter has no letter, */ - SETTING_PW_ERROR_EXIST_FORBIDDEN_STRING = -5, - SETTING_PW_ERROR_NO_MATCH_MAX_REPEAT_COUNT = -6, - SETTING_PW_ERROR_NO_MATCH_CUR_PASSWORD = -7, - SETTING_PW_ERROR_SIMPLE_STYLE = -8, - SETTING_PW_ERROR_REUSED = -9, - SETTING_PW_ERROR_INCLUDE_DIGIT = -10, - SETTING_PW_ERROR_NO_MATCH_WITH_PATTERN = -11, - SETTING_PW_ERROR_NO_DIGIT = -12, - SETTING_PW_ERROR_DO_NOT_MATCH = -13, - SETTING_PW_ERROR_UNKNOWN = -50, -} setting_pw_errors; - -typedef enum { - SETTING_PW_STATUS_OK = 0, - SETTING_PW_STATUS_EXPIRED, - SETTING_PW_STATUS_MAX_FAILED, - SETTING_PW_STATUS_EMPTY, - SETTING_PW_STATUS_DEFAULT, - SETTING_PW_STATUS_NON_PW_TYPE, - SETTING_PW_STATUS_MAX, -} setting_pw_status; - -enum { - SETTING_PW_CATEGORY_LOCK = 0x100, - SETTING_PW_CATEGORY_SIM = 0x200, - SETTING_PW_CATEGORY_MAX, -}; - -enum { - SETTING_PW_SUB_CATEGORY_SIMPLE = 0x01, - SETTING_PW_SUB_CATEGORY_MAX, -}; - - -struct _pw_item { - int pw_type_num; - char *pw_type_string; - int category; - int step; -}; - -/* For Tapi */ -typedef enum { - SIM_OPERATION_OK, - SIM_ERROR, - SIM_REQ_PIN, - SIM_OPERATION_OFF, - SIM_LOCK_ON_SUCCESS, - SIM_LOCK_OFF_SUCCESS, - SIM_PIN_LOCK_ON_SUCCESS, - SIM_PIN_LOCK_OFF_SUCCESS, - SIM_LOCK_ON_FAIL, - SIM_LOCK_INCORRECT_PASSWORD, - SIM_INCORRECT_PIN1_CODE, - SIM_INCORRECT_PIN2_CODE, - SIM_INCORRECT_PUK1_CODE, - SIM_INCORRECT_PUK2_CODE, - SIM_PIN1_CHANGE_SUCCESS, - SIM_PIN2_CHANGE_SUCCESS, - SIM_PIN1_CHANGE_FAIL, - SIM_PIN2_CHANGE_FAIL, - SIM_PIN1_BLOCKED, - SIM_PIN2_BLOCKED, - SIM_PIN1_UNBLOCKED, - SIM_PIN2_UNBLOCKED, - SIM_PUK1_BLOCKED, - SIM_PUK2_BLOCKED, - SIM_REQUIRED_PUK_CODE, - SIM_OPERATION_UNAVAILABLE, - SIM_UNKNOWN_ERROR, -} sim_stat_value; - -typedef enum { - SETTING_PW_NAVIBAR_WITH_NO_BTN, - SETTING_PW_NAVIBAR_WITH_LEFT_BTN, - SETTING_PW_NAVIBAR_WITH_RIGHT_BTN, - SETTING_PW_NAVIBAR_WITH_BOTH_BTN, -} setting_pw_navibar_style_t; - -typedef struct _tapi_request_event { - unsigned int sid; - int event; -} tapi_request_event; - -typedef struct _tapi_receive_info { - sim_stat_value stat; - int retry_cnt; -} tapi_receive_info; - -typedef struct _tapi_request_tapi_info { - tapi_request_event *evt; - int evt_sz; - - void *cb_data; - void (*cb)(tapi_receive_info *, void *); -} tapi_request_tapi_info; - -struct _word_repeat_info { - char name[SETTING_PW_UG_NORMAL_PASSWORD_MAX_LENGTH + 1]; - unsigned int count; - struct _word_repeat_info *next; -}; - -typedef struct _pw_quality { - int quality; - int complex; - int length; -} setting_pw_quality; - -/** - * Setting Password UG context - * all UG function has void* as an agument. this is casted back to SettingPasswordUG - * and the functions access app context. - */ -typedef struct _SettingPasswordUG { - ui_gadget_h ug; - TapiHandle *handle; - TelSimSecResult_t *verify_puks_result; - - /* add more variables here (move your appdata to here) */ - Evas *evas; - Evas_Object *win_main_layout; - Evas_Object *win_get; - Evas_Object *ly_main; - - setting_pw_type view_type; - char *view_type_string; - int step; - - Evas_Object *bottom_btn; /* Instead of Toolbar btn */ - Evas_Object *bottom_btn1; /* Instead of Toolbar btn */ - Setting_GenGroupItem_Data *ed_pw1; - Setting_GenGroupItem_Data *ed_pw2; - Setting_GenGroupItem_Data *ed_pw3; - Setting_GenGroupItem_Data *focus_data; - Evas_Object *setpw_notify; - Evas_Object *notify; - - /*Elm_Object_Item *err_desc; */ - Setting_GenGroupItem_Data *err_desc; - Elm_Genlist_Item_Class itc_err_desc; - - Elm_Object_Item *navi_it; - Evas_Object *controllbar; - tapi_request_tapi_info *t_info; - Evas_Object *navi_bar; - Elm_Genlist_Item_Class itc_variable_height; - Elm_Genlist_Item_Class itc_layout; - Elm_Genlist_Item_Class itc_group_item; - Evas_Object *scroller; - int disable_item_type; - - unsigned int remain_attempt; - unsigned int valid_sec; - - setting_pw_quality pw_quality_info; - - char *step1_str; - - /* for simple password */ - Elm_Genlist_Item_Class itc_title; - Elm_Genlist_Item_Class itc_sp_bg_1icon; - Elm_Object_Item *sp_item; - Evas_Object *sp_entry1; - Evas_Object *sp_entry2; - Evas_Object *sp_entry3; - Evas_Object *sp_entry4; - Evas_Object *sp_focused; - int sp_focused_num; - char sp_chars[5]; - - int sp_title_index; - char *cur_pwd; - - /*int is_simple_password_on; */ - int screen_lock_type; - int is_description; - int pw_status; /*int is_empty; */ - int rotated; - - bool puk_verified_flag; - bool update_change_pin1_flag; - bool incorrect_pin1_flag; - bool incorrect_pin2_flag; - bool destroy; - Ecore_Timer *remove_timer; - Ecore_Timer *set_history_timer; - Ecore_Timer *focus_timer; - /* end */ - - Evas_Object *simple_layout; - Ecore_IMF_Context *imf_context; - Ecore_Event_Handler *imf_handler; - Evas_Object *sp_entry[5]; - Ecore_Timer *simple_done_timer; - - /* fingerprint's alternative password */ - int cur_step; - -} SettingPasswordUG; - - -extern setting_view setting_view_password_sim; -extern setting_view setting_view_password_simple; -extern setting_view setting_view_password_main; - -void setting_password_ug_popup_resp_cb(void *data, Evas_Object *obj, void *event_info); -void setting_password_ug_create_popup_notitle_nobtn(void *data, char *str, int destroy); - -void setting_password_ug_display_desc(void *data, char *desc, int destroy); - - -extern void setting_password_ug_check_attemps_left(void *data); - -int setting_password_check_password(const char *challenge, unsigned int *remain_attempt, unsigned int *valid_sec); -int setting_password_set_password(const char *cur_pwd, const char *new_pwd, void *data); - -#endif diff --git a/setting-password/src/setting-password-forgot-password.c b/setting-password/src/setting-password-forgot-password.c deleted file mode 100644 index 64b4673..0000000 --- a/setting-password/src/setting-password-forgot-password.c +++ /dev/null @@ -1,236 +0,0 @@ -/* -* setting -* -* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. -* -* Contact: MyoungJune Park -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*/ - -#include -#include -#include - -#include -#include - -static int setting_password_forgot_password_create(void *cb); -static int setting_password_forgot_password_destroy(void *cb); -static int setting_password_forgot_password_update(void *cb); -static int setting_password_forgot_password_cleanup(void *cb); - -setting_view setting_view_password_forgot_password = { - .create = setting_password_forgot_password_create, - .destroy = setting_password_forgot_password_destroy, - .update = setting_password_forgot_password_update, - .cleanup = setting_password_forgot_password_cleanup, -}; - -void __reset_personal_popup_resp_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - ret_if(!data); - - SettingPasswordUG *ad = (SettingPasswordUG *)data; - - char *btn_str = elm_entry_markup_to_utf8(elm_object_text_get(obj)); - if (!safeStrCmp(btn_str, _(PW_ST_RESET))) { - int ret = 0; - /* call ode API */ - if (ode_init() == 0) { - ret = pse_restore(); - SETTING_TRACE("pse_restore() returns %d", ret); - - /* initialize vconf */ - vconf_set_int(VCONFKEY_SETAPPL_PERSONAL_MODE_UNLOCK_METHOD_INT, -1); - vconf_set_bool(VCONFKEY_SETAPPL_PERSONAL_MODE_STATUS_BOOL, 0); - - ode_deinit(); - /* send resunt to personal mode ug */ - app_control_h svc; - if (!app_control_create(&svc)) { - app_control_add_extra_data(svc, "result", "Restore"); - ug_send_result(ad->ug, svc); - app_control_destroy(svc); - } - ug_destroy_me(ad->ug); - } - } - - if (ad->reset_personal_popup) { - evas_object_del(ad->reset_personal_popup); - ad->reset_personal_popup = NULL; - } -} - -static void __launch_lockscreen(void) -{ - SETTING_TRACE_BEGIN; - struct sockaddr_un saddr; - int fd; - int retry = 1; - - fd = socket(AF_UNIX, SOCK_STREAM, 0); - if (fd < 0) { - fd = socket(AF_UNIX, SOCK_STREAM, 0); - if (fd < 0) { - SETTING_TRACE("socket() failed"); - return; - } - } - bzero(&saddr, sizeof(saddr)); - saddr.sun_family = AF_UNIX; - strncpy(saddr.sun_path, "/tmp/phlock", strlen("/tmp/phlock")); - saddr.sun_path[strlen("/tmp/phlock")] = 0; - - SETTING_TRACE("saddr.sun_path = %s", saddr.sun_path); -retry_con: - if (connect(fd, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) { - if (retry > 0) { - usleep(100 * 1000); - retry--; - goto retry_con; - } - close(fd); - SETTING_TRACE("connect() failed"); - return; - } - char *cmd = "launch_phone_lock"; - int len = strlen(cmd); - send(fd, cmd, len, 0); -} - -static void setting_password_forgot_password_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - setting_retm_if(data == NULL, "Data parameter is NULL"); - SettingPasswordUG *ad = (SettingPasswordUG *)data; - - retm_if(event_info == NULL, "Invalid argument: event info is NULL"); - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - elm_genlist_item_selected_set(item, 0); - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) elm_object_item_data_get(item); - - SETTING_TRACE("%s clicked", list_item->keyStr); - if (!safeStrCmp(list_item->keyStr, PW_ST_RESET_PERSONAL_MODE)) { - /* if lock type is simple password or password, call lockscreen. */ - int screen_lock_type = 0; - vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &screen_lock_type); - if (screen_lock_type == SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD - || screen_lock_type == SETTING_SCREEN_LOCK_TYPE_PASSWORD) { - /* call lockscreen app */ - __launch_lockscreen(); - /*int ret = 0; */ - /*ret = aul_launch_app("org.tizen.lockscreen", NULL); */ - /*SETTING_TRACE("aul_launch_app() returns %d", ret); */ - } - - /* draw popup */ - ad->reset_personal_popup = setting_create_popup(ad, ad->win_get, - PW_ST_RESET_PERSONAL_MODE, - PW_ST_RESET_PERSONAL_MODE_POPUP_Q, - __reset_personal_popup_resp_cb, 0, FALSE, FALSE, - 2, PW_ST_RESET, PW_ST_CANCEL); - } -} - -static Eina_Bool __forgot_password_pop_cb(void *data, Elm_Object_Item *it) -{ - SETTING_TRACE_BEGIN; - - setting_view_change(&setting_view_password_forgot_password, &setting_view_password_main, data); - - return EINA_TRUE; -} - -static int setting_password_forgot_password_create(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) cb; - - Evas_Object *genlist = NULL; - Elm_Object_Item *navi_it = NULL; - - navi_it = setting_push_layout_navi_bar_genlist(ad->win_main_layout, ad->win_get, - PW_ST_FORGOT_PASSWORD, - NULL, NULL, NULL, NULL, NULL, - &genlist, ad->navi_bar); - /* add pop cb */ - elm_naviframe_item_pop_cb_set(navi_it, (Elm_Naviframe_Item_Pop_Cb)__forgot_password_pop_cb, ad); - - if (genlist) { - /* menu 1. */ - setting_create_Gendial_field_def(genlist, &(itc_1text), - setting_password_forgot_password_mouse_up_Gendial_list_cb, ad, - SWALLOW_Type_INVALID, - NULL, NULL, - 0, PW_ST_RESET_PERSONAL_MODE, NULL, NULL); - - /* menu 2. */ - ADD_GL_HELP(genlist, PW_ST_RESET_PERSONAL_MODE_HELP); - } - - - setting_view_password_forgot_password.is_create = 1; - - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -static int setting_password_forgot_password_destroy(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - setting_view_password_forgot_password.is_create = 0; - - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -static int setting_password_forgot_password_update(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) cb; - - if (ad->ly_main != NULL) { - evas_object_show(ad->ly_main); - } - - return SETTING_RETURN_SUCCESS; -} - -static int setting_password_forgot_password_cleanup(void *cb) -{ - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - return setting_password_forgot_password_destroy(cb); -} - -/* *************************************************** - * - *general func - * - ***************************************************/ - diff --git a/setting-password/src/setting-password-main.c b/setting-password/src/setting-password-main.c deleted file mode 100644 index 7508d00..0000000 --- a/setting-password/src/setting-password-main.c +++ /dev/null @@ -1,939 +0,0 @@ -/* -* setting -* -* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. -* -* Contact: MyoungJune Park -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*/ - -#include -#include -#include -#include -#include -#if SUPPORT_ENCRYPTION -#include -#endif -#include -#include -#include -#include -#include - - -void __add_help_of_password_fails(int ret, SettingPasswordUG *ad); - -static int setting_password_main_create(void *cb); -static int setting_password_main_destroy(void *cb); -static int setting_password_main_update(void *cb); -static int setting_password_main_cleanup(void *cb); - - -setting_view setting_view_password_main = { - .create = setting_password_main_create, - .destroy = setting_password_main_destroy, - .update = setting_password_main_update, - .cleanup = setting_password_main_cleanup, -}; - - -static void setting_password_main_done_password(void *data); -static int __count_string(const char *str, int *cnt_letter, int *cnt_digit, int *cnt_sym); - -extern struct _pw_item pw_its[]; - -/* *************************************************** - * - *basic func - * - ***************************************************/ - -static Eina_Bool setting_password_main_click_softkey_cancel_cb(void *data, Elm_Object_Item *it) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retvm_if(data == NULL, EINA_FALSE, "[Setting > Password] Data parameter is NULL"); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - /* if IME is displayed, hide IME. or Destroy password ug. */ - elm_object_focus_set(ad->ed_pw1->eo_check, EINA_FALSE); - - if (ad->focus_timer) { - ecore_timer_del(ad->focus_timer); - ad->focus_timer = NULL; - } - - /* send result : Cancel */ - app_control_h svc; - if (app_control_create(&svc) == 0) { - app_control_add_extra_data(svc, "result", "Cancel"); - ug_send_result(ad->ug, svc); - SETTING_TRACE("Send Result : %s\n", "Cancel"); - - app_control_destroy(svc); - } - /* Send destroy request */ - ug_destroy_me(ad->ug); - - return EINA_TRUE; -} - -Eina_Bool __rotate_cb(void *data) -{ - /* error check */ - SETTING_TRACE_BEGIN; - retv_if(data == NULL, FALSE); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - /*SETTING_TRACE_DEBUG("category : 0x%x", pw_its[ad->view_type].category);*/ - - /* it can manage the cursor self */ - if (ad->ed_pw1 && ad->ed_pw1->eo_check) { - SETTING_TRACE_DEBUG("set focus on first entry"); - /* no matter how many edifileds, it only need focus on 1st editfiled */ - elm_object_focus_set(ad->ed_pw1->eo_check, EINA_TRUE); - elm_entry_cursor_end_set(ad->ed_pw1->eo_check); - } - - ad->focus_timer = NULL; - - return ECORE_CALLBACK_CANCEL; -} - -static int setting_password_main_create(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) cb; - - ad->ly_main = setting_create_layout_navi_bar_genlist(ad->win_main_layout, ad->win_get, "IDS_ST_BODY_PASSWORD", - _("IDS_ST_BUTTON_BACK"), - NULL, - (setting_call_back_func)setting_password_main_click_softkey_cancel_cb, - NULL, - ad, - &(ad->scroller), - &(ad->navi_bar)); - - ad->navi_it = elm_naviframe_top_item_get(ad->navi_bar); - - ad->bottom_btn = elm_box_add(ad->navi_bar); - elm_box_padding_set(ad->bottom_btn, ELM_SCALE_SIZE(10), ELM_SCALE_SIZE(10)); - elm_box_horizontal_set(ad->bottom_btn, EINA_TRUE); - evas_object_size_hint_weight_set(ad->bottom_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(ad->bottom_btn, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_show(ad->bottom_btn); - elm_box_pack_end(ad->navi_bar, ad->bottom_btn); - - /* button 1 */ - Evas_Object *btn = elm_button_add(ad->bottom_btn); - elm_object_style_set(btn, "bottom"); - elm_object_text_set(btn, _("IDS_ST_BUTTON_CANCEL")); - evas_object_smart_callback_add(btn, "clicked", setting_password_main_click_softkey_cancel_cb, ad); - evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0.5); - evas_object_show(btn); - elm_box_pack_end(ad->bottom_btn, btn); - - /* button 2 */ - ad->bottom_btn1 = elm_button_add(ad->bottom_btn); - elm_object_style_set(ad->bottom_btn1, "bottom"); - if (ad->view_type == SETTING_PW_TYPE_SET_PASSWORD) { - elm_object_text_set(ad->bottom_btn1, _("IDS_ST_BUTTON_CONTINUE")); - evas_object_smart_callback_add(ad->bottom_btn1, "clicked", setting_password_main_click_softkey_continue_cb, ad); - } else { - elm_object_text_set(ad->bottom_btn1, _("IDS_SA_BUTTON_DONE_ABB")); - evas_object_smart_callback_add(ad->bottom_btn1, "clicked", setting_password_main_click_softkey_done_cb, ad); - } - evas_object_size_hint_weight_set(ad->bottom_btn1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(ad->bottom_btn1, EVAS_HINT_FILL, 0.5); - evas_object_show(ad->bottom_btn1); - elm_box_pack_end(ad->bottom_btn, ad->bottom_btn1); - - elm_object_item_part_content_set(ad->navi_it, "toolbar", ad->bottom_btn); - - ad->cur_step = 1; - setting_password_main_draw_1line_password(ad, NULL); - - /* Disable Done button if exist */ - elm_object_disabled_set(ad->bottom_btn1, EINA_TRUE); - elm_object_focus_allow_set(ad->bottom_btn1, EINA_FALSE); - - ad->focus_timer = ecore_timer_add(0.5, __rotate_cb, ad); - - setting_view_password_main.is_create = 1; - - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -static int setting_password_main_destroy(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) cb; - - FREE(ad->step1_str); - - if (ad->remove_timer) { - ecore_timer_del(ad->remove_timer); - ad->remove_timer = NULL; - } - - if (ad->focus_timer) { - ecore_timer_del(ad->focus_timer); - ad->focus_timer = NULL; - } - - if (ad->notify) { - evas_object_del(ad->notify); - ad->notify = NULL; - } - - if (ad->ly_main != NULL) { - evas_object_del(ad->ly_main); - ad->ly_main = NULL; - } - - setting_view_password_main.is_create = 0; - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -static int setting_password_main_update(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) cb; - - if (ad->ly_main != NULL) { - evas_object_show(ad->ly_main); - } - return SETTING_RETURN_SUCCESS; -} - -static int setting_password_main_cleanup(void *cb) -{ - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) cb; - - if (ad->ly_main != NULL) { - evas_object_hide(ad->ly_main); - } - - return SETTING_RETURN_SUCCESS; -} - -/* *************************************************** - * - *general func - * - ***************************************************/ - -static void -setting_password_main_entry_changed_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "[Setting > Password] Data parameter is NULL"); - retm_if(obj == NULL, "[Setting > Password] Data parameter is NULL"); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) data; - SettingPasswordUG *ad = (SettingPasswordUG *) list_item->userdata; - const char *entry_str = elm_entry_entry_get(obj); - list_item->sub_desc = (char *)g_strdup(entry_str); - bool isFoundEmptyEntry = FALSE; - - do { - if (ad->ed_pw1) { - entry_str = ad->ed_pw1->sub_desc; - if (NULL == entry_str || '\0' == entry_str[0]) { - isFoundEmptyEntry = TRUE; - elm_object_item_signal_emit(ad->ed_pw1->item, "elm,state,eraser,hide", ""); - break; - } else { - elm_object_item_signal_emit(ad->ed_pw1->item, "elm,state,eraser,show", ""); - break; - } - } - } while (0); - - Eina_Bool item_disabled = elm_object_item_disabled_get(list_item->item); - if (item_disabled) - return; - - /* For disable toolbar (done) item */ - bool disableFlag = isFoundEmptyEntry; - if (ad->ed_pw1 && ad->ed_pw1->eo_check && (safeStrLen(elm_entry_entry_get(ad->ed_pw1->eo_check)) < 4)) - disableFlag = TRUE; - -#if SUPPORT_BOTTOM_BTNS - if (disableFlag) { - elm_object_disabled_set(ad->bottom_btn1, EINA_TRUE); - elm_entry_input_panel_return_key_disabled_set(obj, EINA_TRUE); - } else { - elm_object_disabled_set(ad->bottom_btn1, EINA_FALSE); - elm_entry_input_panel_return_key_disabled_set(obj, EINA_FALSE); - } -#else - elm_object_item_disabled_set(elm_toolbar_last_item_get(ad->controllbar), disableFlag); -#endif - -} - -static void __reached_max_pwlength_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - retm_if(!elm_object_focus_get(obj), "Entry is not focused");/*notify only when entry is being focused on. */ - - // int err = 0; - - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data; - SettingPasswordUG *ad = (SettingPasswordUG *) list_item->userdata; - - /* Display help text. */ - char temp[128] = {0,}; - snprintf(temp, 128, _(PW_ST_PW_MAX_LENGTH_HELP), list_item->limit_filter_data->max_char_count); - setting_password_ug_display_desc(ad, temp, FALSE); -} - -static void __entry_activated_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data; - SettingPasswordUG *ad = (SettingPasswordUG *) list_item->userdata; - - if (ad->bottom_btn) { - if (elm_object_disabled_get(ad->bottom_btn1) == EINA_FALSE) { - /* call done cb. */ - if (ad->view_type == SETTING_PW_TYPE_SET_PASSWORD && ad->cur_step == 1) { - /* Save first input */ - ad->step1_str = (char *)strdup(ad->ed_pw1->sub_desc); - - /* Check step1_str : more than 4, not all digits */ - int letter = 0; - int digit = 0; - int symbol = 0; - __count_string(ad->step1_str, &letter, &digit, &symbol); - if (safeStrLen(ad->step1_str) == digit) { - __add_help_of_password_fails(SETTING_PW_ERROR_INCLUDE_NO_LETTER, ad); - FREE(ad->step1_str); - return; - } - - setting_password_main_clear_1line_password(ad); - if (ad->err_desc && ad->err_desc->item) { - elm_object_item_del(ad->err_desc->item); - ad->err_desc = NULL; - } - - /* Change entry title : PW_SHORT_GUIDE_CONFIRM */ - FREE(ad->ed_pw1->keyStr); - ad->ed_pw1->keyStr = (char *)strdup(PW_SHORT_GUIDE_CONFIRM); - elm_genlist_item_fields_update(ad->ed_pw1->item, "elm.text.main", ELM_GENLIST_ITEM_FIELD_TEXT); - - - /* Change button */ - elm_object_text_set(ad->bottom_btn1, _("IDS_SA_BUTTON_DONE_ABB")); - evas_object_smart_callback_add(ad->bottom_btn1, "clicked", setting_password_main_click_softkey_done_cb, ad); - elm_object_disabled_set(ad->bottom_btn1, EINA_TRUE); - elm_entry_input_panel_return_key_disabled_set(obj, EINA_TRUE); - ad->cur_step++; - } else { - setting_password_main_done_password(ad); - } - } - } -} - -static void __entry_focused_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data; - // SettingPasswordUG *ad = (SettingPasswordUG *)list_item->userdata; - - if (!elm_entry_is_empty(obj)) { - elm_object_item_signal_emit(list_item->item, "elm,state,eraser,show", ""); - } - elm_object_item_signal_emit(list_item->item, "elm,state,rename,hide", ""); -} - -static void __entry_unfocused_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - retm_if(obj == NULL, "Data parameter is NULL"); - - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data; - - if (list_item->item) { - elm_object_item_signal_emit(list_item->item, "elm,state,eraser,hide", ""); - elm_object_item_signal_emit(list_item->item, "elm,state,rename,show", ""); - } -} - -int setting_password_main_draw_1line_password(void *data, void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER, - "[Setting > Password] Data parameter is NULL"); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - switch (ad->view_type) { - case SETTING_PW_TYPE_PASSWORD: - ad->ed_pw1 = - setting_create_Gendial_field_editfield(ad->scroller, - &(itc_editfield), - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - "IDS_ST_BODY_PASSWORD", - NULL, - setting_password_main_entry_changed_cb, - __entry_focused_cb, - __entry_unfocused_cb, - __entry_activated_cb, - __reached_max_pwlength_cb, - ELM_INPUT_PANEL_LAYOUT_PASSWORD, - TRUE, TRUE, - SETTING_PW_UG_NORMAL_PASSWORD_MAX_LENGTH, - 0, NULL, NULL); - /* change return key type */ - if (ad->ed_pw1) { - ad->ed_pw1->return_key_type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE; - elm_entry_input_panel_return_key_type_set(ad->ed_pw1->eo_check, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE); - elm_object_focus_set(ad->ed_pw1->eo_check, EINA_TRUE); - } - - break; - case SETTING_PW_TYPE_SET_PASSWORD: - ad->ed_pw1 = - setting_create_Gendial_field_editfield(ad->scroller, - &(itc_editfield), - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - PW_SHORT_GUIDE_NEW, - NULL, - setting_password_main_entry_changed_cb, - __entry_focused_cb, - __entry_unfocused_cb, - __entry_activated_cb, - __reached_max_pwlength_cb, - ELM_INPUT_PANEL_LAYOUT_PASSWORD, - TRUE, TRUE, - SETTING_PW_UG_NORMAL_PASSWORD_MAX_LENGTH, - 0, NULL, NULL); - - ad->err_desc = setting_create_Gendial_field_helpitem_without_bottom_separator( - ad->scroller, - &(itc_multiline_text), - SWALLOW_Type_LAYOUT_SPECIALIZTION_X, - PW_NORMAL_AND_CONTAIN_ALPHANUMER_DESC); - - /* change return key type */ - if (ad->ed_pw1) { - ad->ed_pw1->return_key_type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT; - elm_entry_input_panel_return_key_type_set(ad->ed_pw1->eo_check, ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT); - elm_object_focus_set(ad->ed_pw1->eo_check, EINA_TRUE); - } - - break; - default: - break; - } - - ad->ed_pw2 = NULL; - ad->ed_pw3 = NULL; - - return 0; -} - -int setting_password_main_clear_1line_password(void *data) -{ - /* error check */ - retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER, - "[Setting > Password] Data parameter is NULL"); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - retv_if(NULL == ad->ed_pw1, -1); - - ad->ed_pw1->sub_desc = NULL; - ad->ed_pw1->isFocusFlag = FALSE; - - elm_entry_entry_set(ad->ed_pw1->eo_check, ""); - elm_object_part_text_set(ad->ed_pw1->eo_check, "elm.guide", _("IDS_ST_BODY_ENTER_PASSWORD")); - - return 0; -} - -/* This help is shown on entering new/confirm password view */ -void __add_help_of_password_policy(SettingPasswordUG *ad) -{ - ret_if(ad == NULL); - - ad->err_desc = setting_create_Gendial_field_helpitem_without_bottom_separator( - ad->scroller, - &(itc_multiline_text), - SWALLOW_Type_LAYOUT_SPECIALIZTION_X, - PW_NORMAL_AND_CONTAIN_ALPHANUMER_DESC); - - if (ad->ed_pw1 && ad->ed_pw1->eo_check) { - SETTING_TRACE_DEBUG("FOCUS IN"); - ad->ed_pw1->isFocusFlag = TRUE; - elm_object_focus_set(ad->ed_pw1->eo_check, EINA_TRUE); - } -} - -/* This help is shown after verifying entered new/confirm password with constraint */ -void __add_help_of_password_fails(int ret, SettingPasswordUG *ad) -{ - ret_if(ad == NULL); - - switch (ret) { - case SETTING_PW_ERROR_INVALID_LENGTH: - setting_password_ug_display_desc(ad, "Invalid length", FALSE); - break; - case SETTING_PW_ERROR_INCLUDE_NO_LETTER: - setting_password_ug_display_desc(ad, "IDS_ST_BODY_PASSWORD_MUST_CONTAIN_AT_LEAST_1_LETTER", FALSE); - break; - case SETTING_PW_ERROR_NO_MATCH_WITH_POLICY: - setting_password_ug_display_desc(ad, "No match with policy", FALSE); - break; - case SETTING_PW_ERROR_NO_MATCH_MIN_COMPLEX: - setting_password_ug_display_desc(ad, "No match with min complex", FALSE); - break; - case SETTING_PW_ERROR_EXIST_FORBIDDEN_STRING: - setting_password_ug_display_desc(ad, "Exist forbidden string", FALSE); - break; - case SETTING_PW_ERROR_NO_MATCH_MAX_REPEAT_COUNT: - setting_password_ug_display_desc(ad, "No match with max repeat count", FALSE); - break; - case SETTING_PW_ERROR_SIMPLE_STYLE: - setting_password_ug_display_desc(ad, "Exist simple sequence", FALSE); - break; - case SETTING_PW_ERROR_INCLUDE_DIGIT: - setting_password_ug_display_desc(ad, "Password should not include any digit or symbol", FALSE); - break; - case SETTING_PW_ERROR_NO_MATCH_WITH_PATTERN: - setting_password_ug_display_desc(ad, "No match with pattern", FALSE); - break; - case SETTING_PW_ERROR_NO_DIGIT: - setting_password_ug_display_desc(ad, "IDS_ST_BODY_PASSWORD_MUST_CONTAIN_AT_LEAST_1_NUMBER", FALSE); - break; - default: - setting_password_ug_display_desc(ad, PW_ERR_DESC, FALSE); - break; - } -} - -int setting_password_main_check_1line_password(void *data) -{ - /* error check */ - retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - /*const char *entry_str = ad->ed_pw1->sub_desc; */ - const char *entry_str = elm_entry_markup_to_utf8(ad->ed_pw1->sub_desc); - /*char* plain_str = elm_entry_markup_to_utf8(ad->ed_pw1->sub_desc); */ - ad->focus_data = ad->ed_pw1; - - /* Empty Check */ - if (isEmptyStr(entry_str)) { - setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE); - FREE(entry_str); - return SETTING_ENTRY_RETURN_NULL_STR_ERR; - } - - /* Length Check */ - int entry_str_len = safeStrLen(entry_str); - if (entry_str_len < SETTING_PW_UG_NORMAL_PASSWORD_MIN_LENGTH - || entry_str_len > SETTING_PW_UG_NORMAL_PASSWORD_MAX_LENGTH) { - setting_password_main_warning_entry_added_byte_popup(ad, - SETTING_PW_UG_NORMAL_PASSWORD_MIN_LENGTH, - SETTING_PW_UG_NORMAL_PASSWORD_MAX_LENGTH); - FREE(entry_str); - return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW; - } - FREE(entry_str); - return SETTING_RETURN_SUCCESS; -} - -int setting_password_main_check_2line_password(void *data) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - if (ad->ed_pw1 == NULL) - return SETTING_GENERAL_ERR_NULL_DATA_PARAMETER; - - const char *entry_str1 = ad->step1_str; - const char *entry_str2 = ad->ed_pw1->sub_desc; - - /*SETTING_TRACE(" entry_str1 : %s ", entry_str1); */ - /*SETTING_TRACE(" entry_str2 : %s ", entry_str2); */ - - /*char* plain_str = elm_entry_markup_to_utf8(str); */ - const char *entry_str1_mk = elm_entry_markup_to_utf8(entry_str1); - const char *entry_str2_mk = elm_entry_markup_to_utf8(entry_str2); - - ad->focus_data = ad->ed_pw1; - - /* Empty Check */ - if (isEmptyStr(entry_str1_mk)) { - setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE); - FREE(entry_str1_mk); - FREE(entry_str2_mk); - return SETTING_ENTRY_RETURN_NULL_STR_ERR; - } - - /* Match Check */ - if (0 != safeStrCmp(entry_str1_mk, entry_str2_mk)) { - setting_password_main_clear_1line_password(ad); - setting_password_ug_display_desc(ad, _("IDS_ST_POP_PASSWORDS_DO_NOT_MATCH"), FALSE); - FREE(entry_str1_mk); - FREE(entry_str2_mk); - return SETTING_ENTRY_NOT_MATCH_NEW_CONF_PW; - } - - /* Length Check */ - int entry_str_len = safeStrLen(entry_str1_mk); - if (entry_str_len < SETTING_PW_UG_NORMAL_PASSWORD_MIN_LENGTH - || entry_str_len > SETTING_PW_UG_NORMAL_PASSWORD_MAX_LENGTH) { - setting_password_main_warning_entry_added_byte_popup(ad, - SETTING_PW_UG_NORMAL_PASSWORD_MIN_LENGTH, - SETTING_PW_UG_NORMAL_PASSWORD_MAX_LENGTH); - FREE(entry_str1_mk); - FREE(entry_str2_mk); - return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW; - } - - FREE(entry_str1_mk); - FREE(entry_str2_mk); - return SETTING_RETURN_SUCCESS; -} - -void setting_password_main_warning_entry_added_byte_popup(SettingPasswordUG *ad, - int min, int max) -{ - char str[MAX_SPECIALIZITION_LEN + 1] = { 0 }; - - snprintf(str, MAX_SPECIALIZITION_LEN, _("IDS_ST_POP_PASSWORD_MUST_BE_MORE_THAN_P1SD_CHARACTERS_AND_LESS_THAN_P2SD"), min, max); - setting_password_ug_display_desc(ad, str, FALSE); -} - -static void setting_password_main_done_password(void *data) -{ - ret_if(data == NULL); - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - app_control_h svc; - if (app_control_create(&svc)) { - SETTING_TRACE_ERROR("app_control_create() failed"); - return; - } - - SETTING_TRACE("ad->view_type:%d", ad->view_type); - int ret = 0; - - switch (ad->view_type) { - case SETTING_PW_TYPE_PASSWORD: - ret = setting_password_main_check_1line_password(ad); - - if (ret == SETTING_RETURN_SUCCESS) { - const char *entry_str; - entry_str = ad->ed_pw1->sub_desc; - /*SETTING_TRACE(" ----> entry_str : %s ", entry_str); */ - /*SETTING_TRACE(" ----> ad->view_type_string : %s ", ad->view_type_string); */ - unsigned int remain_attempt = ATTEMPT_INFINITE; - unsigned int valid_seconds = 0; - - ret = setting_password_check_password(entry_str, &remain_attempt, &valid_seconds); - - if (ret == SETTING_RETURN_SUCCESS) { - int err; - - if (safeStrCmp(ad->view_type_string, "SETTING_PW_TYPE_PASSWORD") == 0) { - - /* reset VCONF */ - setting_set_int_slp_key(INT_SLP_SETTING_PHONE_LOCK_ATTEMPTS_LEFT, PHONE_LOCK_ATTEMPS_MAX, &err); - if (err == SETTING_RETURN_FAIL) { - SETTING_TRACE_ERROR("[Error] set value of vconf fail."); - app_control_destroy(svc); - return; - } - } else if (0 == safeStrCmp(ad->view_type_string, "SETTING_PW_TYPE_ENTER_LOCK_TYPE")) { - app_control_add_extra_data(svc, "current", entry_str); - } - } else { - /* Incorrect Password. Display Popup. */ - setting_password_main_clear_1line_password(ad); - ad->focus_data = ad->ed_pw1; - /*else */ - /*{ */ - /* setting_password_ug_check_attemps_left(ad); */ - /* return; */ - /*} */ - setting_password_ug_display_desc(ad, PW_ERR_DESC, FALSE); - app_control_destroy(svc); - return; - } - } else { - setting_password_main_clear_1line_password(ad); - app_control_destroy(svc); - return; - } - break; - case SETTING_PW_TYPE_SET_PASSWORD: { - /*SETTING_TRACE("case SETTING_PW_TYPE_SET_PASSWORD"); */ - ret = setting_password_main_check_2line_password(ad); - /*SETTING_TRACE("setting_password_main_check_2line_password --> ret = %d ", ret); */ - - if (SETTING_RETURN_SUCCESS == ret) { - const char *entry_str; - entry_str = ad->ed_pw1->sub_desc; - - if (isEmptyStr(entry_str)) { - ad->focus_data = ad->ed_pw1; - SETTING_TRACE_DEBUG("%s*** [ERR] elm_entry_entry_get return NULL ***%s", - SETTING_FONT_RED, SETTING_FONT_BLACK); - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - app_control_destroy(svc); - return; - } - - ret = setting_password_set_password(ad->cur_pwd, entry_str, ad); - SETTING_TRACE(" -----------------> setting_password_set_password : %d \n", ret); - - /* Modify Setting Password */ - if (ret > 0) { - /* Display popup */ - /*service_add_extra_data(svc, "current", entry_str); */ - if (ad->set_history_timer) { - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_NEW_PASSWD_SAVED"), FALSE); - } else { - app_control_add_extra_data(svc, "result", ad->view_type_string); - ug_send_result(ad->ug, svc); - SETTING_TRACE("Send Result : %s\n", ad->view_type_string); - - app_control_destroy(svc); - /* Send destroy request */ - ug_destroy_me(ad->ug); - return; - } - app_control_destroy(svc); - return; - } else if (ret == SETTING_PW_ERROR_REUSED) { - ad->focus_data = ad->ed_pw1; - setting_password_main_clear_1line_password(ad); - setting_password_ug_display_desc(ad, _(PW_ERR_REUSED), FALSE); - app_control_destroy(svc); - return; - } else { - ad->focus_data = ad->ed_pw1; - setting_password_main_clear_1line_password(ad); - setting_password_ug_display_desc(ad, _("IDS_BT_POP_OPERATION_FAILED"), FALSE); - app_control_destroy(svc); - return; - } - } else if (SETTING_ENTRY_NOT_MATCH_NEW_CONF_PW == ret) { - /* Nothing */ - app_control_destroy(svc); - setting_password_main_clear_1line_password(ad); - setting_password_ug_display_desc(ad, PW_ST_PW_DO_NOT_MATCH, FALSE); - return; - } else { - SETTING_TRACE("error : %d", ret); - setting_password_main_clear_1line_password(ad); - setting_password_ug_display_desc(ad, PW_ERR_DESC, FALSE); - app_control_destroy(svc); - return; - } - } - break; - default: - app_control_destroy(svc); - return; - } - - app_control_add_extra_data(svc, "result", ad->view_type_string); - ug_send_result(ad->ug, svc); - SETTING_TRACE("Send Result : %s\n", ad->view_type_string); - - app_control_destroy(svc); - /* Send destroy request */ - ug_destroy_me(ad->ug); -} - -static int __count_string(const char *str, int *cnt_letter, int *cnt_digit, int *cnt_sym) -{ - SETTING_TRACE_BEGIN; - retv_if(str == NULL || cnt_letter == NULL || cnt_digit == NULL || cnt_sym == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - /*char* plain_str = elm_entry_markup_to_utf8(str); */ - char *plain_str = str; - - int length = strlen(plain_str); - int index = 0; - char temp = 0; - int letter = 0; - int digit = 0; - int symbol = 0; - - if (length <= 0) { - SETTING_TRACE_DEBUG("[DEBUG] invalid input length"); - return SETTING_RETURN_FAIL; - } - - for (index = 0; index < length; index++) { - temp = (char)(plain_str[index]); - SETTING_TRACE_SECURE_DEBUG("temp %c", temp); - - if ((temp >= '0') && (temp <= '9')) { /* digit */ - digit++; - } else if ((temp >= 'a') && (temp <= 'z')) { /* lower letter */ - letter++; - } else if ((temp >= 'A') && (temp <= 'Z')) { /* upper letter */ - letter++; - } else if ((temp >= ' ') && (temp <= '~')) { /* symbol means special char that enables to input from IME. */ - symbol++; - } - } - SETTING_TRACE_SECURE_DEBUG("%s includes %d letters, %d digits, and %d symbols", plain_str, letter, digit, symbol); - *cnt_letter = letter; - *cnt_digit = digit; - *cnt_sym = symbol; - return SETTING_RETURN_SUCCESS; -} - -void setting_password_main_click_softkey_continue_cb(void *data, Evas_Object *obj, - void *event_info) -{ - /* error check */ - retm_if(data == NULL, "[Setting > Password] Data parameter is NULL"); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - /* Save first input */ - ad->step1_str = (char *)strdup(ad->ed_pw1->sub_desc); - - /* Check step1_str : more than 4, not all digits */ - int letter = 0; - int digit = 0; - int symbol = 0; - char *plain_str = elm_entry_markup_to_utf8(ad->step1_str); - __count_string(plain_str, &letter, &digit, &symbol); - - if (safeStrLen(plain_str) == digit) { - setting_password_main_clear_1line_password(ad); - __add_help_of_password_fails(SETTING_PW_ERROR_INCLUDE_NO_LETTER, ad); - FREE(ad->step1_str); - FREE(plain_str); - return; - } - - setting_password_main_clear_1line_password(ad); - if (ad->err_desc && ad->err_desc->item) { - elm_object_item_del(ad->err_desc->item); - ad->err_desc = NULL; - } - - /* Change entry title : PW_SHORT_GUIDE_CONFIRM */ - FREE(ad->ed_pw1->keyStr); - ad->ed_pw1->keyStr = (char *)strdup(PW_SHORT_GUIDE_CONFIRM); - elm_genlist_item_fields_update(ad->ed_pw1->item, "elm.text.main", ELM_GENLIST_ITEM_FIELD_TEXT); - - /* change return key type */ - ad->ed_pw1->return_key_type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE; - elm_entry_input_panel_return_key_type_set(ad->ed_pw1->eo_check, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE); - elm_object_focus_set(ad->ed_pw1->eo_check, EINA_TRUE); - - /* Change button */ - if (ad->bottom_btn) { - ad->bottom_btn = elm_box_add(ad->navi_bar); - elm_box_padding_set(ad->bottom_btn, ELM_SCALE_SIZE(10), ELM_SCALE_SIZE(10)); - elm_box_horizontal_set(ad->bottom_btn, EINA_TRUE); - evas_object_size_hint_weight_set(ad->bottom_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(ad->bottom_btn, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_show(ad->bottom_btn); - elm_box_pack_end(ad->navi_bar, ad->bottom_btn); - - /* button 1 */ - Evas_Object *btn = elm_button_add(ad->bottom_btn); - elm_object_style_set(btn, "bottom"); - elm_object_text_set(btn, _("IDS_ST_BUTTON_CANCEL")); - evas_object_smart_callback_add(btn, "clicked", setting_password_main_click_softkey_cancel_cb, ad); - evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0.5); - evas_object_show(btn); - elm_box_pack_end(ad->bottom_btn, btn); - elm_object_disabled_set(btn, EINA_FALSE); - - /* button 2 */ - ad->bottom_btn1 = elm_button_add(ad->bottom_btn); - elm_object_style_set(ad->bottom_btn1, "bottom"); - elm_object_text_set(ad->bottom_btn1, _("IDS_SA_BUTTON_DONE_ABB")); - evas_object_smart_callback_del(ad->bottom_btn1, "clicked", setting_password_main_click_softkey_continue_cb); - evas_object_smart_callback_add(ad->bottom_btn1, "clicked", setting_password_main_click_softkey_done_cb, ad); - elm_object_disabled_set(ad->bottom_btn1, EINA_TRUE); - evas_object_size_hint_weight_set(ad->bottom_btn1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(ad->bottom_btn1, EVAS_HINT_FILL, 0.5); - evas_object_show(ad->bottom_btn1); - elm_box_pack_end(ad->bottom_btn, ad->bottom_btn1); - elm_object_item_part_content_set(ad->navi_it, "toolbar", ad->bottom_btn); - } - - ad->cur_step++; - FREE(plain_str); -} - -void setting_password_main_click_softkey_done_cb(void *data, Evas_Object *obj, - void *event_info) -{ - /* error check */ - retm_if(data == NULL, "[Setting > Password] Data parameter is NULL"); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - if (ad->ed_pw1 && ad->ed_pw1->eo_check) { - elm_object_focus_set(ad->ed_pw1->eo_check, EINA_FALSE); - } - - if (ad->err_desc && ad->err_desc->item) { - elm_object_item_del(ad->err_desc->item); - ad->err_desc = NULL; - } - - setting_password_main_done_password(ad); -} diff --git a/setting-password/src/setting-password-sim.c b/setting-password/src/setting-password-sim.c deleted file mode 100644 index f22841d..0000000 --- a/setting-password/src/setting-password-sim.c +++ /dev/null @@ -1,2301 +0,0 @@ -/* -* setting -* -* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. -* -* Contact: MyoungJune Park -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static int setting_password_sim_create(void *cb); -static int setting_password_sim_destroy(void *cb); -static int setting_password_sim_update(void *cb); -static int setting_password_sim_cleanup(void *cb); - -setting_view setting_view_password_sim = { - .create = setting_password_sim_create, - .destroy = setting_password_sim_destroy, - .update = setting_password_sim_update, - .cleanup = setting_password_sim_cleanup, -}; - -static void setting_password_sim_done(void *data); - - -/* *************************************************** - * - *basic func - * - ***************************************************/ -static void -__password_sim_gl_mouse_up(void *data, Evas *e, Evas_Object *obj, - void *event) -{ - ret_if(!data); - /*SettingPasswordUG *ad = (SettingPasswordUG *) data; */ - - /* P131121-05156 : do not hide input panel when genlist scrolls, - plz compare with [about device > device name] item */ -} - -static char *setting_password_sim_get_title_str(void *data) -{ - retvm_if(data == NULL, NULL, - "[Setting > Password] Data parameter is NULL"); - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - switch (ad->view_type) { - case SETTING_PW_TYPE_SIM_LOCK_ON: - case SETTING_PW_TYPE_SIM_LOCK_OFF: - return "IDS_ST_BODY_PASSWORD"; - break; - case SETTING_PW_TYPE_PIN_LOCK_ON: - case SETTING_PW_TYPE_PIN_LOCK_OFF: - return _("IDS_ST_BODY_PIN"); - break; - case SETTING_PW_TYPE_CHANGE_PIN: - return _("IDS_ST_HEADER_CHANGE_PIN_ABB"); - break; - - case SETTING_PW_TYPE_CHANGE_PIN2: - return _("IDS_ST_BODY_CHANGE_PIN2"); - break; - - case SETTING_PW_TYPE_PIN_BLOCKED: - return _("IDS_ST_BODY_PUK1_CODE"); - break; - case SETTING_PW_TYPE_PIN2_BLOCKED: - - return _("IDS_ST_BODY_PUK2"); - break; - default: - SETTING_TRACE_DEBUG("%s*** Unknown Password Type. ***%s", - SETTING_FONT_BGREEN, SETTING_FONT_BLACK); - break; - } - return NULL; - -} - -static Eina_Bool setting_password_sim_click_softkey_cancel_cb(void *data, Elm_Object_Item *it) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retvm_if(data == NULL, EINA_FALSE, "[Setting > Password] Data parameter is NULL"); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; -#if 0 - /* if IME is displayed, hide IME. or Destroy password ug. */ - if (ad->ed_pw1 && ad->ed_pw1->isFocusFlag == TRUE && elm_object_focus_get(ad->ed_pw1->eo_check)) { - SETTING_TRACE_DEBUG("wait to hide IME"); - elm_object_focus_set(ad->ed_pw1->eo_check, EINA_FALSE); - return EINA_FALSE; - } else if (ad->ed_pw2 && ad->ed_pw2->isFocusFlag == TRUE && elm_object_focus_get(ad->ed_pw2->eo_check)) { - SETTING_TRACE_DEBUG("wait to hide IME"); - elm_object_focus_set(ad->ed_pw2->eo_check, EINA_FALSE); - return EINA_FALSE; - } else if (ad->ed_pw3 && ad->ed_pw3->isFocusFlag == TRUE && elm_object_focus_get(ad->ed_pw3->eo_check)) { - SETTING_TRACE_DEBUG("wait to hide IME"); - elm_object_focus_set(ad->ed_pw3->eo_check, EINA_FALSE); - return EINA_FALSE; - } -#endif - if (ad->focus_timer) { - ecore_timer_del(ad->focus_timer); - ad->focus_timer = NULL; - } - - /* send result : Cancel */ - app_control_h svc; - if (app_control_create(&svc) == 0) { - app_control_add_extra_data(svc, "result", "Cancel"); - ug_send_result(ad->ug, svc); - SETTING_TRACE("Send Result : %s\n", "Cancel"); - - app_control_destroy(svc); - } - /* Send destroy request */ - ug_destroy_me(ad->ug); - - return EINA_TRUE; -} - -static int __create_sim_layout(void *data) -{ - SETTING_TRACE_BEGIN; - retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *)data; - static int count = 0; - - count++; - /* CONTENT */ - if (ad->scroller != NULL) { - evas_object_del(ad->scroller); - ad->scroller = NULL; - } - - /* PIN related views have 2 toolbar buttons. CANCEL and DONE button */ - ad->ly_main = setting_create_layout_navi_bar_genlist(ad->win_main_layout, ad->win_get, setting_password_sim_get_title_str(ad), - _("IDS_ST_BUTTON_BACK"), - NULL, - (setting_call_back_func)setting_password_sim_click_softkey_cancel_cb, - NULL, - ad, - &(ad->scroller), - &(ad->navi_bar)); - - ad->navi_it = elm_naviframe_top_item_get(ad->navi_bar); - ad->bottom_btn = elm_button_add(ad->navi_bar); - - Evas_Object *btn_cancel = elm_button_add(ad->navi_bar); - elm_object_style_set(btn_cancel, "naviframe/title_cancel"); - evas_object_smart_callback_add(btn_cancel, "clicked", setting_password_sim_click_softkey_cancel_cb, ad); - elm_object_item_part_content_set(ad->navi_it, "title_left_btn", btn_cancel); - - Evas_Object *btn_done = elm_button_add(ad->navi_bar); - elm_object_style_set(btn_done, "naviframe/title_done"); - evas_object_smart_callback_add(btn_done, "clicked", setting_password_sim_click_softkey_done_cb, ad); - elm_object_item_part_content_set(ad->navi_it, "title_right_btn", btn_done); - - if (!ad->scroller) { - SETTING_TRACE("genlist is NULL"); - return SETTING_RETURN_FAIL; - } - - /* Disable Done button if exist */ - elm_object_disabled_set(ad->bottom_btn, EINA_TRUE); - elm_object_focus_allow_set(ad->bottom_btn, EINA_FALSE); - elm_object_item_signal_emit(ad->navi_it, "elm,state,sip,shown", ""); - - elm_genlist_mode_set(ad->scroller, ELM_LIST_COMPRESS); - /*evas_object_smart_callback_add(ad->scroller, "drag", __password_main_gl_drag, ad); */ - evas_object_event_callback_add(ad->scroller, EVAS_CALLBACK_MOUSE_UP, - __password_sim_gl_mouse_up, ad); - - return SETTING_RETURN_SUCCESS; -} - -static Eina_Bool __setting_password_sim_rotate_cb(void *data) -{ - /* error check */ - SETTING_TRACE_BEGIN; - retv_if(data == NULL, FALSE); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - if (ad->view_type == SETTING_PW_TYPE_PIN_LOCK_OFF - || ad->view_type == SETTING_PW_TYPE_PIN_LOCK_ON - || ((ad->view_type == SETTING_PW_TYPE_CHANGE_PIN) && !ad->cur_pwd) - || ad->view_type == SETTING_PW_TYPE_PIN_BLOCKED) { - if (tel_get_sim_lock_info(ad->handle, TAPI_SIM_LOCK_SC, setting_get_pin_lock_info_cb, ad) != 0) - SETTING_TRACE_DEBUG("failed to call tel_get_sim_lock_info()"); - } else if (((ad->view_type == SETTING_PW_TYPE_CHANGE_PIN2) && !ad->cur_pwd) - || ad->view_type == SETTING_PW_TYPE_PIN2_BLOCKED) { - if (tel_get_sim_lock_info(ad->handle, TAPI_SIM_LOCK_FD, setting_get_pin_lock_info_cb, ad) != 0) - SETTING_TRACE_DEBUG("failed to call tel_get_sim_lock_info()"); - } - - /* it can manage the cursor self */ - if (ad->ed_pw1 && ad->ed_pw1->isFocusFlag) { - if (ad->ed_pw1->eo_check) { - SETTING_TRACE_DEBUG("set focus on first entry"); - /* no matter how many edifileds, it only need focus on 1st editfiled */ - elm_object_focus_set(ad->ed_pw1->eo_check, EINA_TRUE); - elm_entry_cursor_end_set(ad->ed_pw1->eo_check); - } - } else if (ad->ed_pw2 && ad->ed_pw2->isFocusFlag) { - if (ad->ed_pw2->eo_check) { - SETTING_TRACE_DEBUG("set focus on second entry"); - /*no matter how many edifileds, it only need focus on 1st editfiled */ - elm_object_focus_set(ad->ed_pw2->eo_check, EINA_TRUE); - elm_entry_cursor_end_set(ad->ed_pw2->eo_check); - } - } else if (ad->ed_pw3 && ad->ed_pw3->isFocusFlag) { - if (ad->ed_pw3->eo_check) { - SETTING_TRACE_DEBUG("set focus on third entry"); - /*no matter how many edifileds, it only need focus on 1st editfiled */ - elm_object_focus_set(ad->ed_pw3->eo_check, EINA_TRUE); - elm_entry_cursor_end_set(ad->ed_pw3->eo_check); - } - } - - ad->focus_timer = NULL; - - return ECORE_CALLBACK_CANCEL; -} - -static void __init_tapi(SettingPasswordUG *ad) -{ - ad->handle = tel_init(NULL); - if (!ad->handle) { - SETTING_TRACE_DEBUG("%s*** [ERR] tel_init. ***%s", - SETTING_FONT_RED, SETTING_FONT_BLACK); - setting_password_ug_create_popup_notitle_nobtn(ad, - _("IDS_ST_POP_ERROR"), - FALSE); - } -} - -static void __deinit_tapi(SettingPasswordUG *ad) -{ - if (ad->handle) { - if (tel_deinit(ad->handle) != TAPI_API_SUCCESS) { - SETTING_TRACE_DEBUG("%s*** [ERR] setting_network_unsubscribe_tapi_events. ***%s", - SETTING_FONT_RED, SETTING_FONT_BLACK); - setting_password_ug_create_popup_notitle_nobtn(ad, - _("IDS_ST_POP_ERROR"), - FALSE); - } - ad->handle = NULL; - } -} - -static int setting_password_sim_create(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) cb; - int ret = 0; - - ret = __create_sim_layout(ad); - - if (ret < 0) - return SETTING_RETURN_FAIL; - - __init_tapi(ad); - - setting_password_sim_create_ui(ad); - - ad->focus_timer = ecore_timer_add(0.5, __setting_password_sim_rotate_cb, ad); - - setting_view_password_sim.is_create = 1; - - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -static int setting_password_sim_destroy(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) cb; - - __deinit_tapi(ad); - - if (ad->remove_timer) { - ecore_timer_del(ad->remove_timer); - ad->remove_timer = NULL; - } - if (ad->notify) { - evas_object_del(ad->notify); - ad->notify = NULL; - } - /*FREE(ad->guide_str); */ - - if (ad->ly_main != NULL) { - evas_object_del(ad->ly_main); - ad->ly_main = NULL; - setting_view_password_sim.is_create = 0; - } - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -static int setting_password_sim_update(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) cb; - - if (ad->ly_main != NULL) { - evas_object_show(ad->ly_main); - } - if (ad->puk_verified_flag == TRUE && ad->view_type == SETTING_PW_TYPE_PIN_BLOCKED) { - ad->puk_verified_flag = FALSE; - SETTING_TRACE_DEBUG("view type : PIN1_BLOCKED, change view"); - if (ad->scroller) { - elm_genlist_clear(ad->scroller); - if (ad->cur_pwd) { - setting_password_sim_draw_2line_entry(ad, NULL); - } else { - setting_password_sim_draw_1line_entry(ad, NULL); - ad->focus_timer = ecore_timer_add(0.5, __setting_password_sim_rotate_cb, ad); - } - } - } - return SETTING_RETURN_SUCCESS; -} - -static int setting_password_sim_cleanup(void *cb) -{ - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) cb; - - if (ad->ly_main != NULL) { - evas_object_hide(ad->ly_main); - } - - return SETTING_RETURN_SUCCESS; -} - -/* *************************************************** - * - *general func - * - ***************************************************/ - -int setting_password_sim_create_ui(void *data) -{ - /* error check */ - retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER, - "[Setting > Password] Data parameter is NULL"); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - SETTING_TRACE_DEBUG("ad->view_type=%d ***", ad->view_type); - - switch (ad->view_type) { - case SETTING_PW_TYPE_SIM_LOCK_OFF: - case SETTING_PW_TYPE_PIN_LOCK_ON: - case SETTING_PW_TYPE_PIN_LOCK_OFF: - case SETTING_PW_TYPE_PIN_BLOCKED: - case SETTING_PW_TYPE_CHANGE_PIN: - case SETTING_PW_TYPE_CHANGE_PIN2: - setting_password_sim_draw_1line_entry(ad, NULL); - break; - case SETTING_PW_TYPE_SIM_LOCK_ON: - setting_password_sim_draw_2line_entry(ad, NULL); - break; - case SETTING_PW_TYPE_PIN2_BLOCKED: - setting_password_sim_draw_3line_entry(ad, NULL); - break; - default: - SETTING_TRACE_DEBUG("%s*** Unknown Password Type. ***%s", - SETTING_FONT_BGREEN, SETTING_FONT_BLACK); - break; - } - - /** @todo this function always return 0, not verifying the function flow with the value */ - return 0; -} - -static void -setting_password_sim_entry_changed_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "[Setting > Password] Data parameter is NULL"); - retm_if(obj == NULL, "[Setting > Password] Data parameter is NULL"); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) data; - SettingPasswordUG *ad = (SettingPasswordUG *) list_item->userdata; - const char *entry_str = elm_entry_entry_get(obj); - list_item->sub_desc = (char *)g_strdup(entry_str); - bool isFoundEmptyEntry = FALSE; - - elm_object_part_text_set(obj, "elm.guide", ""); - - do { - if (ad->ed_pw1) { - entry_str = ad->ed_pw1->sub_desc; - if (NULL == entry_str || '\0' == entry_str[0]) { - isFoundEmptyEntry = TRUE; - elm_object_part_text_set(obj, "elm.guide", _("IDS_ST_HEADER_ENTER_PIN_ABB3")); - elm_object_item_signal_emit(ad->ed_pw1->item, "elm,state,eraser,hide", ""); - break; - } else if (ad->ed_pw1->isFocusFlag) { - elm_object_item_signal_emit(ad->ed_pw1->item, "elm,state,eraser,show", ""); - break; - } - } - if (ad->ed_pw2) { - entry_str = ad->ed_pw2->sub_desc; - if (NULL == entry_str || '\0' == entry_str[0]) { - isFoundEmptyEntry = TRUE; - elm_object_part_text_set(obj, "elm.guide", _("IDS_ST_HEADER_ENTER_PIN_ABB3")); - elm_object_item_signal_emit(ad->ed_pw2->item, "elm,state,eraser,hide", ""); - break; - } else if (ad->ed_pw2->isFocusFlag) { - elm_object_item_signal_emit(ad->ed_pw2->item, "elm,state,eraser,show", ""); - break; - } - } - if (ad->ed_pw3) { - entry_str = ad->ed_pw3->sub_desc; - if (NULL == entry_str || '\0' == entry_str[0]) { - isFoundEmptyEntry = TRUE; - elm_object_part_text_set(obj, "elm.guide", _("IDS_ST_HEADER_ENTER_PIN_ABB3")); - elm_object_item_signal_emit(ad->ed_pw3->item, "elm,state,eraser,hide", ""); - break; - } else if (ad->ed_pw3->isFocusFlag) { - elm_object_item_signal_emit(ad->ed_pw3->item, "elm,state,eraser,show", ""); - break; - } - } - - } while (0); - - Eina_Bool item_disabled = elm_object_item_disabled_get(list_item->item); - if (item_disabled) - return; - - /* For disable toolbar (done) item */ - bool disableFlag = isFoundEmptyEntry; - if (ad->view_type == SETTING_PW_TYPE_PIN_BLOCKED - || ad->view_type == SETTING_PW_TYPE_PIN2_BLOCKED) { - if (ad->ed_pw1) { - if (!ad->cur_pwd && ad->ed_pw1->eo_check && (safeStrLen(elm_entry_entry_get(ad->ed_pw1->eo_check)) < 8)) { - SETTING_TRACE_DEBUG("disable flag becomes TRUE"); - disableFlag = TRUE; - } - } - } else { - if (ad->ed_pw1 && ad->ed_pw1->eo_check && (safeStrLen(elm_entry_entry_get(ad->ed_pw1->eo_check)) < 4)) - disableFlag = TRUE; - if (ad->ed_pw2 && ad->ed_pw2->eo_check && (safeStrLen(elm_entry_entry_get(ad->ed_pw2->eo_check)) < 4)) - disableFlag = TRUE; - if (ad->ed_pw3 && ad->ed_pw3->eo_check && (safeStrLen(elm_entry_entry_get(ad->ed_pw3->eo_check)) < 4)) - disableFlag = TRUE; - } - - if (disableFlag) { - elm_object_disabled_set(ad->bottom_btn, EINA_TRUE); - } else { - elm_object_disabled_set(ad->bottom_btn, EINA_FALSE); - if (ad->err_desc && ad->err_desc->item) { - elm_object_item_del(ad->err_desc->item); - ad->err_desc = NULL; - } - } -} - -#if 0 -static void __reached_max_pwlength_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - retm_if(!elm_object_focus_get(obj), "Entry is not focused");/*notify only when entry is being focused on. */ - - int err = 0; - - /*Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data; */ - /*SettingPasswordUG *ad = (SettingPasswordUG *) list_item->userdata; */ - - int haptic_return = 0; - haptic_device_h haptic_handle; - haptic_return = haptic_open(HAPTIC_DEVICE_0, &haptic_handle); - SETTING_TRACE("haptic_handle : %d", haptic_handle); - if (haptic_return < 0) { - SETTING_TRACE_DEBUG("%s*** [ERR] Failed haptic_open ***%s", - SETTING_FONT_RED, SETTING_FONT_BLACK); - } - - err = haptic_vibrate_file_with_detail(haptic_handle, "/usr/share/feedback/haptic/touch/touch.ivt", 1, HAPTIC_FEEDBACK_AUTO, HAPTIC_PRIORITY_MIN, NULL); - - if (err < 0) - SETTING_TRACE("Failed to play haptic"); - - haptic_close(haptic_handle); -} -#endif - -static void __entry_activated_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data; - SettingPasswordUG *ad = (SettingPasswordUG *) list_item->userdata; - - if (elm_object_disabled_get(ad->bottom_btn) == EINA_FALSE) { - elm_object_focus_set(obj, EINA_FALSE); - /* call done cb. */ - setting_password_sim_done(ad); - } - - if (obj == ad->ed_pw1->eo_check) { - if (ad->view_type == SETTING_PW_TYPE_PIN_BLOCKED - || ad->view_type == SETTING_PW_TYPE_PIN2_BLOCKED) { - /* PUK should be 8 chars always */ - if (safeStrLen(elm_entry_entry_get(ad->ed_pw1->eo_check)) < SETTING_PW_UG_PUK_MAX_LENGTH) { - SETTING_TRACE_DEBUG("do not move focus to next entry."); - ad->ed_pw1->isFocusFlag = TRUE; - elm_object_focus_set(ad->ed_pw1->eo_check, EINA_TRUE); - return; - } - } - if (ad->ed_pw2 && ad->ed_pw2->eo_check) { - elm_object_focus_set(ad->ed_pw2->eo_check, EINA_TRUE); - ad->ed_pw2->isFocusFlag = TRUE; - } - } else if (obj == ad->ed_pw2->eo_check) { - if (ad->ed_pw3 && ad->ed_pw3->eo_check) { - elm_object_focus_set(ad->ed_pw3->eo_check, EINA_TRUE); - ad->ed_pw3->isFocusFlag = TRUE; - } - } -} - -static void __entry_focused_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data; - SettingPasswordUG *ad = (SettingPasswordUG *)list_item->userdata; - - if (!elm_entry_is_empty(obj)) { - elm_object_item_signal_emit(list_item->item, "elm,state,eraser,show", ""); - } - elm_object_item_signal_emit(list_item->item, "elm,state,rename,hide", ""); - - if (ad == NULL) - return; - - if (ad->ed_pw1 && obj == ad->ed_pw1->eo_check) { - ad->ed_pw1->isFocusFlag = TRUE; - if (ad->ed_pw2) - ad->ed_pw2->isFocusFlag = FALSE; - if (ad->ed_pw3) - ad->ed_pw3->isFocusFlag = FALSE; - } else if (ad->ed_pw2 && obj == ad->ed_pw2->eo_check) { - ad->ed_pw2->isFocusFlag = TRUE; - if (ad->ed_pw1) - ad->ed_pw1->isFocusFlag = FALSE; - if (ad->ed_pw3) - ad->ed_pw3->isFocusFlag = FALSE; - } else if (ad->ed_pw3 && obj == ad->ed_pw3->eo_check) { - ad->ed_pw3->isFocusFlag = TRUE; - if (ad->ed_pw1) - ad->ed_pw1->isFocusFlag = FALSE; - if (ad->ed_pw2) - ad->ed_pw2->isFocusFlag = FALSE; - } -} - -static void __entry_unfocused_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - retm_if(data == NULL, "Data parameter is NULL"); - retm_if(obj == NULL, "Data parameter is NULL"); - - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data; - - list_item->isFocusFlag = FALSE; - - if (list_item->item) { - elm_object_item_signal_emit(list_item->item, "elm,state,eraser,hide", ""); - elm_object_item_signal_emit(list_item->item, "elm,state,rename,show", ""); - } -} - -int setting_password_sim_draw_1line_entry(void *data, void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER, - "[Setting > Password] Data parameter is NULL"); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - switch (ad->view_type) { - case SETTING_PW_TYPE_SIM_LOCK_OFF: - ad->ed_pw1 = - setting_create_Gendial_field_editfield(ad->scroller, - &(itc_editfield), - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - "IDS_ST_BODY_SIM_PASSWORD", - NULL, - setting_password_sim_entry_changed_cb, - __entry_focused_cb, - __entry_unfocused_cb, - NULL, - NULL, - ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, - TRUE, TRUE, - SETTING_PW_UG_SIM_MAX_LENGTH, - 0, "0123456789", NULL); - break; - - case SETTING_PW_TYPE_PIN_LOCK_ON: - case SETTING_PW_TYPE_PIN_LOCK_OFF: - ad->ed_pw1 = - setting_create_Gendial_field_editfield(ad->scroller, - &(itc_editfield), - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - "IDS_ST_BODY_PIN", NULL, - setting_password_sim_entry_changed_cb, - __entry_focused_cb, - __entry_unfocused_cb, - __entry_activated_cb, - NULL, - ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, - TRUE, TRUE, - SETTING_PW_UG_PIN_MAX_LENGTH, - 0, "0123456789", NULL); - if (ad->ed_pw1) - ad->ed_pw1->guide_text = (char *)g_strdup(_("IDS_ST_HEADER_ENTER_PIN_ABB3")); - break; - case SETTING_PW_TYPE_PIN_BLOCKED: - ad->ed_pw1 = - setting_create_Gendial_field_editfield(ad->scroller, - &(itc_editfield), - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - "IDS_ST_BODY_PUK1_CODE", - NULL, - setting_password_sim_entry_changed_cb, - __entry_focused_cb, - __entry_unfocused_cb, - __entry_activated_cb, - NULL, - ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, - TRUE, TRUE, - SETTING_PW_UG_PUK_MAX_LENGTH, - 0, "0123456789", NULL); - break; - case SETTING_PW_TYPE_CHANGE_PIN: - case SETTING_PW_TYPE_CHANGE_PIN2: - ad->ed_pw1 = - setting_create_Gendial_field_editfield(ad->scroller, - &(itc_editfield), - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - PW_SHORT_GUIDE_CURRENT, - NULL, - setting_password_sim_entry_changed_cb, - __entry_focused_cb, - __entry_unfocused_cb, - __entry_activated_cb, - NULL, - ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, - TRUE, TRUE, - SETTING_PW_UG_PIN_MAX_LENGTH, - 0, "0123456789", NULL); - if (ad->ed_pw1) - ad->ed_pw1->guide_text = (char *)g_strdup(_("IDS_ST_HEADER_ENTER_PIN_ABB3")); - break; - default: - break; - } - - ad->ed_pw2 = NULL; - ad->ed_pw3 = NULL; - ad->cur_pwd = NULL; - - return 0; -} - -int setting_password_sim_clear_1line_entry(void *data) -{ - /* error check */ - retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER, - "[Setting > Password] Data parameter is NULL"); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - retv_if(NULL == ad->ed_pw1, -1); - - ad->ed_pw1->sub_desc = NULL; - ad->ed_pw1->isFocusFlag = FALSE; - - elm_entry_entry_set(ad->ed_pw1->eo_check, ""); - elm_object_part_text_set(ad->ed_pw1->eo_check, "elm.guide", _("Enter PIN")); - - return 0; -} - -int setting_password_sim_draw_2line_entry(void *data, void *cb) -{ - /* error check */ - retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - switch (ad->view_type) { - case SETTING_PW_TYPE_SIM_LOCK_ON: - ad->ed_pw1 = - setting_create_Gendial_field_editfield(ad->scroller, - &(itc_editfield), - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - PW_SHORT_GUIDE_NEW, - NULL, - setting_password_sim_entry_changed_cb, - __entry_focused_cb, - __entry_unfocused_cb, - __entry_activated_cb, - NULL, - ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, - TRUE, TRUE, - SETTING_PW_UG_SIM_MAX_LENGTH, - 0, "0123456789", NULL); - - ad->ed_pw2 = - setting_create_Gendial_field_editfield(ad->scroller, - &(itc_editfield), - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - PW_SHORT_GUIDE_CONFIRM, - NULL, - setting_password_sim_entry_changed_cb, - __entry_focused_cb, - __entry_unfocused_cb, - NULL, - NULL, - ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, - TRUE, FALSE, - SETTING_PW_UG_SIM_MAX_LENGTH, - 0, "0123456789", NULL); - break; - case SETTING_PW_TYPE_PIN_BLOCKED: - case SETTING_PW_TYPE_CHANGE_PIN: - case SETTING_PW_TYPE_CHANGE_PIN2: - ad->ed_pw1 = - setting_create_Gendial_field_editfield(ad->scroller, - &(itc_editfield), - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - PW_SHORT_GUIDE_NEW, - NULL, - setting_password_sim_entry_changed_cb, - __entry_focused_cb, - __entry_unfocused_cb, - __entry_activated_cb, - NULL, - ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, - TRUE, TRUE, - SETTING_PW_UG_PIN_MAX_LENGTH, - 0, "0123456789", NULL); - if (ad->ed_pw1) - ad->ed_pw1->guide_text = (char *)g_strdup(_("IDS_ST_HEADER_ENTER_PIN_ABB3")); - - ad->ed_pw2 = - setting_create_Gendial_field_editfield(ad->scroller, - &(itc_editfield), - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - PW_SHORT_GUIDE_CONFIRM, - NULL, - setting_password_sim_entry_changed_cb, - __entry_focused_cb, - __entry_unfocused_cb, - __entry_activated_cb, - NULL, - ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, - TRUE, FALSE, - SETTING_PW_UG_PIN_MAX_LENGTH, - 0, "0123456789", NULL); - if (ad->ed_pw2) - ad->ed_pw2->guide_text = (char *)g_strdup(_("IDS_ST_HEADER_ENTER_PIN_ABB3")); - break; - default: - break; - } - - ad->ed_pw3 = NULL; - return 0; -} - -int setting_password_sim_clear_2line_entry(void *data) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER, - "[Setting > Password] Data parameter is NULL"); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - retv_if(NULL == ad->ed_pw1, -1); - ad->ed_pw1->sub_desc = NULL; - ad->ed_pw1->isFocusFlag = FALSE; - elm_entry_entry_set(ad->ed_pw1->eo_check, ""); - elm_object_part_text_set(ad->ed_pw1->eo_check, "elm.guide", _("Enter PIN")); - - retv_if(NULL == ad->ed_pw2, -1); - ad->ed_pw2->sub_desc = NULL; - ad->ed_pw2->isFocusFlag = FALSE; - elm_entry_entry_set(ad->ed_pw2->eo_check, ""); - elm_object_part_text_set(ad->ed_pw1->eo_check, "elm.guide", _("Enter PIN")); - return 0; -} - -int setting_password_sim_draw_3line_entry(void *data, void *cb) -{ - /* error check */ - retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER, - "[Setting > Password] Data parameter is NULL"); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - switch (ad->view_type) { - case SETTING_PW_TYPE_PIN_BLOCKED: - ad->ed_pw1 = - setting_create_Gendial_field_editfield(ad->scroller, - &(itc_editfield), - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - "IDS_ST_BODY_PUK1_CODE", - NULL, - setting_password_sim_entry_changed_cb, - __entry_focused_cb, - __entry_unfocused_cb, - __entry_activated_cb, - NULL, - ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, - TRUE, TRUE, - SETTING_PW_UG_PUK_MAX_LENGTH, - 0, "0123456789", NULL); - - ad->ed_pw2 = - setting_create_Gendial_field_editfield(ad->scroller, - &(itc_editfield), - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - "IDS_ST_BODY_NEW_PIN1", - NULL, - setting_password_sim_entry_changed_cb, - __entry_focused_cb, - __entry_unfocused_cb, - __entry_activated_cb, - NULL, - ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, - TRUE, FALSE, - SETTING_PW_UG_PIN_MAX_LENGTH, - 0, "0123456789", NULL); - - ad->ed_pw3 = - setting_create_Gendial_field_editfield(ad->scroller, - &(itc_editfield), - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - "IDS_ST_BODY_CONFIRM_NEW_PIN1", - NULL, - setting_password_sim_entry_changed_cb, - __entry_focused_cb, - __entry_unfocused_cb, - NULL, - NULL, - ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, - TRUE, FALSE, - SETTING_PW_UG_PIN_MAX_LENGTH, - 0, "0123456789", NULL); - break; - case SETTING_PW_TYPE_PIN2_BLOCKED: - ad->ed_pw1 = - setting_create_Gendial_field_editfield(ad->scroller, - &(itc_editfield), - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - "IDS_ST_BODY_PUK2", NULL, - setting_password_sim_entry_changed_cb, - __entry_focused_cb, - __entry_unfocused_cb, - __entry_activated_cb, - NULL, - ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, - TRUE, TRUE, - SETTING_PW_UG_PIN_MAX_LENGTH, - 0, "0123456789", NULL); - - ad->ed_pw2 = - setting_create_Gendial_field_editfield(ad->scroller, - &(itc_editfield), - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - "IDS_ST_BODY_NEW_PIN2", - NULL, - setting_password_sim_entry_changed_cb, - __entry_focused_cb, - __entry_unfocused_cb, - __entry_activated_cb, - NULL, - ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, - TRUE, FALSE, - SETTING_PW_UG_PIN_MAX_LENGTH, - 0, "0123456789", NULL); - - ad->ed_pw3 = - setting_create_Gendial_field_editfield(ad->scroller, - &(itc_editfield), - NULL, ad, - SWALLOW_Type_LAYOUT_EDITFIELD, - "IDS_ST_BODY_CONFIRM_NEW_PIN2", - NULL, - setting_password_sim_entry_changed_cb, - __entry_focused_cb, - __entry_unfocused_cb, - NULL, - NULL, - ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, - TRUE, FALSE, - SETTING_PW_UG_PIN_MAX_LENGTH, - 0, "0123456789", NULL); - break; - - default: - break; - } - return 0; -} - -int setting_password_sim_clear_3line_entry(void *data) -{ - /* error check */ - retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER, - "[Setting > Password] Data parameter is NULL"); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - /*Evas_Object *layout = NULL; */ - - retv_if(NULL == ad->ed_pw1, -1); - ad->ed_pw1->sub_desc = NULL; - ad->ed_pw1->isFocusFlag = FALSE; - elm_entry_entry_set(ad->ed_pw1->eo_check, ""); - elm_object_part_text_set(ad->ed_pw1->eo_check, "elm.guide", _("Enter PUK")); - - retv_if(NULL == ad->ed_pw2, -1); - ad->ed_pw2->sub_desc = NULL; - ad->ed_pw2->isFocusFlag = FALSE; - elm_entry_entry_set(ad->ed_pw2->eo_check, ""); - elm_object_part_text_set(ad->ed_pw2->eo_check, "elm.guide", _("Enter PIN")); - - retv_if(NULL == ad->ed_pw3, -1); - ad->ed_pw3->sub_desc = NULL; - ad->ed_pw3->isFocusFlag = FALSE; - elm_entry_entry_set(ad->ed_pw3->eo_check, ""); - elm_object_part_text_set(ad->ed_pw3->eo_check, "elm.guide", _("Enter PIN")); - - return 0; -} - -int setting_password_sim_check_1line_entry(void *data) -{ - /* error check */ - retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - const char *entry_str = ad->ed_pw1->sub_desc; - ad->focus_data = ad->ed_pw1; - - /* Length Check */ - int entry_str_len = safeStrLen(entry_str); - switch (ad->view_type) { - case SETTING_PW_TYPE_PIN_LOCK_ON: - case SETTING_PW_TYPE_PIN_LOCK_OFF: - case SETTING_PW_TYPE_CHANGE_PIN: - case SETTING_PW_TYPE_CHANGE_PIN2: { - if (entry_str_len < SETTING_PW_UG_PIN_MIN_LENGTH - || entry_str_len > SETTING_PW_UG_PIN_MAX_LENGTH) { - setting_password_sim_warning_entry_added_byte_popup - (ad, SETTING_PW_UG_PIN_MIN_LENGTH, SETTING_PW_UG_PIN_MAX_LENGTH); - return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW; - } - } - break; - case SETTING_PW_TYPE_SIM_LOCK_OFF: { - if (entry_str_len < SETTING_PW_UG_SIM_MIN_LENGTH - || entry_str_len > SETTING_PW_UG_SIM_MAX_LENGTH) { - setting_password_sim_warning_entry_added_byte_popup - (ad, SETTING_PW_UG_SIM_MIN_LENGTH, SETTING_PW_UG_SIM_MAX_LENGTH); - return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW; - } - } - default: - break; - } - return SETTING_RETURN_SUCCESS; -} - -int setting_password_sim_check_2line_entry(void *data) -{ - /* error check */ - retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - if (ad->ed_pw1 == NULL || ad->ed_pw2 == NULL) - return SETTING_GENERAL_ERR_NULL_DATA_PARAMETER; - - const char *entry_str1 = ad->ed_pw1->sub_desc; - const char *entry_str2 = ad->ed_pw2->sub_desc; - ad->focus_data = ad->ed_pw1; - - /* Match Check */ - if (0 != safeStrCmp(entry_str1, entry_str2)) { - setting_password_sim_clear_2line_entry(ad); - if (ad->view_type == SETTING_PW_TYPE_PIN_BLOCKED - || ad->view_type == SETTING_PW_TYPE_CHANGE_PIN - || ad->view_type == SETTING_PW_TYPE_PIN2_BLOCKED) { - setting_password_ug_display_desc(ad, _("IDS_IDLE_BODY_NEW_PIN_AND_CONFIRM_PIN_DO_NOT_MATCH"), FALSE); - } else if (ad->view_type == SETTING_PW_TYPE_CHANGE_PIN2) { - setting_password_ug_display_desc(ad, _("IDS_ST_BODY_NEW_PIN2_AND_CONFIRM_PIN2_DO_NOT_MATCH"), FALSE); - } - - return SETTING_ENTRY_NOT_MATCH_NEW_CONF_PW; - } - -#if SUPPORT_SIMLOCK - /* Length Check */ - int entry_str_len = safeStrLen(entry_str1); - if (ad->view_type == SETTING_PW_TYPE_SIM_LOCK_ON) { - if (entry_str_len < SETTING_PW_UG_SIM_MIN_LENGTH - || entry_str_len > SETTING_PW_UG_SIM_MAX_LENGTH) { - setting_password_sim_warning_entry_added_byte_popup - (ad, SETTING_PW_UG_SIM_MIN_LENGTH, SETTING_PW_UG_SIM_MAX_LENGTH); - return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW; - } - } -#endif - - return SETTING_RETURN_SUCCESS; -} - -void setting_password_sim_warning_entry_added_byte_popup(SettingPasswordUG *ad, - int min, int max) -{ - char str[MAX_SPECIALIZITION_LEN + 1] = { 0 }; - - safeCopyStr(str, _("IDS_COM_BODY_TYPE_A_PIN_THAT_IS_4_TO_8_NUMBERS"), MAX_SPECIALIZITION_LEN); - setting_password_ug_display_desc(ad, str, FALSE); -} - -int setting_password_sim_check_3line_entry(void *data) -{ - /* error check */ - retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - const char *entry_str1 = ad->ed_pw1->sub_desc; - const char *entry_str2 = ad->ed_pw2->sub_desc; - const char *entry_str3 = ad->ed_pw3->sub_desc; - ad->focus_data = ad->ed_pw1; - - /* Length Check */ - int entry_str1_len = safeStrLen(entry_str1); - int entry_str2_len = safeStrLen(entry_str2); - int entry_str3_len = safeStrLen(entry_str3); - - /* PUK code always should be 8 chars. */ - if (entry_str1_len != SETTING_PW_UG_PUK_MAX_LENGTH) { - setting_password_sim_warning_entry_added_byte_popup - (ad, SETTING_PW_UG_PUK_MAX_LENGTH, SETTING_PW_UG_PUK_MAX_LENGTH); - return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW; - } - if (entry_str2_len < SETTING_PW_UG_PIN_MIN_LENGTH - || entry_str2_len > SETTING_PW_UG_PIN_MAX_LENGTH) { - ad->focus_data = ad->ed_pw2; - setting_password_sim_warning_entry_added_byte_popup - (ad, SETTING_PW_UG_PIN_MIN_LENGTH, SETTING_PW_UG_PIN_MAX_LENGTH); - return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW; - } - if (entry_str3_len < SETTING_PW_UG_PIN_MIN_LENGTH - || entry_str3_len > SETTING_PW_UG_PIN_MAX_LENGTH) { - ad->focus_data = ad->ed_pw3; - setting_password_sim_warning_entry_added_byte_popup - (ad, SETTING_PW_UG_PIN_MIN_LENGTH, SETTING_PW_UG_PIN_MAX_LENGTH); - return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW; - } - - return SETTING_RETURN_SUCCESS; -} - -static void setting_password_sim_done(void *data) -{ - SETTING_TRACE_BEGIN; - ret_if(data == NULL); - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - app_control_h svc; - if (app_control_create(&svc)) { - SETTING_TRACE_ERROR("app_control_create() failed"); - return; - } - - SETTING_TRACE("ad->view_type:%d", ad->view_type); - int ret = 0; - - switch (ad->view_type) { - case SETTING_PW_TYPE_PIN_LOCK_ON: { - SETTING_TRACE("case SETTING_PW_TYPE_PIN_LOCK_ON"); - - ret = setting_password_sim_check_1line_entry(ad); - - if (ret == SETTING_RETURN_SUCCESS) { - TelSimFacilityPw_t sim_sec_data = { 0, }; - int tapi_ret = TAPI_API_SUCCESS; - const char *entry_str; - - entry_str = ad->ed_pw1->sub_desc; - if (isEmptyStr(entry_str)) { - ad->focus_data = ad->ed_pw1; - SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!"); - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - app_control_destroy(svc); - return; - } - - sim_sec_data.lock_type = TAPI_SIM_LOCK_SC;/*TAPI_SIM_PTYPE_PIN1 */ - sim_sec_data.pw = (unsigned char *)entry_str; - sim_sec_data.pw_len = safeStrLen(entry_str); - - tapi_ret = tel_enable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_enable_cb, ad); - setting_password_sim_clear_1line_entry(ad); - - if (TAPI_API_SUCCESS != tapi_ret) { - ad->focus_data = ad->ed_pw1; - SETTING_TRACE_DEBUG("%s*** [ERR] tel_disable_sim_facility err=%d ***%s", - SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK); - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - } else { - /* Success. Send Message to Caller for Modify Pin Lock slider status */ - } - } else { - setting_password_sim_clear_1line_entry(ad); - } - } - app_control_destroy(svc); - return; - case SETTING_PW_TYPE_PIN_LOCK_OFF: { - SETTING_TRACE("case SETTING_PW_TYPE_PIN_LOCK_OFF"); - - ret = setting_password_sim_check_1line_entry(ad); - - if (ret == SETTING_RETURN_SUCCESS) { - TelSimFacilityPw_t sim_sec_data = { 0, }; - int tapi_ret = TAPI_API_SUCCESS; - const char *entry_str; - - entry_str = ad->ed_pw1->sub_desc; - if (isEmptyStr(entry_str)) { - ad->focus_data = ad->ed_pw1; - SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!"); - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - app_control_destroy(svc); - return; - } - - sim_sec_data.lock_type = TAPI_SIM_LOCK_SC;/*TAPI_SIM_PTYPE_PIN1 */ - sim_sec_data.pw = (unsigned char *)entry_str; - sim_sec_data.pw_len = safeStrLen(entry_str); - - tapi_ret = tel_disable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_disable_cb, ad); - setting_password_sim_clear_1line_entry(ad); - - if (TAPI_API_SUCCESS != tapi_ret) { - ad->focus_data = ad->ed_pw1; - SETTING_TRACE_DEBUG("%s*** [ERR] tel_disable_sim_facility err=%d ***%s", - SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK); - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - } else { - /* Success. Send Message to Caller for Modify Pin Lock slider status */ - } - } else { - setting_password_sim_clear_1line_entry(ad); - } - } - app_control_destroy(svc); - return; - case SETTING_PW_TYPE_PIN_BLOCKED: { - /* PIN1 Status is "Blocked": User should input puk code and new pin1 code. */ - /* If puk code is correct and success to modify pin1 code, display pin1 code change popup */ - /* But, if this menu is "Pin Lock", pinlock status will not be changed. */ - SETTING_TRACE("case SETTING_PW_TYPE_PIN_BLOCKED"); - if (ad->cur_pwd == NULL) { - ret = setting_password_sim_check_1line_entry(ad); - if (ret == SETTING_RETURN_SUCCESS) { - ad->cur_pwd = (char *)strdup(ad->ed_pw1->sub_desc); - elm_genlist_clear(ad->scroller); - setting_password_sim_draw_2line_entry(ad, NULL); - } else { - setting_password_sim_clear_1line_entry(ad); - } - } else { - ret = setting_password_sim_check_2line_entry(ad); - - if (ret == SETTING_RETURN_SUCCESS) { - TelSimSecPw_t puk1_data = { 0, }; - TelSimSecPw_t pin1_data = { 0, }; - int tapi_ret = TAPI_API_SUCCESS; - const char *puk; - const char *new_pin1; - - puk = ad->cur_pwd; - new_pin1 = ad->ed_pw1->sub_desc; - - puk1_data.type = TAPI_SIM_PTYPE_PUK1; - puk1_data.pw = (unsigned char *)puk; - puk1_data.pw_len = safeStrLen(puk); - - pin1_data.type = TAPI_SIM_PTYPE_PIN1; - pin1_data.pw = (unsigned char *)new_pin1; - pin1_data.pw_len = safeStrLen(new_pin1); - - tapi_ret = tel_verify_sim_puks(ad->handle, &puk1_data, &pin1_data, setting_sim_verify_puks_cb, ad); - FREE(ad->cur_pwd); - ad->cur_pwd = NULL; - - setting_password_sim_clear_2line_entry(ad); - - if (TAPI_API_SUCCESS != tapi_ret) { - ad->focus_data = ad->ed_pw1; - SETTING_TRACE_DEBUG("%s*** [ERR] tel_verify_sim_puks err=%d ***%s", - SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK); - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - } else { - /* Success. Send Message to Caller for Modify Pin Lock slider status */ - - } - } else { - setting_password_sim_clear_2line_entry(ad); - } - } - } - app_control_destroy(svc); - return; - case SETTING_PW_TYPE_PIN2_BLOCKED: { - SETTING_TRACE("case SETTING_PW_TYPE_PIN2_BLOCKED"); - ret = setting_password_sim_check_3line_entry(ad); - - if (ret == SETTING_RETURN_SUCCESS) { - TelSimSecPw_t puk2_data = { 0, }; - TelSimSecPw_t pin2_data = { 0, }; - int tapi_ret = TAPI_API_SUCCESS; - const char *puk; - const char *new_pin2; - - puk = ad->ed_pw1->sub_desc; - new_pin2 = ad->ed_pw2->sub_desc; - if (isEmptyStr(puk)) { - ad->focus_data = ad->ed_pw1; - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - app_control_destroy(svc); - return; - } - - if (isEmptyStr(new_pin2)) { - ad->focus_data = ad->ed_pw2; - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - app_control_destroy(svc); - return; - } - - puk2_data.type = TAPI_SIM_PTYPE_PUK2; - puk2_data.pw = (unsigned char *)puk; - puk2_data.pw_len = safeStrLen(puk); - - pin2_data.type = TAPI_SIM_PTYPE_PIN2; - pin2_data.pw = (unsigned char *)new_pin2; - pin2_data.pw_len = safeStrLen(new_pin2); - - tapi_ret = tel_verify_sim_puks(ad->handle, &puk2_data, &pin2_data, setting_sim_verify_puks_cb, ad); - setting_password_sim_clear_3line_entry(ad); - - if (TAPI_API_SUCCESS != tapi_ret) { - ad->focus_data = ad->ed_pw1; - SETTING_TRACE_DEBUG("%s*** [ERR] tel_verify_sim_puks err=%d ***%s", - SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK); - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - } else { - /* Success. Send Message to Caller for Modify Pin Lock slider status */ - - } - } else { - setting_password_sim_clear_3line_entry(ad); - } - } - app_control_destroy(svc); - return; - case SETTING_PW_TYPE_CHANGE_PIN: { - SETTING_TRACE("case SETTING_PW_TYPE_CHANGE_PIN"); - if (ad->cur_pwd) { - SETTING_TRACE("step #2. new pins"); - ret = setting_password_sim_check_2line_entry(ad); - if (ret == SETTING_RETURN_SUCCESS) { - const char *old_pw; - const char *new_pw; - TelSimSecPw_t sim_old_sec_data = { 0, }; - TelSimSecPw_t sim_new_sec_data = { 0, }; - int tapi_ret = TAPI_API_SUCCESS; - - old_pw = ad->cur_pwd; - new_pw = ad->ed_pw1->sub_desc; - sim_old_sec_data.type = TAPI_SIM_PTYPE_PIN1; - sim_new_sec_data.type = TAPI_SIM_PTYPE_PIN1; - sim_old_sec_data.pw = (unsigned char *)old_pw; - sim_old_sec_data.pw_len = safeStrLen(old_pw); - sim_new_sec_data.pw = (unsigned char *)new_pw; - sim_new_sec_data.pw_len = safeStrLen(new_pw); - - tapi_ret = tel_change_sim_pins(ad->handle, &sim_old_sec_data, &sim_new_sec_data, setting_sim_change_pins_cb, ad); - setting_password_sim_clear_2line_entry(ad); - - if (TAPI_API_SUCCESS != tapi_ret) { - ad->focus_data = ad->ed_pw1; - SETTING_TRACE_DEBUG("%s*** [ERR] TelTapiSimChangePIN err=%d ***%s", - SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK); - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - } - } else { - setting_password_sim_clear_2line_entry(ad); - } - } else { - SETTING_TRACE("step #1. current pin"); - /* keep cur_pwd */ - ret = setting_password_sim_check_1line_entry(ad); - if (ret == SETTING_RETURN_SUCCESS) { - ad->cur_pwd = (char *)strdup(ad->ed_pw1->sub_desc); - /*ad->update_change_pin1_flag = TRUE; */ - /*setting_view_update(&setting_view_password_main, ad); */ - - Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(ad->ed_pw1->eo_check); - if (imf_context) { - SETTING_TRACE_DEBUG("imf_context (0x%.8x) : clear event callbacks", imf_context); - ecore_imf_context_input_panel_event_callback_clear(imf_context); - } - - elm_genlist_clear(ad->scroller); - setting_password_sim_draw_2line_entry(ad, NULL); - ad->focus_timer = ecore_timer_add(0.5, __setting_password_sim_rotate_cb, ad); - } else { - setting_password_sim_clear_1line_entry(ad); - } - } - } - app_control_destroy(svc); - return; - case SETTING_PW_TYPE_CHANGE_PIN2: { - SETTING_TRACE("case SETTING_PW_TYPE_CHANGE_PIN2"); - if (ad->cur_pwd) { - SETTING_TRACE("step #2. new pin2s"); - ret = setting_password_sim_check_2line_entry(ad); - if (ret == SETTING_RETURN_SUCCESS) { - const char *old_pw; - const char *new_pw; - TelSimSecPw_t sim_old_sec_data = { 0, }; - TelSimSecPw_t sim_new_sec_data = { 0, }; - int tapi_ret = TAPI_API_SUCCESS; - - old_pw = ad->cur_pwd; - new_pw = ad->ed_pw1->sub_desc; - - sim_old_sec_data.type = TAPI_SIM_PTYPE_PIN2; - sim_new_sec_data.type = TAPI_SIM_PTYPE_PIN2; - sim_old_sec_data.pw = (unsigned char *)old_pw; - sim_old_sec_data.pw_len = safeStrLen(old_pw); - sim_new_sec_data.pw = (unsigned char *)new_pw; - sim_new_sec_data.pw_len = safeStrLen(new_pw); - - tapi_ret = tel_change_sim_pins(ad->handle, &sim_old_sec_data, &sim_new_sec_data, setting_sim_change_pins_cb, ad); - setting_password_sim_clear_2line_entry(ad); - - if (TAPI_API_SUCCESS != tapi_ret) { - ad->focus_data = ad->ed_pw1; - SETTING_TRACE_DEBUG("%s*** [ERR] TelTapiSimChangePIN err=%d ***%s", - SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK); - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - } - } else { - setting_password_sim_clear_2line_entry(ad); - } - } else { - SETTING_TRACE("step #1. current pin2"); - /* keep cur_pwd */ - ret = setting_password_sim_check_1line_entry(ad); - if (ret == SETTING_RETURN_SUCCESS) { - ad->cur_pwd = (char *)strdup(ad->ed_pw1->sub_desc); - - Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(ad->ed_pw1->eo_check); - if (imf_context) { - SETTING_TRACE_DEBUG("imf_context (0x%.8x) : clear event callbacks", imf_context); - ecore_imf_context_input_panel_event_callback_clear(imf_context); - } - - elm_genlist_clear(ad->scroller); - setting_password_sim_draw_2line_entry(ad, NULL); - ad->focus_timer = ecore_timer_add(0.5, __setting_password_sim_rotate_cb, ad); - } else { - setting_password_sim_clear_1line_entry(ad); - } - } - } - app_control_destroy(svc); - return; -#if SUPPORT_SIMLOCK - case SETTING_PW_TYPE_SIM_LOCK_ON: { - SETTING_TRACE("case SETTING_PW_TYPE_SIM_LOCK_ON"); - - ret = setting_password_sim_check_2line_entry(ad); - - if (ret == SETTING_RETURN_SUCCESS) { - TelSimFacilityPw_t sim_sec_data = { 0, }; - int tapi_ret = TAPI_API_SUCCESS; - const char *entry_str; - entry_str = ad->ed_pw1->sub_desc; - if (isEmptyStr(entry_str)) { - ad->focus_data = ad->ed_pw1; - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - app_control_destroy(svc); - return; - } - - sim_sec_data.lock_type = TAPI_SIM_LOCK_PS;/*TAPI_SIM_PTYPE_SIM */ - sim_sec_data.pw = (unsigned char *)entry_str; - sim_sec_data.pw_len = safeStrLen(entry_str); - - tapi_ret = tel_enable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_enable_cb, ad); - setting_password_sim_clear_2line_entry(ad); - - SETTING_TRACE_SECURE_DEBUG("SIM Lock password : %s\n", (char *)(sim_sec_data.pw)); - if (TAPI_API_SUCCESS != tapi_ret) { - ad->focus_data = ad->ed_pw1; - SETTING_TRACE_DEBUG("%s*** [ERR] tel_enable_sim_facility err=%d ***%s", - SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK); - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - } else { - /* Success. Send Message to Caller for Modify Pin Lock slider status */ - - } - } else { - setting_password_sim_clear_2line_entry(ad); - } - } - app_control_destroy(svc); - return; - case SETTING_PW_TYPE_SIM_LOCK_OFF: { - SETTING_TRACE("case SETTING_PW_TYPE_SIM_LOCK_OFF"); - - ret = setting_password_sim_check_1line_entry(ad); - if (ret == SETTING_RETURN_SUCCESS) { - TelSimFacilityPw_t sim_sec_data = { 0, }; - int tapi_ret = TAPI_API_SUCCESS; - const char *entry_str; - - entry_str = ad->ed_pw1->sub_desc; - if (isEmptyStr(entry_str)) { - ad->focus_data = ad->ed_pw1; - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - app_control_destroy(svc); - return; - } - - sim_sec_data.lock_type = TAPI_SIM_LOCK_PS;/*TAPI_SIM_PTYPE_SIM */ - sim_sec_data.pw = (unsigned char *)entry_str; - sim_sec_data.pw_len = safeStrLen(entry_str); - - tapi_ret = tel_disable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_disable_cb, ad); - setting_password_sim_clear_1line_entry(ad); - - if (TAPI_API_SUCCESS != tapi_ret) { - ad->focus_data = ad->ed_pw1; - SETTING_TRACE_DEBUG("%s*** [ERR] tel_disable_sim_facility err=%d ***%s", - SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK); - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - } else { - /* Success. Send Message to Caller for Modify Pin Lock slider status */ - - } - } else { - setting_password_sim_clear_1line_entry(ad); - } - } - app_control_destroy(svc); - return; -#endif -#if SUPPORT_FDN - case SETTING_PW_TYPE_FDN_MODE_ON: { - SETTING_TRACE("case SETTING_PW_TYPE_FDN_MODE_ON"); - ret = setting_password_sim_check_1line_entry(ad); - - if (ret == SETTING_RETURN_SUCCESS) { - const char *entry_str; - int tapi_ret = TAPI_API_INVALID_INPUT; - - TelSimFacilityPw_t sim_sec_data = {0,}; - int ReqId; - - entry_str = ad->ed_pw1->sub_desc; - if (isEmptyStr(entry_str)) { - ad->focus_data = ad->ed_pw1; - SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!"); - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - app_control_destroy(svc); - return; - } - sim_sec_data.lock_type = TAPI_SIM_LOCK_FD;/*TAPI_SIM_PTYPE_PIN2; */ - sim_sec_data.pw_len = safeStrLen(entry_str); - sim_sec_data.pw = (unsigned char *)entry_str; - - tapi_ret = tel_enable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_enable_cb, ad); - setting_password_sim_clear_1line_entry(ad); - - if (tapi_ret != TAPI_API_SUCCESS) { - ad->focus_data = ad->ed_pw1; - SETTING_TRACE_ERROR("[ERR] Failed to enable FDN. Tapi return %d", tapi_ret); - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - app_control_destroy(svc); - return; - } - - app_control_add_extra_data(svc, "result", ad->view_type_string); - ug_send_result(ad->ug, svc); - SETTING_TRACE("Send Result : %s\n", ad->view_type_string); - app_control_destroy(svc); - /*ug_destroy_me(ad->ug); */ - } else { - /* check failed */ - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), TRUE); - } - } - break; - case SETTING_PW_TYPE_FDN_MODE_OFF: { - SETTING_TRACE("case SETTING_PW_TYPE_FDN_MODE_OFF"); - ret = setting_password_sim_check_1line_entry(ad); - - if (ret == SETTING_RETURN_SUCCESS) { - const char *entry_str; - int tapi_ret = TAPI_API_INVALID_INPUT; - - TelSimFacilityPw_t sim_sec_data = {0,}; - - entry_str = ad->ed_pw1->sub_desc; - if (isEmptyStr(entry_str)) { - ad->focus_data = ad->ed_pw1; - SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!"); - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - app_control_destroy(svc); - return; - } - sim_sec_data.lock_type = TAPI_SIM_LOCK_FD;/*TAPI_SIM_PTYPE_PIN2 */ - sim_sec_data.pw_len = safeStrLen(entry_str); - sim_sec_data.pw = (unsigned char *)entry_str; - - tapi_ret = tel_disable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_disable_cb, ad); - setting_password_sim_clear_1line_entry(ad); - - if (tapi_ret != TAPI_API_SUCCESS) { - ad->focus_data = ad->ed_pw1; - SETTING_TRACE_ERROR("[ERR] Failed to disable FDN. Tapi return %d", tapi_ret); - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), FALSE); - app_control_destroy(svc); - return; - } - - app_control_add_extra_data(svc, "result", ad->view_type_string); - ug_send_result(ad->ug, svc); - SETTING_TRACE("Send Result : %s\n", ad->view_type_string); - - app_control_destroy(svc); - /*ug_destroy_me(ad->ug); */ - } else { - /* check failed */ - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_ERROR"), TRUE); - } - } - break; -#endif - default: - app_control_destroy(svc); - return; - } - -#if SUPPORT_FDN - app_control_add_extra_data(svc, "result", ad->view_type_string); - ug_send_result(ad->ug, svc); - SETTING_TRACE("Send Result : %s\n", ad->view_type_string); - - app_control_destroy(svc); - /* Send destroy request */ - ug_destroy_me(ad->ug); -#endif -} - -void setting_password_sim_click_softkey_done_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(data == NULL, "[Setting > Password] Data parameter is NULL"); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - if (ad->ed_pw1 && ad->ed_pw1->eo_check) { - elm_object_focus_set(ad->ed_pw1->eo_check, EINA_FALSE); - } - if (ad->ed_pw2 && ad->ed_pw2->eo_check) { - elm_object_focus_set(ad->ed_pw2->eo_check, EINA_FALSE); - } - if (ad->ed_pw3 && ad->ed_pw3->eo_check) { - elm_object_focus_set(ad->ed_pw3->eo_check, EINA_FALSE); - } - - if (ad->err_desc && ad->err_desc->item) { - elm_object_item_del(ad->err_desc->item); - ad->err_desc = NULL; - } - - setting_password_sim_done(ad); -} - -void setting_get_sim_lock_info_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - ret_if(data == NULL || user_data == NULL); - - TelSimPinOperationResult_t sec_rt = result; - TelSimLockInfo_t *lock = data; - - SettingPasswordUG *ad = (SettingPasswordUG *)user_data; - - SETTING_TRACE_SECURE_DEBUG("sec_ret[%d], lock_type[%d], lock_status[%d], retry_count[%d]", sec_rt, lock->lock_type, lock->lock_status, lock->retry_count); - - char temp[256] = {0,}; - if (lock->retry_count > 1) - snprintf(temp, 256, _(ATTEMPTS_DESC), lock->retry_count); - else if (lock->retry_count > 0) - snprintf(temp, 256, _(ATTEMPT_DESC), lock->retry_count); - - if (ad->err_desc && ad->err_desc->item) { - elm_object_item_del(ad->err_desc->item); - ad->err_desc = NULL; - } - ad->err_desc = setting_create_Gendial_field_helpitem_without_bottom_separator( - ad->scroller, - &(itc_multiline_text), - SWALLOW_Type_LAYOUT_SPECIALIZTION_X, - temp); -} - -void setting_get_pin_lock_info_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - - TelSimPinOperationResult_t sec_rt = result; - TelSimLockInfo_t *lock = data; - - - SettingPasswordUG *ad = (SettingPasswordUG *)user_data; - - SETTING_TRACE_SECURE_DEBUG("sec_ret[%d], lock_type[%d], lock_status[%d], retry_count[%d]", sec_rt, lock->lock_type, lock->lock_status, lock->retry_count); - - char temp[256] = {0,}; - if (ad->view_type == SETTING_PW_TYPE_CHANGE_PIN) { - char rtemp[SETTING_STR_SLP_LEN] = {0,}; - if (ad->incorrect_pin1_flag) { - if (lock->retry_count > 1) { - snprintf(rtemp, SETTING_STR_SLP_LEN, "%s. %s.", _("IDS_ST_BODY_INCORRECT_PIN_E"), _(ATTEMPTS_DESC)); - snprintf(temp, SETTING_STR_SLP_LEN, rtemp, lock->retry_count); - } else { - snprintf(rtemp, SETTING_STR_SLP_LEN, "%s. %s.", _("IDS_ST_BODY_INCORRECT_PIN_E"), _(ATTEMPT_DESC)); - snprintf(temp, SETTING_STR_SLP_LEN, rtemp, lock->retry_count); - } - } else { - if (lock->retry_count > 1) - snprintf(temp, 256, _(ATTEMPTS_DESC), lock->retry_count); - else if (lock->retry_count > 0) - snprintf(temp, 256, _(ATTEMPT_DESC), lock->retry_count); - } - } else if (ad->view_type == SETTING_PW_TYPE_CHANGE_PIN2) { - char rtemp[SETTING_STR_SLP_LEN] = {0,}; - if (ad->incorrect_pin2_flag) { - if (lock->retry_count > 1) { - snprintf(rtemp, SETTING_STR_SLP_LEN, "%s. %s.", _("IDS_ST_POP_INCORRECT_PIN2"), _(ATTEMPTS_DESC)); - snprintf(temp, SETTING_STR_SLP_LEN, rtemp, lock->retry_count); - } else { - snprintf(rtemp, SETTING_STR_SLP_LEN, "%s. %s.", _("IDS_ST_POP_INCORRECT_PIN2"), _(ATTEMPT_DESC)); - snprintf(temp, SETTING_STR_SLP_LEN, rtemp, lock->retry_count); - } - } else { - if (lock->retry_count > 1) - snprintf(temp, 256, _(ATTEMPTS_DESC), lock->retry_count); - else if (lock->retry_count > 0) - snprintf(temp, 256, _(ATTEMPT_DESC), lock->retry_count); - } - } else { - if (lock->retry_count > 1) - snprintf(temp, 256, _(ATTEMPTS_DESC), lock->retry_count); - else if (lock->retry_count > 0) - snprintf(temp, 256, _(ATTEMPT_DESC), lock->retry_count); - } - - if (ad->err_desc && ad->err_desc->item) { - elm_object_item_del(ad->err_desc->item); - ad->err_desc = NULL; - } - ad->err_desc = setting_create_Gendial_field_helpitem_without_bottom_separator( - ad->scroller, - &(itc_multiline_text), - SWALLOW_Type_LAYOUT_SPECIALIZTION_X, - temp); -} - -void setting_sim_change_pins_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - ret_if(!user_data || !data); - TelSimPinOperationResult_t sec_rt = result; - tapi_receive_info result_info = { 0, }; - TelSimSecResult_t *sim_event_data = (TelSimSecResult_t *) data; - SETTING_TRACE_SECURE_DEBUG("sec_rt[%d]", sec_rt); - SETTING_TRACE_SECURE_DEBUG("sim_event_data->type:%d", sim_event_data->type); - SETTING_TRACE_SECURE_DEBUG("sim_event_data->retry_count[%d]", sim_event_data->retry_count); - - if (TAPI_SIM_PIN_OPERATION_SUCCESS == sec_rt) { - if (TAPI_SIM_PTYPE_PIN1 == sim_event_data->type) - result_info.stat = SIM_PIN1_CHANGE_SUCCESS; - else if (TAPI_SIM_PTYPE_PIN2 == sim_event_data->type) - result_info.stat = SIM_PIN2_CHANGE_SUCCESS; - } else if (TAPI_SIM_PIN_INCORRECT_PASSWORD == sec_rt) { - if (TAPI_SIM_PTYPE_PIN1 == sim_event_data->type) { - result_info.stat = SIM_INCORRECT_PIN1_CODE; - result_info.retry_cnt = sim_event_data->retry_count; - } else if (TAPI_SIM_PTYPE_PIN2 == sim_event_data->type) { - result_info.stat = SIM_INCORRECT_PIN2_CODE; - result_info.retry_cnt = sim_event_data->retry_count; - } - } else if (TAPI_SIM_PUK_REQUIRED == sec_rt) { - if (TAPI_SIM_PTYPE_PIN1 == sim_event_data->type) - result_info.stat = SIM_PIN1_BLOCKED; - else if (TAPI_SIM_PTYPE_PIN2 == sim_event_data->type) - result_info.stat = SIM_PIN2_BLOCKED; - } else { - SETTING_TRACE_DEBUG - ("%s*** [ERR] INCORRECTED ***%s", - SETTING_FONT_RED, SETTING_FONT_BLACK); - return; - } - setting_password_ug_display_result_popup(&result_info, user_data); -} - -void setting_sim_verify_puks_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - - ret_if(!user_data || !data); - SettingPasswordUG *ad = user_data; - TelSimPinOperationResult_t sec_rt = result; - tapi_receive_info result_info = { 0, }; - TelSimSecResult_t *sim_event_data = (TelSimSecResult_t *) data; - ad->verify_puks_result = sim_event_data; - SETTING_TRACE_SECURE_DEBUG("sec_rt[%d]", sec_rt); - SETTING_TRACE_SECURE_DEBUG("sim_event_data->type:%d", sim_event_data->type); - SETTING_TRACE_SECURE_DEBUG("sim_event_data->retry_count[%d]", sim_event_data->retry_count); - - if (TAPI_SIM_PTYPE_PUK1 == sim_event_data->type) { - /*if (TAPI_SIM_PIN_REQUIRED == sec_rt){ */ - if (TAPI_SIM_PIN_OPERATION_SUCCESS == sec_rt) { - SETTING_TRACE_DEBUG("SIM_PIN1_UNBLOCKED"); - safeCopyStr(ad->view_type_string, "SETTING_PW_TYPE_PIN1_UNBLOCKED", sizeof("SETTING_PW_TYPE_PIN1_UNBLOCKED") + 1); - - char tmp_str[SETTING_STR_SLP_LEN] = {0,}; - snprintf(tmp_str, SETTING_STR_SLP_LEN, "%s. %s.", _("IDS_ST_POP_PUK1_VERIFIED"), _("IDS_ST_POP_PIN_UNBLOCKED")); - setting_password_ug_create_popup_notitle_nobtn(ad, tmp_str, TRUE); - return; - } else if (TAPI_SIM_PIN_INCORRECT_PASSWORD == sec_rt) { - result_info.stat = SIM_INCORRECT_PUK1_CODE; - result_info.retry_cnt = sim_event_data->retry_count; - ad->puk_verified_flag = TRUE; - setting_view_update(&setting_view_password_main, ad); - } else if (TAPI_SIM_PUK_INCORRECT_PASSWORD == sec_rt) { - if (sim_event_data->retry_count <= 0) { - result_info.stat = SIM_PUK1_BLOCKED; - result_info.retry_cnt = 0; - } else { - result_info.stat = SIM_INCORRECT_PUK1_CODE; - result_info.retry_cnt = sim_event_data->retry_count; - ad->puk_verified_flag = TRUE; - setting_view_update(&setting_view_password_main, ad); - } - } else if (TAPI_SIM_PERM_BLOCKED == sec_rt) { - result_info.stat = SIM_PUK1_BLOCKED; - result_info.retry_cnt = 0; - } else { - result_info.stat = SIM_UNKNOWN_ERROR; - } - } - - else if (TAPI_SIM_PTYPE_PUK2 == sim_event_data->type) { - SETTING_TRACE_DEBUG("sec_rt : %d", sec_rt); - /*if (TAPI_SIM_PUK_REQUIRED == sec_rt) */ - if (TAPI_SIM_PIN_OPERATION_SUCCESS == sec_rt) { - SETTING_TRACE_DEBUG("SIM_PIN2_UNBLOCKED"); - safeCopyStr(ad->view_type_string, "SETTING_PW_TYPE_PIN2_UNBLOCKED", sizeof("SETTING_PW_TYPE_PIN2_UNBLOCKED") + 1); - /*char tmp_str[SETTING_STR_SLP_LEN] = {0,}; */ - /*snprintf(tmp_str, SETTING_STR_SLP_LEN, "%s. %s.", _("IDS_ST_POP_PUK2_VERIFIED"), _("IDS_ST_POP_PIN2_UNBLOCKED")); */ - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_PIN2_UNBLOCKED"), TRUE); - return; - } else if (TAPI_SIM_PIN_INCORRECT_PASSWORD == sec_rt) { - SETTING_TRACE_DEBUG("stat : SIM_INCORRECT_PUK2_CODE"); - result_info.stat = SIM_INCORRECT_PUK2_CODE; - result_info.retry_cnt = sim_event_data->retry_count; - } else if (TAPI_SIM_PUK_INCORRECT_PASSWORD == sec_rt) { - SETTING_TRACE_DEBUG("stat : SIM_INCORRECT_PUK2_CODE"); - if (sim_event_data->retry_count <= 0) { - result_info.stat = SIM_PUK2_BLOCKED; - result_info.retry_cnt = 0; - } else { - result_info.stat = SIM_INCORRECT_PUK2_CODE; - result_info.retry_cnt = sim_event_data->retry_count; - } - } else if (TAPI_SIM_PERM_BLOCKED == sec_rt) { - result_info.stat = SIM_PUK2_BLOCKED; - result_info.retry_cnt = 0; - } else { - result_info.stat = SIM_UNKNOWN_ERROR; - } - } else { - result_info.stat = SIM_UNKNOWN_ERROR; - } - setting_password_ug_display_result_popup(&result_info, user_data); -} - -void setting_sim_facility_enable_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - ret_if(!user_data); - - SETTING_TRACE_SECURE_DEBUG("result[%d]", result); - if (result == TAPI_API_SIM_LOCKED) { /* -503 error */ - setting_password_ug_create_popup_notitle_nobtn(user_data, _("IDS_ST_HEADER_UNAVAILABLE"), TRUE); - return; - } - ret_if(!data); - tapi_receive_info result_info = { 0, }; - TelSimFacilityResult_t *sim_event_data = (TelSimFacilityResult_t *) data; - - SETTING_TRACE_SECURE_DEBUG("sim_event_data->type:%d", sim_event_data->type); - SETTING_TRACE_SECURE_DEBUG("sim_event_data->retry_count[%d]", sim_event_data->retry_count); - - /* Sim Lock */ - if (TAPI_SIM_LOCK_PS == sim_event_data->type) { - SETTING_TRACE("CASE TAPI_SIM_PTYPE_SIM == sim_event_data->type"); - if (TAPI_SIM_PIN_OPERATION_SUCCESS == result) - result_info.stat = SIM_LOCK_ON_SUCCESS; - else if (TAPI_SIM_PIN_INCORRECT_PASSWORD == result) - result_info.stat = SIM_LOCK_INCORRECT_PASSWORD; - else { - SETTING_TRACE_DEBUG("%s*** [ERR] INCORRECTED ***%s", - SETTING_FONT_RED, - SETTING_FONT_BLACK); - return; - } - } - /* Pin Lock */ - else if (TAPI_SIM_LOCK_SC == sim_event_data->type) { - SETTING_TRACE("CASE TAPI_SIM_PTYPE_PIN1 == sim_event_data->type"); - if (TAPI_SIM_PIN_OPERATION_SUCCESS == result) - result_info.stat = SIM_PIN_LOCK_ON_SUCCESS; - else if (TAPI_SIM_PIN_INCORRECT_PASSWORD == result) { - result_info.stat = SIM_INCORRECT_PIN1_CODE; - result_info.retry_cnt = sim_event_data->retry_count; - } else if (TAPI_SIM_PUK_REQUIRED == result) - result_info.stat = SIM_PIN1_BLOCKED; - - /* Pre CCF */ - else if (TAPI_SIM_INCOMPATIBLE_PIN_OPERATION == result - || TAPI_SIM_CARD_ERROR == result) { - /* popup */ - result_info.stat = SIM_OPERATION_UNAVAILABLE; - } else { - SETTING_TRACE_DEBUG - ("%s*** [ERR] INCORRECTED ***%s", - SETTING_FONT_RED, - SETTING_FONT_BLACK); - return; - } - } - setting_password_ug_display_result_popup(&result_info, user_data); -} - -void setting_sim_facility_disable_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - ret_if(!user_data); - - SETTING_TRACE_SECURE_DEBUG("result[%d]", result); - if (result == TAPI_API_SIM_LOCKED) { /* -503 error */ - setting_password_ug_create_popup_notitle_nobtn(user_data, _("IDS_ST_HEADER_UNAVAILABLE"), TRUE); - return; - } - ret_if(!data); - tapi_receive_info result_info = { 0, }; - TelSimFacilityResult_t *sim_event_data = (TelSimFacilityResult_t *) data; - - SETTING_TRACE_SECURE_DEBUG("sim_event_data->type:%d", sim_event_data->type); - SETTING_TRACE_SECURE_DEBUG("sim_event_data->retry_count[%d]", sim_event_data->retry_count); - - /* Sim Lock */ - if (TAPI_SIM_LOCK_PS == sim_event_data->type) { - SETTING_TRACE_DEBUG("SIM lOCK"); - if (TAPI_SIM_PIN_OPERATION_SUCCESS == result) - result_info.stat = SIM_LOCK_OFF_SUCCESS; - else if (TAPI_SIM_PIN_INCORRECT_PASSWORD == result) - result_info.stat = SIM_LOCK_INCORRECT_PASSWORD; - else { - SETTING_TRACE_DEBUG - ("%s*** [ERR] INCORRECTED ***%s", - SETTING_FONT_RED, - SETTING_FONT_BLACK); - return; - } - } - /* Pin Lock */ - else if (TAPI_SIM_LOCK_SC == sim_event_data->type) { - SETTING_TRACE_DEBUG("PIN LOCK"); - if (TAPI_SIM_PIN_OPERATION_SUCCESS == result) - result_info.stat = SIM_PIN_LOCK_OFF_SUCCESS; - else if (TAPI_SIM_PIN_INCORRECT_PASSWORD == result) { - result_info.stat = SIM_INCORRECT_PIN1_CODE; - result_info.retry_cnt = sim_event_data->retry_count; - } else if (TAPI_SIM_PUK_REQUIRED == result) - result_info.stat = SIM_PIN1_BLOCKED; - - /* Pre CCF */ - else if (TAPI_SIM_INCOMPATIBLE_PIN_OPERATION == result - || TAPI_SIM_CARD_ERROR == result) { - /* popup */ - result_info.stat = SIM_OPERATION_UNAVAILABLE; - } else { - SETTING_TRACE_DEBUG - ("%s*** [ERR] INCORRECTED ***%s", - SETTING_FONT_RED, - SETTING_FONT_BLACK); - return; - } - } - setting_password_ug_display_result_popup(&result_info, user_data); -} - -static void setting_password_ug_display_result_popup(tapi_receive_info *result, - SettingPasswordUG *ad) -{ - SETTING_TRACE_BEGIN; - switch (result->stat) { - case SIM_OPERATION_OK: - case SIM_LOCK_ON_SUCCESS: - case SIM_LOCK_OFF_SUCCESS: - case SIM_PIN_LOCK_ON_SUCCESS: - case SIM_PIN_LOCK_OFF_SUCCESS: { - if (ad->view_type == - SETTING_PW_TYPE_SIM_LOCK_OFF) { - int err = SETTING_RETURN_SUCCESS; - /* reset VCONF */ - setting_set_int_slp_key - (INT_SLP_SETTING_SIM_LOCK_ATTEMPTS_LEFT, - SIM_LOCK_ATTEMPS_MAX, &err); - setting_retm_if(err == SETTING_RETURN_FAIL, - "[Error] set value of vconf fail."); - } - /* Success to Operate */ - app_control_h svc; - if (app_control_create(&svc)) - return; - - app_control_add_extra_data(svc, "result", ad->view_type_string); - ug_send_result(ad->ug, svc); - SETTING_TRACE("Send Result : %s\n", ad->view_type_string); - - app_control_destroy(svc); - /* Send destroy request */ - ug_destroy_me(ad->ug); - } - break; - - case SIM_PIN1_BLOCKED: { - SETTING_TRACE_DEBUG("SIM_PIN1_BLOCKED"); - /*ad->view_type = SETTING_PW_TYPE_PIN_BLOCKED; */ - /* Success to Operate */ - app_control_h svc; - if (app_control_create(&svc)) - return; - - app_control_add_extra_data(svc, "result", "SETTING_PW_TYPE_PIN_BLOCKED"); - ug_send_result(ad->ug, svc); - SETTING_TRACE("Send Result : %s\n", "SETTING_PW_TYPE_PIN_BLOCKED"); - - app_control_destroy(svc); - /* Send destroy request */ - ug_destroy_me(ad->ug); - } - break; - case SIM_PIN2_BLOCKED: { - SETTING_TRACE_DEBUG("SIM_PIN2_BLOCKED"); - /*ad->view_type = SETTING_PW_TYPE_PIN2_BLOCKED; */ - app_control_h svc; - if (app_control_create(&svc)) - return; - - app_control_add_extra_data(svc, "result", "SETTING_PW_TYPE_PIN2_BLOCKED"); - ug_send_result(ad->ug, svc); - SETTING_TRACE("Send Result : %s\n", "SETTING_PW_TYPE_PIN2_BLOCKED"); - - app_control_destroy(svc); - /* Send destroy request */ - ug_destroy_me(ad->ug); - /*safeCopyStr(ad->view_type_string, "SETTING_PW_TYPE_PIN2_BLOCKED", safeStrLen("SETTING_PW_TYPE_PIN2_BLOCKED")+1); */ - /*setting_password_ug_create_popup_notitle_nobtn(ad, */ - /* _("IDS_ST_POP_PIN2_BLOCKED"), TRUE); */ - } - break; - case SIM_LOCK_INCORRECT_PASSWORD: { - SETTING_TRACE_DEBUG("SIM LOCK INCORRECT PASSWORD"); - ad->focus_data = ad->ed_pw1; - setting_password_ug_display_desc(ad, PW_ERR_DESC, FALSE); - } - break; - case SIM_INCORRECT_PIN1_CODE: { - if (ad->view_type == SETTING_PW_TYPE_CHANGE_PIN) { - ad->incorrect_pin1_flag = TRUE; - FREE(ad->cur_pwd); - elm_genlist_clear(ad->scroller); - setting_password_sim_draw_1line_entry(ad, NULL); - ad->focus_timer = ecore_timer_add(0.5, __setting_password_sim_rotate_cb, ad); - return; - } - - const char *ret_str = NULL; - char tmp_str[SETTING_STR_SLP_LEN] = {0,}; - - if (result->retry_cnt > 1) { - /* there has '%d' in 'IDS_ST_POP_INCORRECT_PIN_PD_ATTEMPTS_LEFT', must transform */ - char tmp_str2[SETTING_STR_SLP_LEN] = {0,}; - snprintf(tmp_str2, SETTING_STR_SLP_LEN, "%s. %s.", _("IDS_ST_BODY_INCORRECT_PIN_E"), _(ATTEMPTS_DESC)); - int ret = snprintf(tmp_str, SETTING_STR_SLP_LEN, tmp_str2, result->retry_cnt); - setting_retm_if(ret < 0, "snprintf fail"); - ret_str = tmp_str; - } else { - char tmp_str2[SETTING_STR_SLP_LEN] = {0,}; - snprintf(tmp_str2, SETTING_STR_SLP_LEN, "%s. %s.", _("IDS_ST_BODY_INCORRECT_PIN_E"), _(ATTEMPT_DESC)); - int ret = snprintf(tmp_str, SETTING_STR_SLP_LEN, tmp_str2, result->retry_cnt); - setting_retm_if(ret < 0, "snprintf fail"); - ret_str = tmp_str; - /*ret_str = _("IDS_ST_POP_INCORRECT_PIN1_ATTEMPT_LEFT"); */ - } - - ad->focus_data = ad->ed_pw1; -#ifdef SUPPORT_POPUP - setting_password_ug_create_popup_notitle_nobtn(ad, (char *)ret_str, FALSE); -#else - setting_password_ug_display_desc(ad, (char *)ret_str, FALSE); -#endif - } - break; - case SIM_INCORRECT_PIN2_CODE: { - if (ad->view_type == SETTING_PW_TYPE_CHANGE_PIN2) { - ad->incorrect_pin2_flag = TRUE; - FREE(ad->cur_pwd); - elm_genlist_clear(ad->scroller); - setting_password_sim_draw_1line_entry(ad, NULL); - ad->focus_timer = ecore_timer_add(0.5, __setting_password_sim_rotate_cb, ad); - return; - } - - char *ret_str = NULL; - char tmp_str[SETTING_STR_SLP_LEN] = {0,}; - - if (result->retry_cnt > 1) { - /* there has '%d' in 'IDS_ST_POP_INCORRECT_PIN_PD_ATTEMPTS_LEFT', must transform */ - char tmp_str2[SETTING_STR_SLP_LEN] = {0,}; - snprintf(tmp_str2, SETTING_STR_SLP_LEN, "%s. %s.", _("IDS_ST_POP_INCORRECT_PIN2"), _(ATTEMPTS_DESC)); - int ret = snprintf(tmp_str, SETTING_STR_SLP_LEN, tmp_str2, result->retry_cnt); - setting_retm_if(ret < 0, "snprintf fail"); - ret_str = tmp_str; - } else { - char tmp_str2[SETTING_STR_SLP_LEN] = {0,}; - snprintf(tmp_str2, SETTING_STR_SLP_LEN, "%s. %s.", _("IDS_ST_POP_INCORRECT_PIN2"), _(ATTEMPT_DESC)); - int ret = snprintf(tmp_str, SETTING_STR_SLP_LEN, tmp_str2, result->retry_cnt); - setting_retm_if(ret < 0, "snprintf fail"); - ret_str = tmp_str; - /*ret_str = _("IDS_ST_POP_INCORRECT_PIN1_ATTEMPT_LEFT"); */ - } - - ad->focus_data = ad->ed_pw1; -#ifdef SUPPORT_POPUP - setting_password_ug_create_popup_notitle_nobtn(ad, ret_str, FALSE); -#else - setting_password_ug_display_desc(ad, ret_str, FALSE); -#endif - } - break; - case SIM_INCORRECT_PUK1_CODE: { - char *ret_str = NULL; - char tmp_str[SETTING_STR_SLP_LEN] = {0,}; - - if (result->retry_cnt > 1) { - /* there has '%d' in 'IDS_ST_POP_INCORRECT_PUK1_PD_ATTEMPTS_LEFT', must transform */ - int ret = snprintf(tmp_str, SETTING_STR_SLP_LEN, PUK1_ERR_DESC, result->retry_cnt); - setting_retm_if(ret < 0, "snprintf fail"); - ret_str = tmp_str; - } else { - ret_str = _("IDS_ST_POP_INCORRECT_PUK1_CODE"); - } - - ad->focus_data = ad->ed_pw1; -#ifdef SUPPORT_POPUP - setting_password_ug_create_popup_notitle_nobtn(ad, ret_str, FALSE); -#else - setting_password_ug_display_desc(ad, ret_str, FALSE); -#endif - } - break; - case SIM_INCORRECT_PUK2_CODE: { - char *ret_str = NULL; - char tmp_str[SETTING_STR_SLP_LEN] = {0,}; - - if (result->retry_cnt > 1) { - /* there has '%d' in 'IDS_ST_POP_INCORRECT_PIN_PD_ATTEMPTS_LEFT', must transform */ - char tmp_str2[SETTING_STR_SLP_LEN] = {0,}; - snprintf(tmp_str2, SETTING_STR_SLP_LEN, "%s. %s.", _("IDS_ST_POP_INCORRECT_PUK2"), _(ATTEMPTS_DESC)); - int ret = snprintf(tmp_str, SETTING_STR_SLP_LEN, tmp_str2, result->retry_cnt); - setting_retm_if(ret < 0, "snprintf fail"); - ret_str = tmp_str; - } else { - char tmp_str2[SETTING_STR_SLP_LEN] = {0,}; - snprintf(tmp_str2, SETTING_STR_SLP_LEN, "%s. %s.", _("IDS_ST_POP_INCORRECT_PUK2"), _(ATTEMPT_DESC)); - int ret = snprintf(tmp_str, SETTING_STR_SLP_LEN, tmp_str2, result->retry_cnt); - setting_retm_if(ret < 0, "snprintf fail"); - ret_str = tmp_str; - ret_str = _("IDS_ST_POP_INCORRECT_PIN1_ATTEMPT_LEFT"); - } - ad->focus_data = ad->ed_pw1; -#ifdef SUPPORT_POPUP - setting_password_ug_create_popup_notitle_nobtn(ad, ret_str, FALSE); -#else - setting_password_ug_display_desc(ad, ret_str, FALSE); -#endif - } - break; - - case SIM_PIN1_CHANGE_SUCCESS: { - SETTING_TRACE_DEBUG("SIM_PIN1_CHANGE_SUCCESS"); - /*ad->view_type = SETTING_PW_TYPE_PIN_BLOCKED; */ - /* Success to Operate */ - app_control_h svc; - if (app_control_create(&svc)) - return; - - app_control_add_extra_data(svc, "result", ad->view_type_string); - ug_send_result(ad->ug, svc); - SETTING_TRACE("Send Result : %s\n", ad->view_type_string); - - app_control_destroy(svc); - /* Send destroy request */ - ug_destroy_me(ad->ug); - } - /*setting_password_ug_create_popup_notitle_nobtn(ad, */ - /* _("IDS_ST_POP_PIN1_CHANGED"), TRUE); */ - break; - case SIM_PIN2_CHANGE_SUCCESS: - setting_password_ug_create_popup_notitle_nobtn(ad, - _("IDS_ST_POP_PIN2_CHANGED"), TRUE); - break; - case SIM_PIN1_UNBLOCKED: - SETTING_TRACE_DEBUG("SIM_PIN1_UNBLOCKED"); - safeCopyStr(ad->view_type_string, "SETTING_PW_TYPE_PIN_LOCK_ON", safeStrLen("SETTING_PW_TYPE_PIN_LOCK_ON") + 1); - setting_password_ug_create_popup_notitle_nobtn(ad, - _("IDS_ST_POP_PIN_UNBLOCKED"), TRUE); - break; - case SIM_PIN2_UNBLOCKED: - setting_password_ug_create_popup_notitle_nobtn(ad, - _("IDS_ST_POP_PIN2_UNBLOCKED"), TRUE); - break; - case SIM_PUK1_BLOCKED: { - char *ret_str = NULL; - ret_str = PUK1_BLOCKED; - - safeCopyStr(ad->view_type_string, "SETTING_PW_TYPE_PUK1_BLOCKED", safeStrLen("SETTING_PW_TYPE_PUK1_BLOCKED") + 1); - setting_password_ug_create_popup_notitle_nobtn(ad, - ret_str, TRUE); - /* Phone blocked. Call Permernent UG */ - } - break; - case SIM_PUK2_BLOCKED: { - app_control_h svc; - if (app_control_create(&svc)) - return; - - app_control_add_extra_data(svc, "result", "SETTING_PW_TYPE_PUK2_BLOCKED"); - ug_send_result(ad->ug, svc); - SETTING_TRACE("Send Result : %s\n", "SETTING_PW_TYPE_PUK2_BLOCKED"); - - app_control_destroy(svc); - /* Send destroy request */ - ug_destroy_me(ad->ug); - } - /* Call Permernent UG */ - break; - case SIM_REQUIRED_PUK_CODE: - SETTING_TRACE_DEBUG("SIM_REQUIRED_PUK_CODE"); - safeCopyStr(ad->view_type_string, "SETTING_PW_TYPE_PIN_BLOCKED", safeStrLen("SETTING_PW_TYPE_PIN_BLOCKED") + 1); - setting_password_ug_create_popup_notitle_nobtn(ad, - _("IDS_ST_POP_PIN1_BLOCKED"), TRUE); - break; - case SIM_OPERATION_UNAVAILABLE: - setting_password_ug_create_popup_notitle_nobtn(ad, - _("IDS_ST_HEADER_UNAVAILABLE"), TRUE); - break; - case SIM_UNKNOWN_ERROR: - setting_password_ug_create_popup_notitle_nobtn(ad, - _("IDS_CST_POP_UNKNOWN_OPERATION"), FALSE); - break; - case SIM_ERROR: - case SIM_REQ_PIN: - case SIM_OPERATION_OFF: - case SIM_LOCK_ON_FAIL: - SETTING_TRACE_DEBUG("SIM_LOCK_ON_FAIL"); - { - if (result->retry_cnt > 0) { - setting_password_ug_display_desc(ad, PW_ERR_DESC, FALSE); - } else { - char tmp_str[SETTING_STR_SLP_LEN] = {0,}; - snprintf(tmp_str, SETTING_STR_SLP_LEN, PW_ERR_DELAY_DESC, PW_ERR_DELAY_TIME); - safeCopyStr(ad->view_type_string, "SETTING_PW_TYPE_SIM_LOCK_DISABLE", safeStrLen("SETTING_PW_TYPE_SIM_LOCK_DISABLE") + 1); - setting_password_ug_create_popup_notitle_nobtn(ad, tmp_str, TRUE); - } - } - break; - case SIM_PIN1_CHANGE_FAIL: - case SIM_PIN2_CHANGE_FAIL: - setting_password_ug_create_popup_notitle_nobtn(ad, - _("Change Failed"), TRUE); - break; - default: - break; - } - - SETTING_TRACE_END; -} diff --git a/setting-password/src/setting-password-simple.c b/setting-password/src/setting-password-simple.c deleted file mode 100644 index 66b0991..0000000 --- a/setting-password/src/setting-password-simple.c +++ /dev/null @@ -1,672 +0,0 @@ -/* -* setting -* -* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. -* -* Contact: MyoungJune Park -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -int setting_password_simple_check_simple_password(const char *collection); -int setting_password_simple_draw_next_simple_password(void *data, int title_index); - -static int setting_password_simple_create(void *cb); -static int setting_password_simple_destroy(void *cb); -static int setting_password_simple_update(void *cb); -static int setting_password_simple_cleanup(void *cb); - -setting_view setting_view_password_simple = { - .create = setting_password_simple_create, - .destroy = setting_password_simple_destroy, - .update = setting_password_simple_update, - .cleanup = setting_password_simple_cleanup, -}; - - -#define SETTING_SP_TITLE_INDEX_START 0 -#define SETTING_SP_TITLE_INDEX_MAX 3 -const char *sp_titles[5] = { PW_ST_ENTER_PW, - PW_ST_NEW_PW, - PW_ST_ENTER_PW_AGAIN, - PW_ST_ENTER_CUR_PW, - NULL, - }; - - -extern struct _pw_item pw_its[]; - -/* *************************************************** - * - *basic func - * - ***************************************************/ - -static Eina_Bool setting_password_simple_click_softkey_cancel_cb(void *data, Elm_Object_Item *it) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retvm_if(data == NULL, EINA_FALSE, "[Setting > Password] Data parameter is NULL"); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - if (ad->focus_timer) { - ecore_timer_del(ad->focus_timer); - ad->focus_timer = NULL; - } - - if (ad->imf_handler) { - ecore_event_handler_del(ad->imf_handler); - ad->imf_handler = NULL; - } - if (ad->imf_context) { - ecore_imf_context_del(ad->imf_context); - ad->imf_context = NULL; - } - - /* send result : Cancel */ - app_control_h svc; - if (app_control_create(&svc) == 0) { - app_control_add_extra_data(svc, "result", "Cancel"); - ug_send_result(ad->ug, svc); - SETTING_TRACE("Send Result : %s\n", "Cancel"); - - app_control_destroy(svc); - } - /* Send destroy request */ - ug_destroy_me(ad->ug); - - return EINA_TRUE; -} - -static void setting_password_simple_add_description(Evas_Object *layout, char *desc) -{ - ret_if(!layout || !desc); - elm_object_part_text_set(layout, "help.txt", _(desc)); -} - -static void _copy_chars_from_sp_entries(void *data, char *collection) -{ - ret_if(data == NULL || collection == NULL); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - if (ad->sp_entry1 == NULL || ad->sp_entry2 == NULL || - ad->sp_entry3 == NULL || ad->sp_entry4 == NULL) - return; - - strncpy(collection, ad->sp_chars, 4); - memset(ad->sp_chars, 0x00, 5); -} - -/* Verify simple password */ -static int _handle_step1(void *data, char *collection) -{ - SETTING_TRACE_BEGIN; - retv_if(data == NULL, SETTING_RETURN_FAIL); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - int ret = 0; - int err = 0; - - _copy_chars_from_sp_entries(ad, collection); - - ret = setting_password_simple_check_simple_password(collection); - SETTING_TRACE("ret:%d", ret); - if (ret < 0) { - SETTING_TRACE_ERROR("Invalid Password formatting") - setting_password_simple_draw_next_simple_password(ad, 3); - return SETTING_RETURN_FAIL; - } - - unsigned int remain_attempt; - unsigned int valid_sec; - ret = setting_password_check_password(collection, &remain_attempt, &valid_sec); - SETTING_TRACE("ret:%d", ret); - if (ret != SETTING_RETURN_SUCCESS) { - SETTING_TRACE_ERROR("Failed to invoke security_server_chk_pwd") - setting_password_simple_draw_next_simple_password(ad, 3); - ad->remain_attempt = remain_attempt; - ad->valid_sec = valid_sec; - return SETTING_PW_ERROR_DO_NOT_MATCH; - } - - int value = 0; - ecore_imf_context_input_panel_hide(ad->imf_context); - - if (0 == safeStrCmp(ad->view_type_string, "SETTING_PW_TYPE_SIMPLE_PASSWORD")) { - setting_get_bool_slp_key(BOOL_SLP_SETTING_POWER_ON_LOCK, &value, &err); - SETTING_TRACE_DEBUG("get VCONF POWER_ON_LOCK : %d", value); - - if (value == 0) - ret = setting_set_bool_slp_key(BOOL_SLP_SETTING_POWER_ON_LOCK, - SETTING_ON_OFF_BTN_ON, &err); - else - ret = setting_set_bool_slp_key(BOOL_SLP_SETTING_POWER_ON_LOCK, - SETTING_ON_OFF_BTN_OFF, &err); - - /* reset VCONF */ - setting_set_int_slp_key(INT_SLP_SETTING_PHONE_LOCK_ATTEMPTS_LEFT, - PHONE_LOCK_ATTEMPS_MAX, &err); - setting_retvm_if(err == SETTING_RETURN_FAIL, SETTING_RETURN_FAIL, "[Error] set value of vconf fail."); - - /* Correct Password. Send Bundle to caller for status change */ - } - - app_control_h svc; - if (app_control_create(&svc)) { - setting_password_simple_draw_next_simple_password(ad, 3); - return SETTING_RETURN_FAIL; - } - - app_control_add_extra_data(svc, "result", ad->view_type_string); - - if (0 == safeStrCmp(ad->view_type_string, "SETTING_PW_TYPE_ENTER_LOCK_TYPE")) - app_control_add_extra_data(svc, "current", collection); - - /* reset static variables */ - memset(collection, 0x00, SETTING_PW_UG_NORMAL_PASSWORD_MIN_LENGTH + 1); - - ug_send_result(ad->ug, svc); - SETTING_TRACE("Send Result : %s\n", ad->view_type_string); - app_control_destroy(svc); - /* Send destroy request */ - ug_destroy_me(ad->ug); - - return SETTING_RETURN_SUCCESS; -} - -/* Set new simple password */ -static int _handle_step2(void *data, int *step, char *collection1, char *collection2) -{ - SETTING_TRACE_BEGIN; - retv_if(data == NULL, SETTING_RETURN_FAIL); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - int ret = 0; - - - if (*step == 0) { /* Enter new password */ - _copy_chars_from_sp_entries(ad, collection1); - - ret = setting_password_simple_check_simple_password(collection1); - if (ret < 0) { - setting_password_simple_draw_next_simple_password(ad, 1); - return SETTING_RETURN_FAIL; - } - - (*step)++; - setting_password_simple_draw_next_simple_password(ad, 2); - } else if (*step == 1) { /* Enter password again */ - _copy_chars_from_sp_entries(ad, collection2); - - ret = setting_password_simple_check_simple_password(collection2); - if (ret < 0) { - setting_password_simple_draw_next_simple_password(ad, 2); - return SETTING_RETURN_FAIL; - } - - /* compare two input passwords : collection_step1, collection_step2 */ - if (safeStrNCmp(collection1, collection2, 4) == 0) { - ecore_imf_context_input_panel_hide(ad->imf_context); - ret = setting_password_set_password(ad->cur_pwd, collection1, ad); - - if (SETTING_RETURN_SUCCESS == ret) { - FREE(ad->step1_str); - - app_control_h svc; - if (!app_control_create(&svc)) { - app_control_add_extra_data(svc, "result", ad->view_type_string); - - /* reset static variables */ - *step = 0; - /* reset static variables */ - memset(collection1, 0x00, SETTING_PW_UG_NORMAL_PASSWORD_MIN_LENGTH + 1); - memset(collection2, 0x00, SETTING_PW_UG_NORMAL_PASSWORD_MIN_LENGTH + 1); - - ug_send_result(ad->ug, svc); - SETTING_TRACE("Send Result : %s\n", ad->view_type_string); - app_control_destroy(svc); - /* Send destroy request */ - ug_destroy_me(ad->ug); - return SETTING_RETURN_SUCCESS; - } - /* Display popup */ - setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_NEW_PASSWD_SAVED"), TRUE); - } else if (ret == SETTING_PW_ERROR_REUSED) { - setting_password_simple_draw_next_simple_password(ad, 1); - setting_password_simple_add_description(ad->simple_layout, PW_ERR_REUSED); - *step = 0; - /* reset static variables */ - memset(collection1, 0x00, SETTING_PW_UG_NORMAL_PASSWORD_MIN_LENGTH + 1); - memset(collection2, 0x00, SETTING_PW_UG_NORMAL_PASSWORD_MIN_LENGTH + 1); - return SETTING_PW_ERROR_REUSED; - } else { - setting_password_simple_draw_next_simple_password(ad, 1); - char temp[256] = {0,}; - snprintf(temp, 256, "Unable to save password (%d)", ret); - setting_password_ug_create_popup_notitle_nobtn(ad, temp, FALSE); - - *step = 0; - /* reset static variables */ - memset(collection1, 0x00, SETTING_PW_UG_NORMAL_PASSWORD_MIN_LENGTH + 1); - memset(collection2, 0x00, SETTING_PW_UG_NORMAL_PASSWORD_MIN_LENGTH + 1); - return SETTING_PW_ERROR_UNKNOWN; - } - } else { - setting_password_simple_draw_next_simple_password(ad, 2); - return SETTING_ENTRY_NOT_MATCH_NEW_CONF_PW; - } - } - return SETTING_RETURN_SUCCESS; -} - -static int setting_password_simple_done_simple_password(void *data, int on_locking) -{ - SETTING_TRACE_BEGIN; - retv_if(data == NULL, SETTING_RETURN_FAIL); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - static int step = 0; - - static char collection_step1[SETTING_PW_UG_NORMAL_PASSWORD_MIN_LENGTH + 1] = {0,}; - static char collection_step2[SETTING_PW_UG_NORMAL_PASSWORD_MIN_LENGTH + 1] = {0,}; - - switch (ad->view_type) { - case SETTING_PW_TYPE_SIMPLE_PASSWORD: { - SETTING_TRACE_DEBUG("case SIMPLE_PASSWORD"); - return _handle_step1(ad, collection_step1); - } - case SETTING_PW_TYPE_SET_SIMPLE_PASSWORD: { - SETTING_TRACE_DEBUG("case SET_SIMPLE_PASSWORD"); - return _handle_step2(ad, &step, collection_step1, collection_step2); - } - - default: - break; - } - return SETTING_RETURN_SUCCESS; -} - -static Eina_Bool setting_password_simple_check_4entries(void *data) -{ - SETTING_TRACE_BEGIN; - retv_if(data == NULL, EINA_FALSE); - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - int ret = 0; - - ret = setting_password_simple_done_simple_password(ad, TRUE); - - memset(ad->sp_chars, 0x00, 5); - - if (ret == SETTING_RETURN_FAIL) { - setting_password_simple_add_description(ad->simple_layout, PW_ST_INCORRECT_PW_TRY_AGAIN); - } else if (ret == SETTING_PW_ERROR_DO_NOT_MATCH) { - if (0 == safeStrCmp(ad->view_type_string, "SETTING_PW_TYPE_ENTER_LOCK_TYPE")) { - - setting_password_simple_add_description(ad->simple_layout, PW_ERR_DESC); - return EINA_FALSE; - } - /** @todo setting_password_ug_check_attemps_left */ - setting_int_slp_list item_attempts_left; - setting_str_slp_list item_lock_timestamp; - int attemps_left_max = 5; - item_attempts_left = INT_SLP_SETTING_PHONE_LOCK_ATTEMPTS_LEFT; - item_lock_timestamp = STR_SLP_SETTING_PHONE_LOCK_TIMESTAMP; - attemps_left_max = PHONE_LOCK_ATTEMPS_MAX; - - int value = -1; - int err = SETTING_RETURN_SUCCESS; - setting_get_int_slp_key(item_attempts_left, &value, &err); - retvm_if(err == SETTING_RETURN_FAIL, EINA_FALSE, "[Error] get value of vconf fail."); - value--; - if (value > 0 && value <= attemps_left_max) { - setting_set_int_slp_key(item_attempts_left, value, &err); - setting_retvm_if(err == SETTING_RETURN_FAIL, EINA_FALSE, "[Error] set value of vconf fail."); - char speciliztion[MAX_SPECIALIZITION_LEN] = { 0, }; - char temp[MAX_SPECIALIZITION_LEN] = {0,}; - if (value > 1) - snprintf(temp, sizeof(temp), "%s. %s.", PW_ERR_DESC, ATTEMPTS_DESC); - else - snprintf(temp, sizeof(temp), "%s. %s.", PW_ERR_DESC, ATTEMPT_DESC); - snprintf(speciliztion, sizeof(speciliztion), temp, value); - setting_password_simple_add_description(ad->simple_layout, speciliztion); - } else if (value == 0) { - /* store the lock timestamp */ - elm_object_focus_set(ad->sp_entry1, EINA_FALSE); - time_t cur_time = time(NULL); - char cur_timestamp[LOCK_TIMESTAMP_LEN] = { 0, }; - int ret = snprintf(cur_timestamp, sizeof(cur_timestamp), "%ld", cur_time); - retv_if(ret < 0, EINA_FALSE); - setting_set_string_slp_key(item_lock_timestamp, cur_timestamp, &err); - setting_retvm_if(err == SETTING_RETURN_FAIL, EINA_FALSE, - "[Error] set value of vconf fail."); - - setting_set_int_slp_key(item_attempts_left, value, &err); - setting_retvm_if(err == SETTING_RETURN_FAIL, EINA_FALSE, - "[Error] set value of vconf fail."); - - ad->disable_item_type = ad->view_type; - - char temp[MAX_SPECIALIZITION_LEN] = {0,}; - snprintf(temp, sizeof(temp), PW_ERR_DELAY_DESC, PW_ERR_DELAY_TIME); - setting_password_ug_create_popup_notitle_nobtn(ad, temp, TRUE); - } - } else if (ret == SETTING_ENTRY_NOT_MATCH_NEW_CONF_PW) { - setting_password_simple_add_description(ad->simple_layout, PW_ST_PW_DO_NOT_MATCH); - } else { - /* if you have more cases, modify here. */ - } - - ad->simple_done_timer = NULL; - return EINA_FALSE; -} - -Ecore_IMF_Context *__imf_context_create(void *data) -{ - SETTING_TRACE_BEGIN; - retv_if(data == NULL, NULL); - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - Ecore_IMF_Context *imf_context = NULL; - const char *ctx_id = ecore_imf_context_default_id_get(); - - if (ctx_id) { - imf_context = ecore_imf_context_add(ctx_id); - - if (ad->evas && imf_context) { - ecore_imf_context_client_window_set(imf_context, (void *)ecore_evas_window_get(ecore_evas_ecore_evas_get(ad->evas))); - ecore_imf_context_client_canvas_set(imf_context, ad->evas); - } - } - return imf_context; -} - -static Eina_Bool __imf_event_key_down_cb(void *data, int type, void *event) -{ - SETTING_TRACE_BEGIN; - SettingPasswordUG *ad = (SettingPasswordUG *)data; - Ecore_Event_Key *ev = event; - - char *commit_str = (char *)ev->key; - char *digit = (char *)ev->string; - SETTING_TRACE_DEBUG("ev->keyname is %s\n", commit_str); /*here you get the Input String from ISE */ - - if (!safeStrCmp(commit_str, "Return")) - return EINA_TRUE; - else if (!safeStrCmp(commit_str, "XF86Back")) - return EINA_TRUE; - - if (!safeStrCmp(commit_str, "BackSpace")) { - if (ad->sp_focused_num > 0) - elm_entry_entry_set(ad->sp_entry[--ad->sp_focused_num], ""); - if (ad->sp_focused_num < 0) - ad->sp_focused_num = 0; - } else { - if (!digit) - return EINA_TRUE; - - if (ad->sp_focused_num >= 4) { - SETTING_TRACE_DEBUG("all entries are filled."); - return EINA_TRUE; - } else if (ad->sp_focused_num < 0) { - ad->sp_focused_num = 0; - } - char key = digit[0]; - SETTING_TRACE_DEBUG("digit is %c", key); - if (key >= '0' && key <= '9') { - ad->sp_chars[ad->sp_focused_num] = key; - elm_entry_entry_set(ad->sp_entry[ad->sp_focused_num], "•"); - ad->sp_focused_num++; - if (ad->sp_focused_num == 4) - /*call done cb */ - ad->simple_done_timer = ecore_timer_add(0.2, setting_password_simple_check_4entries, ad); - } - } - - return EINA_TRUE; -}; - -void __imf_show_for_simple_password(void *data) -{ - SETTING_TRACE_BEGIN; - ret_if(data == NULL); - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - if (ad->imf_context) { - ecore_imf_context_input_panel_show(ad->imf_context); - } else { - Ecore_IMF_Context *imf_context = NULL; - imf_context = __imf_context_create(ad); - - ad->imf_context = imf_context; - - ecore_imf_context_reset(imf_context); - ecore_imf_context_input_panel_imdata_set(imf_context, (void *)"type=password", 13); /* for password read out with TTS */ - ecore_imf_context_input_panel_layout_set(imf_context, ECORE_IMF_INPUT_PANEL_LAYOUT_DATETIME); - ecore_imf_context_input_panel_return_key_disabled_set(imf_context, EINA_TRUE); - ecore_imf_context_focus_in(imf_context); - ad->imf_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, __imf_event_key_down_cb, ad); - if (!ad->imf_handler) - SETTING_TRACE_DEBUG("handler is NULL"); - } - SETTING_TRACE_END; -} - -static void __enable_imf_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - setting_retm_if(data == NULL, "Data parameter is NULL"); - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - __imf_show_for_simple_password(ad); -} - -static int setting_password_simple_create(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) cb; - - ad->sp_focused_num = 0; - - /* Create layout : layout/simple_password in setting-theme.edc */ - ad->simple_layout = elm_layout_add(ad->win_main_layout); - elm_layout_file_set(ad->simple_layout, SETTING_THEME_EDJ_NAME, "layout/simple_password"); - - ad->sp_entry1 = elm_entry_add(ad->simple_layout); - elm_object_style_set(ad->sp_entry1 , "popup"); - elm_entry_single_line_set(ad->sp_entry1 , EINA_TRUE); - elm_entry_editable_set(ad->sp_entry1 , EINA_FALSE); - ad->sp_entry[0] = ad->sp_entry1; - elm_object_part_content_set(ad->simple_layout, "entry1", ad->sp_entry1); - - ad->sp_entry2 = elm_entry_add(ad->simple_layout); - elm_object_style_set(ad->sp_entry2 , "popup"); - elm_entry_single_line_set(ad->sp_entry2 , EINA_TRUE); - elm_entry_editable_set(ad->sp_entry2 , EINA_FALSE); - ad->sp_entry[1] = ad->sp_entry2; - elm_object_part_content_set(ad->simple_layout, "entry2", ad->sp_entry2); - - ad->sp_entry3 = elm_entry_add(ad->simple_layout); - elm_object_style_set(ad->sp_entry3 , "popup"); - elm_entry_single_line_set(ad->sp_entry3 , EINA_TRUE); - elm_entry_editable_set(ad->sp_entry3 , EINA_FALSE); - ad->sp_entry[2] = ad->sp_entry3; - elm_object_part_content_set(ad->simple_layout, "entry3", ad->sp_entry3); - - ad->sp_entry4 = elm_entry_add(ad->simple_layout); - elm_object_style_set(ad->sp_entry4 , "popup"); - elm_entry_single_line_set(ad->sp_entry4 , EINA_TRUE); - elm_entry_editable_set(ad->sp_entry4 , EINA_FALSE); - ad->sp_entry[3] = ad->sp_entry4; - elm_object_part_content_set(ad->simple_layout, "entry4", ad->sp_entry4); - - if (ad->view_type == SETTING_PW_TYPE_SIMPLE_PASSWORD) - elm_object_part_text_set(ad->simple_layout, "title.txt", _(sp_titles[3])); - else - elm_object_part_text_set(ad->simple_layout, "title.txt", _(sp_titles[1])); - /* End */ - - ad->ly_main = setting_create_layout_navi_bar(ad->win_main_layout, ad->win_get, "IDS_ST_BODY_SIMPLE_PASSWORD", - _("IDS_ST_BUTTON_BACK"), - (setting_call_back_func)setting_password_simple_click_softkey_cancel_cb, - ad, - ad->simple_layout, - &(ad->navi_bar), NULL); - evas_object_event_callback_add(ad->sp_entry1, EVAS_CALLBACK_MOUSE_DOWN, __enable_imf_cb, ad); - evas_object_event_callback_add(ad->sp_entry2, EVAS_CALLBACK_MOUSE_DOWN, __enable_imf_cb, ad); - evas_object_event_callback_add(ad->sp_entry3, EVAS_CALLBACK_MOUSE_DOWN, __enable_imf_cb, ad); - evas_object_event_callback_add(ad->sp_entry4, EVAS_CALLBACK_MOUSE_DOWN, __enable_imf_cb, ad); - - evas_object_show(ad->simple_layout); - - __imf_show_for_simple_password(ad); - - setting_view_password_simple.is_create = 1; - - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -static int setting_password_simple_destroy(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) cb; - - if (ad->imf_handler) { - ecore_event_handler_del(ad->imf_handler); - ad->imf_handler = NULL; - } - if (ad->imf_context) { - ecore_imf_context_del(ad->imf_context); - ad->imf_context = NULL; - } - - if (ad->simple_done_timer) { - ecore_timer_del(ad->simple_done_timer); - ad->simple_done_timer = NULL; - } - - if (ad->notify) { - evas_object_del(ad->notify); - ad->notify = NULL; - } - - if (ad->ly_main != NULL) { - evas_object_del(ad->ly_main); - ad->ly_main = NULL; - } - - setting_view_password_simple.is_create = 0; - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -static int setting_password_simple_update(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) cb; - - if (ad->ly_main != NULL) { - evas_object_show(ad->ly_main); - } - return SETTING_RETURN_SUCCESS; -} - -static int setting_password_simple_cleanup(void *cb) -{ - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingPasswordUG *ad = (SettingPasswordUG *) cb; - - if (ad->ly_main != NULL) { - evas_object_hide(ad->ly_main); - } - - return SETTING_RETURN_SUCCESS; -} - -/* *************************************************** - * - *general func - * - ***************************************************/ - -int setting_password_simple_draw_next_simple_password(void *data, int title_index) -{ - /* error check */ - retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER, - "[Setting > Password] Data parameter is NULL"); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - elm_object_part_text_set(ad->simple_layout, "title.txt", _(sp_titles[title_index])); - elm_entry_entry_set(ad->sp_entry1, ""); - elm_entry_entry_set(ad->sp_entry2, ""); - elm_entry_entry_set(ad->sp_entry3, ""); - elm_entry_entry_set(ad->sp_entry4, ""); - - memset(ad->sp_chars, 0x00, 5); - ad->sp_focused_num = 0; - - return SETTING_RETURN_SUCCESS; -} - -int setting_password_simple_check_simple_password(const char *collection) -{ - retv_if(collection == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - int sp_len = safeStrLen(collection); - int index = 0; - char temp; - - SETTING_TRACE_SECURE_DEBUG("collection length is %d", sp_len); - - if (sp_len != 4) - return SETTING_RETURN_FAIL; - - /* check if digit. */ - for (index = 0; index < sp_len; index++) { - temp = (char)(collection[index]); - if ((temp < '0') || (temp > '9')) - return SETTING_RETURN_FAIL; - else - SETTING_TRACE_SECURE_DEBUG("temp %c", temp); - } - - return SETTING_RETURN_SUCCESS; -} diff --git a/setting-password/src/setting-password.c b/setting-password/src/setting-password.c deleted file mode 100644 index 7e63f98..0000000 --- a/setting-password/src/setting-password.c +++ /dev/null @@ -1,728 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include -#include - -extern void setting_get_pin_lock_info_cb(TapiHandle *handle, int result, void *data, void *user_data); - -#ifndef UG_MODULE_API -#define UG_MODULE_API __attribute__ ((visibility("default"))) -#endif - -struct _pw_item pw_its[] = { - { 0, NULL, 0, 0}, - { SETTING_PW_TYPE_PASSWORD, "SETTING_PW_TYPE_PASSWORD", SETTING_PW_CATEGORY_LOCK, 1 }, - { SETTING_PW_TYPE_SET_PASSWORD, "SETTING_PW_TYPE_SET_PASSWORD", SETTING_PW_CATEGORY_LOCK, 2 }, - { SETTING_PW_TYPE_SIMPLE_PASSWORD, "SETTING_PW_TYPE_SIMPLE_PASSWORD", SETTING_PW_CATEGORY_LOCK + SETTING_PW_SUB_CATEGORY_SIMPLE, 1 }, - { SETTING_PW_TYPE_SET_SIMPLE_PASSWORD, "SETTING_PW_TYPE_SET_SIMPLE_PASSWORD", SETTING_PW_CATEGORY_LOCK + SETTING_PW_SUB_CATEGORY_SIMPLE, 2 }, - { SETTING_PW_TYPE_ENTER_LOCK_TYPE, "SETTING_PW_TYPE_ENTER_LOCK_TYPE", SETTING_PW_CATEGORY_LOCK, 1 }, - { SETTING_PW_TYPE_SIM_LOCK_ON, "SETTING_PW_TYPE_SIM_LOCK_ON", SETTING_PW_CATEGORY_SIM, 2 }, - { SETTING_PW_TYPE_SIM_LOCK_OFF, "SETTING_PW_TYPE_SIM_LOCK_OFF", SETTING_PW_CATEGORY_SIM, 1 }, - { SETTING_PW_TYPE_PIN_LOCK_ON, "SETTING_PW_TYPE_PIN_LOCK_ON", SETTING_PW_CATEGORY_SIM, 1 }, - { SETTING_PW_TYPE_PIN_LOCK_OFF, "SETTING_PW_TYPE_PIN_LOCK_OFF", SETTING_PW_CATEGORY_SIM, 1 }, - { SETTING_PW_TYPE_CHANGE_PIN, "SETTING_PW_TYPE_CHANGE_PIN", SETTING_PW_CATEGORY_SIM, 3 }, - { SETTING_PW_TYPE_CHANGE_PIN2, "SETTING_PW_TYPE_CHANGE_PIN2", SETTING_PW_CATEGORY_SIM, 3 }, - { SETTING_PW_TYPE_PIN_BLOCKED, "SETTING_PW_TYPE_PIN_BLOCKED", SETTING_PW_CATEGORY_SIM, 3 }, - { SETTING_PW_TYPE_PIN2_BLOCKED, "SETTING_PW_TYPE_PIN2_BLOCKED", SETTING_PW_CATEGORY_SIM, 3 }, - { SETTING_PW_TYPE_MAX, NULL } -}; - -static void setting_password_ug_cb_resize(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - /*SettingPasswordUG *ad = (SettingPasswordUG *) data; */ - /*setting_view_update(&setting_view_password_main, ad); */ -} - -void __chk_cur_pw_status(SettingPasswordUG *ad, app_control_h service) -{ -#if SECURITY_SERVER - int ret = 0; - unsigned int attempt = 0; - unsigned int max_attempt = 0; - unsigned int expire_sec = 0; -#endif - - ad->pw_status = SETTING_PW_STATUS_DEFAULT; - -#if SECURITY_SERVER - ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec); - SETTING_TRACE_DEBUG("status of password : %d (cur attempt %d, max %d, expire %d", ret, attempt, max_attempt, expire_sec); - - if (ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD) { - SETTING_TRACE("security-server has no password!"); - ad->pw_status = SETTING_PW_STATUS_EMPTY; - } -#endif -} - -void __get_extra_data(SettingPasswordUG *ad, app_control_h service) -{ - SETTING_TRACE_BEGIN; - - //char *encryption = NULL; - - /* #1. viewtype */ - app_control_get_extra_data(service, "viewtype", &(ad->view_type_string)); - SETTING_TRACE("viewtype:%s", ad->view_type_string); - /* #2. current pw */ - app_control_get_extra_data(service, "current", &(ad->cur_pwd)); - if (ad->cur_pwd) - SETTING_TRACE_SECURE_DEBUG("Receive current : %s", ad->cur_pwd); -} - -void __get_password_view_type(SettingPasswordUG *ad, app_control_h service) -{ - SETTING_TRACE_BEGIN; - - setting_pw_type ret_pw_type = 0; - int i; - - for (i = 1; i < SETTING_PW_TYPE_MAX; i++) { - if (0 == safeStrCmp(ad->view_type_string, pw_its[i].pw_type_string)) { - SETTING_TRACE_DEBUG("%s %d", ad->view_type_string, pw_its[i].pw_type_num); - ret_pw_type = pw_its[i].pw_type_num; - break; - } - } - - if (pw_its[ret_pw_type].category == SETTING_PW_CATEGORY_SIM) { - SETTING_TRACE_DEBUG("SIM or Fingerprint do not need to check pw status. %d", pw_its[ret_pw_type].category); - ad->view_type = ret_pw_type; - return; - } - - __chk_cur_pw_status(ad, service); - - /* Some pw types should be changed, according to pw status and current lock type */ - if (ret_pw_type == SETTING_PW_TYPE_ENTER_LOCK_TYPE) { - if (ad->pw_status == SETTING_PW_STATUS_EMPTY) { - if (ad->screen_lock_type == SETTING_SCREEN_LOCK_TYPE_PASSWORD) - ret_pw_type = SETTING_PW_TYPE_SET_PASSWORD; - else if (ad->screen_lock_type == SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD) - ret_pw_type = SETTING_PW_TYPE_SET_SIMPLE_PASSWORD; - } else { - if (ad->screen_lock_type == SETTING_SCREEN_LOCK_TYPE_PASSWORD) - ret_pw_type = SETTING_PW_TYPE_PASSWORD; - else if (ad->screen_lock_type == SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD) - ret_pw_type = SETTING_PW_TYPE_SIMPLE_PASSWORD; - } - } - /* end */ - - ad->view_type = ret_pw_type; -} - -static setting_view *__initialize_view_node_table(int category) -{ - setting_view_node_table_intialize(); - - if (category == SETTING_PW_CATEGORY_SIM) { - setting_view_node_table_register(&setting_view_password_sim, NULL); - return &setting_view_password_sim; - } else if (category & SETTING_PW_SUB_CATEGORY_SIMPLE) { - setting_view_node_table_register(&setting_view_password_simple, NULL); - return &setting_view_password_simple; - } else { - setting_view_node_table_register(&setting_view_password_main, NULL); - return &setting_view_password_main; - } -} - -static void __destroy_view(SettingPasswordUG *ad) -{ - ret_if(!ad); - - if (pw_its[ad->view_type].category == SETTING_PW_CATEGORY_SIM) { - setting_view_destroy(&setting_view_password_sim, ad); - } - if (pw_its[ad->view_type].category & SETTING_PW_SUB_CATEGORY_SIMPLE) { - setting_view_destroy(&setting_view_password_simple, ad); - } else { - /* delete the allocated objects. */ - setting_view_destroy(&setting_view_password_main, ad); - } -} - -static char *__gl_err_desc_text_get(void *data, Evas_Object *obj, const char *part) -{ - SETTING_TRACE_BEGIN; - retv_if(data == NULL, NULL); - char buf[256] = {0,}; - - snprintf(buf, 256, "%s", (char *)data); - - SETTING_TRACE_DEBUG("buf is %s", buf); - - return (char *)g_strdup(buf); -} - -static void __gl_err_desc_del(void *data, Evas_Object *obj) -{ - SETTING_TRACE_BEGIN; - char *desc = data; - if (desc) { - G_FREE(desc); - SETTING_TRACE_DEBUG("free err_desc"); - } -} - -static void setting_password_rotated_cb(void *data, Evas_Object *obj, void *event) -{ - SETTING_TRACE_BEGIN; - SettingPasswordUG *ad = (SettingPasswordUG *)data; - - if (ad == NULL || ad->win_get == NULL || obj == NULL) - return; - - /*int changed_ang = 0; - changed_ang = elm_win_rotation_get(obj);*/ - - if (ad->view_type == SETTING_PW_TYPE_PIN_LOCK_OFF - || ad->view_type == SETTING_PW_TYPE_PIN_LOCK_ON - || ad->view_type == SETTING_PW_TYPE_CHANGE_PIN - || ad->view_type == SETTING_PW_TYPE_PIN_BLOCKED) { - if (ad->handle) { - if (tel_get_sim_lock_info(ad->handle, TAPI_SIM_LOCK_SC, setting_get_pin_lock_info_cb, ad) != 0) - SETTING_TRACE_DEBUG("failed to call tel_get_sim_lock_info()"); - } - } else if (ad->view_type == SETTING_PW_TYPE_CHANGE_PIN2 - || ad->view_type == SETTING_PW_TYPE_PIN2_BLOCKED) { - if (ad->handle) { - if (tel_get_sim_lock_info(ad->handle, TAPI_SIM_LOCK_FD, setting_get_pin_lock_info_cb, ad) != 0) - SETTING_TRACE_DEBUG("failed to call tel_get_sim_lock_info()"); - } - } - /* it can manage the cursor self */ - if (ad->ed_pw1 && (ad->ed_pw1->isFocusFlag == TRUE)) { - if (ad->ed_pw1->eo_check) { - SETTING_TRACE_DEBUG("set focus on first entry"); - /* no matter how many edifileds, it only need focus on 1st editfiled */ - elm_object_focus_set(ad->ed_pw1->eo_check, EINA_TRUE); - elm_entry_cursor_end_set(ad->ed_pw1->eo_check); - } - } else if (ad->ed_pw2 && (ad->ed_pw2->isFocusFlag == TRUE)) { - if (ad->ed_pw2->eo_check) { - SETTING_TRACE_DEBUG("set focus on second entry"); - /*no matter how many edifileds, it only need focus on 1st editfiled */ - elm_object_focus_set(ad->ed_pw2->eo_check, EINA_TRUE); - elm_entry_cursor_end_set(ad->ed_pw2->eo_check); - } - } else if (ad->ed_pw3 && (ad->ed_pw3->isFocusFlag == TRUE)) { - if (ad->ed_pw3->eo_check) { - SETTING_TRACE_DEBUG("set focus on third entry"); - /*no matter how many edifileds, it only need focus on 1st editfiled */ - elm_object_focus_set(ad->ed_pw3->eo_check, EINA_TRUE); - elm_entry_cursor_end_set(ad->ed_pw3->eo_check); - } - } else { - SETTING_TRACE_DEBUG("no entry to set focus"); - } -} - -static void *setting_password_ug_on_create(ui_gadget_h ug, - enum ug_mode mode, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - setting_retvm_if((!priv), NULL, "!priv"); - - SettingPasswordUG *passwordUG = (SettingPasswordUG *)priv; - passwordUG->ug = ug; - passwordUG->win_main_layout = (Evas_Object *) ug_get_parent_layout(ug); - passwordUG->win_get = (Evas_Object *) ug_get_window(); - evas_object_show(passwordUG->win_main_layout); - passwordUG->evas = evas_object_evas_get(passwordUG->win_main_layout); - - setting_retvm_if(passwordUG->win_main_layout == NULL, NULL, - "cannot get main window "); - - /* set launguage */ - /*setting_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR); */ - bindtextdomain(SETTING_PACKAGE, SETTING_LOCALEDIR); - evas_object_smart_callback_add(passwordUG->win_get, "wm,rotation,changed", setting_password_rotated_cb, passwordUG); - - setting_create_Gendial_itc(SETTING_GENLIST_GROUP_INDEX_STYLE, &(passwordUG->itc_title)); - setting_create_Gendial_itc("1icon", &(passwordUG->itc_variable_height)); - - passwordUG->itc_err_desc.item_style = "multiline_sub"; - passwordUG->itc_err_desc.func.text_get = __gl_err_desc_text_get; - passwordUG->itc_err_desc.func.content_get = NULL; - passwordUG->itc_err_desc.func.state_get = NULL; - passwordUG->itc_err_desc.func.del = __gl_err_desc_del; - - /* get screen lock type */ - vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &(passwordUG->screen_lock_type)); - SETTING_TRACE_DEBUG("screen lock type : %d", passwordUG->screen_lock_type); - - /* init */ - __get_extra_data(passwordUG, service); - __get_password_view_type(passwordUG, service); - passwordUG->step1_str = NULL; - - setting_view *main_view = __initialize_view_node_table(pw_its[passwordUG->view_type].category); - - /* creating a view. */ - setting_view_create(main_view, (void *)passwordUG); - evas_object_event_callback_add(passwordUG->win_main_layout, - EVAS_CALLBACK_RESIZE, - setting_password_ug_cb_resize, - passwordUG); - - return passwordUG->ly_main; -} - -static void setting_password_ug_on_start(ui_gadget_h ug, app_control_h service, void *priv) -{ -} - -static void setting_password_ug_on_pause(ui_gadget_h ug, app_control_h service, void *priv) -{ - SETTING_TRACE_BEGIN; - SettingPasswordUG *passwordUG = (SettingPasswordUG *)priv; - - if (pw_its[passwordUG->view_type].category & SETTING_PW_SUB_CATEGORY_SIMPLE) { - /* If pause, simple password's SIP should be focused out. - If not, Our SIP will not be shown after using Other apps with independent SIP. */ - if (passwordUG->imf_context) { - ecore_imf_context_reset(passwordUG->imf_context); - ecore_imf_context_focus_out(passwordUG->imf_context); - } - } -} - -static void setting_password_ug_on_resume(ui_gadget_h ug, app_control_h service, void *priv) -{ - SETTING_TRACE_BEGIN; - SettingPasswordUG *passwordUG = (SettingPasswordUG *)priv; - - if (pw_its[passwordUG->view_type].category & SETTING_PW_SUB_CATEGORY_SIMPLE) { - /* If resume, simple password's SIP should be focused in. - If not, Our SIP will not be shown after using Other apps with independent SIP. */ - if (passwordUG->imf_context) { - /*ecore_imf_context_input_panel_show(passwordUG->imf_context); */ - ecore_imf_context_focus_in(passwordUG->imf_context); - } - } -} - -static void setting_password_ug_on_destroy(ui_gadget_h ug, app_control_h service, void *priv) -{ - SETTING_TRACE_BEGIN; - SettingPasswordUG *passwordUG = (SettingPasswordUG *)priv; - - evas_object_event_callback_del(passwordUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_password_ug_cb_resize); /* fix flash issue for gallery */ - evas_object_smart_callback_del(passwordUG->win_get, "wm,rotation,changed", setting_password_rotated_cb); - passwordUG->ug = ug; - - if (passwordUG->view_type_string) - FREE(passwordUG->view_type_string); - - if (passwordUG->cur_pwd) - FREE(passwordUG->cur_pwd); - - if (passwordUG->t_info) { - FREE(passwordUG->t_info); - passwordUG->t_info = NULL; - } - - if (pw_its[passwordUG->view_type].category & SETTING_PW_SUB_CATEGORY_SIMPLE) { - if (passwordUG->imf_context) { - ecore_imf_context_del(passwordUG->imf_context); - passwordUG->imf_context = NULL; - } - } - - __destroy_view(passwordUG); - - if (NULL != ug_get_layout(passwordUG->ug)) { - evas_object_hide((Evas_Object *) ug_get_layout(passwordUG->ug)); - evas_object_del((Evas_Object *) ug_get_layout(passwordUG->ug)); - } - SETTING_TRACE_END; -} - -static void setting_password_ug_on_message(ui_gadget_h ug, app_control_h msg, - app_control_h service, void *priv) -{ - -} - -static void setting_password_ug_on_event(ui_gadget_h ug, - enum ug_event event, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - if (!priv) - return; - - // SettingPasswordUG *ad = (SettingPasswordUG *)priv; - /*static int old_event = -1; */ - switch (event) { - case UG_EVENT_LOW_MEMORY: - break; - case UG_EVENT_LOW_BATTERY: - break; - case UG_EVENT_LANG_CHANGE: { -#if 0 - /* update toolbar items */ - Evas_Object *toolbar = elm_object_item_part_content_get(ad->navi_it, "toolbar"); - if (toolbar != NULL) { - Elm_Object_Item *last_item = elm_toolbar_last_item_get(toolbar); - Elm_Object_Item *first_item = elm_toolbar_last_item_get(toolbar); - - if (last_item) - elm_object_item_text_set(last_item, _("IDS_SA_BUTTON_DONE_ABB")); - if (first_item && (first_item != last_item)) - elm_object_item_text_set(last_item, _("IDS_ST_BUTTON_CANCEL_ABB")); - } -#endif - } - break; - case UG_EVENT_ROTATE_PORTRAIT: - case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN: - case UG_EVENT_ROTATE_LANDSCAPE: - case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN: - break; - case UG_EVENT_REGION_CHANGE: - break; - default: - break; - } -} - -static void setting_password_ug_on_key_event(ui_gadget_h ug, - enum ug_key_event event, - app_control_h service, void *priv) -{ - if (!priv) - return; - - // SettingPasswordUG *ad = (SettingPasswordUG *)priv; - - switch (event) { - case UG_KEY_EVENT_END: - ug_destroy_me(ug); - break; - default: - break; - } -} - -UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops) -{ - SettingPasswordUG *passwordUG = calloc(1, sizeof(SettingPasswordUG)); - setting_retvm_if(!passwordUG, -1, "Create SettingPasswordUG obj failed"); - - ops->create = setting_password_ug_on_create; - ops->start = setting_password_ug_on_start; - ops->pause = setting_password_ug_on_pause; - ops->resume = setting_password_ug_on_resume; - ops->destroy = setting_password_ug_on_destroy; - ops->message = setting_password_ug_on_message; - ops->event = setting_password_ug_on_event; - ops->key_event = setting_password_ug_on_key_event; - ops->priv = passwordUG; - ops->opt = UG_OPT_INDICATOR_ENABLE; - - memset(passwordUG, 0x00, sizeof(SettingPasswordUG)); - - return 0; -} - -UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops) -{ - SETTING_TRACE_BEGIN; - struct SettingPasswordUG *passwordUG; - setting_retm_if(!ops, "ops == NULL"); - - passwordUG = ops->priv; - if (passwordUG) - FREE(passwordUG); -} - -void setting_password_ug_popup_resp_cb(void *data, Evas_Object *obj, - void *event_info) -{ - retm_if(data == NULL, "Data parameter is NULL"); - - app_control_h svc; - SettingPasswordUG *ad = (SettingPasswordUG *) data; - if (ad->destroy) { - /* Success to Operate */ - - if (app_control_create(&svc)) - return; - - app_control_add_extra_data(svc, "result", ad->view_type_string); - ug_send_result(ad->ug, svc); - SETTING_TRACE("Send Result : %s\n", ad->view_type_string); - - app_control_destroy(svc); - /* Send destroy request */ - ug_destroy_me(ad->ug); - } else { - if (ad->view_type == SETTING_PW_TYPE_PIN_BLOCKED) { - ug_destroy_me(ad->ug); - return; - } else if (ad->view_type == SETTING_PW_TYPE_PIN2_BLOCKED) { - ug_destroy_me(ad->ug); - return; - } -#if SUPPORT_SIMLOCK - char *diable_view_type = NULL; - if (ad->disable_item_type == SETTING_PW_TYPE_SIM_LOCK_OFF) { - diable_view_type = "SETTING_PW_TYPE_SIM_LOCK_DISABLE"; - } - - if (diable_view_type) { - /* Success to Operate */ - - if (app_control_create(&svc)) - return; - - app_control_add_extra_data(svc, "result", diable_view_type); - ug_send_result(ad->ug, svc); - - app_control_destroy(svc); - /* Send destroy request */ - ug_destroy_me(ad->ug); - } -#endif - if (ad->focus_data) { - ad->focus_data->isFocusFlag = TRUE; - elm_object_item_data_set(ad->focus_data->item, ad->focus_data); - elm_genlist_item_update(ad->focus_data->item); - } - } -} - -void setting_password_ug_display_desc(void *data, char *desc, int destroy) -{ - SETTING_TRACE_BEGIN; - ret_if(data == NULL || desc == NULL); - - SettingPasswordUG *ad = (SettingPasswordUG *)data; - - ad->destroy = destroy; - - if (ad->scroller == NULL) - return; - - if (ad->err_desc && ad->err_desc->item) { - elm_object_item_del(ad->err_desc->item); - ad->err_desc = NULL; - } - - ad->err_desc = setting_create_Gendial_field_helpitem_without_bottom_separator( - ad->scroller, - &(itc_multiline_text), - SWALLOW_Type_LAYOUT_SPECIALIZTION_X, - desc); - - /* if pw incorrect, show keyboard again. */ - /*if(ad->ed_pw1 && ad->ed_pw1->eo_check) */ - /*{ */ - /* elm_object_focus_set(ad->ed_pw1->eo_check, EINA_TRUE); */ - /*} */ -} - -void -setting_password_ug_create_popup_notitle_nobtn(void *data, char *str, - int destroy) -{ - /* error check */ - retm_if(data == NULL, "Data parameter is NULL"); - - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - ad->destroy = destroy; - if (ad->notify) { - evas_object_del(ad->notify); - ad->notify = NULL; - } - ad->notify = setting_create_popup(ad, ad->ly_main, NULL, str, - setting_password_ug_popup_resp_cb, - POPUP_INTERVAL, FALSE, FALSE, 0); -} - -void setting_password_ug_check_attemps_left(void *data) -{ - ret_if(!data); - SettingPasswordUG *ad = (SettingPasswordUG *) data; - - setting_int_slp_list item_attempts_left; - setting_str_slp_list item_lock_timestamp; - int attemps_left_max = 5; - - if (ad->view_type == SETTING_PW_TYPE_PASSWORD) { - item_attempts_left = INT_SLP_SETTING_PHONE_LOCK_ATTEMPTS_LEFT; - item_lock_timestamp = STR_SLP_SETTING_PHONE_LOCK_TIMESTAMP; - attemps_left_max = PHONE_LOCK_ATTEMPS_MAX; - } else if (ad->view_type == SETTING_PW_TYPE_SIM_LOCK_OFF) { - item_attempts_left = INT_SLP_SETTING_SIM_LOCK_ATTEMPTS_LEFT; - item_lock_timestamp = STR_SLP_SETTING_SIM_LOCK_TIMESTAMP; - attemps_left_max = SIM_LOCK_ATTEMPS_MAX; - } else { - return; - } - - int value = -1; - int err = SETTING_RETURN_SUCCESS; - setting_get_int_slp_key(item_attempts_left, &value, &err); - setting_retm_if(err == SETTING_RETURN_FAIL, - "[Error] get value of vconf fail."); - - value--; - - if (value > 0 && value <= attemps_left_max) { - setting_set_int_slp_key(item_attempts_left, value, &err); - setting_retm_if(err == SETTING_RETURN_FAIL, "[Error] set value of vconf fail."); - char temp_str[MAX_SPECIALIZITION_LEN] = {0,}; - char temp[MAX_SPECIALIZITION_LEN] = {0,}; - - if (value > 1) - snprintf(temp, sizeof(temp), "%s. %s.", PW_ERR_DESC, ATTEMPTS_DESC); - else - snprintf(temp, sizeof(temp), "%s. %s.", PW_ERR_DESC, ATTEMPT_DESC); - - int ret = snprintf(temp_str, MAX_SPECIALIZITION_LEN, temp, value); - - ret_if(ret < 0); - - setting_password_ug_display_desc(ad, temp_str, FALSE); - } else if (value == 0) { - /* store the lock timestamp */ - time_t cur_time = time(NULL); - char cur_timestamp[LOCK_TIMESTAMP_LEN] = { 0, }; - int ret = snprintf(cur_timestamp, sizeof(cur_timestamp), "%ld", cur_time); - ret_if(ret < 0); - - setting_set_string_slp_key(item_lock_timestamp, cur_timestamp, &err); - setting_retm_if(err == SETTING_RETURN_FAIL, - "[Error] set value of vconf fail."); - - setting_set_int_slp_key(item_attempts_left, value, &err); - setting_retm_if(err == SETTING_RETURN_FAIL, - "[Error] set value of vconf fail."); - - ad->disable_item_type = ad->view_type; - - char temp[MAX_SPECIALIZITION_LEN] = {0,}; - snprintf(temp, sizeof(temp), PW_ERR_DELAY_DESC, PW_ERR_DELAY_TIME); - - setting_password_ug_create_popup_notitle_nobtn(ad, temp, FALSE); - } else { - setting_password_ug_create_popup_notitle_nobtn(ad, - _("IDS_ST_POP_ERROR"), FALSE); - } - -} - -int setting_password_check_password(const char *challenge, unsigned int *remain_attempt, unsigned int *valid_sec) -{ - SETTING_TRACE_BEGIN; - retv_if(challenge == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - int ret = 0; -#if SECURITY_SERVER - int inner_ret = 0; - unsigned int current_attempt = 0; - unsigned int max_attempt = 0; - unsigned int valid_secs = 0; -#endif - - SETTING_TRACE_DEBUG("check pwd : %s", challenge); - -#if SECURITY_SERVER - inner_ret = security_server_chk_pwd(challenge, ¤t_attempt, &max_attempt, &valid_secs); - - SETTING_TRACE_DEBUG("chk password : %d", inner_ret); - SETTING_TRACE_SECURE_DEBUG("current_attempt : %d, max_attempt : %d, valid_secs : %d secs", current_attempt, max_attempt, valid_secs); - - if (valid_sec != NULL) - *valid_sec = valid_secs; - - if (inner_ret == SECURITY_SERVER_API_SUCCESS) { - ret = SETTING_RETURN_SUCCESS; - } else { - if (remain_attempt != NULL) { - if ((max_attempt > 0) && (max_attempt >= current_attempt)) - *remain_attempt = max_attempt - current_attempt; - else - *remain_attempt = ATTEMPT_INFINITE; /* infinite */ - } - ret = SETTING_RETURN_FAIL; - } -#endif - - return ret; -} - -int setting_password_set_password(const char *cur_pwd, const char *new_pwd, void *data) -{ - SETTING_TRACE_BEGIN; - retv_if(new_pwd == NULL || data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - -#if SECURITY_SERVER - SettingPasswordUG *ad = (SettingPasswordUG *)data; - int ret = 0; - int err; - - /* max attempt count will be handled in passwordug for a while. */ - if (ad->pw_status == SETTING_PW_STATUS_EMPTY) { - ret = security_server_set_pwd(NULL, new_pwd, 0, 0); - SETTING_TRACE_DEBUG("[security_server_set_pwd() + empty current] returns %d, INFINITE", ret); - if (ret == SECURITY_SERVER_API_SUCCESS) { -#if 0 - /* To support key manager */ - uid_t user = 5000; - /*int ckmc_ret = CKMC_ERROR_NONE; */ - ckmc_ret = ckmc_reset_user_password(user, new_pwd); - SETTING_TRACE("ckmc_reset_user_password() returns %d", ckmc_ret); - setting_set_int_slp_key(INT_SLP_SETTING_PHONE_LOCK_ATTEMPTS_LEFT, PHONE_LOCK_ATTEMPS_MAX, &err); -#endif - return SETTING_RETURN_SUCCESS; - } - - return SETTING_PW_ERROR_UNKNOWN; - - } - - ret = security_server_set_pwd(cur_pwd, new_pwd, 0, 0); - SETTING_TRACE_DEBUG("[security_server_set_pwd()] returns %d, INFINITE", ret); - if (ret == SECURITY_SERVER_API_SUCCESS) { -#if 0 - ckmc_ret = ckmc_change_user_password(user, cur_pwd, new_pwd); - SETTING_TRACE("ckmc_change_user_password() returns %d", ckmc_ret); - setting_set_int_slp_key(INT_SLP_SETTING_PHONE_LOCK_ATTEMPTS_LEFT, PHONE_LOCK_ATTEMPS_MAX, &err); -#endif - return SETTING_RETURN_SUCCESS; - } - return SETTING_PW_ERROR_UNKNOWN; - -#else - - return SETTING_PW_ERROR_UNKNOWN; - -#endif -} - - diff --git a/setting-security/CMakeLists.txt b/setting-security/CMakeLists.txt deleted file mode 100755 index 39cf452..0000000 --- a/setting-security/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${SETTING_COMMON}/include) - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs_security REQUIRED ecore evas elementary tapi dlog -ui-gadget-1 capi-appfw-application capi-appfw-app-manager appcore-common ail -deviced capi-network-connection json-glib-1.0 efl-extension libtzplatform-config) - -FOREACH(flag ${pkgs_security_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Werror-implicit-function-declaration") -SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") - -IF("${ARCH}" STREQUAL "arm") - ADD_DEFINITIONS("-DTARGET") -ENDIF("${ARCH}" STREQUAL "arm") -FOREACH(flag ${pkgs_security_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") -ADD_DEFINITIONS("-DSLP_DEBUG") -ADD_DEFINITIONS("-shared") - -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib") - -ADD_LIBRARY(${SETTING_SECURITY_UG} SHARED - ./src/setting-security.c - ./src/setting-security-main.c - ./src/setting-security-sim-settings.c - ./src/setting-security-update.c - ) - -TARGET_LINK_LIBRARIES(${SETTING_SECURITY_UG} -L${CMAKE_BINARY_DIR}/${SETTING_COMMON} -lsetting-common) -TARGET_LINK_LIBRARIES(${SETTING_SECURITY_UG} ${pkgs_security_LDFLAGS}) - -INSTALL(TARGETS ${SETTING_SECURITY_UG} DESTINATION ${PREFIX}/lib/ug) diff --git a/setting-security/include/setting-security-enc-processing.h b/setting-security/include/setting-security-enc-processing.h deleted file mode 100644 index 8620bbd..0000000 --- a/setting-security/include/setting-security-enc-processing.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_SECURITY_ENC_PROCESSING_H__ -#define __SETTING_SECURITY_ENC_PROCESSING_H__ - -#include - -#endif diff --git a/setting-security/include/setting-security-main.h b/setting-security/include/setting-security-main.h deleted file mode 100644 index 4624dbb..0000000 --- a/setting-security/include/setting-security-main.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_SECURITY_MAIN_H__ -#define __SETTING_SECURITY_MAIN_H__ - -#include -#include - -#define SETTING_SECURITY_SD_CARD_DECYPTION_WITHOUT_SD_CARD_POPUP_HELP "IDS_ST_POP_NO_SD_CARD_IS_INSERTED_DISABLE_ENCRYPT_SD_CARD_ANYWAY_Q" -#define SETTING_SECURITY_SD_CARD_ENCRYPTION_WITHOUT_SD_CARD_POPUP_HELP "IDS_ST_POP_NO_SD_CARD_HAS_BEEN_INSERTED_ENCRYPTION_WILL_START_AUTOMATICALLY_WHEN_YOU_INSERT_AN_SD_CARD" -#define SETTING_SECURITY_SD_CARD_ENCRYPTION_POPUP_HELP "IDS_ST_POP_ENCRYPT_SD_CARD_Q_OPERATION_IS_IRREVERSIBLE_AND_IF_YOU_INTERRUPT_IT_YOU_WILL_LOSE_DATA" -#define SETTING_SECURITY_DEVICE_ENCRYPTION_POPUP_HELP "IDS_ST_BODY_ENCRYPT_DEVICE_Q_OPERATION_IS_IRREVERSIBLE_AND_IF_YOU_INTERRUPT_IT_YOU_WILL_LOSE_DATA" - -void setting_security_main_vconf_change_cb(keynode_t *key, void *data); -int _handle_sim_exception(void *data, int sim_status); -#endif diff --git a/setting-security/include/setting-security-sim-settings.h b/setting-security/include/setting-security-sim-settings.h deleted file mode 100755 index 6a4f8d7..0000000 --- a/setting-security/include/setting-security-sim-settings.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_SECURITY_SIM_SETTINGS_H__ -#define __SETTING_SECURITY_SIM_SETTINGS_H__ - -#include - - -static void -setting_security_sim_settings_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj, - void *event_info); -/*static void */ -/*setting_security_sim_settings_click_softkey_back_cb(void *data, Evas_Object *obj, */ -/* void *event_info); */ -Eina_Bool setting_security_sim_settings_click_softkey_back_cb(void *data, Elm_Object_Item *it); - -static void -setting_security_sim_settings_chk_btn_cb(void *data, Evas_Object *obj, - void *event_info); - -#endif diff --git a/setting-security/include/setting-security.h b/setting-security/include/setting-security.h deleted file mode 100644 index b6a266f..0000000 --- a/setting-security/include/setting-security.h +++ /dev/null @@ -1,483 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef __SETTING_SECURITY_H__ -#define __SETTING_SECURITY_H__ - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include - - -/*///////////////////face and voice unlock */ -#define SET_AS_LOCK_STR "IDS_ST_SK_SET_LITE"/*"Set as lock" */ -#define CONTINUE_STR "Continue" -#define SET_UP_STR "Set it up" -#define ADAPT_VOICE_STR "Adapt Voice" - -#define About_Motion_Unlock_Str "IDS_ST_HEADER_MOTION_UNLOCK" -#define About_Face_Unlock_Str "About Face Unlock" -#define Setup_Face_Unlock_Str "Set up Face Unlock" -#define Voice_Record_BtnStr "Voice record icon" -#define Put_Face_Str "Put your face here" -#define Show_Face_Str "Show your face" - -#define Motion_Unlock_Guildtext "Unlock device using motion

"\ - "Tap and hold the screen then tilt the device "\ - "towards you to unlock it. If the screen does not unlock, "\ - "try tiling the device more. When learn about tilt or motion "\ - "lock are set,motion activation will be automatically enabled "\ - "in Settings" - -#define Motion_Unlock_Guildtext1 "IDS_ST_HEADER_UNLOCK_DEVICE_USING_MOTION_ABB" -#define Motion_Unlock_Guildtext2 "IDS_ST_BODY_TAP_AND_HOLD_THE_SCREEN_THEN_TILT_THE_DEVICE_TOWARDS_YOU_TO_UNLOCK_IT_IF_THE_SCREEN_DOES_NOT_UNLOCK_TRY_TILTING_THE_DEVICE_MORE" -#define Motion_Unlock_Guildtext3 "IDS_ST_BODY_WHEN_LEARN_ABOUT_TILT_OR_MOTION_UNLOCK_ARE_SET_MOTION_ACTIVATION_WILL_BE_AUTOMATICALLY_ENABLED_IN_SETTINGS" - -#define Face_Unlock_Warring "Warning

"\ - "Do not use face unlock while driving, it may distract you from "\ - "the road and cause an accident" - -#define Face_Unlock_Warring2 "Look at your phone to Unlock it

"\ - "Keep these things in mind
"\ - ".Face Unlock is less secure than PIN or password.

"\ - ".Someone who looks similar to you could unlock your phone.

"\ - ".The data used to identify your face is kept private on the phone." - -#define Face_Unlock_Warring3 "For best results:

"\ - ".Find an indoor spot that is not too bright or too dim.

"\ - ".Hold the phone at eye level." - -#define Voice_Unlock_Guildtext "Tap button below then say voice command you want to use for Unlock 4 times all at once" -#define Voice_Unlock_Guildtext2 "Use 3-5 syllable words and maintain constant intonation.

"\ - "All background music and recording will stop when you unlock the device using Face and voice
" -#define Voice_Recognized_text "Recognised. Now you can use your own voice command for Unlock.

"\ - "For assuring higher security. You can adapt voice command by tapping 'Adapt voice' button." - -#define Adapt_voice_Str "Adapt Voice" - -#define Finish_Setup_Face "You've finished!

"\ - "To unlock your phone, just look at it.

"\ - "Tip : improve face matching by having your face capture in different "\ - "conditions." - -#define Speak_Now_Str "Speak now" -#define Keystr_FDN "IDS_ST_BODY_FIXED_DIALLING_MODE" - -#define SEC_FIREWALL_DIR "/home/app/.firewall" - -#define PIN_BLOCKED_ENTER_PUK_DESC "IDS_ST_BODY_PIN_BLOCKED_ENTER_PUK_TO_CONTINUE_JPN_DCM" -#define SECURITY_MANUAL_UPDATE_TEXT "IDS_ST_POP_CHECK_FOR_SECURITY_UPDATES_AND_DOWNLOAD_NEW_UPDATES_Q_NOTI_MSG" -#define SECURITY_UPDATE_TOGGLE_ON "IDS_ST_POP_ENABLING_AUTO_UPDATE_MEANS_YOUR_DEVICE_WILL_CHECK_FOR_SECURITY_UPDATES_AUTOMATICALLY_NOTI_MSG" -#define SECURITY_UPDATE_TOGGLE_OFF "IDS_ST_POP_DISABLING_AUTO_UPDATE_MEANS_YOU_HAVE_TO_CHECK_FOR_SECURITY_UPDATES_MANUALLY_NOTI_MSG" -#define SECURITY_UPDATE_TEXT "IDS_EMAIL_POP_SECURITY_UPDATE_ABB" -#define UPDATE_TEXT "IDS_ST_BODY_CHECK_FOR_UPDATES" -#define CHECK_UPDATES "IDS_ST_BODY_CHECK_FOR_UPDATES_ABB" -#define AUTO_UPDATE "IDS_ST_OPT_AUTO_UPDATE_ABB" -#define CHECK_UPDATE_AUTO "IDS_ST_BODY_CHECK_FOR_UPDATES_AUTOMATICALLY_ABB" -#define CHECK_UPDATE_AUTO_MSG "IDS_ST_SBODY_AUTOMATICALLY_CHECK_FOR_CHANGES_TO_THE_SECURITY_POLICY_MSG" -#define CONNECT_TO_SERVER "IDS_ST_POP_CONNECTING_TO_THE_SERVER_ING" -#define SECURITY_VIA_WIFI "IDS_ST_MBODY_VIA_WI_FI_ONLY" -#define SECURITY_VIA_WIFI_HELP_MSG "IDS_ST_SBODY_ONLY_UPDATE_THE_SECURITY_POLICY_AUTOMATICALLY_WHEN_YOUR_DEVICE_IS_CONNECTED_TO_A_WI_FI_NETWORK" -#define SECURITY_SIM_NOT_PRESENT_MSG "" -#define SECURITY_SIM_SETTINGS "IDS_JAVA_OPT_SIM_SETTINGS" - - -#define SETTING_SECURITY_FIREWALL_BLOCKLIST_NAME_LEN_MAX 256 - -#if SUPPORT_SECURITY_FIREWALL -typedef struct _BlockList_Info BlockList_Info; -struct _BlockList_Info { - char name[SETTING_SECURITY_FIREWALL_BLOCKLIST_NAME_LEN_MAX + 1]; -}; - -#endif - -#if SUPPORT_ENCRYPTION -#define Keystr_DeviceEncryption "IDS_ASEML_BODY_DEVICE_ENCRYPTION" -#define keystr_DeviceDecryption "Device decryption" -#define DEVICE_ENCRYPTION_DESC "IDS_ST_BODY_PASSWORD_REQUIRED_TO_DECRYPT_DEVICE_EACH_TIME_YOU_TURN_IT_ON" -#define DEVICE_DECRYPTION_DESC "IDS_ST_BODY_DEVICE_ENCRYPTED" - -#define Keystr_ConfirmEncryption "IDS_ST_HEADER_CONFIRM_ENCRYPTION" -#define Keystr_ConfirmDecryption "IDS_ST_BODY_CONFIRM_DECRYPTION" -#define DEVICE_ENCRYPTION_GUIDE_01 "IDS_ST_BODY_DEVICE_ENCRYPTION_HELP_MSG" -#define DEVICE_ENCRYPTION_GUIDE_03 "IDS_ST_BODY_SET_AN_UNLOCK_PASSWORD_OF_AT_LEAST_6_CHARACTERS_CONTAINING_AT_LEAST_1_NUMBER" -#define DEVICE_ENCRYPTION_GUIDE_04 "IDS_ST_BODY_PLUG_IN_CHARGER_AND_TRY_AGAIN" -#define DEVICE_ENCRYPTION_GUIDE_05 "IDS_ST_BODY_CHARGE_BATTERY_TO_ABOVE_80P_AND_TRY_AGAIN" -#define DEVICE_DECRYPTION_GUIDE_01 "IDS_ST_BODY_YOU_CAN_DECRYPT_ACCOUNTS_SETTINGS_DOWNLOADED_APPLICATIONS_AND_THEIR_DATA_MEDIA_AND_OTHER_FILES_DECRYPTION_WARNING_MSG" -#define CONFIRM_ENCRYPTION_GUIDE_01 "IDS_ST_BODY_ENCRYPT_DEVICE_Q_WARNING_MSG" -#define CONFIRM_ENCRYPTION_GUIDE_02 "IDS_ST_BODY_FAST_ENCRYPTION" -#define CONFIRM_ENCRYPTION_GUIDE_03 "IDS_ST_BODY_IF_YOU_SELECT_THIS_OPTION_ONLY_USED_MEMORY_SPACE_WILL_BE_ENCRYPTED" -#define CONFIRM_DECRYPTION_GUIDE_01 "IDS_ST_BODY_DECRYPT_DEVICE_Q_WARNING_MSG" -#define Keystr_Encrypting "IDS_ST_BODY_ENCRYPTING_ING" -#define Keystr_Decrypting "IDS_ST_BODY_DECRYPTING_ING" -#define ENCRYPTING_GUIDE_01 "IDS_ST_BODY_PREPARING_THIS_COULD_TAKE_OVER_10_MINUTES_ING" -#define ENCRYPTING_GUIDE_02 "IDS_ST_BODY_WAIT_WHILE_DEVICE_IS_ENCRYPTED_PDP_COMPLETE" -#define DECRYPTING_GUIDE_02 "IDS_ST_BODY_WAIT_WHILE_DEVICE_IS_DECRYPTED_PDP_COMPLETE" -#define Keystr_EncryptDevice "IDS_ST_HEADER_ENCRYPT_DEVICE" -#define Keystr_DecryptDevice "IDS_ST_BODY_DECRYPT_DEVICE" -#endif - -#define USELESS_SIM_CARD "Not useful SIM card" -#define KeyStr_Security_Waiting_Sim "IDS_ST_BODY_WAITING_FOR_RESPONSE_FROM_SIM_CARD_ING" -#define Keystr_ScreenLockType "IDS_ST_BODY_SCREEN_LOCK_TYPE" -#define Keystr_LockScreenOptions "IDS_ST_BODY_LOCK_SCREEN_OPTIONS" -#define Keystr_Swipe "IDS_ST_MBODY_SWIPE" -#define Keystr_FaceAndVoice "IDS_ST_BODY_FACE_AND_VOICE" - -#if SUPPORT_SECURITY_FIREWALL -#define Keystr_Firewall "IDS_ST_BODY_FIREWALL" -#define Keystr_BlockIP "IDS_ST_BODY_BLOCK_IP" -#define Keystr_BlockedIPList "IDS_ST_BODY_BLOCKED_IP_LIST" -#define Keystr_BlockedIPDesc "IDS_ST_BODY_USER_CAN_BLOCK_A_SPECIFIC_IP_ADDRESS_MSG" -#define Keystr_BlockURL "IDS_ST_BODY_BLOCK_URL" -#define Keystr_BlockedURLList "IDS_ST_BODY_BLOCKED_URL_LIST" -#define Keystr_BlockedURLDesc "IDS_ST_BODY_USER_CAN_BLOCK_A_SPECIFIC_URL_MSG" -#define Keystr_BlockPort "IDS_ST_BODY_BLOCK_PORT" -#define Keystr_BlockedPortList "IDS_ST_BODY_BLOCKED_PORT_LIST" -#define Keystr_BlockedPortDesc "IDS_ST_BODY_USER_CAN_BLOCK_A_SPECIFIC_PORT_MSG" -#define Keystr_BlockedNetworkType "IDS_ST_BODY_NETWORK_TYPE" -#define Keystr_BlockedProtocolType "IDS_ST_BODY_PROTOCOL_TYPE" - -#define Keystr_AddIP "IDS_ST_HEADER_ADD_IP" -#define Keystr_AddURL "IDS_ST_HEADER_ADD_URL" -#define Keystr_AddPort "IDS_ST_HEADER_ADD_PORT" -#define Keystr_IP "IDS_WIFI_BODY_IP" -#define Keystr_URL "IDS_ST_BODY_URL" -#define Keystr_Port "IDS_ST_HEADER_PORT" - -#define KeyStr_IP_removed "IDS_ST_POP_IP_ADDRESS_REMOVED" -#define KeyStr_Port_removed "IDS_ST_POP_PORT_REMOVED" -#define KeyStr_Ports_removed "IDS_ST_POP_PORTS_REMOVED" -#define KeyStr_URL_removed "IDS_ST_POP_URL_REMOVED" -#define KeyStr_URLs_removed "IDS_ST_POP_URLS_REMOVED" -#endif -#define Keystr_Security_Engine "IDS_ST_BODY_SECURITY_ENGINE" -#define Keystr_Security_Engine_Default "IDS_ST_BODY_ANTIVIRUS_SOFTWARE_ABB" -#define Keystr_Security_Engine_Type_None "IDS_ST_BODY_NONE" -#define Keystr_Security_Engine_Desc "IDS_ST_BODY_PROTECT_YOUR_DEVICE_FROM_HARMFUL_VIRUSES_AND_MALWARE" -#define Keystr_Firewall_dimm_desc "IDS_IM_POP_THIS_FEATURE_IS_NOT_AVAILABLE_WHILE_FLIGHT_MODE_IS_ON" - -typedef struct _SettingSecurityUG SettingSecurityUG; - -struct _security_item { - int pw_type_num; - char *pw_type_string; - int (*passwd_handler)(SettingSecurityUG *ad, void *data); -}; - -#if SUPPORT_SECURITY_FIREWALL -typedef enum { - SETTING_SEC_FIREWALL_BLOCK_IP, - SETTING_SEC_FIREWALL_BLOCK_URL, - SETTING_SEC_FIREWALL_BLOCK_PORT, - SETTING_SEC_FIREWALL_BLOCK_3G, - SETTING_SEC_FIREWALL_BLOCK_WIFI, - SETTING_SEC_FIREWALL_BLOCK_TCP, - SETTING_SEC_FIREWALL_BLOCK_UDP, - SETTING_SEC_FIREWALL_BLOCK_MAX -} setting_sec_firewall_blcok_type; - -typedef enum { - SETTING_SEC_FIREWALL_NETWORK_BLOCK_ALLOW_ALL = 0, - SETTING_SEC_FIREWALL_NETWORK_BLOCK_WIFI, - SETTING_SEC_FIREWALL_NETWORK_BLOCK_3G, - SETTING_SEC_FIREWALL_NETWORK_BLOCK_ALL, - SETTING_SEC_FIREWALL_NETWORK_BLOCK_MAX -} setting_sec_firewall_network_block_type; - -typedef enum { - SETTING_SEC_FIREWALL_PROTOCOL_BLOCK_ALLOW_ALL = 0, - SETTING_SEC_FIREWALL_PROTOCOL_BLOCK_TCP, - SETTING_SEC_FIREWALL_PROTOCOL_BLOCK_UDP, - SETTING_SEC_FIREWALL_PROTOCOL_BLOCK_ALL, - SETTING_SEC_FIREWALL_PROTOCOL_BLOCK_MAX -} setting_sec_firewall_protocol_block_type; - -typedef struct _bs firewall_db; -typedef struct _bsl firewall_db_list; - -struct _bs { - int _magic; - int id; - /*char * ip; */ - char ip[256]; - /*char url[256]; */ - /*char port[256]; */ -}; - -struct _bsl { - struct _bs firewall_db; - struct _bsl *prev; - struct _bsl *next; -}; - -typedef struct _commandList { - /*char ** arg_list ; */ - char *command; - struct _commandList *next; -} COMMAND; - -COMMAND *g_ipHead, *g_ipTail; -COMMAND *g_urlHead, *g_urlTail; -COMMAND *g_portHead, *g_portTail; - - -#endif -#define MAX_VOICE_TIME 4 -#define MAX_SEC_PROFILE_NUM 100 - - -enum { - SETTING_SEC_VIEWTYPE_MAIN = 0, - SETTING_SEC_VIEWTYPE_ENCRYPTION, - SETTING_SEC_VIEWTYPE_LOCKTYPE, - SETTING_SEC_VIEWTYPE_UPDATE, - SETTING_SEC_VIEWTYPE_MAX -}; - -/** - * Setting Security UG context - * all UG function has void* as an agument. this is casted back to SettingSecurityUG - * and the functions access app context. - */ -struct _SettingSecurityUG { - ui_gadget_h ug; - ui_gadget_h ug_loading; - TapiHandle *handle; - TelSimFacilityStatus_t sim_status; - TelSimFacilityStatus_t pin1_status; - TelSimFacilityStatus_t pin2_status;/*it indicates fdn status too */ - unsigned int enter_tapi_async_cb_flag; - - /* add more variables here (move your appdata to here) */ - Evas *evas; - Evas_Object *win_main_layout; - Evas_Object *win_get; - Evas_Object *notify; - Evas_Object *video_ly; - Evas_Object *video_ly_show_face_btn; - Evas_Object *video_ly_content_face; - Ecore_Timer *update_timer; - Evas_Object *image[MAX_VOICE_TIME]; - int processed_img_num; - Evas_Object *record_genlist; - Elm_Object_Item *screen_lock_main_item; - char *selected_lock_type; - - int viewtype; - - /*to export lock type UG */ - setting_view *view_to_load; - Evas_Object *save_popup; - - Evas_Object *ly_guild; - Evas_Object *ly_main; - Evas_Object *navi_bar; - Evas_Object *sim_popup; - ui_gadget_h ug_passwd; - ui_gadget_h ug_mmc_encryption; - ui_gadget_h ug_mt; - ui_gadget_h ug_firewall; - ui_gadget_h ug_locktype; - - Evas_Object *genlist; - Evas_Object *sec_genlist; - Evas_Object *pop_manual_update; - Evas_Object *pop_progress; - Evas_Object *pop_auto_update_on; - Evas_Object *pop_auto_update_off; - -#if SUPPORT_SECURITY_FIREWALL - Elm_Object_Item *navi_it; - Evas_Object *view_layout; - Evas_Object *scroller; - Evas_Object *content; - Evas_Object *focus_timer; - int list_cnt; - char *interface_name; - connection_h connection; - connection_profile_h profile; -#endif - Setting_GenGroupItem_Data *data_phone_lk; - Setting_GenGroupItem_Data *data_mb; - Setting_GenGroupItem_Data *data_sim_lk; - Setting_GenGroupItem_Data *data_pin_lk; - Setting_GenGroupItem_Data *data_parental_md; - /*Setting_GenGroupItem_Data *data_simple_pw; */ - Setting_GenGroupItem_Data *data_change_pin1; - Setting_GenGroupItem_Data *data_change_pin2; - Setting_GenGroupItem_Data *data_sim_settings; - /* for simple password */ - - Setting_GenGroupItem_Data *data_cng_pw; -#if SUPPORT_ENCRYPTION - Setting_GenGroupItem_Data *data_device_enc; - Setting_GenGroupItem_Data *data_mmc_enc; - Setting_GenGroupItem_Data *data_enc_btn; - Setting_GenGroupItem_Data *data_confirm_enc_btn; - int cur_enc_mode; /* 0: unencrypted, 1: encrypted */ - Ecore_Event_Handler *event_handler; - Evas_Object *enc_progressbar; - Evas_Object *enc_layout; - Evas_Object *enc_genlist; - Evas_Object *sub_layout; - Evas_Object *scroller_lable; - Evas_Object *enc_scroller; - Evas_Object *popup_sd_card_encryption; - Evas_Object *popup_device_encryption; -#endif - Elm_Genlist_Item_Class itc_1text; - Elm_Genlist_Item_Class itc_bg_1icon; - Elm_Genlist_Item_Class itc_1text_1icon; - Elm_Genlist_Item_Class itc_2text_2; - Elm_Genlist_Item_Class itc_1icon; - - Elm_Genlist_Item_Class itc_group_item; - Elm_Genlist_Item_Class itc_2text_3_parent; - - -#if SUPPORT_FDN - Setting_GenGroupItem_Data *data_fdn; - Evas_Object *chk_fdn; -#endif - - setting_sec_pw_type pw_type; -#if SUPPORT_SECURITY_FIREWALL - Elm_Object_Item *firewall_separator; - setting_sec_firewall_blcok_type firewall_block_type; -#endif - - Evas_Object *sl_scroller; - ui_gadget_h ug_lockscreen; - - Setting_GenGroupItem_Data *data_set_screenlock_btn; - -#if SUPPORT_SECURITY_FIREWALL - firewall_db *fdb; - Evas_Object *blocked_list; - Setting_Done_List_Data data_block_list; - Setting_GenGroupItem_Data *data_security_firewall; - Setting_GenGroupItem_Data *data_firewall_disable_desc; - Setting_GenGroupItem_Data *data_security_engine; - Setting_GenGroupItem_Data *data_security_update; - Setting_GenGroupItem_Data *data_block_ip; - Setting_GenGroupItem_Data *data_blocked_ip_list; - Setting_GenGroupItem_Data *data_blocked_ip_des; - Setting_GenGroupItem_Data *data_block_url; - Setting_GenGroupItem_Data *data_blocked_url_list; - Setting_GenGroupItem_Data *data_blocked_url_des; - Setting_GenGroupItem_Data *data_block_port; - Setting_GenGroupItem_Data *data_blocked_port_list; - Setting_GenGroupItem_Data *data_blocked_port_des; - Setting_GenGroupItem_Data *data_block_network_type; - Setting_GenGroupItem_Data *data_block_protocol_type; - Setting_GenGroupItem_Data *data_security_keypad; - Setting_GenGroupItem_Data *ip_list; - Setting_GenGroupItem_Data *url_list; - Setting_GenGroupItem_Data *port_list; -#endif - - Setting_GenGroupItem_Data *data_security_update_bt; - Setting_GenGroupItem_Data *data_security_update_chk; - Setting_GenGroupItem_Data *data_security_wifi_update_chk; - char *caller; - char *input_pwd; - - int sel_item; /**< It's used to check PIN1, PIN2 _BLOCKED. 0:click pin lock, 1:change pin1 code, 2:fdn, 3: change pin2 code */ - Ecore_Timer *update_view_timer; - Ecore_Timer *get_security_list_timer; - - Ecore_Timer *remove_sim_popup_timer; - Ecore_Timer *tapi_async_cb_check_timer; - /*for Security engine */ - GList *secrity_engine_list; - - bool ug_removed; - bool pin2_blocked_flag; - bool samsung_account_is_running; - - struct mmc_contents mmc_content; /* Handle exception of SD card encryption */ -}; - -extern setting_view setting_view_security_main; -#if SUPPORT_ENCRYPTION -extern setting_view setting_view_security_encryption; -extern setting_view setting_view_security_confirm_encryption; -#endif -/*extern setting_view setting_view_security_enc_processing; */ -/*extern setting_view setting_view_security_locktype; */ -extern setting_view setting_view_security_sim_settings; - -#if SUPPORT_SECURITY_FIREWALL -/*extern setting_view setting_view_security_firewall; */ -/*extern setting_view setting_view_security_blocked_list; */ -/*extern setting_view setting_view_security_firewall_keypad; */ -/*extern setting_view setting_view_security_delete_block_list; */ -#endif - -extern setting_view setting_view_security_update; - -SettingSecurityUG *g_ad; /* for tapi callback */ - -/*char *get_screen_lock_type_str(void * priv); */ -void setting_security_result_password_ug_cb(ui_gadget_h ug, - app_control_h service, void *priv); -void setting_security_sim_get_facility_cb(TapiHandle *handle, int result, void *data, void *user_data); -void setting_security_pin_get_facility_cb(TapiHandle *handle, int result, void *data, void *user_data); -void setting_security_pin2_get_lock_info_cb(TapiHandle *handle, int result, void *data, void *user_data); - -gboolean setting_security_create_password_sg(void *data); - -void setting_security_destroy_password_ug_cb(ui_gadget_h ug, - void *priv); -void setting_security_layout_passwd_ug_cb(ui_gadget_h ug, - enum ug_mode mode, void *priv); - -gboolean setting_security_create_lockscreen_options_sg(void *data); -gboolean setting_security_create_mmc_encryption_sg(void *data); -gboolean setting_security_create_firewall_sg(void *data); - -#endif - -#if SUPPORT_SECURITY_FIREWALL -int setting_security_system_command(const char *command, const char *commandex); -\ -int setting_security_firewall_reset(); -#endif diff --git a/setting-security/src/setting-firewall/firewall b/setting-security/src/setting-firewall/firewall deleted file mode 100755 index 8b96d3a..0000000 Binary files a/setting-security/src/setting-firewall/firewall and /dev/null differ diff --git a/setting-security/src/setting-firewall/firewall.sh b/setting-security/src/setting-firewall/firewall.sh deleted file mode 100755 index d61db75..0000000 --- a/setting-security/src/setting-firewall/firewall.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh - -DESC="Tizen firewall" -DAEMON=/usr/bin/$NAME -MJRUN=$TZ_SYS_RO_APP/org.tizen.setting/bin/firewall -FIREWALLSTART="30" -FIREWALLSTOP="31" - -[ -x "$MJRUN" ] || exit 0 - -do_start() { - $MJRUN $FIREWALLSTART - RETVAL=$? - return "$RETVAL" - -} - -do_stop(){ - $MJRUN $FIREWALLSTOP - RETVAL=$? - return "$RETVAL" -} - - - -prt_res() { - RETVAL=$1 - - case "$RETVAL" in - 77) - echo "... done." - RETVAL=0 - ;; - *) - echo "... failed!" - RETVAL=1 - ;; - esac - return $RETVAL -} - -case "$1" in -start) -echo "Starting $DESC" -do_start -prt_res $? - -;; -stop) -echo "Stopping $DESC" -do_stop -prt_res $? -;; -*) -echo "Usage: firewall {start|stop}" >&2 -exit 3 -;; -esac diff --git a/setting-security/src/setting-security-enc-processing.c b/setting-security/src/setting-security-enc-processing.c deleted file mode 100644 index 92cc6ec..0000000 --- a/setting-security/src/setting-security-enc-processing.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include -#include -#include - -#include -#include - -#include -#include - -static int setting_security_enc_processing_create(void *cb); -static int setting_security_enc_processing_destroy(void *cb); -static int setting_security_enc_processing_update(void *cb); -static int setting_security_enc_processing_cleanup(void *cb); - -setting_view setting_view_security_enc_processing = { - .create = setting_security_enc_processing_create, - .destroy = setting_security_enc_processing_destroy, - .update = setting_security_enc_processing_update, - .cleanup = setting_security_enc_processing_cleanup, -}; - -/* *************************************************** - ** - **basic func - ** - ****************************************************/ - -static void __encrypting_key_grab(SettingSecurityUG *ad) -{ - SETTING_TRACE_BEGIN; -#ifdef ECORE_X - Ecore_X_Window xwin = 0; - Ecore_X_Display *disp = NULL; -#endif - - int ret = 0; - - if (ad == NULL) - return; - -#ifdef ECORE_X - disp = ecore_x_display_get(); - xwin = elm_win_xwindow_get((Evas_Object *)ug_get_window()); - - - ret = eext_win_keygrab_set(xwin, "XF86PowerOff"); - if (ret) - return; - ret = eext_win_keygrab_set(xwin, "XF86Home"); - if (ret) - return; - ret = eext_win_keygrab_set(xwin, "XF86AudioRaiseVolume"); - if (ret) - return; - ret = eext_win_keygrab_set(xwin, "XF86AudioLowerVolume"); - if (ret) - return; -#else - // @todo : repace codes using X with codes tizen 3.0 API -#endif - ad->event_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, NULL, NULL); - SETTING_TRACE_END; -} -static void __encrypting_key_ungrab(SettingSecurityUG *ad) -{ - SETTING_TRACE_BEGIN; -#ifdef ECORE_X - Ecore_X_Window xwin = 0; - Ecore_X_Display *disp = NULL; -#endif - - int ret = 0; - - if (ad == NULL) - return; - -#ifdef ECORE_X - disp = ecore_x_display_get(); - xwin = elm_win_xwindow_get((Evas_Object *)ug_get_window()); - - - ret = eext_win_keygrab_unset(xwin, "XF86PowerOff"); - if (ret) - return; - ret = eext_win_keygrab_unset(xwin, "XF86Home"); - if (ret) - return; - ret = eext_win_keygrab_unset(xwin, "XF86AudioRaiseVolume"); - if (ret) - return; - ret = eext_win_keygrab_unset(xwin, "XF86AudioLowerVolume"); - if (ret) - return; -#else - // @todo : repace codes using X with codes tizen 3.0 API -#endif - ecore_event_handler_del(ad->event_handler); -} - -static void __vconf_change_cb(keynode_t *key, void *data) -{ - SETTING_TRACE_BEGIN; - ret_if(data == NULL); - SettingSecurityUG *ad = (SettingSecurityUG *) data; - - /* To do : update progressbar */ - char *vconf_name = vconf_keynode_get_name(key); - char *vconf_value = NULL; - char temp[MAX_COMMON_BUFFER_LEN] = {0,}; - - /*if (!safeStrCmp(vconf_name, VCONFKEY_ODE_ENCRYPT_PROGRESS)) {*/ - if (!safeStrCmp(vconf_name, "db/ode/encrypt_progress")) { - vconf_value = (char *)g_strdup(vconf_keynode_get_str(key)); - if (vconf_value == NULL) - return; - - SETTING_TRACE_DEBUG("progress : %s", vconf_value); - float i_value = atof(vconf_value); - if (i_value <= 0) - return; - - if (ad->cur_enc_mode == 0) { - snprintf(temp, MAX_COMMON_BUFFER_LEN, _(ENCRYPTING_GUIDE_02), (int)i_value); - } else if (ad->cur_enc_mode == 1) { - snprintf(temp, MAX_COMMON_BUFFER_LEN, _(DECRYPTING_GUIDE_02), (int)i_value); - } - elm_object_part_text_set(ad->enc_layout, "description", temp); - SETTING_TRACE_DEBUG("current status : %s", temp); - - elm_progressbar_value_set(ad->enc_progressbar, i_value / 100.0); - SETTING_TRACE_DEBUG("progressbar is updated. %f", i_value / 100.0); - G_FREE(vconf_value); - - if (i_value == 100) { - SETTING_TRACE_DEBUG("100%"); - /* To do : Encryption completed. Restart target. */ - if (ode_crypto_complete() == 0) { - SETTING_TRACE_DEBUG("ode_crypto_complete() success."); - ode_deinit(); - /*system("reboot"); */ - } - } - } -} - -int __listen_vconf_change(void *data) -{ - SETTING_TRACE_BEGIN; - retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - int ret = 0; - - ret = vconf_notify_key_changed(VCONFKEY_ODE_ENCRYPT_PROGRESS, - __vconf_change_cb, data); - setting_retvm_if(ret < 0, ret, "%s notifications Failed(%d)", - (char *)VCONFKEY_ODE_ENCRYPT_PROGRESS, ret); - - return ret; -} - -static int setting_security_enc_processing_create(void *cb) -{ - SETTING_TRACE_BEGIN; - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingSecurityUG *ad = (SettingSecurityUG *) cb; - - if (ad->input_pwd == NULL) - return SETTING_RETURN_FAIL; - - Evas_Object *window = NULL; - Evas_Object *layout = NULL; - Evas_Object *progressbar = NULL; - char enc_type[16] = {0,}; - - layout = elm_layout_add(ad->win_main_layout); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - elm_layout_file_set(layout, SETTING_THEME_EDJ_NAME, "encryption_layout"); - /*elm_win_center(layout, EINA_TRUE, EINA_TRUE); */ - /*elm_win_fullscreen_set(layout, EINA_TRUE); */ - /*setting_resize_object(layout, 720, 1280); */ - - /*elm_win_resize_object_add(ad->win_get, layout); */ - - progressbar = elm_progressbar_add(layout); - elm_progressbar_value_set(progressbar, 0); - elm_object_part_content_set(layout, "progressbar", progressbar); - - evas_object_show(layout); - - ad->enc_progressbar = progressbar; - ad->enc_layout = layout; - - /* grab home key and volume key */ - __encrypting_key_grab(ad); - __listen_vconf_change(ad); - - if (ode_init() < 0) { - SETTING_TRACE_DEBUG("ode_init() failed"); - setting_security_enc_processing_destroy(ad); - return SETTING_RETURN_FAIL; - } - - if (ad->cur_enc_mode == 0) { - elm_object_part_text_set(layout, "title", _(Keystr_Encrypting)); - elm_object_part_text_set(layout, "description", _(ENCRYPTING_GUIDE_01)); - safeCopyStr(enc_type, "inplace", 16); -#if TEMP - if (ode_enable(enc_type, ad->input_pwd) == 0) { - SETTING_TRACE_DEBUG("ode_enable(%s, %s) success", ad->input_pwd, enc_type); - } else { - SETTING_TRACE_DEBUG("ode_enable(%s, %s) failed", ad->input_pwd, enc_type); - } -#endif - } else if (ad->cur_enc_mode == 1) { - elm_object_part_text_set(layout, "title", _(Keystr_Decrypting)); - elm_object_part_text_set(layout, "description", _(DECRYPTING_GUIDE_02)); - safeCopyStr(enc_type, "disable", 16); -#if TEMP - if (ode_disable(ad->input_pwd) == 0) { - SETTING_TRACE_DEBUG("ode_disable(%s, %s) success", ad->input_pwd, enc_type); - } else { - SETTING_TRACE_DEBUG("ode_disable(%s, %s) failed", ad->input_pwd, enc_type); - } -#endif - } - - setting_view_security_enc_processing.is_create = 1; - - return SETTING_RETURN_SUCCESS; - -} - -static int setting_security_enc_processing_destroy(void *cb) -{ - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingSecurityUG *ad = (SettingSecurityUG *) cb; - - vconf_ignore_key_changed(VCONFKEY_ODE_ENCRYPT_PROGRESS, __vconf_change_cb); - - if (ad->enc_layout) { - evas_object_del(ad->enc_layout); - ad->enc_layout = NULL; - } - - setting_view_security_enc_processing.is_create = 0; - - return SETTING_RETURN_SUCCESS; -} - -static int setting_security_enc_processing_update(void *cb) -{ - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - return SETTING_RETURN_SUCCESS; -} - -static int setting_security_enc_processing_cleanup(void *cb) -{ - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - setting_security_enc_processing_destroy(cb); - - return SETTING_RETURN_SUCCESS; -} diff --git a/setting-security/src/setting-security-main.c b/setting-security/src/setting-security-main.c deleted file mode 100644 index 1af6df8..0000000 --- a/setting-security/src/setting-security-main.c +++ /dev/null @@ -1,435 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include -#include - -#include -#include -#include -#if SUPPORT_ENCRYPTION -#include -#endif - -static int setting_security_main_create(void *cb); -static int setting_security_main_destroy(void *cb); -static int setting_security_main_update(void *cb); -static int setting_security_main_cleanup(void *cb); - -setting_view setting_view_security_main = { - .create = setting_security_main_create, - .destroy = setting_security_main_destroy, - .update = setting_security_main_update, - .cleanup = setting_security_main_cleanup, -}; - -static Eina_Bool setting_security_main_click_softkey_back_cb(void *data, Elm_Object_Item *it); -static void setting_security_main_mouse_up_Gendial_list_cb(void *data, - Evas_Object *obj, - void *event_info); - -void __security_sub_list_sel_cb(void *data, Evas_Object *obj, void *event_info); - -#define SECURITY_ENGINE_NAME_MAX_LEN 128 - -#define SUPPORT_LOCKTYPE_IN_SECURITY_MENU 0 -/* *************************************************** - ** - **basic func - ** - ****************************************************/ - -static int setting_security_main_create(void *cb) -{ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - SETTING_TRACE_BEGIN; - SettingSecurityUG *ad = (SettingSecurityUG *) cb; - - Evas_Object *scroller; - - int ret = 0; - int value = 0; - int err = 0; - - gboolean b_status = FALSE; - int tapi_ret; - - /* add basic layout */ - char setBtnStr[MAX_DISPLAY_NAME_LEN_ON_UI]; - snprintf(setBtnStr, sizeof(setBtnStr), "%s", - (char *)dgettext("sys_string", "IDS_ST_BUTTON_BACK")); - ad->ly_main = - setting_create_layout_navi_bar_genlist(ad->win_main_layout, - ad->win_get, - KeyStr_LockScreen, - setBtnStr, NULL, - (setting_call_back_func)setting_security_main_click_softkey_back_cb, - NULL, ad, &scroller, - &ad->navi_bar); - - /*setting_enable_expandable_genlist(scroller, ad, __security_exp_cb, NULL); */ - - Elm_Object_Item *item = NULL; - - /* Group List: Lock screen */ - (void)setting_create_Gendial_field_titleItem(scroller, - &itc_group_item, - KeyStr_LockScreen, NULL); - - /* Lockscreen */ - setting_create_Gendial_field_def(scroller, &(ad->itc_1text), - setting_security_main_mouse_up_Gendial_list_cb, ad, - SWALLOW_Type_INVALID, - NULL, NULL, - 0, KeyStr_LockScreen, NULL, NULL); - - /*Security update*/ - app_info_h app_info = NULL; - /* replace deprecated API : - from app_manager_get_app_info() - to app_info_create() */ - ret = app_info_create("org.tizen.msa", &app_info); - if (ret != APP_MANAGER_ERROR_NONE) { - SETTING_TRACE("No corresponding app_id for [%s]\n", "org.tizen.msa"); - } else { - ad->data_security_update = setting_create_Gendial_field_def(scroller, &(ad->itc_1text_1icon), - setting_security_main_mouse_up_Gendial_list_cb, ad, - SWALLOW_Type_INVALID, - NULL, NULL, - value, _(SECURITY_UPDATE_TEXT), NULL, NULL); - - if (app_info_destroy(app_info) != 0) { - SETTING_TRACE_ERROR("app_info_destroy error for org.tizen.msa"); - } - } - - /* update info */ - if (ad->data_sim_settings) { - if ((ad->handle == NULL) || (isEmulBin() == TRUE)) { - setting_disable_genlist_item(ad->data_sim_settings->item); - } else { - ret = setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err); - tapi_ret = tel_check_modem_power_status(ad->handle, &b_status); - if ((tapi_ret != TAPI_API_SUCCESS) - || (b_status != TAPI_PHONE_POWER_STATUS_ON) - || (value != VCONFKEY_TELEPHONY_SIM_INSERTED)) { - setting_disable_genlist_item(ad->data_sim_settings->item); - } - TelSimCardType_t cardInfo; - tapi_ret = tel_get_sim_type(ad->handle, &cardInfo); - if (tapi_ret == TAPI_API_SIM_PERM_BLOCKED) - setting_disable_genlist_item(ad->data_sim_settings->item); - } - - /* If flight mode is ON, can't use sim settings menu */ - int status = 0; - vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &status); - if (status == 1) - setting_disable_genlist_item(ad->data_sim_settings->item); - } - - setting_view_security_main.is_create = 1; - - g_ad = (SettingSecurityUG *) malloc(sizeof(SettingSecurityUG)*1); - retv_if(!g_ad, -1); - memcpy(g_ad, ad, sizeof(SettingSecurityUG)); - - vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE, - setting_security_main_vconf_change_cb, ad); - vconf_notify_key_changed(VCONFKEY_WIFI_STATE, - setting_security_main_vconf_change_cb, ad); - - SETTING_TRACE_END; - return SETTING_RETURN_SUCCESS; -} - -static int setting_security_main_destroy(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingSecurityUG *ad = (SettingSecurityUG *) cb; -#if SUPPORT_ENCRYPTION - if (ad->popup_sd_card_encryption) { - evas_object_del(ad->popup_sd_card_encryption); - ad->popup_sd_card_encryption = NULL; - } -#endif - if (ad->update_view_timer) { - ecore_timer_del(ad->update_view_timer); - ad->update_view_timer = NULL; - } - if (ad->get_security_list_timer) { - ecore_timer_del(ad->get_security_list_timer); - ad->get_security_list_timer = NULL; - } - if (ad->remove_sim_popup_timer) { - ecore_timer_del(ad->remove_sim_popup_timer); - ad->remove_sim_popup_timer = NULL; - } - if (ad->tapi_async_cb_check_timer) { - ecore_timer_del(ad->tapi_async_cb_check_timer); - ad->tapi_async_cb_check_timer = NULL; - } - - vconf_ignore_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE, - setting_security_main_vconf_change_cb); - vconf_ignore_key_changed(VCONFKEY_WIFI_STATE, - setting_security_main_vconf_change_cb); - if (ad->secrity_engine_list) { - g_list_free(ad->secrity_engine_list); - } - if (ad->ly_main != NULL) { - evas_object_del(ad->ly_main); - - FREE(g_ad); - } - - setting_view_security_main.is_create = 0; - - return SETTING_RETURN_SUCCESS; -} - -static int setting_security_main_update(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - SettingSecurityUG *ad = (SettingSecurityUG *) cb; - - evas_object_show(ad->ly_main); - - return SETTING_RETURN_SUCCESS; -} - -static int setting_security_main_cleanup(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - return SETTING_RETURN_SUCCESS; -} - -/* *************************************************** - ** - **call back func - ** - ****************************************************/ -static Eina_Bool -setting_security_main_click_softkey_back_cb(void *data, Elm_Object_Item *it) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retvm_if(data == NULL, EINA_FALSE, "[Setting > Security] Data parameter is NULL"); - - SettingSecurityUG *ad = (SettingSecurityUG *) data; - - bool is_running = 0; - app_manager_is_running("gr47by21a5.SamsungAccount", &is_running); - if (is_running && ad->samsung_account_is_running) { /* If samsung account is running from Find my mobile, security ug can't be destroyed. */ - return EINA_FALSE; - } - if (ad->ug_mt) { /* If find my mobile ug is running, security ug can't be destroyed. */ - return EINA_FALSE; - } - - /* Send destroy request */ - ug_destroy_me(ad->ug); - return EINA_TRUE; -} - -int _handle_sim_exception(void *data, int sim_status) -{ - retv_if(data == NULL, SETTING_RETURN_FAIL); - - SettingSecurityUG *ad = (SettingSecurityUG *) data; - - switch (sim_status) { - case VCONFKEY_TELEPHONY_SIM_INSERTED: - break; - - case VCONFKEY_TELEPHONY_SIM_NOT_PRESENT: - - setting_create_popup(NULL, ad->win_get, - NULL, _(SECURITY_SIM_NOT_PRESENT_MSG), NULL, 0, false, false, 0); - SETTING_TRACE_DEBUG - ("%s*** [ERR] INCORRECTED SIM. sim_slot_type=%d ***%s", - SETTING_FONT_RED, sim_status, SETTING_FONT_BLACK); - return SETTING_RETURN_FAIL; - - break; - - case VCONFKEY_TELEPHONY_SIM_CARD_ERROR: - case VCONFKEY_TELEPHONY_SIM_UNKNOWN: - - setting_create_popup(NULL, ad->win_get, - NULL, _("IDS_SIM_BODY_INVALID_SIM_CARD"), NULL, 0, false, false, 0); - SETTING_TRACE_DEBUG - ("%s*** [ERR] INCORRECTED SIM. sim_slot_type=%d ***%s", - SETTING_FONT_RED, sim_status, SETTING_FONT_BLACK); - return SETTING_RETURN_FAIL; - - break; - default: - break; - } - return SETTING_RETURN_SUCCESS; -} - -static Eina_Bool __remove_sim_popup_cb(void *data) -{ - SETTING_TRACE_BEGIN; - retv_if(data == NULL, EINA_FALSE); - SettingSecurityUG *ad = (SettingSecurityUG *)data; - - if (ad->sim_popup) { - evas_object_del(ad->sim_popup); - ad->sim_popup = NULL; - } - ad->remove_sim_popup_timer = NULL; - return EINA_FALSE; -} - -static Eina_Bool _check_tapi_async_cb_is_called(void *data) -{ - SETTING_TRACE_BEGIN; - retv_if(data == NULL, EINA_FALSE); - - SettingSecurityUG *ad = (SettingSecurityUG *)data; - - if (!ad->enter_tapi_async_cb_flag) { - ad->sim_popup = setting_create_popup(ad, ad->win_get, - NULL, KeyStr_Security_Waiting_Sim, - (setting_call_back_func)__remove_sim_popup_cb, - 0, FALSE, FALSE, 0); - ad->remove_sim_popup_timer = ecore_timer_add(1, __remove_sim_popup_cb, ad); - } - ad->tapi_async_cb_check_timer = NULL; - - return EINA_FALSE; -} - -static Eina_Bool __freeze_event_timer_cb(void *cb) -{ - SETTING_TRACE_BEGIN; - retv_if(cb == NULL, EINA_FALSE); - - SettingSecurityUG *ad = (SettingSecurityUG *)cb; - - evas_object_freeze_events_set(ad->navi_bar, EINA_FALSE); - ad->update_view_timer = NULL; - return EINA_FALSE; -} - -void setting_security_lockscreen_layout_ug_cb(ui_gadget_h ug, - enum ug_mode mode, - void *priv) -{ - SETTING_TRACE_BEGIN; - Evas_Object *base; - - if (!priv) - return; - - base = (Evas_Object *) ug_get_layout(ug); - if (!base) - return; - - switch (mode) { - case UG_MODE_FULLVIEW: - evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - evas_object_show(base); - break; - default: - break; - } - SETTING_TRACE_END; -} - -static void setting_security_lockscreen_destroy_ug_cb(ui_gadget_h ug, void *priv) -{ - SETTING_TRACE_BEGIN; - ret_if(priv == NULL); - SettingSecurityUG *ad = (SettingSecurityUG *) priv; - if (ug) { - setting_ug_destroy(ug); - } - elm_genlist_realized_items_update(ad->genlist); -} - -static void -setting_security_main_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - setting_retm_if(data == NULL, "Data parameter is NULL"); - - retm_if(event_info == NULL, "Invalid argument: event info is NULL"); - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - elm_genlist_item_selected_set(item, 0); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) elm_object_item_data_get(item); - setting_retm_if(NULL == list_item, "list_item is NULL"); - - SettingSecurityUG *ad = (SettingSecurityUG *) data; - - SETTING_TRACE("clicking item[%s]", _(list_item->keyStr)); - - if (!safeStrCmp(KeyStr_LockScreen, list_item->keyStr)) { -#if 1 - if (0 == app_launcher("lockscreen-options")) { - //if (0 == app_launcher("setting-lockscreen-options-efl")) { - ad->update_view_timer = ecore_timer_add(1, __freeze_event_timer_cb, ad); - evas_object_freeze_events_set(ad->navi_bar, EINA_TRUE); - } -#else - retm_if(data == NULL, "Data parameter is NULL"); - - SettingSecurityUG *ad = (SettingSecurityUG *) data; - - struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs)); - setting_retm_if(!cbs, "calloc failed"); - cbs->layout_cb = setting_security_lockscreen_layout_ug_cb; - cbs->result_cb = NULL; - cbs->destroy_cb = setting_security_lockscreen_destroy_ug_cb; - cbs->priv = (void *)ad; - - elm_object_tree_focus_allow_set(ad->ly_main, EINA_FALSE); - - SETTING_TRACE("To load ug[%s]", "lockscreen-options"); - setting_ug_create(ad->ug, "lockscreen-options", UG_MODE_FULLVIEW, NULL, cbs); - FREE(cbs); -#endif - } -} - -void setting_security_main_vconf_change_cb(keynode_t *key, void *data) -{ - SETTING_TRACE_BEGIN; - /*ret_if(NULL == data); */ - /*SettingSecurityUG *ad = (SettingSecurityUG *) data; */ -} diff --git a/setting-security/src/setting-security-sim-settings.c b/setting-security/src/setting-security-sim-settings.c deleted file mode 100644 index 5db9c31..0000000 --- a/setting-security/src/setting-security-sim-settings.c +++ /dev/null @@ -1,563 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include -#include -#include -#include - -#include -#include -#include - -static int setting_security_sim_settings_create(void *cb); -static int setting_security_sim_settings_destroy(void *cb); -static int setting_security_sim_settings_update(void *cb); -static int setting_security_sim_settings_cleanup(void *cb); - -setting_view setting_view_security_sim_settings = { - .create = setting_security_sim_settings_create, - .destroy = setting_security_sim_settings_destroy, - .update = setting_security_sim_settings_update, - .cleanup = setting_security_sim_settings_cleanup, -}; - -/* *************************************************** - ** - **basic func - ** - ****************************************************/ - -static int setting_security_sim_settings_create(void *cb) -{ - SETTING_TRACE_BEGIN; - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingSecurityUG *ad = (SettingSecurityUG *) cb; - - Evas_Object *scroller; - Elm_Object_Item *item = NULL; - - /* add basic layout */ - setting_push_layout_navi_bar_genlist(ad->win_main_layout, - ad->win_get, - SECURITY_SIM_SETTINGS, - _("IDS_ST_BUTTON_BACK"), NULL, - (setting_call_back_func)setting_security_sim_settings_click_softkey_back_cb, - NULL, ad, &scroller, ad->navi_bar); - - evas_object_smart_callback_add(scroller, "realized", __gl_realized_cb, NULL); - - /* separator */ - item = elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - - /* to do : sim settings menu */ - /* g. pin lock */ - /*if TAPI is responsed in time, ad->sim_status will have invalid value, */ - /*or else ad->data_pin_lk will be updated by setting_security_sim_get_facility_cb */ - ad->data_pin_lk = setting_create_Gendial_field_def(scroller, &itc_1text_1icon, - setting_security_sim_settings_mouse_up_Gendial_list_cb, ad, - SWALLOW_Type_1ICON_1RADIO, - NULL, NULL, - ad->pin1_status, "IDS_ST_BODY_PIN_LOCK", NULL, setting_security_sim_settings_chk_btn_cb); - if (ad->data_pin_lk) { - ad->data_pin_lk->userdata = ad; - } - /* h. change pin1 */ - ad->data_change_pin1 = setting_create_Gendial_field_def(scroller, &(ad->itc_1text), - setting_security_sim_settings_mouse_up_Gendial_list_cb, ad, - SWALLOW_Type_INVALID, - NULL, NULL, - 0, "IDS_ST_HEADER_CHANGE_PIN_ABB", NULL, NULL); - - if (ad->data_change_pin1) { - ad->data_change_pin1->userdata = ad; - } - - if (!ad->pin1_status) { - if (ad->data_change_pin1) { - setting_disable_genlist_item(ad->data_change_pin1->item); - } - } - - /* i. change pin2 */ - if (ad->pin2_blocked_flag) { - ad->data_change_pin2 = setting_create_Gendial_field_def(scroller, &(ad->itc_1text), - setting_security_sim_settings_mouse_up_Gendial_list_cb, ad, - SWALLOW_Type_INVALID, - NULL, NULL, - 0, "IDS_CST_BODY_UNBLOCK_PIN2", NULL, NULL); - } else { - ad->data_change_pin2 = setting_create_Gendial_field_def(scroller, &(ad->itc_1text), - setting_security_sim_settings_mouse_up_Gendial_list_cb, ad, - SWALLOW_Type_INVALID, - NULL, NULL, - 0, "IDS_ST_BODY_CHANGE_PIN2", NULL, NULL); - } - - if (ad->data_change_pin2) { - ad->data_change_pin2->userdata = ad; - } - -#if SUPPORT_FDN - /* j. FDN */ - /*if TAPI is responsed in time, ad->sim_status will have invalid value, */ - /*or else ad->data_fdn will be updated by setting_security_sim_get_facility_cb */ - ad->data_fdn = setting_create_Gendial_field_def(scroller, &(ad->itc_1text_1icon), - setting_security_sim_settings_mouse_up_Gendial_list_cb, ad, - SWALLOW_Type_1TOGGLE, - NULL, NULL, - ad->pin2_status, Keystr_FDN, NULL, setting_security_sim_settings_chk_btn_cb); - if (ad->data_fdn) - ad->data_fdn->userdata = ad; -#endif - - evas_object_smart_callback_add(scroller, "realized", __gl_realized_cb, ad); - - setting_view_security_sim_settings.is_create = 1; - - return SETTING_RETURN_SUCCESS; - -} - -static int setting_security_sim_settings_destroy(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingSecurityUG *ad = (SettingSecurityUG *) cb; - if (ad->tapi_async_cb_check_timer) { - ecore_timer_del(ad->tapi_async_cb_check_timer); - ad->tapi_async_cb_check_timer = NULL; - } - /*elm_naviframe_item_pop(ad->navi_bar); */ - - setting_view_security_sim_settings.is_create = 0; - - return SETTING_RETURN_SUCCESS; -} - -static int setting_security_sim_settings_update(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingSecurityUG *ad = (SettingSecurityUG *) cb; - SETTING_TRACE("Update PIN menu"); - if (ad->data_pin_lk) { /*it indicates TAPI is not responsed in time */ - /*setting_update_gl_item_chk_status(ad->data_pin_lk, ad->pin1_status); */ - ad->data_pin_lk->chk_status = ad->pin1_status; - elm_genlist_item_fields_update(ad->data_pin_lk->item, "*", ELM_GENLIST_ITEM_FIELD_CONTENT); - - if (ad->data_pin_lk->chk_status == 0) - setting_disable_genlist_item(ad->data_change_pin1->item); - else - setting_enable_genlist_item(ad->data_change_pin1->item); - } - - if (ad->data_change_pin2 && ad->data_change_pin2->item) { - if (ad->pin2_blocked_flag) { - if (!safeStrCmp(ad->data_change_pin2->keyStr, "IDS_ST_BODY_CHANGE_PIN2")) { - ad->data_change_pin2->keyStr = (char *)g_strdup("IDS_CST_BODY_UNBLOCK_PIN2"); - elm_object_item_data_set(ad->data_change_pin2->item, ad->data_change_pin2); - elm_genlist_item_update(ad->data_change_pin2->item); - } - } else { - if (!safeStrCmp(ad->data_change_pin2->keyStr, "IDS_CST_BODY_UNBLOCK_PIN2")) { - ad->data_change_pin2->keyStr = (char *)g_strdup("IDS_ST_BODY_CHANGE_PIN2"); - elm_object_item_data_set(ad->data_change_pin2->item, ad->data_change_pin2); - elm_genlist_item_update(ad->data_change_pin2->item); - } - } - } - - return SETTING_RETURN_SUCCESS; -} - -static int setting_security_sim_settings_cleanup(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingSecurityUG *ad = (SettingSecurityUG *) cb; - return setting_security_sim_settings_destroy(ad); -} - -/* *************************************************** - ** - **call back func - ** - ****************************************************/ - -static void get_pin_lock_info_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - - TelSimPinOperationResult_t sec_rt = result; - TelSimLockInfo_t *lock = data; - - SettingSecurityUG *ad = (SettingSecurityUG *)user_data; - - /* delete popup */ - if (ad->sim_popup) { - evas_object_del(ad->sim_popup); - ad->sim_popup = NULL; - } - ad->enter_tapi_async_cb_flag = 1; - - int old_state = ad->data_pin_lk->chk_status;/*elm_check_state_get(ad->data_pin_lk->eo_check); */ - if (old_state) { - SETTING_TRACE("Current status of PIN Lock is ON"); - ad->pw_type = SETTING_SEC_PW_PIN_LOCK_OFF; - } else { - SETTING_TRACE("Current status of PIN Lock is OFF"); - ad->pw_type = SETTING_SEC_PW_PIN_LOCK_ON; - } - - SETTING_TRACE_DEBUG("sec_ret[%d], lock_type[%d], lock_status[%d], retry_count[%d]", sec_rt, lock->lock_type, lock->lock_status, lock->retry_count); - if (lock->lock_status == 2) { /* PUK */ - SETTING_TRACE("Current status of PIN Lock is Blocked"); - ad->pw_type = SETTING_SEC_PW_PIN1_BLOCKED; - } else if (lock->lock_status == 5) { /* Blocked */ - setting_create_popup(NULL, ad->win_get, - NULL, _("PUK is blocked. Can't use PIN Lock"), NULL, 0, false, false, 0); - return; - } - - setting_security_create_password_sg(ad); -} - -static Eina_Bool _check_tapi_async_cb_is_called(void *data) -{ - SETTING_TRACE_BEGIN; - retv_if(data == NULL, EINA_FALSE); - - SettingSecurityUG *ad = (SettingSecurityUG *)data; - - if (!ad->enter_tapi_async_cb_flag) { - ad->sim_popup = setting_create_popup(ad, ad->win_get, - NULL, KeyStr_Security_Waiting_Sim, - NULL, - 0, TRUE, TRUE, 0); - } - ad->tapi_async_cb_check_timer = NULL; - - return EINA_FALSE; -} - -void _draw_pin_onoff_status(void *data, Evas_Object *check) -{ - SETTING_TRACE("PIN Lock"); - - ret_if(data == NULL); - - SettingSecurityUG *ad = (SettingSecurityUG *) data; - int value = 0; - int err = 0; - int ret = 0; - - ad->sel_item = 0; /* 0:click pin lock, 1:change pin1 code, 2:fdn, 3: change pin2 code */ - - ret = setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err); - - ret = _handle_sim_exception(ad, value); - if (ret == SETTING_RETURN_FAIL) - return; - - /* check sim status */ - int tapi_ret = TAPI_API_INVALID_INPUT; - TelSimCardType_t sim_card = TAPI_SIM_CARD_TYPE_UNKNOWN; - - tapi_ret = tel_get_sim_type(ad->handle, &sim_card); - if (tapi_ret != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("tel_get_sim_type call failed with error code %d", tapi_ret); - return; - } - SETTING_TRACE("SIM Type is %d", (int)sim_card); - if (sim_card == (TelSimCardType_t) TAPI_SIM_CARD_TYPE_UNKNOWN) { - SETTING_TRACE_DEBUG - ("%s*** [ERR] tel_get_sim_type. sim_card=%d ***%s", - SETTING_FONT_RED, sim_card, SETTING_FONT_BLACK); - setting_create_popup(NULL, ad->win_get, - NULL, _("IDS_SIM_BODY_INVALID_SIM_CARD"), NULL, 0, false, false, 0); - return; - } - - ad->enter_tapi_async_cb_flag = 0; - ad->sim_popup = NULL; - ad->tapi_async_cb_check_timer = ecore_timer_add(0.5, _check_tapi_async_cb_is_called, ad); - - if (tel_get_sim_lock_info(ad->handle, TAPI_SIM_LOCK_SC, get_pin_lock_info_cb, ad) != 0) { - SETTING_TRACE_ERROR("failed to call tel_get_sim_lock_info()"); - } -} - -static void get_sim_lock_info_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - ret_if(data == NULL || user_data == NULL); - - TelSimPinOperationResult_t sec_rt = result; - TelSimLockInfo_t *lock = data; - - SettingSecurityUG *ad = (SettingSecurityUG *)user_data; - - /* delete popup */ - if (ad->sim_popup) { - evas_object_del(ad->sim_popup); - ad->sim_popup = NULL; - } - - int old_state = ad->data_sim_lk->chk_status;/*elm_check_state_get(ad->data_sim_lk->eo_check); */ - if (old_state) { - SETTING_TRACE("Current status of SIM Lock is ON"); - ad->pw_type = SETTING_SEC_PW_SIM_LOCK_OFF; - } else { - SETTING_TRACE("Current status of SIM Lock is OFF"); - ad->pw_type = SETTING_SEC_PW_SIM_LOCK_ON; - } - - SETTING_TRACE_DEBUG("sec_ret[%d], lock_type[%d], lock_status[%d], retry_count[%d]", sec_rt, lock->lock_type, lock->lock_status, lock->retry_count); - - if (lock->lock_status == 5) { /* Blocked */ - setting_create_popup(NULL, ad->win_get, - NULL, _("SIM is blocked. Can't use SIM Lock"), NULL, 0, false, false, 0); - return; - } - - setting_security_create_password_sg(ad); -} - -void _draw_sim_onoff_status(void *data, Evas_Object *check) -{ - ret_if(data == NULL); - - SettingSecurityUG *ad = (SettingSecurityUG *) data; - int value = 0; - int err = 0; - int ret = 0; - - ret = setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err); - ret = _handle_sim_exception(ad, value); - if (ret == SETTING_RETURN_FAIL) - return; - - /* create popup */ - if (ad->sim_popup) { - evas_object_del(ad->sim_popup); - ad->sim_popup = NULL; - } - ad->sim_popup = setting_create_popup(ad, ad->win_get, - NULL, KeyStr_Security_Waiting_Sim, - NULL, - 0, FALSE, FALSE, 0); - - if (tel_get_sim_lock_info(ad->handle, TAPI_SIM_LOCK_PS, get_sim_lock_info_cb, ad) != 0) { - SETTING_TRACE_ERROR("failed to call tel_get_sim_lock_info()"); - } -} - -static void get_change_pin_info_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - ret_if(data == NULL || user_data == NULL); - - TelSimPinOperationResult_t sec_rt = result; - TelSimLockInfo_t *lock = data; - - SettingSecurityUG *ad = (SettingSecurityUG *)user_data; - - SETTING_TRACE_DEBUG("sec_ret[%d], lock_type[%d], lock_status[%d], retry_count[%d]", sec_rt, lock->lock_type, lock->lock_status, lock->retry_count); - if (lock->lock_type == TAPI_SIM_LOCK_SC && lock->lock_status == TAPI_SIM_LOCK_KEY_PUK) { /* PUK required : 0x02*/ - SETTING_TRACE("Current status of PIN Lock is Blocked"); - ad->pw_type = SETTING_SEC_PW_PIN1_BLOCKED; - } else if (lock->lock_type == TAPI_SIM_LOCK_SC && - (lock->lock_status == TAPI_SIM_LOCK_KEY_NOT_NEED || lock->lock_status == TAPI_SIM_LOCK_KEY_PIN)) { /* PIN required : 0x00, 0x01 */ - ad->pw_type = SETTING_SEC_PW_CHANGE_PIN1; - } else if (lock->lock_type == TAPI_SIM_LOCK_FD && lock->lock_status == TAPI_SIM_LOCK_KEY_PUK2) { /* PUK2 required : 0x04 */ - SETTING_TRACE("Current status of Change PIN2 is Blocked"); - ad->pw_type = SETTING_SEC_PW_PIN2_BLOCKED; - } else if (lock->lock_type == TAPI_SIM_LOCK_FD && - (lock->lock_status == TAPI_SIM_LOCK_KEY_NOT_NEED || lock->lock_status == TAPI_SIM_LOCK_KEY_PIN2)) { /* PIN2 required : 0x00, 0x03 */ - ad->pw_type = SETTING_SEC_PW_CHANGE_PIN2; - } else if (lock->lock_status == TAPI_SIM_LOCK_PERM_BLOCKED) { /* Blocked : 0x05 */ - setting_create_popup(NULL, ad->win_get, - NULL, _("Permanent block SIM"), NULL, 0, false, false, 0); - return; - } - - setting_security_create_password_sg(ad); -} - -void _mouse_up_change_pin(void *data, int sel_item) -{ - ret_if(data == NULL); - - SettingSecurityUG *ad = (SettingSecurityUG *) data; - - ad->sel_item = sel_item; /* 0:click pin lock, 1:change pin1 code, 2:fdn, 3: change pin2 code */ - int ret; - int value = 0; - int err; - - ret = setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err); - setting_retm_if(ret != 0, "failed to read vconf value"); - switch (value) { - case VCONFKEY_TELEPHONY_SIM_INSERTED: - break; - case VCONFKEY_TELEPHONY_SIM_NOT_PRESENT: - setting_create_popup(NULL, ad->win_get, - NULL, _(SECURITY_SIM_NOT_PRESENT_MSG), NULL, 0, false, false, 0); - SETTING_TRACE_DEBUG - ("%s*** [ERR] INCORRECTED SIM. sim_slot_type=%d ***%s", - SETTING_FONT_RED, value, SETTING_FONT_BLACK); - return; - break; - case VCONFKEY_TELEPHONY_SIM_CARD_ERROR: - case VCONFKEY_TELEPHONY_SIM_UNKNOWN: - setting_create_popup(NULL, ad->win_get, - NULL, _("IDS_SIM_BODY_INVALID_SIM_CARD"), NULL, 0, false, false, 0); - SETTING_TRACE_DEBUG - ("%s*** [ERR] INCORRECTED SIM. sim_slot_type=%d ***%s", - SETTING_FONT_RED, value, SETTING_FONT_BLACK); - return; - break; - default: - break; - } - - /* check sim status */ - TapiResult_t tapi_ret = TAPI_API_INVALID_INPUT; - TelSimCardType_t sim_card = TAPI_SIM_CARD_TYPE_UNKNOWN; - - tapi_ret = tel_get_sim_type(ad->handle, &sim_card); - if (tapi_ret != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("tel_get_sim_type call failed with error code %d", tapi_ret); - return; - } - if (sim_card == (TelSimCardType_t) SETTING_TAPI_UNKNOWN_SIM_TYPE) { - SETTING_TRACE_DEBUG - ("%s*** [ERR] tel_get_sim_type. sim_card=%d ***%s", - SETTING_FONT_RED, sim_card, SETTING_FONT_BLACK); - setting_create_popup(NULL, ad->win_get, - NULL, _("IDS_SIM_BODY_INVALID_SIM_CARD"), NULL, 0, false, false, 0); - return; - } - if (sel_item == 1 && (ad->pin1_status == TAPI_SIM_FACILITY_ENABLED)) { - if (tel_get_sim_lock_info(ad->handle, TAPI_SIM_LOCK_SC, get_change_pin_info_cb, ad) != 0) { - SETTING_TRACE_ERROR("failed to call tel_get_sim_lock_info()"); - } - } else if (sel_item == 3) { - if (tel_get_sim_lock_info(ad->handle, TAPI_SIM_LOCK_FD, get_change_pin_info_cb, ad) != 0) { - SETTING_TRACE_ERROR("failed to call tel_get_sim_lock_info()"); - } - /*ad->pw_type = SETTING_SEC_PW_CHANGE_PIN2; */ - /*setting_security_create_password_sg(ad); */ - } -} - -static void -setting_security_sim_settings_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - setting_retm_if(data == NULL, "Data parameter is NULL"); - - retm_if(event_info == NULL, "Invalid argument: event info is NULL"); - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - elm_genlist_item_selected_set(item, 0); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) elm_object_item_data_get(item); - setting_retm_if(NULL == list_item, "list_item is NULL"); - - SettingSecurityUG *ad = (SettingSecurityUG *) data; - - SETTING_TRACE("clicking item[%s]", _(list_item->keyStr)); - if (!safeStrCmp("IDS_ST_BODY_PIN_LOCK", list_item->keyStr)) { - _draw_pin_onoff_status(ad, list_item->eo_check); - - } else if (!safeStrCmp("IDS_ST_HEADER_CHANGE_PIN_ABB", list_item->keyStr)) { - _mouse_up_change_pin(ad, 1); /* 0:click pin lock, 1:change pin1 code, 2:fdn, 3: change pin2 code */ - } else if (!safeStrCmp("IDS_ST_BODY_CHANGE_PIN2", list_item->keyStr)) { - _mouse_up_change_pin(ad, 3); /* 0:click pin lock, 1:change pin1 code, 2:fdn, 3: change pin2 code */ - } else if (!safeStrCmp("IDS_CST_BODY_UNBLOCK_PIN2", list_item->keyStr)) { - ad->pw_type = SETTING_SEC_PW_PIN2_BLOCKED; - setting_security_create_password_sg(ad); - } -} - -static void -setting_security_sim_settings_chk_btn_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(data == NULL, "[Setting > Reset] Data parameter is NULL"); - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data; - SettingSecurityUG *ad = list_item->userdata; - - list_item->chk_status = elm_check_state_get(obj); /* for genlist update status */ - if (!safeStrCmp("IDS_ST_BODY_PIN_LOCK", list_item->keyStr)) { - /*Rollback state of toggle. */ - /*it invokes async TAPIs to enable/disable, so don't change the status at first to avoid rollback */ - /*setting_update_gl_item_chk_status(list_item, !(list_item->chk_status)); */ - list_item->chk_status = !(list_item->chk_status); - _draw_pin_onoff_status(ad, obj); - - } -#if SUPPORT_FDN - else if (!safeStrCmp(Keystr_FDN, list_item->keyStr)) { - /*Rollback state of toggle. */ - /*it invokes async TAPIs to enable/disable, so don't change the status at first to avoid rollback */ - setting_update_gl_item_chk_status(list_item, !(list_item->chk_status)); - ad->chk_fdn = obj; - _draw_fdn_onoff_status(ad, obj); - } -#endif -} - - -/*static void */ -/*setting_security_sim_settings_click_softkey_back_cb(void *data, Evas_Object *obj, */ -/* void *event_info) */ -Eina_Bool setting_security_sim_settings_click_softkey_back_cb(void *data, Elm_Object_Item *it) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(data == NULL, EINA_FALSE); - - SettingSecurityUG *ad = (SettingSecurityUG *) data; - if (ad->ug_passwd) - return EINA_FALSE; - - if (ad->sim_popup) { - return EINA_FALSE; - } - - setting_view_change(&setting_view_security_sim_settings, &setting_view_security_main, ad); - - return EINA_TRUE; - SETTING_TRACE_END; -} diff --git a/setting-security/src/setting-security-update.c b/setting-security/src/setting-security-update.c deleted file mode 100644 index a09d1fa..0000000 --- a/setting-security/src/setting-security-update.c +++ /dev/null @@ -1,759 +0,0 @@ -/* - * setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include -#include - -#include -#include -#include - -static int setting_view_security_update_create(void *cb); -static int setting_view_security_update_destroy(void *cb); -static int setting_view_security_update_update(void *cb); -static int setting_view_security_update_cleanup(void *cb); - -static Eina_Bool setting_security_update_click_softkey_back_cb(void *data, Evas_Object *obj, void *event_info); -static void setting_security_update_mouse_up_Gendial_chk_cb(void *data, Evas_Object *obj, void *event_info); -static void setting_security_update_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj, void *event_info); -static void __get_toggle_status_form_msa(void *data); -/*static void __get_toggle_status_form_msa_wifi_only(void *data); */ -static void setting_security_update_gl_item_chk_status(Setting_GenGroupItem_Data *item_data, int status); - - - -setting_view setting_view_security_update = { - .create = setting_view_security_update_create, - .destroy = setting_view_security_update_destroy, - .update = setting_view_security_update_update, - .cleanup = setting_view_security_update_cleanup, -}; - - -/* *************************************************** - ** - **basic func - ** - ****************************************************/ -static int setting_view_security_update_create(void *cb) -{ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - SETTING_TRACE_BEGIN; - SettingSecurityUG *ad = (SettingSecurityUG *) cb; - - Evas_Object *scroller; - Elm_Object_Item *item = NULL; - - /* add basic layout */ - char setBtnStr[MAX_DISPLAY_NAME_LEN_ON_UI]; - snprintf(setBtnStr, sizeof(setBtnStr), "%s", - (char *)dgettext("sys_string", "IDS_ST_BUTTON_BACK")); - - if (&setting_view_security_update == ad->view_to_load) { - ad->ly_main = - setting_create_layout_navi_bar_genlist(ad->win_main_layout, - ad->win_get, - "IDS_EMAIL_POP_SECURITY_UPDATE_ABB", - setBtnStr, - NULL, - (setting_call_back_func)setting_security_update_click_softkey_back_cb, - NULL, ad, &scroller, - &(ad->navi_bar)); - } else { - - setting_push_layout_navi_bar_genlist(ad->win_main_layout, - ad->win_get, - "IDS_EMAIL_POP_SECURITY_UPDATE_ABB", - setBtnStr, NULL, - (setting_call_back_func)setting_security_update_click_softkey_back_cb, - NULL, ad, &scroller, ad->navi_bar); - } - - ad->genlist = scroller; - evas_object_smart_callback_add(ad->genlist, "realized", __gl_realized_cb, ad); - - /* separator */ - item = elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - - - /* Update button */ - ad->data_security_update_bt = setting_create_Gendial_field_def(scroller, &(ad->itc_1text_1icon), - setting_security_update_mouse_up_Gendial_list_cb, ad, - SWALLOW_Type_INVALID, - NULL, NULL, - 1, _(UPDATE_TEXT), NULL, NULL); - if (ad->data_security_update_bt) { - __BACK_POINTER_SET(ad->data_security_update_bt); - } - /* Update button desc*/ - /*D_GL_HELP(scroller,CHECK_UPDATES); */ - /* separator */ - item = elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - /*button with toggle*/ - ad->data_security_update_chk = - setting_create_Gendial_field_def(scroller, &itc_1text_1icon, - setting_security_update_mouse_up_Gendial_list_cb, - ad, SWALLOW_Type_1ICON_1RADIO, NULL, - NULL, 1, - _(AUTO_UPDATE), - NULL, - setting_security_update_mouse_up_Gendial_chk_cb); - if (ad->data_security_update_chk) { - __BACK_POINTER_SET(ad->data_security_update_chk); - ad->data_security_update_chk->userdata = ad; - } else { - SETTING_TRACE_ERROR("ad->data_security_update_chk is NULL"); - } - ADD_GL_HELP(scroller, CHECK_UPDATE_AUTO_MSG); - - /* separator */ - item = elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - - /*via wifi only*/ - ad->data_security_wifi_update_chk = - setting_create_Gendial_field_def(scroller, &itc_1text_1icon, - setting_security_update_mouse_up_Gendial_list_cb, - ad, SWALLOW_Type_1ICON_1RADIO, NULL, - NULL, 1, - _(SECURITY_VIA_WIFI), - NULL, - setting_security_update_mouse_up_Gendial_chk_cb); - if (ad->data_security_wifi_update_chk) { - __BACK_POINTER_SET(ad->data_security_wifi_update_chk); - ad->data_security_wifi_update_chk->userdata = ad; - } else { - SETTING_TRACE_ERROR("ad->data_security_update_chk is NULL"); - } - ADD_GL_HELP(scroller, SECURITY_VIA_WIFI_HELP_MSG); - - /*get auto update & via wifi value */ - __get_toggle_status_form_msa(cb); - - setting_view_security_update.is_create = 1; - return SETTING_RETURN_SUCCESS; -} - -static int setting_view_security_update_destroy(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - SettingSecurityUG *ad = (SettingSecurityUG *) cb; - if (&setting_view_security_update == ad->view_to_load) { - if (ad->ly_main) { - evas_object_del(ad->ly_main); - ad->ly_main = NULL; - } - } else { - elm_naviframe_item_pop(ad->navi_bar); - } - - /*evas_object_smart_callback_del(ad->genlist, "realized", __gl_realized_cb); */ - - setting_view_security_update.is_create = 0; - - return SETTING_RETURN_SUCCESS; -} - -static int setting_view_security_update_update(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - - return SETTING_RETURN_SUCCESS; -} - -static int setting_view_security_update_cleanup(void *cb) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); - SettingSecurityUG *ad = (SettingSecurityUG *) cb; - return setting_view_security_update_destroy(ad); - /*return SETTING_RETURN_SUCCESS; */ -} - -/* *************************************************** - ** - **call back func - ** - ****************************************************/ -static Eina_Bool -setting_security_update_click_softkey_back_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retvm_if(data == NULL, EINA_FALSE, "[Setting > Security update] Data parameter is NULL"); - SettingSecurityUG *ad = (SettingSecurityUG *) data; - if (&setting_view_security_update == ad->view_to_load) { - /* Send destroy request */ - ug_destroy_me(ad->ug); - } else - setting_view_change(&setting_view_security_update, &setting_view_security_main, ad); - SETTING_TRACE_END; - return EINA_TRUE; -} - -static void setting_security_update_gl_item_chk_status(Setting_GenGroupItem_Data *item_data, int status) -{ - SETTING_TRACE_BEGIN; - if (item_data && item_data->chk_status != status) { - item_data->chk_status = status; - elm_genlist_item_update(item_data->item); - } - SETTING_TRACE_END; -} - -static void security_update_get_status_service_reply_cb(app_control_h request, - app_control_h reply, - app_control_result_e result, - void *user_data) -{ - SETTING_TRACE_BEGIN; - retm_if(request == NULL, "request is NULL"); - retm_if(reply == NULL, "reply is NULL"); - SettingSecurityUG *ad = (SettingSecurityUG *)user_data; - char *resultMsa = NULL; - - SETTING_TRACE_DEBUG("result:[%d]", result); - - if (result == APP_CONTROL_RESULT_SUCCEEDED) { - SETTING_TRACE_DEBUG("APP_CONTROL_RESULT_SUCCEEDED"); - /*for auto update value */ - app_control_get_extra_data(reply, "AUTO", &resultMsa); - SETTING_TRACE_DEBUG("resultCode:[%s]", resultMsa); - if (!safeStrCmp(_("AUTO_ON"), resultMsa)) { - SETTING_TRACE_DEBUG("auto update - on"); - setting_security_update_gl_item_chk_status(ad->data_security_update_chk, 1); - if (ad->data_security_wifi_update_chk) { - elm_object_item_disabled_set(ad->data_security_wifi_update_chk->item, EINA_FALSE); - } - } else if (!safeStrCmp(_("AUTO_OFF"), resultMsa)) { - SETTING_TRACE_DEBUG("auto update - off"); - setting_security_update_gl_item_chk_status(ad->data_security_update_chk, 0); - if (ad->data_security_wifi_update_chk) { - elm_object_item_disabled_set(ad->data_security_wifi_update_chk->item, EINA_TRUE); - } - } - FREE(resultMsa); - /*for via wifi value */ - app_control_get_extra_data(reply, "WIFI", &resultMsa); - SETTING_TRACE_DEBUG("resultCode:[%s]", resultMsa); - if (!safeStrCmp(_("WIFI_ON"), resultMsa)) { - SETTING_TRACE_DEBUG(" wifi only - on"); - setting_security_update_gl_item_chk_status(ad->data_security_wifi_update_chk, 1); - } else if (!safeStrCmp(_("WIFI_OFF"), resultMsa)) { - SETTING_TRACE_DEBUG("wifi only - off"); - setting_security_update_gl_item_chk_status(ad->data_security_wifi_update_chk, 0); - } - FREE(resultMsa); - } else if (result == APP_CONTROL_RESULT_FAILED) { - SETTING_TRACE_DEBUG("APP_CONTROL_RESULT_FAILED"); - } else if (result == APP_CONTROL_RESULT_CANCELED) { - SETTING_TRACE_DEBUG("APP_CONTROL_RESULT_CANCELED"); - } - - return; -} - -static void __get_toggle_status_form_msa(void *data) -{ - SETTING_TRACE_BEGIN; - ret_if(NULL == data); - - int ret = 0; - app_control_h service = NULL; - - ret = app_control_create(&service); - if (ret != APP_CONTROL_ERROR_NONE) { - SETTING_TRACE_DEBUG("service_create fail!! ret=%d", ret); - return; - } - - app_control_set_app_id(service, "org.tizen.msa"); - app_control_set_operation(service, "http://org.tizen.msa/appcontrol/operation/query"); - - ret = app_control_add_extra_data(service, "KEY", "STATUS"); - SETTING_TRACE_DEBUG("add extra data (KEY,STATUS) to service ret=%d", ret); - - ret = app_control_send_launch_request(service, security_update_get_status_service_reply_cb, (void *)data); - SETTING_TRACE_DEBUG("send launch service (KEY,STATUS) request ret=%d", ret); - if (ret != APP_CONTROL_ERROR_NONE) { - SETTING_TRACE_ERROR("Cannot launch app"); - } - app_control_destroy(service); -} - -static void security_update_on_service_reply_cb(app_control_h request, - app_control_h reply, - app_control_result_e result, - void *user_data) -{ - SETTING_TRACE_BEGIN; - retm_if(request == NULL, "request is NULL"); - retm_if(reply == NULL, "reply is NULL"); - retm_if(user_data == NULL, "user_data is NULL"); - SettingSecurityUG *ad = (SettingSecurityUG *) user_data; - - SETTING_TRACE_DEBUG("result:[%d]", result); - - if (result == APP_CONTROL_RESULT_SUCCEEDED) { - SETTING_TRACE_DEBUG("APP_CONTROL_RESULT_SUCCEEDED"); - setting_update_gl_item_chk_status(ad->data_security_update_chk, 1); - } else if (result == APP_CONTROL_RESULT_FAILED) { - SETTING_TRACE_DEBUG("APP_CONTROL_RESULT_FAILED"); - setting_update_gl_item_chk_status(ad->data_security_update_chk, 0); - } else if (result == APP_CONTROL_RESULT_CANCELED) { - SETTING_TRACE_DEBUG("APP_CONTROL_RESULT_CANCELED"); - setting_update_gl_item_chk_status(ad->data_security_update_chk, 0); - } - return; -} - -static void security_update_off_service_reply_cb(app_control_h request, - app_control_h reply, - app_control_result_e result, - void *user_data) -{ - SETTING_TRACE_BEGIN; - retm_if(request == NULL, "request is NULL"); - retm_if(reply == NULL, "reply is NULL"); - retm_if(user_data == NULL, "user_data is NULL"); - SettingSecurityUG *ad = (SettingSecurityUG *) user_data; - - SETTING_TRACE_DEBUG("result:[%d]", result); - - if (result == APP_CONTROL_RESULT_SUCCEEDED) { - SETTING_TRACE_DEBUG("APP_CONTROL_RESULT_SUCCEEDED"); - setting_update_gl_item_chk_status(ad->data_security_update_chk, 0); - if (ad->data_security_wifi_update_chk) { - elm_object_item_disabled_set(ad->data_security_wifi_update_chk->item, EINA_TRUE); - elm_object_disabled_set(ad->data_security_wifi_update_chk->eo_check, EINA_TRUE); - } - } else if (result == APP_CONTROL_RESULT_FAILED) { - SETTING_TRACE_DEBUG("APP_CONTROL_RESULT_FAILED"); - setting_update_gl_item_chk_status(ad->data_security_update_chk, 1); - } else if (result == APP_CONTROL_RESULT_CANCELED) { - SETTING_TRACE_DEBUG("APP_CONTROL_RESULT_CANCELED"); - setting_update_gl_item_chk_status(ad->data_security_update_chk, 1); - } - return; -} - -static void security_wifi_update_on_service_reply_cb(app_control_h request, - app_control_h reply, - app_control_result_e result, - void *user_data) -{ - SETTING_TRACE_BEGIN; - retm_if(request == NULL, "request is NULL"); - retm_if(reply == NULL, "reply is NULL"); - retm_if(user_data == NULL, "user_data is NULL"); - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) user_data; - - SETTING_TRACE_DEBUG("result:[%d]", result); - - if (result == APP_CONTROL_RESULT_SUCCEEDED) { - SETTING_TRACE_DEBUG("APP_CONTROL_RESULT_SUCCEEDED"); - setting_update_gl_item_chk_status(list_item, 1); - } else if (result == APP_CONTROL_RESULT_FAILED) { - SETTING_TRACE_DEBUG("APP_CONTROL_RESULT_FAILED"); - setting_update_gl_item_chk_status(list_item, 0); - } else if (result == APP_CONTROL_RESULT_CANCELED) { - SETTING_TRACE_DEBUG("APP_CONTROL_RESULT_CANCELED"); - setting_update_gl_item_chk_status(list_item, 0); - } - return; -} - -static void security_wifi_update_off_service_reply_cb(app_control_h request, - app_control_h reply, - app_control_result_e result, - void *user_data) -{ - SETTING_TRACE_BEGIN; - retm_if(request == NULL, "request is NULL"); - retm_if(reply == NULL, "reply is NULL"); - retm_if(user_data == NULL, "user_data is NULL"); - Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) user_data; - - SETTING_TRACE_DEBUG("result:[%d]", result); - - if (result == APP_CONTROL_RESULT_SUCCEEDED) { - SETTING_TRACE_DEBUG("APP_CONTROL_RESULT_SUCCEEDED"); - setting_update_gl_item_chk_status(list_item, 0); - } else if (result == APP_CONTROL_RESULT_FAILED) { - SETTING_TRACE_DEBUG("APP_CONTROL_RESULT_FAILED"); - setting_update_gl_item_chk_status(list_item, 1); - } else if (result == APP_CONTROL_RESULT_CANCELED) { - SETTING_TRACE_DEBUG("APP_CONTROL_RESULT_CANCELED"); - setting_update_gl_item_chk_status(list_item, 1); - } - return; -} - -static void __ask_create_auto_update_pop_on_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - SettingSecurityUG *ad = (SettingSecurityUG *) data; - ret_if(NULL == data); - int response_type = btn_type(obj); - - if (POPUP_RESPONSE_OK == response_type) { - SETTING_TRACE("OK"); - int ret = 0; - app_control_h service = NULL; - /*if(ad->data_security_update_chk->chk_status == 0) { */ - /* SETTING_TRACE_DEBUG("set auto update state to 1"); */ - /* setting_update_gl_item_chk_status(ad->data_security_update_chk, 1); */ - /*} */ - ret = app_control_create(&service); - if (ret != APP_CONTROL_ERROR_NONE) { - SETTING_TRACE_DEBUG("service_create fail!! ret=%d", ret); - SETTING_TRACE_ERROR("Cannot launch app"); - } else { - app_control_set_app_id(service, "org.tizen.msa"); - app_control_set_operation(service, "http://org.tizen.msa/appcontrol/operation/query"); - - ret = app_control_add_extra_data(service, "KEY", "AUTO_ON"); - SETTING_TRACE_DEBUG("add extra data (KEY,AUTO_ON) to service ret=%d", ret); - - ret = app_control_send_launch_request(service, security_update_on_service_reply_cb, (void *)data); - SETTING_TRACE_DEBUG("send launch service (KEY,AUTO_ON) request ret=%d", ret); - if (ret != APP_CONTROL_ERROR_NONE) { - SETTING_TRACE_ERROR("Cannot launch app"); - } - if (ad->data_security_wifi_update_chk) { - elm_object_item_disabled_set(ad->data_security_wifi_update_chk->item, EINA_FALSE); - elm_object_disabled_set(ad->data_security_wifi_update_chk->eo_check, EINA_FALSE); - } - } - app_control_destroy(service); - } else if (POPUP_RESPONSE_CANCEL == response_type) { - SETTING_TRACE("CANCEL"); - setting_update_gl_item_chk_status(ad->data_security_update_chk, 0); - } - - evas_object_del(ad->pop_auto_update_on); - ad->pop_auto_update_on = NULL; -} - -static void __ask_create_auto_update_pop_off_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - SettingSecurityUG *ad = (SettingSecurityUG *) data; - ret_if(NULL == data); - int response_type = btn_type(obj); - - if (POPUP_RESPONSE_OK == response_type) { - SETTING_TRACE("OK"); - int ret = 0; - app_control_h service = NULL; - /*if(ad->data_security_update_chk->chk_status == 1) */ - /* setting_update_gl_item_chk_status(ad->data_security_update_chk, 0); */ - ret = app_control_create(&service); - if (ret != APP_CONTROL_ERROR_NONE) { - SETTING_TRACE_DEBUG("service_create fail!! ret=%d", ret); - SETTING_TRACE_ERROR("Cannot launch app"); - } else { - app_control_set_app_id(service, "org.tizen.msa"); - app_control_set_operation(service, "http://org.tizen.msa/appcontrol/operation/query"); - - ret = app_control_add_extra_data(service, "KEY", "AUTO_OFF"); - SETTING_TRACE_DEBUG("add extra data (KEY,AUTO_OFF) to service ret=%d", ret); - - ret = app_control_send_launch_request(service, security_update_off_service_reply_cb, (void *)data); - SETTING_TRACE_DEBUG("send launch service (KEY,AUTO_OFF) request ret=%d", ret); - if (ret != APP_CONTROL_ERROR_NONE) { - SETTING_TRACE_ERROR("Cannot launch app"); - } - /*if (ad->data_security_wifi_update_chk) { */ - /* elm_object_item_disabled_set(ad->data_security_wifi_update_chk->item, EINA_TRUE); */ - /* elm_object_disabled_set(ad->data_security_wifi_update_chk->eo_check, EINA_TRUE); */ - /*} */ - } - app_control_destroy(service); - } else if (POPUP_RESPONSE_CANCEL == response_type) { - SETTING_TRACE("CANCEL"); - setting_update_gl_item_chk_status(ad->data_security_update_chk, 1); - } - - evas_object_del(ad->pop_auto_update_off); - ad->pop_auto_update_off = NULL; -} - -static void __ask_create_manual_update_pop_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - SettingSecurityUG *ad = (SettingSecurityUG *) data; - ret_if(NULL == data); - int response_type = btn_type(obj); - if (POPUP_RESPONSE_OK == response_type) { - SETTING_TRACE("OK"); - - /*request manual update */ - int ret = 0; - app_control_h service = NULL; - ret = app_control_create(&service); - if (ret != APP_CONTROL_ERROR_NONE) { - SETTING_TRACE_DEBUG("service_create fail!! ret=%d", ret); - evas_object_del(ad->pop_manual_update); - ad->pop_manual_update = NULL; - SETTING_TRACE_ERROR("Cannot launch app"); - return; - } else { - app_control_set_app_id(service, "org.tizen.msa"); - app_control_set_operation(service, "http://org.tizen.msa/appcontrol/operation/query"); - ret = app_control_add_extra_data(service, "KEY", "MANUAL_UPDATE"); - SETTING_TRACE_DEBUG("add extra data to service ret=%d", ret); - ret = app_control_send_launch_request(service, NULL, NULL); - SETTING_TRACE_DEBUG("send launch service request ret=%d", ret); - if (ret != APP_CONTROL_ERROR_NONE) { - evas_object_del(ad->pop_manual_update); - ad->pop_manual_update = NULL; - SETTING_TRACE_ERROR("Cannot launch app"); - app_control_destroy(service); - service = NULL; - return; - } - } - app_control_destroy(service); - service = NULL; - - - /*POP_UP */ - ad->pop_progress = elm_popup_add(ad->win_get); - eext_object_event_callback_add(ad->pop_progress, EEXT_CALLBACK_BACK, setting_popup_del_cb, NULL); - evas_object_size_hint_weight_set(ad->pop_progress, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - Evas_Object *box = NULL; - Evas_Object *progressbar = NULL; - Evas_Object *label = NULL; - - /*label */ - label = elm_label_add(ad->pop_progress); - elm_object_text_set(label, _(CONNECT_TO_SERVER)); - evas_object_show(label); - box = elm_box_add(ad->pop_progress); - - /*progressbar */ - progressbar = elm_progressbar_add(ad->pop_progress); - elm_object_style_set(progressbar, PROGRESSBAR_STYLE); - elm_progressbar_pulse(progressbar, EINA_TRUE); - evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5); - evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - elm_progressbar_pulse(progressbar, EINA_TRUE); - evas_object_show(progressbar); - - /*box */ - Evas_Object *blank = setting_create_blank_rect_customize(ad->pop_progress, 10, 30); - elm_box_pack_end(box, blank); - elm_box_pack_end(box, label); - elm_box_pack_end(box, blank); - elm_box_pack_end(box, progressbar); - elm_box_pack_end(box, blank); - /*elm_box_pack_end(box, btn); */ - evas_object_show(box); - elm_object_content_set(ad->pop_progress, box); - evas_object_show(ad->pop_progress); - - - } else if (POPUP_RESPONSE_CANCEL == response_type) { - SETTING_TRACE("CANCEL"); - /* do nothing */ - } - - evas_object_del(ad->pop_manual_update); - ad->pop_manual_update = NULL; -} - -static void -setting_security_update_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj, - void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - setting_retm_if(data == NULL, "Data parameter is NULL"); - - retm_if(event_info == NULL, "Invalid argument: event info is NULL"); - Elm_Object_Item *item = (Elm_Object_Item *) event_info; - elm_genlist_item_selected_set(item, 0); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) elm_object_item_data_get(item); - setting_retm_if(NULL == list_item, "list_item is NULL"); - - SettingSecurityUG *ad = (SettingSecurityUG *) data; - - SETTING_TRACE("clicking item[%s]", _(list_item->keyStr)); - - if (!safeStrCmp(_(AUTO_UPDATE), list_item->keyStr)) { - SETTING_TRACE_DEBUG("There is auto update"); - if (ad->data_security_update_chk->chk_status == 1) { - SETTING_TRACE_DEBUG("set auto update state to 0"); - /* TOGGLE OFF */ - SETTING_TRACE_DEBUG("There is auto update toggle on->off"); - ad->pop_auto_update_off = setting_create_popup(ad, - ad->win_get, - NULL, SECURITY_UPDATE_TOGGLE_OFF, - __ask_create_auto_update_pop_off_cb, - 0, FALSE, FALSE, - 2, "IDS_ST_BODY_TURN_OFF", "IDS_ST_BUTTON_CANCEL_ABB"); - } else { - SETTING_TRACE_DEBUG("set auto update state to 1"); - /* TOGGLE ON */ - SETTING_TRACE_DEBUG("There is auto update toggle off->on"); - ad->pop_auto_update_on = setting_create_popup(ad, - ad->win_get, - NULL, SECURITY_UPDATE_TOGGLE_ON, - __ask_create_auto_update_pop_on_cb, - 0, FALSE, FALSE, - 2, "IDS_ST_BUTTON_OK", "IDS_ST_BUTTON_CANCEL_ABB"); - } - } else if (!safeStrCmp(_(UPDATE_TEXT), list_item->keyStr)) { - SETTING_TRACE_DEBUG("There is manual update"); - ad->pop_manual_update = setting_create_popup(ad, - ad->win_get, - NULL, SECURITY_MANUAL_UPDATE_TEXT, - __ask_create_manual_update_pop_cb, - 0, FALSE, FALSE, - 2, "IDS_ST_BUTTON_OK", "IDS_ST_BUTTON_CANCEL_ABB"); - } else if (!safeStrCmp(_(SECURITY_VIA_WIFI), list_item->keyStr)) { - int ret = 0; - app_control_h service = NULL; - int chk_status = !list_item->chk_status; - setting_update_gl_item_chk_status(list_item, chk_status); - ret = app_control_create(&service); - if (ret != APP_CONTROL_ERROR_NONE) { - SETTING_TRACE_DEBUG("service_create fail!! ret=%d", ret); - } else { - app_control_set_app_id(service, "org.tizen.msa"); - app_control_set_operation(service, "http://org.tizen.msa/appcontrol/operation/query"); - char *type = NULL; - if (chk_status) { - type = "WIFI_ON"; - } else { - type = "WIFI_OFF"; - } - ret = app_control_add_extra_data(service, "KEY", type); - - if (chk_status == 1) - ret = app_control_send_launch_request(service, security_wifi_update_on_service_reply_cb, list_item); - else - ret = app_control_send_launch_request(service, security_wifi_update_off_service_reply_cb, list_item); - SETTING_TRACE_DEBUG("send launch service (MSA_QUERY, %s) request ret=%d", type, ret); - if (ret != APP_CONTROL_ERROR_NONE) { - SETTING_TRACE_ERROR("Cannot launch app"); - } - } - app_control_destroy(service); - } -} - -static void __setting_security_update_toggle_automatic_chk(void *data, int chk_status, char *keyStr) -{ - SETTING_TRACE_BEGIN; - SettingSecurityUG *ad = (SettingSecurityUG *) data; - - if (chk_status) { - /* TOGGLE ON */ - SETTING_TRACE_DEBUG("There is auto update toggle off->on"); - ad->pop_auto_update_on = setting_create_popup(ad, - ad->win_get, - NULL, SECURITY_UPDATE_TOGGLE_ON, - __ask_create_auto_update_pop_on_cb, - 0, FALSE, FALSE, - 2, "IDS_ST_BUTTON_OK", "IDS_ST_BUTTON_CANCEL_ABB"); - } else { - /* TOGGLE OFF */ - SETTING_TRACE_DEBUG("There is auto update toggle on->off"); - ad->pop_auto_update_off = setting_create_popup(ad, - ad->win_get, - NULL, SECURITY_UPDATE_TOGGLE_OFF, - __ask_create_auto_update_pop_off_cb, - 0, FALSE, FALSE, - 2, "IDS_ST_BODY_TURN_OFF", "IDS_ST_BUTTON_CANCEL_ABB"); - } - return; -} - -static void setting_security_update_mouse_up_Gendial_chk_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(data == NULL, "Data parameter is NULL"); - Setting_GenGroupItem_Data *list_item = - (Setting_GenGroupItem_Data *) data; - SettingSecurityUG *ad = list_item->userdata; - list_item->chk_status = elm_check_state_get(obj); /* for genlist update status */ - SETTING_TRACE_DEBUG("auto update toggle cb"); - - /* enable /disable toggle button */ - if (!safeStrCmp(_(AUTO_UPDATE), list_item->keyStr)) { - __setting_security_update_toggle_automatic_chk(ad, list_item->chk_status, list_item->keyStr); - list_item->chk_status = !list_item->chk_status; - elm_check_state_set(obj, list_item->chk_status); - } else if (!safeStrCmp(_(SECURITY_VIA_WIFI), list_item->keyStr)) { - int ret = 0; - app_control_h service = NULL; - int chk_status = list_item->chk_status; - /*setting_update_gl_item_chk_status(ad->data_security_wifi_update_chk, chk_status); */ - ret = app_control_create(&service); - if (ret != APP_CONTROL_ERROR_NONE) { - SETTING_TRACE_DEBUG("service_create fail!! ret=%d", ret); - SETTING_TRACE_ERROR("Cannot launch app"); - } else { - app_control_set_app_id(service, "org.tizen.msa"); - app_control_set_operation(service, "http://org.tizen.msa/appcontrol/operation/query"); - char *type = NULL; - if (chk_status) { - type = "WIFI_ON"; - } else { - type = "WIFI_OFF"; - } - ret = app_control_add_extra_data(service, "KEY", type); - - if (chk_status == 1) - ret = app_control_send_launch_request(service, security_wifi_update_on_service_reply_cb, list_item); - else - ret = app_control_send_launch_request(service, security_wifi_update_off_service_reply_cb, list_item); - SETTING_TRACE_DEBUG("send launch service (KEY, %s) request ret=%d", type, ret); - if (ret != APP_CONTROL_ERROR_NONE) { - SETTING_TRACE_ERROR("Cannot launch app"); - } - } - list_item->chk_status = !list_item->chk_status; - elm_check_state_set(obj, list_item->chk_status); - app_control_destroy(service); - } - return; -} diff --git a/setting-security/src/setting-security.c b/setting-security/src/setting-security.c deleted file mode 100755 index ae6337c..0000000 --- a/setting-security/src/setting-security.c +++ /dev/null @@ -1,1383 +0,0 @@ -/* - setting - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. - * - * Contact: MyoungJune Park - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include - -#include -#include -#if SUPPORT_ENCRYPTION -#include -#endif -#include -#include - - -#define Max_Passwd_View_Type_Len 64 -#ifndef UG_MODULE_API -#define UG_MODULE_API __attribute__ ((visibility("default"))) -#endif - -enum { - RESULT_OK, - RESULT_FAILED, - RESULT_CANCELED, - RESULT_NETWORK_ERROR -}; - -void setting_security_ug_popup_resp_cb(void *data, Evas_Object *obj, void *event_info) -{ - retm_if(data == NULL, "Data parameter is NULL"); - - SettingSecurityUG *ad = (SettingSecurityUG *)data; - if (ad->save_popup) { - evas_object_del(ad->save_popup); - ad->save_popup = NULL; - } - ug_destroy_me(ad->ug); -} - -int pwd_handler_do_nothing(SettingSecurityUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - /*SettingSecurityUG *ad = (SettingSecurityUG *)data; */ - /* DO NOTHING */ - return 0; -} - -int pwd_handler_sec_pw_passwd(SettingSecurityUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; -#if SUPPORT_ENCRYPTION - SettingSecurityUG *ad = (SettingSecurityUG *)data; - - if (setting_view_security_encryption.is_create == TRUE && ad->pw_type == SETTING_SEC_PW_ENCRYPTION) { - if (setting_view_get_topview(&setting_view_security_confirm_encryption) != &setting_view_security_encryption) { - SETTING_TRACE("view stack is missed. initialize again."); - setting_view_node_table_intialize(); - /*SETTING_TRACE("viewtype 0x%x", ad->viewtype); */ - if (ad->viewtype == SETTING_SEC_VIEWTYPE_ENCRYPTION) { - setting_view_node_table_register(&setting_view_security_encryption, NULL); - setting_view_node_table_register(&setting_view_security_confirm_encryption, &setting_view_security_encryption); - } else { - setting_view_node_table_register(&setting_view_security_main, NULL); - setting_view_node_table_register(&setting_view_security_sim_settings, &setting_view_security_main); - setting_view_node_table_register(&setting_view_security_update, &setting_view_security_main); - setting_view_node_table_register(&setting_view_security_encryption, &setting_view_security_main); - setting_view_node_table_register(&setting_view_security_confirm_encryption, &setting_view_security_encryption); - } - } - setting_view_change(&setting_view_security_encryption, &setting_view_security_confirm_encryption, ad); - return 0; - } -#endif - - if (vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_PASSWORD) == 0) { - /* Success to save */ - } else { - SETTING_TRACE_ERROR("setting vconf value failed : screen_lock_type"); - } - - return 0; -} - -static void -__face_voice_done_cb(void *data, Evas_Object *obj, void *event_info) -{ - /* error check */ - retm_if(data == NULL, "[Setting > Security] Data parameter is NULL"); - SettingSecurityUG *ad = (SettingSecurityUG *) data; - - /*int i = 0; */ - while (elm_naviframe_top_item_get(ad->navi_bar) != ad->screen_lock_main_item) { - elm_naviframe_item_pop(ad->navi_bar); - /*SETTING_TRACE("i:%d",i); */ - /*i++; */ - /*sleep(2); */ - if (elm_naviframe_top_item_get(ad->navi_bar) == elm_naviframe_bottom_item_get(ad->navi_bar)) { - break; - } - } -} - -int pwd_handler_sec_pw_simple_passwd(SettingSecurityUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - SettingSecurityUG *ad = (SettingSecurityUG *)data; - - SETTING_TRACE("ad->selected_lock_type:%s", ad->selected_lock_type); - /*'face and voice ' and 'simple password' share the same PASSWD_TYPE and callback function */ - int lock_type = SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD; - if (!safeStrCmp(ad->selected_lock_type, Keystr_FaceAndVoice)) { - lock_type = SETTING_SCREEN_LOCK_TYPE_FACE_AND_VOICE; - setting_create_guild_layout(ad->navi_bar, Setup_Face_Unlock_Str, - _("IDS_SA_BUTTON_DONE_ABB"), NULL, NULL, - __face_voice_done_cb, NULL, NULL, - _(Finish_Setup_Face), - NULL, NULL, NULL, NULL, ad); - } - - if (vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, lock_type) == 0) { - /* Success to save */ - } else { - SETTING_TRACE_ERROR("setting vconf value failed : screen_lock_type"); - } - return 0; -} - -int pwd_handler_sec_pw_sim_lock_on(SettingSecurityUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - SettingSecurityUG *ad = (SettingSecurityUG *)data; - if (tel_get_sim_facility(ad->handle, TAPI_SIM_LOCK_PS, setting_security_sim_get_facility_cb, ad) != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("tel_get_sim_facility(TAPI_SIM_LOCK_PS) failed"); - } - return 0; -} - - -int pwd_handler_sec_pw_sim_lock_off(SettingSecurityUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - SettingSecurityUG *ad = (SettingSecurityUG *)data; - if (tel_get_sim_facility(ad->handle, TAPI_SIM_LOCK_PS, setting_security_sim_get_facility_cb, ad) != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("tel_get_sim_facility(TAPI_SIM_LOCK_PS) failed"); - } - return 0; -} - - -int pwd_handler_sec_pw_pin_lock_on(SettingSecurityUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - retv_if(!data, -1); - SettingSecurityUG *ad = (SettingSecurityUG *)data; - - if (tel_get_sim_facility(ad->handle, TAPI_SIM_LOCK_SC, setting_security_pin_get_facility_cb, ad) != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("tel_get_sim_facility(TAPI_SIM_LOCK_PS) failed"); - } - return 0; -} - - -int pwd_handler_sec_pw_pin_lock_off(SettingSecurityUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - SettingSecurityUG *ad = (SettingSecurityUG *)data; - if (tel_get_sim_facility(ad->handle, TAPI_SIM_LOCK_SC, setting_security_pin_get_facility_cb, ad) != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("tel_get_sim_facility(TAPI_SIM_LOCK_PS) failed"); - } - return 0; -} - - -int pwd_handler_sec_pw_sim_lock_disabled(SettingSecurityUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - SettingSecurityUG *ad = (SettingSecurityUG *)data; - /* [in] Evas_Object *checkbtn */ - if (ad->data_sim_lk) - setting_disable_genlist_item(ad->data_sim_lk->item); - - return 0; -} - - -int pwd_handler_sec_pw_change_pin1(SettingSecurityUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - SettingSecurityUG *ad = (SettingSecurityUG *)data; - - setting_create_popup(ad, ad->ly_main, NULL, "IDS_ST_POP_PIN_CHANGED", - NULL, - POPUP_INTERVAL, FALSE, FALSE, 0); - return 0; -} - -#if SUPPORT_FDN -int pwd_handler_sec_pw_fdn_mode_on(SettingSecurityUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - SettingSecurityUG *ad = (SettingSecurityUG *)data; - if (tel_get_sim_facility(ad->handle, TAPI_SIM_LOCK_FD, setting_security_sim_get_facility_cb, ad) != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("tel_get_sim_facility(TAPI_SIM_LOCK_PS) failed"); - } - return 0; -} - - -int pwd_handler_sec_pw_fdn_mode_off(SettingSecurityUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - SettingSecurityUG *ad = (SettingSecurityUG *)data; - if (tel_get_sim_facility(ad->handle, TAPI_SIM_LOCK_FD, setting_security_sim_get_facility_cb, ad) != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("tel_get_sim_facility(TAPI_SIM_LOCK_PS) failed"); - } - return 0; -} -#endif - -int pwd_handler_sec_pw_change_pin2(SettingSecurityUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - return 0; -} - -static void setting_security_pin1_blocked_resp_cb(void *data, Evas_Object *obj, void *event_info) -{ - SETTING_TRACE_BEGIN; - ret_if(!data); - SettingSecurityUG *ad = data; - - int ret = 0; - /* Call pwlock. */ - bundle *b = bundle_create(); - if (b) { - bundle_add(b, "after_bootup", "1"); - ret = aul_launch_app("org.tizen.pwlock", b); - SETTING_TRACE("aul_launch_app() returns %d", ret); - bundle_free(b); - } - - if (ad->sim_popup) { - evas_object_del(ad->sim_popup); - ad->sim_popup = NULL; - } -} - -int pwd_handler_sec_pw_pin1_blocked(SettingSecurityUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - SettingSecurityUG *ad = (SettingSecurityUG *)data; - - if (ad->sim_popup) { - evas_object_del(ad->sim_popup); - ad->sim_popup = NULL; - } - - /* To do : draw popup, */ - /* content - PIN Blocked\n The PIN is now blocked. Enter your PUK code to continue. */ - /* button - OK */ - char popup_text[2048] = {0,}; - snprintf(popup_text, 2048, "%s", _(PIN_BLOCKED_ENTER_PUK_DESC)); - -#ifdef ECORE_X - Ecore_X_Window xwin = 0; - Ecore_X_Display *disp = NULL; -#endif - - int ret = 0; -#ifdef ECORE_X - disp = ecore_x_display_get(); - xwin = elm_win_xwindow_get(ad->win_get); - - ecore_x_netwm_window_type_set(xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION); - utilx_set_system_notification_level(disp, xwin, UTILX_NOTIFICATION_LEVEL_LOW); - - ret = eext_win_keygrab_set(xwin, "XF86Back"); - if (ret) - SETTING_TRACE("eext_win_keygrab_set() failed."); - ret = eext_win_keygrab_set(xwin, "XF86Home"); - if (ret) - SETTING_TRACE("eext_win_keygrab_set() failed."); - ret = eext_win_keygrab_set(xwin, "XF86AudioRaiseVolume"); - if (ret) - SETTING_TRACE("eext_win_keygrab_set() failed."); - ret = eext_win_keygrab_set(xwin, "XF86AudioLowerVolume"); - if (ret) - SETTING_TRACE("eext_win_keygrab_set() failed."); -#else - // @todo : repace codes using X with codes tizen 3.0 API -#endif - - unsigned int val[3]; - val[0] = 0; /* always enable F */ - val[1] = 0; /* quickpanel enable F */ - val[2] = 0; /* apptray enable F */ - /* set quickpanel disable */ -#ifdef ECORE_X - Ecore_X_Atom ATOM_PANEL_SCROLLABLE_STATE = 0; - ATOM_PANEL_SCROLLABLE_STATE = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE"); - ecore_x_window_prop_card32_set(xwin, ATOM_PANEL_SCROLLABLE_STATE, val, 3); -#else - // @todo : repace codes using X with codes tizen 3.0 API -#endif - - ad->sim_popup = setting_create_popup(ad, ad->win_get, NULL, - popup_text, - setting_security_pin1_blocked_resp_cb, - 0, FALSE, FALSE, - 1, "IDS_ST_BUTTON_OK"); - eext_object_event_callback_del(ad->sim_popup, EEXT_CALLBACK_BACK, setting_popup_del_cb); - - /* End. */ - return 0; -} - -int pwd_handler_sec_pw_pin2_blocked(SettingSecurityUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - - SettingSecurityUG *ad = (SettingSecurityUG *)data; -#if SUPPORT_FDN - if (tel_get_sim_facility(ad->handle, TAPI_SIM_LOCK_FD, setting_security_sim_get_facility_cb, ad) != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("tel_get_sim_facility(TAPI_SIM_LOCK_PS) failed"); - } -#endif - - if (ad->sim_popup) { - evas_object_del(ad->sim_popup); - ad->sim_popup = NULL; - } - char popup_text[2048] = {0,}; - snprintf(popup_text, 2048, "%s", _("IDS_ST_POP_PIN2_BLOCKED")); - - setting_create_popup(ad, ad->win_get, NULL, - popup_text, - NULL, - 2, FALSE, FALSE, 0); - - ad->pin2_blocked_flag = TRUE; - setting_view_update(&setting_view_security_sim_settings, ad); - - return 0; -} - -int pwd_handler_sec_pw_pin2_unblocked(SettingSecurityUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - - SettingSecurityUG *ad = (SettingSecurityUG *)data; - ad->pin2_blocked_flag = FALSE; - setting_view_update(&setting_view_security_sim_settings, ad); - - return 0; -} - -int pwd_handler_sec_pw_puk1_blocked(SettingSecurityUG *data, void *arg) -{ - SETTING_TRACE_BEGIN; - SettingSecurityUG *ad = (SettingSecurityUG *)data; - if (setting_view_security_sim_settings.is_create == TRUE) { - setting_view_change(&setting_view_security_sim_settings, &setting_view_security_main, ad); - } else if (setting_view_security_main.is_create == TRUE) { - setting_view_update(&setting_view_security_main, ad); - } - - return 0; -} - -static struct _security_item security_table[] = { - { SETTING_SEC_PW_PASSWORD, "SETTING_PW_TYPE_PASSWORD", pwd_handler_sec_pw_passwd }, - { SETTING_SEC_PW_SIMPLE_PASSWD, "SETTING_PW_TYPE_SIMPLE_PASSWORD", pwd_handler_sec_pw_simple_passwd }, - { SETTING_SEC_PW_ENTER_LOCK_TYPE, "SETTING_PW_TYPE_ENTER_LOCK_TYPE", pwd_handler_do_nothing}, - { SETTING_SEC_PW_ENCRYPTION, "SETTING_PW_TYPE_ENCRYPTION", pwd_handler_sec_pw_passwd}, - { SETTING_SEC_PW_SIM_LOCK_ON, "SETTING_PW_TYPE_SIM_LOCK_ON", pwd_handler_sec_pw_sim_lock_on }, - { SETTING_SEC_PW_SIM_LOCK_OFF, "SETTING_PW_TYPE_SIM_LOCK_OFF", pwd_handler_sec_pw_sim_lock_off }, - { SETTING_SEC_PW_SIM_LOCK_DISABLED, "SETTING_PW_TYPE_SIM_LOCK_DISABLE", pwd_handler_sec_pw_sim_lock_disabled}, - { SETTING_SEC_PW_PIN_LOCK_ON, "SETTING_PW_TYPE_PIN_LOCK_ON", pwd_handler_sec_pw_pin_lock_on }, - { SETTING_SEC_PW_PIN_LOCK_OFF, "SETTING_PW_TYPE_PIN_LOCK_OFF", pwd_handler_sec_pw_pin_lock_off }, - { SETTING_SEC_PW_CHANGE_PIN1, "SETTING_PW_TYPE_CHANGE_PIN", pwd_handler_sec_pw_change_pin1}, -#if SUPPORT_FDN - { SETTING_SEC_PW_FDN_MODE_ON, "SETTING_PW_TYPE_FDN_MODE_ON", pwd_handler_sec_pw_fdn_mode_on}, - { SETTING_SEC_PW_FDN_MODE_OFF, "SETTING_PW_TYPE_FDN_MODE_OFF", pwd_handler_sec_pw_fdn_mode_off}, -#endif - { SETTING_SEC_PW_CHANGE_PIN2, "SETTING_PW_TYPE_CHANGE_PIN2", pwd_handler_sec_pw_change_pin2}, - { SETTING_SEC_PW_PIN1_BLOCKED, "SETTING_PW_TYPE_PIN_BLOCKED", pwd_handler_sec_pw_pin1_blocked}, - { SETTING_SEC_PW_PIN2_BLOCKED, "SETTING_PW_TYPE_PIN2_BLOCKED", pwd_handler_sec_pw_pin2_blocked}, - { SETTING_SEC_PW_PIN1_UNBLOCKED, "SETTING_PW_TYPE_PIN1_UNBLOCKED", pwd_handler_sec_pw_pin_lock_on}, - { SETTING_SEC_PW_PIN2_UNBLOCKED, "SETTING_PW_TYPE_PIN2_UNBLOCKED", pwd_handler_sec_pw_pin2_unblocked}, - { SETTING_SEC_PW_PUK1_BLOCKED, "SETTING_PW_TYPE_PUK1_BLOCKED", pwd_handler_sec_pw_puk1_blocked}, - { SETTING_SEC_PW_PUK2_BLOCKED, "SETTING_PW_TYPE_PUK2_BLOCKED", pwd_handler_do_nothing}, - /*------------------------------------------------------------------------------------------------------------*/ - { SETTING_SEC_PW_MAX, NULL, pwd_handler_do_nothing} -}; - -static void setting_security_ug_cb_resize(void *data, Evas *e, - Evas_Object *obj, void *event_info) -{ - ret_if(data == NULL); - - SettingSecurityUG *ad = (SettingSecurityUG *) data; /* ad is point to data */ - if (ad->viewtype == SETTING_SEC_VIEWTYPE_MAIN) - setting_view_update(&setting_view_security_main, ad); -} - -setting_view *__get_security_view_to_load(void *data, app_control_h service) -{ - SETTING_TRACE_BEGIN; - SettingSecurityUG *ad = (SettingSecurityUG *)data; - - char *viewtype = NULL; - - app_control_get_extra_data(service, "viewtype", &viewtype); - /*if(!viewtype) */ - /* return NULL; */ - if (viewtype) { - if (!safeStrCmp(viewtype, "encryption")) - ad->viewtype = SETTING_SEC_VIEWTYPE_ENCRYPTION; - else if (!safeStrCmp(viewtype, "update")) - ad->viewtype = SETTING_SEC_VIEWTYPE_UPDATE; - else - ad->viewtype = SETTING_SEC_VIEWTYPE_MAIN; - } else { - ad->viewtype = SETTING_SEC_VIEWTYPE_MAIN; - } - FREE(viewtype); - - if (ad->viewtype == SETTING_SEC_VIEWTYPE_MAIN) { - setting_view_node_table_register(&setting_view_security_main, NULL); - setting_view_node_table_register(&setting_view_security_sim_settings, &setting_view_security_main); - setting_view_node_table_register(&setting_view_security_update, &setting_view_security_main); -#if SUPPORT_ENCRYPTION - setting_view_node_table_register(&setting_view_security_encryption, &setting_view_security_main); - setting_view_node_table_register(&setting_view_security_confirm_encryption, &setting_view_security_encryption); -#endif - return &setting_view_security_main; - } else if (ad->viewtype == SETTING_SEC_VIEWTYPE_UPDATE) { - setting_view_node_table_register(&setting_view_security_update, NULL); - return &setting_view_security_update; - } -#if SUPPORT_ENCRYPTION - else if (ad->viewtype == SETTING_SEC_VIEWTYPE_ENCRYPTION) { - setting_view_node_table_register(&setting_view_security_encryption, NULL); - setting_view_node_table_register(&setting_view_security_confirm_encryption, &setting_view_security_encryption); - /*setting_view_node_table_register(&setting_view_security_enc_processing, &setting_view_security_confirm_encryption); */ - return &setting_view_security_encryption; - } -#endif - else { - /* unknown viewtype */ - return NULL; - } -} - -static void *setting_security_ug_on_create(ui_gadget_h ug, - enum ug_mode mode, app_control_h service, - void *priv) -{ - setting_retvm_if((!priv), NULL, "!priv"); - - SettingSecurityUG *securityUG = priv; - securityUG->ug = ug; - - securityUG->win_main_layout = (Evas_Object *) ug_get_parent_layout(ug); - securityUG->win_get = (Evas_Object *) ug_get_window(); - evas_object_show(securityUG->win_main_layout); - securityUG->evas = evas_object_evas_get(securityUG->win_main_layout); - - setting_retvm_if(securityUG->win_main_layout == NULL, NULL, - "[Setting >> About] cannot get main window "); - - /*setting_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR); */ - bindtextdomain(SETTING_PACKAGE, SETTING_LOCALEDIR); - - /* register view node table */ - setting_view_node_table_intialize(); - - setting_create_Gendial_itc(SETTING_GENLIST_ICON_1LINE_STYLE, &(securityUG->itc_1text)); - setting_create_Gendial_itc(SETTING_GENLIST_ICON_1LINE_STYLE, &(securityUG->itc_1text_1icon)); - setting_create_Gendial_itc(SETTING_GENLIST_GROUP_INDEX_STYLE, &(securityUG->itc_group_item)); - setting_create_Gendial_itc("multiline_sub", &(securityUG->itc_bg_1icon)); - setting_create_Gendial_itc(SETTING_GENLIST_2LINE_STYLE, &(securityUG->itc_2text_2)); - setting_create_Gendial_itc(SETTING_GENLIST_2LINE_STYLE, &(securityUG->itc_2text_3_parent)); - - securityUG->update_view_timer = NULL; - securityUG->remove_sim_popup_timer = NULL; - securityUG->tapi_async_cb_check_timer = NULL; - securityUG->input_pwd = NULL; - /*securityUG->cur_enc_mode = 0; */ - /* creating a view. */ - securityUG->handle = tel_init(NULL); - if (!securityUG->handle) { - SETTING_TRACE_ERROR("*** [ERR] tel_init. ***"); - /*return NULL; */ - } - securityUG->view_to_load = __get_security_view_to_load(securityUG, service); - setting_retvm_if(NULL == securityUG->view_to_load, NULL, - "NULL == securityUG->view_to_load"); - - app_control_get_extra_data(service, "current", &(securityUG->input_pwd)); - - setting_view_node_set_cur_view(securityUG->view_to_load); - setting_view_create(securityUG->view_to_load, (void *)securityUG); - evas_object_event_callback_add(securityUG->win_main_layout, - EVAS_CALLBACK_RESIZE, - setting_security_ug_cb_resize, securityUG); - - return securityUG->ly_main; -} - -static void setting_security_ug_on_start(ui_gadget_h ug, app_control_h service, - void *priv) -{ -} - -static void setting_security_ug_on_pause(ui_gadget_h ug, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - setting_retm_if((!priv), "!priv"); - SettingSecurityUG *securityUG = priv; - - if (setting_view_security_sim_settings.is_create == TRUE) { - bool is_running = FALSE; - app_manager_is_running("org.tizen.pwlock", &is_running); - if (is_running) { - SETTING_TRACE_DEBUG("pwlock is running"); -#ifdef ECORE_X - Ecore_X_Window xwin = 0; - Ecore_X_Display *disp = NULL; - - disp = ecore_x_display_get(); - xwin = elm_win_xwindow_get(securityUG->win_get); - - ecore_x_netwm_window_type_set(xwin, ECORE_X_WINDOW_TYPE_NORMAL); - int ret; - ret = eext_win_keygrab_unset(xwin, "XF86Back"); - if (ret) - SETTING_TRACE("eext_win_keygrab_unset() failed."); - ret = eext_win_keygrab_unset(xwin, "XF86Home"); - if (ret) - SETTING_TRACE("eext_win_keygrab_unset() failed."); - ret = eext_win_keygrab_unset(xwin, "XF86AudioRaiseVolume"); - if (ret) - SETTING_TRACE("eext_win_keygrab_unset() failed."); - ret = eext_win_keygrab_unset(xwin, "XF86AudioLowerVolume"); - if (ret) - SETTING_TRACE("eext_win_keygrab_unset() failed."); -#else - // @todo : repace codes using X with codes tizen 3.0 API -#endif - - unsigned int val[3]; - val[0] = 1; /* always enable */ - val[1] = 1; /* quickpanel enable */ - val[2] = 1; /* apptray enable */ - /* set quickpanel enable */ -#ifdef ECORE_X - Ecore_X_Atom ATOM_PANEL_SCROLLABLE_STATE = 0; - ATOM_PANEL_SCROLLABLE_STATE = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE"); - ecore_x_window_prop_card32_set(xwin, ATOM_PANEL_SCROLLABLE_STATE, val, 3); -#else - // @todo : repace codes using X with codes tizen 3.0 API -#endif - } - } -} - -static void setting_security_ug_on_resume(ui_gadget_h ug, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - setting_retm_if((!priv), "!priv"); - SettingSecurityUG *securityUG = priv; - - if (setting_view_security_sim_settings.is_create == TRUE) { - if (tel_get_sim_facility(securityUG->handle, TAPI_SIM_LOCK_SC, setting_security_pin_get_facility_cb, securityUG) != TAPI_API_SUCCESS) { - SETTING_TRACE_ERROR("tel_get_sim_facility(TAPI_SIM_LOCK_PS) failed"); - } - } -} - -static void setting_security_ug_on_destroy(ui_gadget_h ug, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - setting_retm_if((!priv), "!priv"); - SettingSecurityUG *securityUG = priv; - securityUG->ug = ug; - - evas_object_event_callback_del(securityUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_security_ug_cb_resize); /* fix flash issue for gallery */ - - if (securityUG->handle && tel_deinit(securityUG->handle) != TAPI_API_SUCCESS) { - SETTING_TRACE_DEBUG - ("%s*** [ERR] setting_network_unsubscribe_tapi_events. ***%s", - SETTING_FONT_RED, SETTING_FONT_BLACK); - } - - FREE(securityUG->input_pwd); -#if SUPPORT_ENCRYPTION - if (securityUG->viewtype == SETTING_SEC_VIEWTYPE_ENCRYPTION) { - setting_view_destroy(&setting_view_security_confirm_encryption, securityUG); - setting_view_destroy(&setting_view_security_encryption, securityUG); - } else { -#endif - setting_view_destroy(&setting_view_security_sim_settings, securityUG); - setting_view_destroy(&setting_view_security_update, securityUG); - setting_view_destroy(&setting_view_security_main, securityUG); -#if SUPPORT_ENCRYPTION - setting_view_destroy(&setting_view_security_confirm_encryption, securityUG); - setting_view_destroy(&setting_view_security_encryption, securityUG); - } -#endif - - if (NULL != ug_get_layout(securityUG->ug)) { - evas_object_hide((Evas_Object *) ug_get_layout(securityUG->ug)); - evas_object_del((Evas_Object *) ug_get_layout(securityUG->ug)); - } -} - -static void setting_security_ug_on_message(ui_gadget_h ug, app_control_h msg, - app_control_h service, void *priv) -{ - -} - -static void setting_security_ug_on_event(ui_gadget_h ug, - enum ug_event event, app_control_h service, - void *priv) -{ - if (!priv) - return; - SettingSecurityUG *ad = (SettingSecurityUG *) priv; - - switch (event) { - case UG_EVENT_LOW_MEMORY: - break; - case UG_EVENT_LOW_BATTERY: - break; - case UG_EVENT_LANG_CHANGE: - if (ad->navi_bar) { - setting_navi_items_update(ad->navi_bar); - } - break; - case UG_EVENT_ROTATE_PORTRAIT: - break; - case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN: - break; - case UG_EVENT_ROTATE_LANDSCAPE: - break; - case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN: - break; - case UG_EVENT_REGION_CHANGE: - break; - default: - break; - } -} - -static void setting_security_ug_on_key_event(ui_gadget_h ug, - enum ug_key_event event, - app_control_h service, void *priv) -{ - if (!priv) - return; - SettingSecurityUG *ad = (SettingSecurityUG *) priv; /* ad is point to priv */ - switch (event) { - case UG_KEY_EVENT_END: { - if (elm_naviframe_top_item_get(ad->navi_bar) == - elm_naviframe_bottom_item_get(ad->navi_bar)) { - ug_destroy_me(ug); - } else { - /* elm_naviframe_item_pop(ad->navi_bar); */ - setting_view_cb_at_endKey(ad); - } - } - break; - - default: - break; - } -} - -UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops) -{ - SettingSecurityUG *securityUG = calloc(1, sizeof(SettingSecurityUG)); - setting_retvm_if(!securityUG, -1, - "Create SettingSecurityUG obj failed"); - - memset(securityUG, 0x00, sizeof(SettingSecurityUG)); - - ops->create = setting_security_ug_on_create; - ops->start = setting_security_ug_on_start; - ops->pause = setting_security_ug_on_pause; - ops->resume = setting_security_ug_on_resume; - ops->destroy = setting_security_ug_on_destroy; - ops->message = setting_security_ug_on_message; - ops->event = setting_security_ug_on_event; - ops->key_event = setting_security_ug_on_key_event; - ops->priv = securityUG; - ops->opt = UG_OPT_INDICATOR_ENABLE; - - return 0; -} - -UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops) -{ - struct SettingSecurityUG *securityUG; - setting_retm_if(!ops, "ops == NULL"); - - securityUG = ops->priv; - if (securityUG) - FREE(securityUG); -} - -/* *************************************************** - * - *general func - * - ***************************************************/ -void setting_security_sim_get_facility_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - - ret_if(!user_data); - SETTING_TRACE_DEBUG("user_data is not NULL"); - - ret_if(!data); - SETTING_TRACE_DEBUG("data is not NULL"); - - TelSimPinOperationResult_t sec_rt = result; - TelSimFacilityInfo_t *fi = data; - SettingSecurityUG *ad = user_data; - ad->enter_tapi_async_cb_flag++; - - SETTING_TRACE("sec_rt[%d]", sec_rt); - SETTING_TRACE("fi->type[%d]", fi->type); - SETTING_TRACE("fi->f_status[%d]", fi->f_status); - if (sec_rt == TAPI_SIM_PIN_OPERATION_SUCCESS) { - SETTING_TRACE_DEBUG("PIN_OPERATION_SUCCESS"); - switch (fi->type) { - case TAPI_SIM_LOCK_PS:/*sim status */ - ad->sim_status = fi->f_status; - break; - default: - break; - } - } else { - /*if failed, do nothing.. */ - } - - /* Update SIM Settings view if created. */ - if (setting_view_security_sim_settings.is_create == 1) { - SETTING_TRACE_DEBUG("SIM settings view is already created. [%d]", setting_view_security_sim_settings.is_create); - setting_view_update(&setting_view_security_sim_settings, ad); - } else { - SETTING_TRACE_DEBUG("Change view"); - setting_view_change(&setting_view_security_main, &setting_view_security_sim_settings, ad); - } - - SETTING_TRACE_END; -} - -void setting_security_pin2_get_lock_info_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - ret_if(!user_data); - SETTING_TRACE_DEBUG("user_data is not NULL"); - - ret_if(!data); - SETTING_TRACE_DEBUG("data is not NULL"); - - TelSimPinOperationResult_t sec_rt = result; - TelSimLockInfo_t *lock = data; - - SettingSecurityUG *ad = (SettingSecurityUG *)user_data; - - SETTING_TRACE_DEBUG("sec_ret[%d], lock_type[%d], lock_status[%d], retry_count[%d]", sec_rt, lock->lock_type, lock->lock_status, lock->retry_count); - if (lock->lock_type == TAPI_SIM_LOCK_FD - && lock->lock_status == TAPI_SIM_LOCK_KEY_PUK2) { - ad->pin2_blocked_flag = TRUE; - } -} - -void setting_security_pin_get_facility_cb(TapiHandle *handle, int result, void *data, void *user_data) -{ - SETTING_TRACE_BEGIN; - - ret_if(!user_data); - SETTING_TRACE_DEBUG("user_data is not NULL"); - - ret_if(!data); - SETTING_TRACE_DEBUG("data is not NULL"); - - TelSimPinOperationResult_t sec_rt = result; - TelSimFacilityInfo_t *fi = data; - SettingSecurityUG *ad = user_data; - - SETTING_TRACE("sec_rt[%d]", sec_rt); - SETTING_TRACE("fi->type[%d]", fi->type); - SETTING_TRACE("fi->f_status[%d]", fi->f_status); - if (sec_rt == TAPI_SIM_PIN_OPERATION_SUCCESS) { - SETTING_TRACE_DEBUG("PIN_OPERATION_SUCCESS"); - switch (fi->type) { - case TAPI_SIM_LOCK_SC:/*pin1 status */ - ad->pin1_status = fi->f_status; - break; - case TAPI_SIM_LOCK_FD:/*pin2/fdn status */ - ad->pin2_status = fi->f_status; - break; - default: - break; - } - } else { - /*if failed, do nothing.. */ - } - - if (ad->tapi_async_cb_check_timer) { - ecore_timer_del(ad->tapi_async_cb_check_timer); - ad->tapi_async_cb_check_timer = NULL; - } - ad->enter_tapi_async_cb_flag = 1; - - /* Update SIM Settings view if created. */ - if (setting_view_security_sim_settings.is_create == 1) { - SETTING_TRACE_DEBUG("SIM settings view is already created. [%d]", setting_view_security_sim_settings.is_create); - setting_view_update(&setting_view_security_sim_settings, ad); - } else { - SETTING_TRACE_DEBUG("Change view"); - setting_view_change(&setting_view_security_main, &setting_view_security_sim_settings, ad); - } - - SETTING_TRACE_END; -} - -void setting_security_layout_passwd_ug_cb(ui_gadget_h ug, - enum ug_mode mode, void *priv) -{ - if (!priv) - return; - - Evas_Object *base = ug_get_layout(ug); - if (!base) - return; - - switch (mode) { - case UG_MODE_FULLVIEW: - evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_show(base); - break; - default: - break; - } - - return; -} - -void setting_security_destroy_password_ug_cb(ui_gadget_h ug, - void *priv) -{ - SETTING_TRACE_BEGIN; - ret_if(priv == NULL); - SettingSecurityUG *ad = (SettingSecurityUG *) priv; - - if (ad->ly_main) - elm_object_tree_focus_allow_set(ad->ly_main, EINA_TRUE); - - if (ug) { - setting_ug_destroy(ug); - } - - SETTING_TRACE_DEBUG("[TEST] current : %s", ad->input_pwd); -} - -void setting_security_end_password_ug_cb(ui_gadget_h ug, - void *priv) -{ - SETTING_TRACE_BEGIN; - ret_if(priv == NULL); - SettingSecurityUG *ad = (SettingSecurityUG *) priv; - ad->ug_passwd = NULL; - - if (setting_view_security_sim_settings.is_create == TRUE && ad->pw_type == SETTING_SEC_PW_PIN1_UNBLOCKED) { - SETTING_TRACE("ungrab keys"); - /* ungrab keys. */ -#ifdef ECORE_X - Ecore_X_Window xwin = 0; - Ecore_X_Display *disp = NULL; - - int ret = 0; - - disp = ecore_x_display_get(); - xwin = elm_win_xwindow_get((Evas_Object *)ug_get_window()); - - ret = eext_win_keygrab_unset(xwin, "XF86Back"); - if (ret) - SETTING_TRACE("KEY_BACK ungrab failed."); - ret = eext_win_keygrab_unset(xwin, "XF86Home"); - if (ret) - SETTING_TRACE("XF86Home ungrab failed."); - ret = eext_win_keygrab_unset(xwin, "XF86AudioRaiseVolume"); - if (ret) - SETTING_TRACE("KEY_VOLUMEUP ungrab failed."); - ret = eext_win_keygrab_unset(xwin, "XF86AudioLowerVolume"); - if (ret) - SETTING_TRACE("KEY_VOLUMEDOWN ungrab failed."); -#else - // @todo : repace codes using X with codes tizen 3.0 API -#endif - } -#if SUPPORT_ENCRYPTION - if (setting_view_security_confirm_encryption.is_create == TRUE) { - SETTING_TRACE_DEBUG("[TEST] current : %s", ad->input_pwd); - setting_view_update(&setting_view_security_confirm_encryption, ad); - } else if (setting_view_security_encryption.is_create == TRUE) { - SETTING_TRACE_DEBUG("[TEST] current : %s", ad->input_pwd); - setting_view_update(&setting_view_security_encryption, ad); - } -#endif -} - -gboolean setting_security_create_password_sg(void *data) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retv_if(data == NULL, FALSE); - - SettingSecurityUG *ad = (SettingSecurityUG *) data; /* ad is point to data */ - - /* prevent the ug from being loaded again due to window event queuing */ - /* added by JTS: CQ H0100135346 */ - if (ad->ug_passwd) { - SETTING_TRACE("Password UG is already loaded."); - return FALSE; - } - - if ((ad->pw_type < 0) || (ad->pw_type > SETTING_SEC_PW_MAX)) - return FALSE; - - char str[Max_Passwd_View_Type_Len + 1] = { 0, }; - safeCopyStr(str, security_table[ad->pw_type].pw_type_string, Max_Passwd_View_Type_Len); - - struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs)); - - if (!cbs) - return FALSE; - cbs->layout_cb = setting_security_layout_passwd_ug_cb; - cbs->result_cb = setting_security_result_password_ug_cb; - cbs->destroy_cb = setting_security_destroy_password_ug_cb; - cbs->end_cb = setting_security_end_password_ug_cb; - cbs->priv = (void *)ad; - - app_control_h svc; - if (app_control_create(&svc)) { - FREE(cbs); - return FALSE; - } - - app_control_add_extra_data(svc, "viewtype", str); - - SETTING_TRACE_DEBUG("send viewtype to password : %s", str); - - if ((ad->pw_type != SETTING_SEC_PW_ENTER_LOCK_TYPE) && ad->input_pwd) { - SETTING_TRACE_SECURE_DEBUG("Send current : %s", ad->input_pwd); - app_control_add_extra_data(svc, "current", ad->input_pwd); - } - - if (ad->ly_main) - elm_object_tree_focus_allow_set(ad->ly_main, EINA_FALSE); - ad->ug_removed = FALSE; - ad->ug_passwd = setting_ug_create(ad->ug, "setting-password-efl", UG_MODE_FULLVIEW, svc, cbs); - if (NULL == ad->ug_passwd) { /* error handling */ - evas_object_show(ad->ly_main); - } - - app_control_destroy(svc); - FREE(cbs); - - return TRUE; -} - -void setting_security_layout_lockscreen_options_ug_cb(ui_gadget_h ug, - enum ug_mode mode, void *priv) -{ - if (!priv) - return; - - Evas_Object *base = ug_get_layout(ug); - if (!base) - return; - - switch (mode) { - case UG_MODE_FULLVIEW: - evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - evas_object_show(base); - break; - default: - break; - } - - return; -} - -void setting_security_destroy_lockscreen_options_ug_cb(ui_gadget_h ug, - void *priv) -{ - ret_if(priv == NULL); - SettingSecurityUG *ad = (SettingSecurityUG *) priv; - if (ug) { - setting_ug_destroy(ug); - ad->ug_lockscreen = NULL; - } -} - - -gboolean setting_security_create_lockscreen_options_sg(void *data) -{ - /* error check */ - retv_if(data == NULL, FALSE); - - SettingSecurityUG *ad = (SettingSecurityUG *) data; /* ad is point to data */ - - if (ad->ug_lockscreen) { - SETTING_TRACE("Password UG is already loaded."); - return FALSE; - } - - -#if 1 - app_launcher("lockscreen-options"); -#else - struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs)); - - if (!cbs) - return FALSE; - cbs->layout_cb = setting_security_layout_lockscreen_options_ug_cb; - cbs->result_cb = NULL; - cbs->destroy_cb = setting_security_destroy_lockscreen_options_ug_cb; - cbs->priv = (void *)ad; - - if (ad->ly_main) - elm_object_tree_focus_allow_set(ad->ly_main, EINA_FALSE); - ad->ug_lockscreen = setting_ug_create(ad->ug, "lockscreen-options", UG_MODE_FULLVIEW, NULL, cbs); - if (NULL == ad->ug_lockscreen) { /* error handling */ - SETTING_TRACE_ERROR("NULL == ad->ug_lockscreen"); - evas_object_show(ad->ly_main); - } - - FREE(cbs); -#endif - - return TRUE; -} -#if SUPPORT_ENCRYPTION -void setting_security_layout_mmc_encryption_ug_cb(ui_gadget_h ug, - enum ug_mode mode, void *priv) -{ - if (!priv) - return; - - Evas_Object *base = ug_get_layout(ug); - if (!base) - return; - - switch (mode) { - case UG_MODE_FULLVIEW: - evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - evas_object_show(base); - break; - default: - break; - } - - return; -} - -void setting_security_destroy_mmc_encryption_ug_cb(ui_gadget_h ug, - void *priv) -{ - ret_if(priv == NULL); - SettingSecurityUG *ad = (SettingSecurityUG *) priv; - if (ug) { - setting_ug_destroy(ug); - ad->ug_mmc_encryption = NULL; - } - -} - -gboolean setting_security_create_mmc_encryption_sg(void *data) -{ - /* error check */ - retv_if(data == NULL, FALSE); - - SettingSecurityUG *ad = (SettingSecurityUG *) data; /* ad is point to data */ - - if (ad->ug_mmc_encryption) { - SETTING_TRACE("mmc encryption UG is already loaded."); - return FALSE; - } - struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs)); - - if (!cbs) - return FALSE; - cbs->layout_cb = setting_security_layout_mmc_encryption_ug_cb; - cbs->result_cb = NULL; - cbs->destroy_cb = setting_security_destroy_mmc_encryption_ug_cb; - cbs->priv = (void *)ad; - - if (ad->ly_main) - elm_object_tree_focus_allow_set(ad->ly_main, EINA_FALSE); - ad->ug_mmc_encryption = setting_ug_create(ad->ug, "setting-mmc-encryption-efl", UG_MODE_FULLVIEW, NULL, cbs); - if (NULL == ad->ug_mmc_encryption) { /* error handling */ - SETTING_TRACE_ERROR("NULL == ad->ug_mmc_encryption"); - evas_object_show(ad->ly_main); - } - - FREE(cbs); - - return TRUE; -} -#endif - -void setting_security_layout_firewall_ug_cb(ui_gadget_h ug, - enum ug_mode mode, void *priv) -{ - Evas_Object *base = ug_get_layout(ug); - if (!base) - return; - - switch (mode) { - case UG_MODE_FULLVIEW: - evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - /*elm_win_resize_object_add(ad->win_get, base); */ - evas_object_show(base); - break; - default: - break; - } - - return; -} - -void setting_security_destroy_firewall_ug_cb(ui_gadget_h ug, - void *priv) -{ - ret_if(priv == NULL); - SettingSecurityUG *ad = (SettingSecurityUG *) priv; - - elm_object_tree_focus_allow_set(ad->ly_main, EINA_TRUE); - if (ug) { - setting_ug_destroy(ug); - ad->ug_firewall = NULL; - } -} - -gboolean setting_security_create_firewall_sg(void *data) -{ - retv_if(data == NULL, FALSE); - - SettingSecurityUG *ad = (SettingSecurityUG *) data; - if (ad->ug_firewall) { - SETTING_TRACE("firewall UG is already loaded."); - return FALSE; - } - struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs)); - - if (!cbs) - return FALSE; - cbs->layout_cb = setting_security_layout_firewall_ug_cb; - cbs->result_cb = NULL; - cbs->destroy_cb = setting_security_destroy_firewall_ug_cb; - cbs->priv = (void *)ad; - - if (ad->ly_main) - elm_object_tree_focus_allow_set(ad->ly_main, EINA_FALSE); - ad->ug_firewall = setting_ug_create(ad->ug, "setting-firewall-efl", UG_MODE_FULLVIEW, NULL, cbs); - if (NULL == ad->ug_firewall) { - SETTING_TRACE_ERROR("NULL == ad->ug_firewall"); - evas_object_show(ad->ly_main); - } - - FREE(cbs); - return TRUE; -} - - -/* *************************************************** - * - *call back func - * - ***************************************************/ -/* -1 on fail */ -/* 0~n on success */ -int _get_security_table_index(char *name) -{ - int i = 0; - - for (i = 0; i < SETTING_SEC_PW_MAX; i++) { - if (0 == safeStrCmp(name, security_table[i].pw_type_string)) - return i; - } - return -1; -} - -void -setting_security_result_password_ug_cb(ui_gadget_h ug, app_control_h service, - void *priv) -{ - SETTING_TRACE_BEGIN; - /* error check */ - retm_if(priv == NULL, "Data paremeter is NULL"); - - SettingSecurityUG *ad = (SettingSecurityUG *) priv; /* ad is point to priv */ - - if (ad->ly_main) - elm_object_tree_focus_allow_set(ad->ly_main, EINA_TRUE); - - char *result = NULL; - char *current = NULL; - - app_control_get_extra_data(service, "result", &result); - app_control_get_extra_data(service, "current", ¤t); - - /* divided pw view type */ - SETTING_TRACE("ad->pw_type: %d result :%s", ad->pw_type, result); - ret_if(NULL == result); - - if (safeStrCmp(result, "Cancel") == 0) { - ad->pw_type = -1; - if (setting_view_security_sim_settings.is_create == 1) { - setting_view_update(&setting_view_security_sim_settings, ad); - } - FREE(result); - return; - /* To do : rollback previouse status. */ - } else if (safeStrCmp(result, "SETTING_PW_TYPE_ENTER_LOCK_TYPE") == 0) { - /*ug_destroy(ug); */ - /*ad->ug_passwd = NULL; */ - /*setting_view_update(&setting_view_security_locktype, ad); */ - ad->pw_type = SETTING_SEC_PW_ENTER_LOCK_TYPE; - } else if (safeStrCmp(result, "SETTING_PW_TYPE_ENTER_LOCK_TYPE:Fail") == 0) { - ad->pw_type = -1; - ug_destroy_me(ad->ug); - FREE(result); - if (current) - FREE(current); - return; - } else { - int index = _get_security_table_index(result); - - if (index != -1) { - security_table[index].passwd_handler(ad, NULL); - ad->pw_type = security_table[index].pw_type_num; - } else { - SETTING_TRACE_ERROR("no table entry"); - } - if (ad->input_pwd) - FREE(ad->input_pwd); - } - - if (current) { - SETTING_TRACE_SECURE_DEBUG("current : %s", current); - ad->input_pwd = (char *)strdup(current); - FREE(current); - } - - evas_object_show(ad->ly_main); - FREE(result); - SETTING_TRACE_END; -} - -#ifdef Status -#undef Status -#endif - -static Setting_Cfg_Node_T s_cfg_node_array[] = { - {"IDS_JAVA_OPT_SIM_SETTINGS", NULL, "viewtype:frontpage;tab:first;keyword:IDS_JAVA_OPT_SIM_SETTINGS", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, - {"IDS_ST_BODY_DECRYPT_DEVICE", NULL, "viewtype:frontpage;tab:first;keyword:IDS_ST_BODY_DECRYPT_DEVICE", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, - {"IDS_ST_HEADER_ENCRYPT_DEVICE", NULL, "viewtype:frontpage;tab:first;keyword:IDS_ST_HEADER_ENCRYPT_DEVICE", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, - {"IDS_DN_BODY_ENCRYPT_SD_CARD", NULL, "viewtype:frontpage;tab:first;keyword:IDS_DN_BODY_ENCRYPT_SD_CARD", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, - {"IDS_ST_BODY_FIREWALL", NULL, "viewtype:frontpage;tab:first;keyword:IDS_ST_BODY_FIREWALL", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, - {"IDS_ST_BODY_ANTIVIRUS_SOFTWARE_ABB", NULL, "viewtype:frontpage;tab:first;keyword:IDS_ST_BODY_ANTIVIRUS_SOFTWARE_ABB", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, - {"IDS_EMAIL_POP_SECURITY_UPDATE_ABB", NULL, "viewtype:frontpage;tab:first;keyword:IDS_EMAIL_POP_SECURITY_UPDATE_ABB", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL}, -}; - -UG_MODULE_API int setting_plugin_search_init(app_control_h service, void *priv, char **applocale) -{ - SETTING_TRACE_BEGIN; - SETTING_TRACE(">> setting-security-efl DB search code"); - - *applocale = strdup("setting:"_TZ_SYS_RO_APP"/org.tizen.setting/res/locale"); - - Eina_List **pplist = (Eina_List **)priv; - int i; - int size = sizeof(s_cfg_node_array) / sizeof(s_cfg_node_array[0]); - for (i = 0; i < size; i++) { - Setting_Cfg_Node_T *node = setting_plugin_search_item_subindex_add(s_cfg_node_array[i].key_name, s_cfg_node_array[i].ug_args, IMG_Security, s_cfg_node_array[i].item_type, s_cfg_node_array[i].data, "Security"); - *pplist = eina_list_append(*pplist, node); - } - return 0; -} - -#if SUPPORT_SECURITY_FIREWALL -int setting_security_system_command(const char *command, const char *commandex) -{ - SETTING_TRACE_BEGIN; - int pid = 0 , status = 0; - char *argv[2] = {NULL,}; - /*int ret; */ - - if (command == 0 && commandex == 0) { - /*not exist input */ - } - - pid = fork(); - - if (pid > 0) { - SETTING_TRACE("parent"); - wait(&status); - return WEXITSTATUS(status); - } - - if (pid == 0) { - char *args[100] = { - argv[0] = (char *)command, - argv[1] = (char *)commandex, - NULL, - }; - - SETTING_TRACE_DEBUG("[%s]:%s", argv[0], argv[1]); - execv(_TZ_SYS_RO_APP"/org.tizen.setting/bin/firewall", args); - } - return 1; -} - -int setting_security_firewall_reset() -{ - SETTING_TRACE_BEGIN; - - struct dirent ent,*next_file; - DIR *theFolder; - - char filepath[256]; - - theFolder = opendir(SEC_FIREWALL_DIR); - readdir_r(theFolder, &ent, &next_file); - while (next_file) { - /* build the full path for each file in the folder */ - snprintf(filepath,256, "%s/%s", SEC_FIREWALL_DIR, ent.d_name); - SETTING_TRACE_DEBUG("[%s]", filepath); - /*(void) remove(filepath); */ - if (remove(filepath) != 0) { /*delete the file */ - perror("remove"); - } - readdir_r(theFolder, &ent, &next_file); - } - - closedir(theFolder); - return 0; -} -#endif -