diff options
-rwxr-xr-x | CMakeLists.txt | 2 | ||||
-rwxr-xr-x | setting-privacy/CMakeLists.txt | 42 | ||||
-rw-r--r-- | setting-privacy/include/setting-privacy-main.h | 26 | ||||
-rwxr-xr-x | setting-privacy/include/setting-privacy.h | 87 | ||||
-rwxr-xr-x | setting-privacy/src/setting-privacy-main.c | 167 | ||||
-rwxr-xr-x | setting-privacy/src/setting-privacy.c | 134 |
6 files changed, 458 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d34b80c..38272a0 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,7 @@ SET(SETTING_STORAGE setting-storage) SET(SETTING_FILEVIEW setting-fileview) SET(SETTING_RINGTONE setting-ringtone) SET(SETTING_APPMGR setting-appmgr) +SET(SETTING_PRIVACY setting-privacy) SET(LIB_SETTING_COMMON setting-common) @@ -95,3 +96,4 @@ ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_PROFILE}) ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_RINGTONE}) ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_STORAGE}) ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_TIME}) +ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_PRIVACY}) diff --git a/setting-privacy/CMakeLists.txt b/setting-privacy/CMakeLists.txt new file mode 100755 index 0000000..d262bd2 --- /dev/null +++ b/setting-privacy/CMakeLists.txt @@ -0,0 +1,42 @@ +SET(PROJECT_SETTING_PRIVACY "setting-privacy") +SET(SETTING_PKG_PRIVACY "org.tizen.setting-privacy") + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${SETTING_COMMON}/include) + +INCLUDE(FindPkgConfig) +pkg_check_modules(pkgs_privacy REQUIRED + capi-appfw-application + dlog + efl-extension + elementary + vconf +) + +FOREACH(flag ${pkgs_privacy_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE -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_EXECUTABLE(${PROJECT_SETTING_PRIVACY} + ./src/setting-privacy.c + ./src/setting-privacy-main.c +) + +TARGET_LINK_LIBRARIES(${PROJECT_SETTING_PRIVACY} -L${CMAKE_BINARY_DIR}/${SETTING_COMMON} -lsetting-common -pie) +TARGET_LINK_LIBRARIES(${PROJECT_SETTING_PRIVACY} ${pkgs_privacy_LDFLAGS}) + +INSTALL(PROGRAMS ${PROJECT_SETTING_PRIVACY} DESTINATION ${TZ_SYS_RO_APP}/${SETTING_PKG_NAME}/bin) + diff --git a/setting-privacy/include/setting-privacy-main.h b/setting-privacy/include/setting-privacy-main.h new file mode 100644 index 0000000..09624ff --- /dev/null +++ b/setting-privacy/include/setting-privacy-main.h @@ -0,0 +1,26 @@ +/* + * setting + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. + * + * Contact: MyoungJune Park <mj2004.park@samsung.com> + * + * 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_PRIVACY_MAIN_H__ +#define __SETTING_PRIVACY_MAIN_H__ + +#include "setting-privacy.h" + +#endif /* __SETTING_PRIVACY_MAIN_H__ */ diff --git a/setting-privacy/include/setting-privacy.h b/setting-privacy/include/setting-privacy.h new file mode 100755 index 0000000..0a02236 --- /dev/null +++ b/setting-privacy/include/setting-privacy.h @@ -0,0 +1,87 @@ +/* + * setting + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. + * + * Contact: MyoungJune Park <mj2004.park@samsung.com> + * + * 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_PRIVACY_H__ +#define __SETTING_PRIVACY_H__ + +#include <stdio.h> +#include <string.h> +#include <Elementary.h> +#include <glib-object.h> + +#include "setting-cfg.h" +#include "setting-common-data-type.h" +#include "setting-common-draw-widget.h" +#include "setting-common-init.h" +#include "setting-common-view.h" + +#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_PrivacySettings "IDS_ST_HEADER_PRIVACY_SETTINGS_ABB" +#define KeyStr_ADs "IDS_ST_MBODY_ADS" + + +#define KeyStr_Security "IDS_ST_BODY_SECURITY" + +#define KeyStr_SecureErase "IDS_ST_TMBODY_SECURE_ERASE" +#define KeyStr_SecureErase_Desc "IDS_ST_SBODY_ERASE_ALL_DELETED_DATA_ON_THE_PHONE_PERMANENTLY_FOR_SECURITY_PURPOSES_THIS_DATA_WILL_NOT_BE_RECOVERABLE_BY_ANYONE" + + +#define KeyStr_Encryption "IDS_ST_HEADER_ENCRYPTION" + +#define KeyStr_DecryptDevice "IDS_ST_BODY_DECRYPT_DEVICE" +#define KeyStr_EncryptDevice "IDS_ST_HEADER_ENCRYPT_DEVICE" + +#define KeyStr_DeviceEncrypted "IDS_ST_SBODY_DEVICE_ENCRYPTED_M_STATUS" +#define KeyStr_DeviceNotEncrypted "IDS_ST_SBODY_DEVICE_NOT_ENCRYPTED_M_STATUS" + +#define KeyStr_DecryptSDcard "IDS_ST_HEADER_DECRYPT_SD_CARD" +#define KeyStr_EncryptSDcard "IDS_ST_HEADER_ENCRYPT_SD_CARD" + +#define KeyStr_SDcardEncrypted "IDS_ST_SBODY_SD_CARD_ENCRYPTED_M_STATUS" +#define KeyStr_SDcardNotEncrypted "IDS_ST_SBODY_DEVICE_NOT_ENCRYPTED_M_STATUS" + +typedef struct _SettingPrivacy SettingPrivacy; + +/** + * Setting MoreConnections context + */ +struct _SettingPrivacy { + MainData md; + + Setting_GenGroupItem_Data *location_service; + Setting_GenGroupItem_Data *VPN; + Setting_GenGroupItem_Data *encryption_device; + Setting_GenGroupItem_Data *encryption_sdcard; + Setting_GenGroupItem_Data *secure_erase; + + /* item class */ + Elm_Genlist_Item_Class itc_2text_2; + Elm_Genlist_Item_Class itc_1text; + Elm_Genlist_Item_Class itc_group_item; + + bool empty_flag; +}; + +extern setting_view setting_view_privacy_main; +char *setting_location_is_enabled(void *data); + +#endif /* __SETTING_MORECONNECTIONS_H__ */ diff --git a/setting-privacy/src/setting-privacy-main.c b/setting-privacy/src/setting-privacy-main.c new file mode 100755 index 0000000..a35cba2 --- /dev/null +++ b/setting-privacy/src/setting-privacy-main.c @@ -0,0 +1,167 @@ +/* + * setting + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. + * + * Contact: MyoungJune Park <mj2004.park@samsung.com> + * + * 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-privacy-main.h" +#include "setting-common-data-slp-setting.h" + +static int _view_create(void *cb); +static int _view_destroy(void *cb); +static int _view_update(void *cb); +static int _view_cleanup(void *cb); +static void _mouse_up_Gendial_list_cb( + void *data, Evas_Object *obj, void *event_info); + +setting_view setting_view_privacy_main = { + .create = _view_create, + .destroy = _view_destroy, + .update = _view_update, + .cleanup = _view_cleanup +}; + +/************************************************ + * @brief Do process when clicking '<-' button + * + * @param data application context + * @param UNUSED + ************************************************/ + +static Eina_Bool _cancel_cb(void *data, Elm_Object_Item *it) +{ + SETTING_TRACE_BEGIN; + ui_app_exit(); + return EINA_TRUE; +} + + +static void _mouse_up_Gendial_list_cb(void *data, Evas_Object *obj, + void *event_info) +{ + Setting_GenGroupItem_Data *list_item = NULL; + 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); + list_item = (Setting_GenGroupItem_Data *)elm_object_item_data_get(item); + SETTING_TRACE("clicking item[%s]", _(list_item->keyStr)); + + if (!safeStrCmp(KeyStr_PrivacySettings, list_item->keyStr)) + app_launcher("org.tizen.privacy-setting", NULL, NULL); + else if (!safeStrCmp(KeyStr_SecureErase, list_item->keyStr)) + app_launcher("org.tizen.secure-erase", NULL, NULL); +} + +/************************************************** + * @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 _generate_genlist(SettingPrivacy *ad) +{ + SETTING_TRACE_BEGIN; + /* error check */ + retv_if(!ad, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); + + Evas_Object *scroller = ad->md.genlist; + + /* Privacy */ + setting_create_Gendial_field_def(scroller, &(ad->itc_1text), + _mouse_up_Gendial_list_cb, + ad, SWALLOW_Type_INVALID, + NULL, NULL, 0, + KeyStr_PrivacySettings, NULL, NULL); + + /* Security */ + setting_create_Gendial_field_titleItem(ad->md.genlist, + &itc_group_item, KeyStr_Security, NULL); + ad->secure_erase = setting_create_Gendial_field_def(scroller, + &(ad->itc_2text_2), + _mouse_up_Gendial_list_cb, + ad, SWALLOW_Type_INVALID, + NULL, NULL, 0, + KeyStr_SecureErase, KeyStr_SecureErase_Desc, NULL); + if (ad->secure_erase) + ad->secure_erase->userdata = ad; + else + SETTING_TRACE_ERROR("ad->secure_erase is NULL"); + + SETTING_TRACE_END; + return SETTING_RETURN_SUCCESS; +} + +/*************************************************** + * + * basic func + * + ***************************************************/ +static int _view_create(void *cb) +{ + SETTING_TRACE_BEGIN; + int ret; + SettingPrivacy *ad = (SettingPrivacy *)cb; + retv_if(!ad, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); + + ret = view_init(&ad->md, _("IDS_ST_HEADER_PRIVACY_AND_SECURITY_ABB")); + if (ret != SETTING_RETURN_SUCCESS) + return ret; + + elm_object_style_set(ad->md.genlist, "dialogue"); + setting_add_back_button(&ad->md, _cancel_cb, ad); + + _generate_genlist(ad); + + setting_view_privacy_main.is_create = 1; + SETTING_TRACE_END; + return SETTING_RETURN_SUCCESS; +} + +static int _view_destroy(void *cb) +{ + SETTING_TRACE_BEGIN; + /* error check */ + retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); + retv_if(!(setting_view_privacy_main.is_create), + SETTING_GENERAL_ERR_NULL_DATA_PARAMETER); + + SettingPrivacy *ad = (SettingPrivacy *)cb; + + if (ad->md.naviframe != NULL) { + evas_object_del(ad->md.naviframe); + ad->md.naviframe = NULL; + } + + setting_view_privacy_main.is_create = 0; + + SETTING_TRACE_END; + return SETTING_RETURN_SUCCESS; +} + +static int _view_update(void *cb) +{ + SETTING_TRACE_BEGIN; + return SETTING_RETURN_SUCCESS; +} + +static int _view_cleanup(void *cb) +{ + SETTING_TRACE_BEGIN; + return SETTING_RETURN_SUCCESS; +} diff --git a/setting-privacy/src/setting-privacy.c b/setting-privacy/src/setting-privacy.c new file mode 100755 index 0000000..c5fd9cb --- /dev/null +++ b/setting-privacy/src/setting-privacy.c @@ -0,0 +1,134 @@ +/* + * setting + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. + * + * Contact: MyoungJune Park <mj2004.park@samsung.com> + * + * 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-privacy.h" +#include "setting-common-data-slp-setting.h" + +#define SETTING_PRIVACY_PACKAGE_NAME "org.tizen.setting-privacy" + +bool on_app_create(void *priv) +{ + SETTING_TRACE_BEGIN; + SettingPrivacy *ad = priv; + retv_if(!ad, NULL); + + if (app_init(&ad->md, SETTING_PRIVACY_PACKAGE_NAME) + != SETTING_RETURN_SUCCESS) { + SETTING_TRACE_ERROR("Cannot initialize application"); + return false; + } + + /* register view node table */ + setting_view_node_table_intialize(); + setting_view_node_table_register(&setting_view_privacy_main, + NULL); + + /* creating a view. */ + setting_create_Gendial_itc(SETTING_GENLIST_2LINE_STYLE, + &(ad->itc_2text_2)); + setting_create_Gendial_itc(SETTING_GENLIST_ICON_1LINE_STYLE, + &(ad->itc_1text)); + setting_create_Gendial_itc(SETTING_GENLIST_GROUP_INDEX_STYLE, + &(ad->itc_group_item)); + + + setting_view_node_set_cur_view(&setting_view_privacy_main); + setting_view_create(&setting_view_privacy_main, (void *)ad); + + return true; +} + +static void on_app_pause(void *data) +{ + SETTING_TRACE_BEGIN; +} + +static void on_app_control(app_control_h service, void *data) +{ + SETTING_TRACE_BEGIN; + SettingPrivacy *ad = data; + evas_object_show(ad->md.window); + +} + +static void on_app_resume(void *priv) +{ + SETTING_TRACE_BEGIN; + SettingPrivacy *ad = priv; + ret_if(!priv); + + setting_view_create(&setting_view_privacy_main, (void *)ad); + + SETTING_TRACE_END; +} + +static void on_app_terminate(void *priv) +{ + SETTING_TRACE_BEGIN; + SettingPrivacy *ad = priv; + + /* called when this shared gadget is terminated. similar with + * app_exit */ + setting_view_destroy(&setting_view_privacy_main, ad); + + SETTING_TRACE_END; +} + +static void _lang_changed(app_event_info_h event_info, void *data) +{ + char *lang = NULL; + if (app_event_get_language(event_info, &lang) == APP_ERROR_NONE) { + SETTING_TRACE_DEBUG("Setting - language is changed : %s", lang); + elm_language_set(lang); + elm_config_all_flush(); + free(lang); + } else { + SETTING_TRACE_ERROR("Cannot get language from event_info"); + } +} + +EXPORT_PUBLIC +int main(int argc, char *argv[]) +{ + app_event_handler_h handlers[5] = {NULL, }; + ui_app_lifecycle_callback_s ops = { + .create = on_app_create, + .app_control = on_app_control, + .pause = on_app_pause, + .resume = on_app_resume, + .terminate = on_app_terminate, + }; + SettingPrivacy app_data; + ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], + APP_EVENT_LOW_MEMORY, NULL, NULL); + ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], + APP_EVENT_LOW_BATTERY, NULL, NULL); + ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], + APP_EVENT_LANGUAGE_CHANGED, _lang_changed, &app_data); + ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], + APP_EVENT_REGION_FORMAT_CHANGED, NULL, NULL); + ui_app_add_event_handler( + &handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], + APP_EVENT_DEVICE_ORIENTATION_CHANGED, NULL, NULL); + memset(&app_data, 0x0, sizeof(app_data)); + return ui_app_main(argc, argv, &ops, &app_data); +} + |