CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
INCLUDE(FindPkgConfig)
ADD_DEFINITIONS("-std=c++0x")
-ADD_SUBDIRECTORY(webapp-common)
ADD_SUBDIRECTORY(webapp-detail)
ADD_SUBDIRECTORY(po)
ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALE_DIR}\"")
License: Flora Software License
Source0: %{name}-%{version}.tar.gz
-BuildRequires: edje-bin
BuildRequires: gettext
-BuildRequires: edje-tools
BuildRequires: cmake
BuildRequires: pkgconfig(elementary)
BuildRequires: pkgconfig(ecore)
%files
%manifest wrt-setting.manifest
-/etc/smack/accesses2.d/ug.webapp-common-efl.include
/etc/smack/accesses2.d/ug.webapp-detail-efl.include
%defattr(-,root,root,-)
%{_datadir}/license/%{name}
ru_RU.po sr.po sk.po sl.po es_ES.po es_MX.po sv.po tr_TR.po uk.po
uz.po fr_CA.po)
-SET(PROJECT_NAME "ug-webapp-common-efl")
+SET(PROJECT_NAME "ug-webapp-detail-efl")
SET(LOCALE_DIR "/usr/ug/res/locale/")
SET(MSGFMT "/usr/bin/msgfmt")
+++ /dev/null
-#
-# Copyright 2012 Samsung Electronics Co., Ltd
-#
-# Licensed under the Flora License, Version 1.1 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://floralicense.org/license/
-#
-# 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.
-#
-
-SET(TARGET_UG_LIB "ug-webapp-common-efl")
-SET(TARGET_UG_EDJ "webapp-common.edj")
-SET(UGDIR "${UG_INSTALL_PREFIX}/ug/lib")
-SET(ICONDIR "${UG_INSTALL_PREFIX}/ug/res/images/${TARGET_UG_LIB}")
-SET(EDJDIR "${UG_INSTALL_PREFIX}/ug/res/edje/${TARGET_UG_LIB}")
-
-PKG_CHECK_MODULES(UG_WEB_APP_COMMON_DEPS
- ecore
- elementary
- ui-gadget-1
- dpl-efl
- dpl-wrt-dao-rw
- dpl-wrt-dao-ro
- REQUIRED)
-
-SET(UG_SOURCES
- ug.cpp
- view.cpp
- popup.cpp
- mainview.cpp
- listview.cpp
- whitelistview.cpp
- whiteuriview.cpp
-)
-
-INCLUDE_DIRECTORIES(${UG_WEB_APP_COMMON_DEPS_INCLUDE_DIRS})
-ADD_LIBRARY(${TARGET_UG_LIB} SHARED ${UG_SOURCES})
-ADD_DEFINITIONS("-DICONDIR=\"${ICONDIR}\"")
-ADD_DEFINITIONS("-DEDJFILE=\"${EDJDIR}/${TARGET_UG_EDJ}\"")
-
-SET_TARGET_PROPERTIES(${TARGET_UG_LIB} PROPERTIES SOVERSION ${PROJECT_API_VERSION})
-SET_TARGET_PROPERTIES(${TARGET_UG_LIB} PROPERTIES VERSION ${PROJECT_VERSION})
-TARGET_LINK_LIBRARIES(${TARGET_UG_LIB} ${UG_WEB_APP_COMMON_DEPS_LDFLAGS})
-INSTALL(TARGETS ${TARGET_UG_LIB} DESTINATION ${UGDIR})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ug.webapp-common-efl.include DESTINATION /etc/smack/accesses2.d)
-INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/icons/ DESTINATION ${ICONDIR} FILES_MATCHING PATTERN "*.png")
-
-ADD_SUBDIRECTORY(edc)
+++ /dev/null
-#
-# Copyright 2012 Samsung Electronics Co., Ltd
-#
-# Licensed under the Flora License, Version 1.1 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://floralicense.org/license/
-#
-# 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.
-#
-
-ADD_CUSTOM_TARGET(${TARGET_UG_EDJ}
- COMMAND edje_cc
- ${CMAKE_CURRENT_SOURCE_DIR}/main.edc ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_UG_EDJ}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/main.edc
-)
-ADD_DEPENDENCIES(${TARGET_UG_LIB} ${TARGET_UG_EDJ})
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_UG_EDJ} DESTINATION ${EDJDIR})
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 WEB_SRC_SETTING_WEBAPP_COMMON_EDC_DEFS_H_
-#define WEB_SRC_SETTING_WEBAPP_COMMON_EDC_DEFS_H_
-
-#define GRP_CONTENT "content"
-#define PART_NOCONTENT "swallow.nocontent"
-#define PART_CONTENT "swallow.content"
-#define SIG_SHOW_NOCONTENT "show,nocontent"
-#define SIG_SHOW_CONTENT "show,content"
-#define SRC_PROG "prog"
-
-#endif /* WEB_SRC_SETTING_WEBAPP_COMMON_EDC_DEFS_H_ */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 "defs.h"
-
-collections {
- group {
- name, GRP_CONTENT;
-
- parts {
- part {
- name, PART_CONTENT;
- type, SWALLOW;
- description {
- state, "default" 0.0;
- }
- description {
- state, "nocontent" 0.0;
- inherit, "default" 0.0;
- rel1.relative, -1.0 0.0;
- rel2.relative, 0.0 1.0;
- }
- }
-
- part {
- name, PART_NOCONTENT;
- type, SWALLOW;
- description {
- state, "default" 0.0;
- rel1.relative, 1.0 0.0;
- rel2.relative, 2.0 1.0;
- }
- description {
- state, "nocontent" 0.0;
- inherit, "default" 0.0;
- rel1.relative, 0.0 0.0;
- rel2.relative, 1.0 1.0;
- }
- }
- }
-
- programs {
- program {
- name, "show_nocontent";
- signal, SIG_SHOW_NOCONTENT;
- source, SRC_PROG;
- action, STATE_SET "nocontent" 0.0;
- target, PART_CONTENT;
- target, PART_NOCONTENT;
- }
- program {
- name, "show_content";
- signal, SIG_SHOW_CONTENT;
- source, SRC_PROG;
- action, STATE_SET "default" 0.0;
- target, PART_CONTENT;
- target, PART_NOCONTENT;
- }
- }
- }
-}
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 WEB_SRC_SETTING_WEBAPP_COMMON_ICONS_H_
-#define WEB_SRC_SETTING_WEBAPP_COMMON_ICONS_H_
-
-#define ICON_EDIT ICONDIR"/01_controlbar_icon_edit.png"
-#define ICON_SAVE ICONDIR"/01_controlbar_icon_save.png"
-#define ICON_DELETE ICONDIR"/01_controlbar_icon_delete.png"
-#define ICON_ADD ICONDIR"/01_controlbar_icon_create.png"
-
-#endif /* WEB_SRC_SETTING_WEBAPP_COMMON_ICONS_H_ */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 <Elementary.h>
-#include <ui-gadget.h>
-#include <ui-gadget-module.h>
-
-#include <dpl/wrt-dao-ro/global_dao_read_only.h>
-#include <dpl/wrt-dao-rw/global_dao.h>
-#include <dpl/assert.h>
-
-#include "listview.h"
-#include "icons.h"
-
-
-#define LOG_TAG "WRT-SETTING"
-#include <dlog.h>
-
-namespace WebAppCommonSetting {
-const char * const COOKIE_SHARING = "IDS_ST_BODY_COOKIE_SHARING";
-const char * const SHARE_COOKIES_BETWEEN_WEB_APPS =
- "IDS_ST_BODY_SHARE_COOKIES_BETWEEN_WEB_APPS";
-const char * const MOFILE_INSTALL_DIR =
- "/usr/ug/res/locale";
-
-char *ListView::getWacTitle(void */*data*/,
- Evas_Object */*obj*/,
- const char */*part*/)
-{
- return strdup("WAC");
-}
-
-char *ListView::getWhiteListTitle(void */*data*/,
- Evas_Object */*obj*/,
- const char */*part*/)
-{
- return strdup("White list");
-}
-
-char *ListView::getText(void *data,
- Evas_Object */*obj*/,
- const char *part)
-{
- OnOffData *onOffData;
- const char *str;
-
- onOffData = static_cast<OnOffData *>(data);
- Assert(onOffData);
-
- if (!strcmp(part, "elm.text"))
- str = onOffData->m_title.c_str();
- else if (!strcmp(part, "elm.text.1"))
- str = onOffData->m_title.c_str();
- else {
- return NULL;
- }
- return strdup(str);
-}
-
-Evas_Object *ListView::getOnOffIcon(void *data,
- Evas_Object *obj,
- const char */*part*/)
-{
- OnOffData *onOffData;
- Evas_Object *chk;
- bool val;
-
- onOffData = static_cast<OnOffData *>(data);
- Assert(onOffData);
-
- chk = elm_check_add(obj);
- if (!chk)
- return NULL;
- evas_object_propagate_events_set(chk, EINA_TRUE);
- elm_object_style_set(chk, "on&off");
- val = onOffData->m_getOnOffVal();
- elm_check_state_set(chk, static_cast<Eina_Bool>(val));
- onOffData->m_chk = chk;
- evas_object_smart_callback_add(chk,
- "changed",
- onOffData->m_changedCb,
- data);
-
- return chk;
-}
-
-void ListView::delOnOffData(void *data, Evas_Object */*obj*/)
-{
- OnOffData *onOffData;
-
- onOffData = static_cast<OnOffData *>(data);
- delete onOffData;
-}
-
-char *ListView::getRoamingLabel(void *data,
- Evas_Object */*obj*/,
- const char *part)
-{
- const char *str;
- RoamingData *roamingData;
-
- roamingData = static_cast<RoamingData *>(data);
- Assert(roamingData);
-
- if (!strcmp(part, "elm.text.1")) {
- str = "Data roaming";
- } else if (!strcmp(part, "elm.text.2")) {
- switch (WrtDB::GlobalDAOReadOnly::GetRoamingDataUsage()) {
- case WrtDB::GlobalDAOReadOnly::NEVER_CONNECT:
- str = "Never connect";
- break;
- case WrtDB::GlobalDAOReadOnly::ALWAYS_ASK:
- str = "Always ask";
- break;
- case WrtDB::GlobalDAOReadOnly::CONNECT_AUTOMATICALLY:
- str = "Connect automatically";
- break;
- default:
- str = NULL;
- break;
- }
- } else {
- str = NULL;
- }
-
- if (!str)
- return NULL;
-
- return strdup(str);
-}
-
-void ListView::delRoamingData(void *data, Evas_Object */*obj*/)
-{
- RoamingData *roamingData;
-
- roamingData = static_cast<RoamingData *>(data);
- delete roamingData;
-}
-
-char *ListView::getRoamingOptLabel(void *data,
- Evas_Object */*obj*/,
- const char */*part*/)
-{
- const char *str;
- RoamingExpandData *roamingExpandData;
-
- roamingExpandData = static_cast<RoamingExpandData *>(data);
- Assert(roamingExpandData);
-
- switch (roamingExpandData->m_mode) {
- case WrtDB::GlobalDAOReadOnly::NEVER_CONNECT:
- str = "Never connect";
- break;
- case WrtDB::GlobalDAOReadOnly::ALWAYS_ASK:
- str = "Always ask";
- break;
- case WrtDB::GlobalDAOReadOnly::CONNECT_AUTOMATICALLY:
- str = "Connect automatically";
- break;
- default:
- str = NULL;
- break;
- }
-
- if (!str)
- return NULL;
-
- return strdup(str);
-}
-
-Evas_Object *ListView::getRoamingOptRadio(void *data,
- Evas_Object *obj,
- const char */*part*/)
-{
- Evas_Object *radio;
- RoamingExpandData *roamingExpandData;
- int mode;
-
- roamingExpandData = static_cast<RoamingExpandData *>(data);
- Assert(roamingExpandData);
- mode = WrtDB::GlobalDAOReadOnly::GetRoamingDataUsage();
- radio = elm_radio_add(obj);
- if (!radio)
- return NULL;
- elm_radio_state_value_set(radio, roamingExpandData->m_mode);
- elm_radio_group_add(radio, roamingExpandData->m_rg);
- if (mode == roamingExpandData->m_mode)
- elm_radio_value_set(radio, mode);
-
- return radio;
-}
-
-void ListView::delRoamingExpandData(void *data, Evas_Object */*obj*/)
-{
- RoamingExpandData *roamingExpandData;
-
- roamingExpandData = static_cast<RoamingExpandData *>(data);
- delete roamingExpandData;
-}
-
-void ListView::onBackBtnClicked(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- ListView *listView;
-
- listView = static_cast<ListView *>(data);
- Assert(listView);
- listView->invokeUnloadCb();
-}
-
-void ListView::onOnOffItemClicked(void *data,
- Evas_Object */*obj*/,
- void *event_info)
-{
- Elm_Object_Item *it;
- OnOffData *onOffData;
-
- it = static_cast<Elm_Object_Item *>(event_info);
- Assert(it);
- elm_genlist_item_selected_set(it, EINA_FALSE);
- onOffData = static_cast<OnOffData *>(data);
- evas_object_smart_callback_call(onOffData->m_chk, "changed", NULL);
-}
-
-void ListView::onCookieSharingPopupOk(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- OnOffData *onOffData;
- ListView *listView;
-
- onOffData = static_cast<OnOffData *>(data);
- listView = onOffData->m_listView;
- Assert(onOffData && listView);
-
- WrtDB::GlobalDAO::SetCookieSharingMode(TRUE);
-
- elm_check_state_set(onOffData->m_chk, EINA_TRUE);
- listView->hidePopup();
-}
-
-void ListView::onCookieSharingPopupCancel(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- OnOffData *onOffData;
- ListView *listView;
-
- onOffData = static_cast<OnOffData *>(data);
- listView = onOffData->m_listView;
- Assert(onOffData && listView);
-
- WrtDB::GlobalDAO::SetCookieSharingMode(FALSE);
- elm_check_state_set(onOffData->m_chk, EINA_FALSE);
- listView->hidePopup();
-}
-
-void ListView::onCookieSharingChanged(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- OnOffData *onOffData;
- ListView *listView;
- bool state;
-
- onOffData = static_cast<OnOffData *>(data);
- listView = onOffData->m_listView;
- Assert(onOffData && onOffData->m_chk && listView);
-
- state = elm_check_state_get(onOffData->m_chk);
-
- if (!state) {
- WrtDB::GlobalDAO::SetCookieSharingMode(TRUE);
- elm_check_state_set(onOffData->m_chk, EINA_TRUE);
- } else {
- WrtDB::GlobalDAO::SetCookieSharingMode(FALSE);
- elm_check_state_set(onOffData->m_chk, FALSE);
- }
-}
-
-void ListView::onUntrustedAppApprovalPopupOk(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- OnOffData *onOffData;
- ListView *listView;
-
- onOffData = static_cast<OnOffData *>(data);
- listView = onOffData->m_listView;
- Assert(onOffData && listView);
-
- WrtDB::GlobalDAO::SetSecureByDefault(true);
- elm_check_state_set(onOffData->m_chk, EINA_TRUE);
- listView->hidePopup();
-}
-
-void ListView::onUntrustedAppApprovalPopupCancel(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- OnOffData *onOffData;
- ListView *listView;
-
- onOffData = static_cast<OnOffData *>(data);
- listView = onOffData->m_listView;
- Assert(onOffData && listView);
-
- elm_check_state_set(onOffData->m_chk, EINA_FALSE);
- listView->hidePopup();
-}
-
-void ListView::onUntrustedAppApprovalChanged(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- OnOffData *onOffData;
- ListView *listView;
- bool state;
-
- onOffData = static_cast<OnOffData *>(data);
- listView = onOffData->m_listView;
- Assert(onOffData && onOffData->m_chk && listView);
-
- state = WrtDB::GlobalDAOReadOnly::GetSecureByDefault();
- if (!state) {
- if (!listView->showPopup("Do you really want to allow "
- "untrusted applications?",
- onUntrustedAppApprovalPopupOk,
- onUntrustedAppApprovalPopupCancel,
- static_cast<void *>(onOffData)))
- return;
- } else {
- WrtDB::GlobalDAO::SetSecureByDefault(false);
- }
- elm_check_state_set(onOffData->m_chk, !state);
-}
-
-void ListView::onRoamingClicked(void *data,
- Evas_Object *obj,
- void *event_info)
-{
- Elm_Object_Item *it;
- Eina_Bool expanded;
- RoamingData *roamingData;
- ListView *listView;
-
- it = static_cast<Elm_Object_Item *>(event_info);
- roamingData = static_cast<RoamingData *>(data);
- listView = roamingData->m_listView;
- Assert(it && roamingData && listView);
- elm_genlist_item_selected_set(it, EINA_FALSE);
- expanded = elm_genlist_item_expanded_get(it);
- elm_genlist_item_expanded_set(it, !expanded);
- if (expanded)
- elm_genlist_item_subitems_clear(it);
- else
- listView->addRoamingOpts(obj, it);
-}
-
-void ListView::onRoamingOptClicked(void *data,
- Evas_Object *obj,
- void *event_info)
-{
- RoamingExpandData *roamingExpandData;
- Elm_Object_Item *it;
-
- it = static_cast<Elm_Object_Item *>(event_info);
- Assert(it);
- elm_genlist_item_selected_set(it, EINA_FALSE);
-
- roamingExpandData = static_cast<RoamingExpandData *>(data);
- Assert(roamingExpandData);
- WrtDB::GlobalDAO::SetRoamingDataUsage(roamingExpandData->m_mode);
- elm_genlist_realized_items_update(obj);
-}
-
-void ListView::onWhiteListClicked(void *data,
- Evas_Object */*obj*/,
- void *event_info)
-{
- Elm_Object_Item *it;
- ListView *listView;
-
- it = static_cast<Elm_Object_Item *>(event_info);
- Assert(it);
- elm_genlist_item_selected_set(it, EINA_FALSE);
-
- listView = static_cast<ListView *>(data);
- Assert(listView);
- listView->loadWhiteListView();
-
-}
-
-void ListView::onWhiteListViewUnload(void *data)
-{
- ListView *listView;
-
- listView = static_cast<ListView *>(data);
- Assert(listView);
- listView->delWhiteListView();
-}
-
-bool ListView::getCookieSharingVal(void)
-{
- LOGD("%s", __FUNCTION__);
- return WrtDB::GlobalDAOReadOnly::GetCookieSharingMode();
-}
-
-bool ListView::getUntrustedAppApprovalVal(void)
-{
- return WrtDB::GlobalDAOReadOnly::GetSecureByDefault();
-}
-
-void ListView::addWacTitle(Evas_Object *gl)
-{
- static Elm_Genlist_Item_Class itc;
-
- Assert(gl);
-
- itc.item_style = "dialogue/title";
- itc.func.text_get = getWacTitle;
- itc.func.content_get = NULL;
- itc.func.state_get = NULL;
- itc.func.del = NULL;
- elm_genlist_item_append(gl,
- &itc,
- NULL,
- NULL,
- ELM_GENLIST_ITEM_NONE,
- NULL,
- NULL);
-}
-
-void ListView::addWhiteList(Evas_Object *gl)
-{
- static Elm_Genlist_Item_Class itc;
-
- Assert(gl);
-
- try {
- itc.item_style = "dialogue/1text";
- itc.func.text_get = getWhiteListTitle;
- itc.func.content_get = NULL;
- itc.func.state_get = NULL;
- itc.func.del = NULL;
- elm_genlist_item_append(gl,
- &itc,
- NULL,
- NULL,
- ELM_GENLIST_ITEM_NONE,
- onWhiteListClicked,
- this);
- } catch (const std::bad_alloc &) {
- }
-}
-
-void ListView::addOnOffItem(Evas_Object *gl,
- const char *title,
- GetOnOffVal getOnOffVal,
- Evas_Smart_Cb changedCb)
-{
- OnOffData *onOffData;
- static Elm_Genlist_Item_Class itc;
-
- Assert(gl);
-
- try {
- onOffData = new OnOffData(this,
- title,
- getOnOffVal,
- changedCb);
- itc.item_style = "dialogue/1text.1icon";
- itc.func.text_get = getText;
- itc.func.content_get = getOnOffIcon;
- itc.func.state_get = NULL;
- itc.func.del = delOnOffData;
- if (!elm_genlist_item_append(gl,
- &itc,
- static_cast<void *>(onOffData),
- NULL,
- ELM_GENLIST_ITEM_NONE,
- onOnOffItemClicked,
- static_cast<void *>(onOffData)))
- delete onOffData;
- } catch (const std::bad_alloc &) {
- }
-}
-void ListView::addDesc(Evas_Object *gl,
- const char *title)
-{
- OnOffData *onOffData;
- static Elm_Genlist_Item_Class itc;
-
- Assert(gl);
-
- try {
- onOffData = new OnOffData(this,
- title,
- NULL,
- NULL);
- itc.item_style = "multiline/1text";
- itc.func.text_get = getText;
- itc.func.content_get = NULL;
- itc.func.state_get = NULL;
- itc.func.del = delOnOffData;
- elm_genlist_mode_set(gl, ELM_LIST_COMPRESS);
- if (!elm_genlist_item_append(gl,
- &itc,
- static_cast<void *>(onOffData),
- NULL,
- ELM_GENLIST_ITEM_NONE,
- NULL,
- static_cast<void *>(onOffData)))
- delete onOffData;
- } catch (const std::bad_alloc &) {
- }
-}
-
-void ListView::addDepth(Evas_Object *gl)
-{
- static Elm_Genlist_Item_Class itc;
- Elm_Object_Item *it;
- Assert(gl);
-
- try {
- itc.item_style = "dialogue/separator/21/with_line";
- itc.func.text_get = NULL;
- itc.func.content_get = NULL;
- itc.func.state_get = NULL;
- itc.func.del = NULL;
- it = elm_genlist_item_append(gl,
- &itc,
- NULL,
- NULL,
- ELM_GENLIST_ITEM_NONE,
- NULL,
- NULL);
- elm_genlist_item_select_mode_set(it,
- ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
- } catch (const std::bad_alloc &) {
- }
-}
-void ListView::addRoamingItem(Evas_Object *gl)
-{
- Evas_Object *rg;
- RoamingData *roamingData;
- static Elm_Genlist_Item_Class itc;
-
- Assert(gl);
-
- rg = elm_radio_add(gl);
- if (!rg)
- return;
-
- try {
- roamingData = new RoamingData(rg, this);
- itc.item_style = "dialogue/2text.3/expandable";
- itc.func.text_get = getRoamingLabel;
- itc.func.content_get = NULL;
- itc.func.state_get = NULL;
- itc.func.del = delRoamingData;
- if (!elm_genlist_item_append(gl,
- &itc,
- static_cast<void *>(roamingData),
- NULL,
- ELM_GENLIST_ITEM_TREE,
- onRoamingClicked,
- static_cast<void *>(roamingData)))
- delete roamingData;
- } catch (const std::bad_alloc &) {
- evas_object_del(rg);
- }
-}
-
-void ListView::addRoamingOpts(Evas_Object *obj, Elm_Object_Item *it)
-{
- static Elm_Genlist_Item_Class itc;
- RoamingData *roamingData;
- RoamingExpandData *roamingExpandData;
- unsigned int i;
- WrtDB::GlobalDAOReadOnly::NetworkAccessMode mode[] = {
- WrtDB::GlobalDAOReadOnly::NEVER_CONNECT,
- WrtDB::GlobalDAOReadOnly::ALWAYS_ASK,
- WrtDB::GlobalDAOReadOnly::CONNECT_AUTOMATICALLY,
- };
-
- Assert(obj && it);
-
- roamingData = static_cast<RoamingData *>(elm_object_item_data_get(it));
- itc.item_style = "dialogue/1text.1icon.2/expandable2";
- itc.func.text_get = getRoamingOptLabel;
- itc.func.content_get = getRoamingOptRadio;
- itc.func.state_get = NULL;
- itc.func.del = delRoamingExpandData;
- for (i = 0; i < sizeof(mode) / sizeof(*mode); i++) {
- try {
- roamingExpandData = new RoamingExpandData(mode[i], roamingData->m_rg);
- if (!elm_genlist_item_append(
- obj,
- &itc,
- static_cast<void *>(roamingExpandData),
- it,
- ELM_GENLIST_ITEM_NONE,
- onRoamingOptClicked,
- static_cast<void *>(roamingExpandData)))
- delete roamingExpandData;
- } catch (const std::bad_alloc &) {
- }
- }
-}
-
-bool ListView::loadView(void)
-{
- Evas_Object *win;
-
- Assert(m_naviFrame);
- resetBase();
- win = static_cast<Evas_Object *>(ug_get_window());
- Assert(win);
-
- m_gl = elm_genlist_add(m_naviFrame);
- if (!m_gl) {
- evas_object_del(m_naviFrame);
- return false;
- }
- bindtextdomain("ug-webapp-common-efl",
- MOFILE_INSTALL_DIR);
- elm_object_style_set(m_gl, "dialogue");
- addDepth(m_gl);
- addOnOffItem(m_gl,
- dgettext("ug-webapp-common-efl", COOKIE_SHARING),
- getCookieSharingVal,
- onCookieSharingChanged);
- addDesc(m_gl,
- dgettext("ug-webapp-common-efl",
- SHARE_COOKIES_BETWEEN_WEB_APPS));
- pushToNaviFrame();
-
- return true;
-}
-
-bool ListView::pushToNaviFrame(void)
-{
- Evas_Object *btn;
-
- Assert(m_naviFrame);
- btn = elm_button_add(m_naviFrame);
- if (!btn)
- return false;
-
- elm_object_style_set(btn, "naviframe/end_btn/default");
- evas_object_smart_callback_add(btn, "clicked", onBackBtnClicked, this);
- elm_naviframe_item_push(m_naviFrame,
- "Web applications",
- btn,
- NULL,
- m_gl,
- NULL);
-
- return true;
-}
-
-void ListView::loadWhiteListView(void)
-{
- Assert(m_naviFrame);
-
- try {
- m_whiteListView.Reset(new WhiteListView(m_naviFrame));
- if (!m_whiteListView->loadView()) {
- m_whiteListView.Reset();
- return;
- }
- m_whiteListView->setUnloadCb(onWhiteListViewUnload, this);
- } catch (const std::bad_alloc &) {
- }
-}
-
-bool ListView::showPopup(const char *desc,
- Evas_Smart_Cb ok_cb,
- Evas_Smart_Cb cancel_cb,
- void *data)
-{
- return m_popup.showPopup(desc, ok_cb, cancel_cb, data);
-}
-
-void ListView::hidePopup(void)
-{
- m_popup.hidePopup();
-}
-
-ListView::ListView(Evas_Object *naviFrame) :
- m_naviFrame(naviFrame)
-{
- m_whiteListView.Reset();
-}
-
-ListView::~ListView(void)
-{
-}
-
-} /* WebAppCommonSetting */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 WEB_SRC_SETTING_WEBAPP_COMMON_LISTVIEW_H_
-#define WEB_SRC_SETTING_WEBAPP_COMMON_LISTVIEW_H_
-
-#include <Elementary.h>
-
-#include <dpl/wrt-dao-ro/global_dao_read_only.h>
-#include <dpl/scoped_ptr.h>
-#include <string>
-
-#include "whitelistview.h"
-#include "popup.h"
-#include "view.h"
-
-namespace WebAppCommonSetting {
-
-typedef bool (*GetOnOffVal)(void);
-
-class ListView : public View
-{
- Evas_Object *m_naviFrame;
- Evas_Object *m_gl;
- Popup m_popup;
- DPL::ScopedPtr<WhiteListView> m_whiteListView;
-
- /* Genlist Item Callbacks */
- static char *getWacTitle(void *data,
- Evas_Object *obj,
- const char *part);
- static char *getWhiteListTitle(void *data,
- Evas_Object *obj,
- const char *part);
- static char *getText(void *data,
- Evas_Object *obj,
- const char *part);
- static Evas_Object *getOnOffIcon(void *data,
- Evas_Object *obj,
- const char *part);
- static void delOnOffData(void *data, Evas_Object *obj);
- static char *getRoamingLabel(void *data,
- Evas_Object *obj,
- const char *part);
- static void delRoamingData(void *data, Evas_Object *obj);
- static char *getRoamingOptLabel(void *data,
- Evas_Object *obj,
- const char *part);
- static Evas_Object *getRoamingOptRadio(void *data,
- Evas_Object *obj,
- const char *part);
- static void delRoamingExpandData(void *data, Evas_Object *obj);
-
- /* Smart Callbacks */
- static void onBackBtnClicked(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onOnOffItemClicked(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onCookieSharingPopupOk(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onCookieSharingPopupCancel(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onCookieSharingChanged(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onUntrustedAppApprovalPopupOk(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onUntrustedAppApprovalPopupCancel(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onUntrustedAppApprovalChanged(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onRoamingClicked(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onRoamingOptClicked(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onWhiteListClicked(void *data,
- Evas_Object *obj,
- void *event_info);
-
- /* Subview Unload callback */
- static void onWhiteListViewUnload(void *data);
-
- /* Utility methods */
- static bool getCookieSharingVal(void);
- static bool getUntrustedAppApprovalVal(void);
-
- void addWacTitle(Evas_Object *gl);
- void addWhiteList(Evas_Object *gl);
- void addOnOffItem(Evas_Object *gl,
- const char *title,
- GetOnOffVal getOnOffVal,
- Evas_Smart_Cb cb);
- void addDesc(Evas_Object *gl, const char *title);
- void addDepth(Evas_Object *gl);
- void addRoamingItem(Evas_Object *gl);
- void addRoamingOpts(Evas_Object *obj, Elm_Object_Item *it);
-
- public:
- ListView(Evas_Object *naviFrame);
- ~ListView(void);
-
- bool loadView(void);
- bool pushToNaviFrame(void);
- void loadWhiteListView(void);
- void delWhiteListView(void) { m_whiteListView.Reset(); }
- bool showPopup(const char *desc,
- Evas_Smart_Cb ok_cb,
- Evas_Smart_Cb cancel_cb,
- void *data);
- void hidePopup(void);
-};
-
-class OnOffData
-{
- public:
- ListView *m_listView;
- std::string m_title;
- Evas_Object *m_chk;
- GetOnOffVal m_getOnOffVal;
- Evas_Smart_Cb m_changedCb;
-
- OnOffData(ListView *listView,
- const char *title,
- GetOnOffVal getOnOffVal,
- Evas_Smart_Cb changedCb) :
- m_listView(listView),
- m_title(title),
- m_chk(NULL),
- m_getOnOffVal(getOnOffVal),
- m_changedCb(changedCb) { };
-
- ~OnOffData(void) { };
-};
-
-class RoamingData
-{
- public:
- Evas_Object *m_rg;
- ListView *m_listView;
-
- RoamingData(Evas_Object *rg, ListView *listView) :
- m_rg(rg),
- m_listView(listView) { };
-
- ~RoamingData(void)
- {
- if (m_rg)
- evas_object_del(m_rg);
- };
-};
-
-class RoamingExpandData
-{
- public:
- WrtDB::GlobalDAOReadOnly::NetworkAccessMode m_mode;
- Evas_Object *m_rg;
-
- RoamingExpandData(WrtDB::GlobalDAOReadOnly::NetworkAccessMode mode,
- Evas_Object *rg) :
- m_mode(mode),
- m_rg(rg) { };
- ~RoamingExpandData(void) { };
-};
-
-class ComplianceModeData
-{
- public:
- ListView *m_listView;
- Evas_Object *m_gl;
- Evas_Object *m_chk;
- Elm_Object_Item *m_it;
-
- ComplianceModeData(ListView *listView, Evas_Object *gl) :
- m_listView(listView),
- m_gl(gl),
- m_chk(NULL),
- m_it(NULL) { };
- ~ComplianceModeData(void) { };
-};
-
-} /* WebAppCommonSetting */
-
-#endif /* WEB_SRC_SETTING_WEBAPP_COMMON_LISTVIEW_H_ */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 <ui-gadget-module.h>
-#include <Elementary.h>
-
-#include <dpl/assert.h>
-
-#include "mainview.h"
-#include "listview.h"
-
-namespace WebAppCommonSetting {
-
-void MainView::onListViewUnload(void *data)
-{
- MainView *mainView;
-
- mainView = static_cast<MainView *>(data);
- Assert(mainView);
- ug_destroy_me(mainView->getUG());
-}
-
-Evas_Object *MainView::createContent(Evas_Object *parent)
-{
- Evas_Object *nf;
-
- Assert(parent);
- nf = elm_naviframe_add(parent);
- if (!nf)
- return NULL;
-
- try {
- m_list.Reset(new ListView(nf));
- if (!m_list->loadView())
- goto del_list;
- m_list->setUnloadCb(onListViewUnload, this);
- return nf;
-
- } catch (const std::bad_alloc &) {
- goto del_nf;
- }
-
-del_list:
- m_list.Reset();
-del_nf:
- evas_object_del(nf);
-
- return NULL;
-}
-
-bool MainView::loadView(void)
-{
- Evas_Object *ly;
- Evas_Object *eo;
- Evas_Object *parent;
-
- Assert(m_ug);
- resetBase();
-
- parent = static_cast<Evas_Object *>(ug_get_parent_layout(m_ug));
- Assert(parent);
-
- ly = elm_layout_add(parent);
- if (!ly)
- return false;
- elm_layout_theme_set(ly, "layout", "application", "default");
-
- eo = elm_bg_add(ly);
- if (!eo)
- goto del_ly;
- elm_object_part_content_set(ly, "elm.swallow.bg", eo);
-
- eo = createContent(ly);
- if (!eo)
- goto del_ly;
- elm_object_part_content_set(ly, "elm.swallow.content", eo);
-
- resetBase(ly);
-
- return true;
-
-del_ly:
- evas_object_del(ly);
-
- return false;
-}
-
-MainView::MainView(ui_gadget_h ug) :
- m_ug(ug)
-{
- Assert(ug);
-
- m_list.Reset();
-}
-
-MainView::~MainView(void)
-{
-}
-
-} /* WebAppCommonSetting */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 WEB_SRC_SETTING_WEBAPP_COMMON_MAINVIEW_H_
-#define WEB_SRC_SETTING_WEBAPP_COMMON_MAINVIEW_H_
-
-#include <ui-gadget.h>
-#include <Evas.h>
-
-#include <dpl/scoped_ptr.h>
-
-#include "listview.h"
-#include "view.h"
-
-namespace WebAppCommonSetting {
-
-class MainView : public View
-{
- ui_gadget_h m_ug;
- DPL::ScopedPtr<ListView> m_list;
-
- static void onListViewUnload(void *data);
- Evas_Object *createContent(Evas_Object *parent);
-
- public:
- MainView(ui_gadget_h ug);
- ~MainView(void);
-
- bool loadView(void);
- ui_gadget_h getUG(void) { return m_ug; }
-};
-
-} /* WebAppCommonSetting */
-
-#endif /* WEB_SRC_SETTING_WEBAPP_COMMON_MAINVIEW_H_ */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 <Elementary.h>
-#include <ui-gadget.h>
-
-#include <dpl/assert.h>
-
-#include "popup.h"
-
-namespace WebAppCommonSetting {
-
-bool Popup::showPopup(const char *desc,
- Evas_Smart_Cb ok_cb,
- Evas_Smart_Cb cancel_cb,
- void *data)
-{
- Evas_Object *btn1;
- Evas_Object *btn2;
-
- if (m_pu)
- evas_object_del(m_pu);
-
- m_pu = elm_popup_add(m_win);
- if (!m_pu)
- return false;
- evas_object_size_hint_weight_set(m_pu,
- EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- elm_object_text_set(m_pu, desc);
-
- btn1 = elm_button_add(m_pu);
- if (!btn1) {
- evas_object_del(m_pu);
- return false;
- }
- elm_object_text_set(btn1, "OK");
- evas_object_smart_callback_add(btn1, "clicked", ok_cb, data);
- elm_object_part_content_set(m_pu, "button1", btn1);
-
- btn2 = elm_button_add(m_pu);
- if (!btn2) {
- evas_object_del(m_pu);
- return false;
- }
- elm_object_text_set(btn2, "Cancel");
- evas_object_smart_callback_add(btn2, "clicked", cancel_cb, data);
- elm_object_part_content_set(m_pu, "button2", btn2);
-
- evas_object_show(m_pu);
-
- return true;
-}
-
-void Popup::hidePopup(void)
-{
- if (m_pu) {
- evas_object_del(m_pu);
- m_pu = NULL;
- }
-}
-
-Popup::Popup(void) :
- m_win(NULL),
- m_pu(NULL)
-{
- m_win = static_cast<Evas_Object *>(ug_get_window());
- Assert(m_win);
-}
-
-Popup::~Popup(void)
-{
- if (m_pu)
- evas_object_del(m_pu);
-}
-
-} /* WebAppCommonSetting */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 WEB_SRC_SETTING_WEBAPP_COMMON_POPUP_H_
-#define WEB_SRC_SETTING_WEBAPP_COMMON_POPUP_H_
-
-#include <Evas.h>
-
-namespace WebAppCommonSetting {
-
-class Popup
-{
- Evas_Object *m_win;
- Evas_Object *m_pu;
-
- public:
- bool showPopup(const char *desc,
- Evas_Smart_Cb ok_cb,
- Evas_Smart_Cb cancel_cb,
- void *data);
- void hidePopup(void);
-
- Popup(void);
- ~Popup(void);
-};
-
-} /* WebAppCommonSetting */
-
-#endif /* WEB_SRC_SETTING_WEBAPP_COMMON_POPUP_H_ */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 <ui-gadget.h>
-#include <ui-gadget-module.h>
-#include <bundle.h>
-
-#include <stdexcept>
-#undef None
-#include <dpl/wrt-dao-ro/WrtDatabase.h>
-#include <dpl/assert.h>
-
-#include "mainview.h"
-
-#define EXPORT_SYMBOL extern "C" __attribute__((visibility("default")))
-
-struct priv {
- WebAppCommonSetting::MainView *mainView;
-};
-
-static void *onCreate(ui_gadget_h ug,
- enum ug_mode /*mode*/,
- service_h /*service*/,
- void *user_data)
-{
- struct priv *priv;
-
- Assert(ug && user_data);
- priv = static_cast<struct priv *>(user_data);
-
- try {
- priv->mainView = new WebAppCommonSetting::MainView(ug);
- if (priv->mainView->loadView())
- return priv->mainView->getBase();
- return NULL;
- } catch (const std::bad_alloc &) {
- return NULL;
- }
-}
-
-static void onDestroy(ui_gadget_h /*ug*/,
- service_h /*service*/,
- void *user_data)
-{
- struct priv *priv;
-
- Assert(user_data);
- priv = static_cast<struct priv *>(user_data);
- delete priv->mainView;
- priv->mainView = NULL;
-}
-
-EXPORT_SYMBOL int UG_MODULE_INIT(struct ug_module_ops *ops)
-{
- struct priv *priv;
-
- Assert(ops);
- priv = static_cast<struct priv *>(calloc(1, sizeof(*priv)));
- if (!priv)
- return -1;
-
- WrtDB::WrtDatabase::attachToThreadRW();
-
- memset(ops, 0x00, sizeof(*ops));
- ops->priv = priv;
- ops->create = onCreate;
- ops->destroy = onDestroy;
- ops->opt = UG_OPT_INDICATOR_ENABLE;
-
- return 0;
-}
-
-EXPORT_SYMBOL void UG_MODULE_EXIT(struct ug_module_ops *ops)
-{
- struct priv *priv;
-
- Assert(ops);
- priv = static_cast<struct priv *>(ops->priv);
- if (priv->mainView)
- delete priv->mainView;
- free(priv);
-
- WrtDB::WrtDatabase::detachFromThread();
-}
+++ /dev/null
-$1 wrt-commons::db_wrt rwx
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 WEB_SRC_SETTING_WEBAPP_COMMON_UTIL_H_
-#define WEB_SRC_SETTING_WEBAPP_COMMON_UTIL_H_
-
-#include <libintl.h>
-
-#define D_(str) dgettext("sys_string", str)
-#define gettext_noop(str) (str)
-#define N_(str) gettext_noop(str)
-
-#endif /* WEB_SRC_SETTING_WEBAPP_COMMON_UTIL_H_ */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 <Evas.h>
-
-#include <dpl/assert.h>
-
-#include "view.h"
-
-namespace WebAppCommonSetting {
-
-void delCb(void *data,
- Evas */*e*/,
- Evas_Object */*eo*/,
- void */*event_info*/)
-{
- View *v;
-
- v = static_cast<View *>(data);
- Assert(v);
- v->resetBase();
- v->invokeUnloadCb();
-}
-
-void View::resetBase(Evas_Object *base)
-{
- if (m_base)
- evas_object_event_callback_del_full(m_base, EVAS_CALLBACK_DEL, delCb, this);
-
- m_base = base;
-
- if (m_base)
- evas_object_event_callback_add(base, EVAS_CALLBACK_DEL, delCb, this);
-}
-
-void View::setUnloadCb(ViewUnloadCb cb, void *data)
-{
- m_viewUnloadCb = cb;
- m_viewUnloadCbData = data;
-}
-
-void View::unsetUnloadCb(void)
-{
- m_viewUnloadCb = NULL;
- m_viewUnloadCbData = NULL;
-}
-
-void View::invokeUnloadCb(void)
-{
- if (m_viewUnloadCb)
- m_viewUnloadCb(m_viewUnloadCbData);
-}
-
-View::~View(void)
-{
- unsetUnloadCb();
-
- if (m_base) {
- evas_object_event_callback_del_full(m_base, EVAS_CALLBACK_DEL, delCb, this);
- evas_object_del(m_base);
- }
-}
-
-} /* WebAppCommonSetting */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 WEB_SRC_SETTING_WEBAPP_COMMON_VIEW_H_
-#define WEB_SRC_SETTING_WEBAPP_COMMON_VIEW_H_
-
-#include <Evas.h>
-
-namespace WebAppCommonSetting {
-
-typedef void (*ViewUnloadCb)(void *data);
-
-class View
-{
- Evas_Object *m_base;
- ViewUnloadCb m_viewUnloadCb;
- void *m_viewUnloadCbData;
-
- public:
- View() :
- m_base(NULL),
- m_viewUnloadCb(NULL),
- m_viewUnloadCbData(NULL) { };
- virtual ~View(void);
-
- void resetBase(Evas_Object *base = NULL);
- Evas_Object *getBase(void) { return m_base; }
- void setUnloadCb(ViewUnloadCb cb, void *data);
- void unsetUnloadCb(void);
- void invokeUnloadCb(void);
-
- virtual bool loadView(void) = 0;
-};
-
-} /* WebAppCommonSetting */
-
-#endif /* WEB_SRC_SETTING_WEBAPP_COMMON_VIEW_H_ */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 <Elementary.h>
-
-#include <dpl/wrt-dao-ro/global_dao_read_only.h>
-#include <dpl/wrt-dao-rw/global_dao.h>
-#include <dpl/foreach.h>
-#include <dpl/assert.h>
-
-#include "whitelistview.h"
-#include "whiteuriview.h"
-#include "icons.h"
-#include "util.h"
-#include "edc/defs.h"
-
-namespace WebAppCommonSetting {
-
-char *WhiteListView::getUriStr(void *data,
- Evas_Object */*obj*/,
- const char *part)
-{
- const char *str;
- UriData *uriData;
-
- uriData = static_cast<UriData *>(data);
- if (!uriData)
- return NULL;
-
- if (!strcmp(part, "elm.text.1"))
- str = uriData->m_uri.c_str();
- else if (!strcmp(part, "elm.text.2"))
- str = NULL;
- else
- str = NULL;
-
- if (!str)
- return NULL;
-
- return strdup(str);
-}
-
-Evas_Object *WhiteListView::getUriChk(void *data,
- Evas_Object *obj,
- const char *part)
-{
- Evas_Object *chk;
- UriData *uriData;
-
- uriData = static_cast<UriData *>(data);
- if (!uriData)
- return NULL;
-
- if (!strcmp(part, "elm.edit.icon.1")) {
- chk = elm_check_add(obj);
- if (!chk)
- return NULL;
- elm_check_state_pointer_set(chk, &uriData->m_selected);
- evas_object_propagate_events_set(chk, EINA_FALSE);
- evas_object_smart_callback_add(chk,
- "changed",
- onUriChkClicked,
- data);
- } else {
- return NULL;
- }
-
- return chk;
-}
-
-void WhiteListView::delUriData(void *data, Evas_Object */*obj*/)
-{
- UriData *uriData;
-
- uriData = static_cast<UriData*>(data);
- delete uriData;
-}
-
-void WhiteListView::onBackBtnClicked(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- WhiteListView *whitelistview;
-
- whitelistview = static_cast<WhiteListView *>(data);
- Assert(whitelistview);
- whitelistview->handleBackBtn();
-}
-
-void WhiteListView::onEditModeBtnClicked(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- WhiteListView *whitelistview;
-
- whitelistview = static_cast<WhiteListView *>(data);
- Assert(whitelistview);
- whitelistview->handleEditModeBtn();
-}
-
-void WhiteListView::onOptBtnClicked(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- WhiteListView *whitelistview;
-
- whitelistview = static_cast<WhiteListView *>(data);
- Assert(whitelistview);
- whitelistview->handleOptBtn();
-}
-
-void WhiteListView::onUriClicked(void *data,
- Evas_Object *obj,
- void *event_info)
-{
- UriData *uriData;
- Elm_Object_Item *it;
- WhiteListView *whiteListView;
-
- uriData = static_cast<UriData *>(data);
- it = static_cast<Elm_Object_Item *>(event_info);
- Assert(it && uriData);
- whiteListView = uriData->m_whiteListView;
- Assert(whiteListView);
-
- if (elm_genlist_decorate_mode_get(obj)) {
- uriData->m_selected = !uriData->m_selected;
- if (uriData->m_selected)
- whiteListView->increaseSelectCnt();
- else
- whiteListView->decreaseSelectCnt();
- elm_genlist_item_update(it);
- } else {
- whiteListView->loadWhiteUriView(&uriData->m_uri);
- }
-
- elm_genlist_item_selected_set(it, EINA_FALSE);
-}
-
-void WhiteListView::onUriChkClicked(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- UriData *uriData;
- WhiteListView *whiteListView;
-
- uriData = static_cast<UriData *>(data);
- Assert(uriData);
- whiteListView = uriData->m_whiteListView;
- Assert(whiteListView);
-
- if (uriData->m_selected)
- whiteListView->increaseSelectCnt();
- else
- whiteListView->decreaseSelectCnt();
-}
-
-void WhiteListView::onSelectAllChkClicked(void *data,
- Evas_Object *obj,
- void */*event_info*/)
-{
- WhiteListView *whiteListView;
-
- whiteListView = static_cast<WhiteListView *>(data);
- Assert(whiteListView);
- whiteListView->selectAll(elm_check_state_get(obj));
-}
-
-void WhiteListView::onSelectAllClicked(void *data,
- Evas */*e*/,
- Evas_Object *obj,
- void */*event_info*/)
-{
- WhiteListView *whiteListView;
- Evas_Object *chk;
- Eina_Bool state;
-
- Assert(obj);
- whiteListView = static_cast<WhiteListView *>(data);
- Assert(whiteListView);
- chk = elm_object_part_content_get(obj, "elm.icon");
- Assert(chk);
- state = elm_check_state_get(chk);
- elm_check_state_set(chk, !state);
- whiteListView->selectAll(!state);
-}
-
-void WhiteListView::onRemoveWhiteUriPopupOk(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- WhiteListView *whiteListView;
-
- whiteListView = static_cast<WhiteListView *>(data);
- Assert(whiteListView);
-
- whiteListView->removeWhiteUri();
- whiteListView->hidePopup();
-}
-
-void WhiteListView::onRemoveWhiteUriPopupCancel(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- WhiteListView *whiteListView;
-
- whiteListView = static_cast<WhiteListView *>(data);
- Assert(whiteListView);
-
- whiteListView->hidePopup();
-}
-
-void WhiteListView::onWhiteUriViewUnload(void *data)
-{
- WhiteListView *whiteListView;
-
- whiteListView = static_cast<WhiteListView *>(data);
- Assert(whiteListView);
- whiteListView->delWhiteUriView();
- whiteListView->reloadUri();
-}
-
-void WhiteListView::addUri(DPL::String &uri)
-{
- UriData *uriData;
- Elm_Object_Item *it;
- static Elm_Genlist_Item_Class itc;
-
- Assert(m_gl);
- itc.item_style = "2text.6";
- itc.func.text_get = getUriStr;
- itc.func.content_get = getUriChk;
- itc.func.state_get = NULL;
- itc.func.del = delUriData;
- itc.decorate_all_item_style = "edit_default";
-
- try {
- uriData = new UriData(this, DPL::ToUTF8String(uri));
- it = elm_genlist_item_append(m_gl,
- &itc,
- static_cast<void *>(uriData),
- NULL,
- ELM_GENLIST_ITEM_NONE,
- onUriClicked,
- static_cast<void *>(uriData));
- if (!it) {
- delete uriData;
- return;
- }
- m_uriCnt++;
- } catch (const std::bad_alloc &) {
- }
-}
-
-Evas_Object *WhiteListView::addToolBar(Evas_Object *parent)
-{
- Evas_Object *toolBar;
-
- toolBar = elm_toolbar_add(parent);
- if (!toolBar)
- return NULL;
- elm_object_style_set(toolBar, "naviframe");
- elm_toolbar_shrink_mode_set(toolBar, ELM_TOOLBAR_SHRINK_EXPAND);
- m_editModeBtn = elm_toolbar_item_append(toolBar,
- ICON_EDIT,
- NULL,
- onEditModeBtnClicked,
- this);
- m_optBtn = elm_toolbar_item_append(toolBar,
- ICON_ADD,
- NULL,
- onOptBtnClicked,
- this);
- if (!m_uriCnt) {
- elm_object_item_disabled_set(m_editModeBtn, EINA_TRUE);
- elm_object_signal_emit(getBase(), SIG_SHOW_NOCONTENT, SRC_PROG);
- }
-
- return toolBar;
-}
-
-bool WhiteListView::pushToNaviFrame(void)
-{
- Evas_Object *btn;
- Evas_Object *toolBar;
- Elm_Object_Item *it;
-
- Assert(m_naviFrame);
-
- btn = elm_button_add(m_naviFrame);
- if (!btn)
- return false;
-
- toolBar = addToolBar(m_naviFrame);
- if (!toolBar) {
- evas_object_del(btn);
- return false;
- }
- elm_object_style_set(btn, "naviframe/end_btn/default");
- evas_object_smart_callback_add(btn, "clicked", onBackBtnClicked, this);
- it = elm_naviframe_item_push(m_naviFrame,
- "White list",
- btn,
- NULL,
- getBase(),
- NULL);
- if (!it) {
- evas_object_del(btn);
- evas_object_del(toolBar);
- return false;
- }
-
- elm_object_item_part_content_set(it, "controlbar", toolBar);
-
- return true;
-}
-
-void WhiteListView::popFromNaviFrame(void)
-{
- Assert(m_naviFrame);
- elm_naviframe_item_pop(m_naviFrame);
-}
-
-bool WhiteListView::addNoContent(Evas_Object *ly)
-{
- Evas_Object *eo;
-
- Assert(ly);
-
- eo = elm_layout_add(ly);
- if (!eo)
- return NULL;
- elm_layout_theme_set(eo, "layout", "nocontents", "full");
- elm_object_part_text_set(eo, "elm.text", D_("IDS_COM_BODY_NO_CONTENTS"));
- elm_object_part_content_set(ly, PART_NOCONTENT, eo);
-
- return true;
-}
-
-bool WhiteListView::addContents(Evas_Object *ly)
-{
- Assert(ly);
-
- m_bx = elm_box_add(ly);
- if (!m_bx)
- return false;
-
- m_gl = elm_genlist_add(m_bx);
- if (!m_gl) {
- evas_object_del(m_bx);
- m_bx = NULL;
- return false;
- }
- evas_object_size_hint_align_set(m_gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(m_gl, EVAS_HINT_EXPAND, 1.0);
- evas_object_show(m_gl);
- elm_box_pack_end(m_bx, m_gl);
- elm_object_part_content_set(ly, PART_CONTENT, m_bx);
-
- return true;
-}
-
-bool WhiteListView::loadView(void)
-{
- Evas_Object *ly;
- WrtDB::WidgetAccessInfoList uriList;
-
- Assert(m_naviFrame);
- resetBase();
-
- ly = elm_layout_add(m_naviFrame);
- if (!ly)
- return false;
- elm_layout_file_set(ly, EDJFILE, GRP_CONTENT);
-
- if (!addNoContent(ly)) {
- evas_object_del(ly);
- return false;
- }
-
- if (!addContents(ly)) {
- evas_object_del(ly);
- return false;
- }
- resetBase(ly);
-
- uriList = WrtDB::GlobalDAOReadOnly::GetWhiteURIList();
- FOREACH(uri, uriList)
- addUri(uri->strIRI);
-
- if (!pushToNaviFrame()) {
- resetBase();
- return false;
- }
-
- return true;
-}
-
-void WhiteListView::loadWhiteUriView(std::string *uri)
-{
- Assert(m_naviFrame);
-
- try {
- if (uri)
- m_whiteUriView.Reset(new WhiteUriView(m_naviFrame, *uri));
- else
- m_whiteUriView.Reset(new WhiteUriView(m_naviFrame));
-
- if (!m_whiteUriView->loadView()) {
- m_whiteUriView.Reset();
- return;
- }
- m_whiteUriView->setUnloadCb(onWhiteUriViewUnload, this);
- } catch (const std::bad_alloc &) {
- }
-}
-
-void WhiteListView::delWhiteUriView(void)
-{
- m_whiteUriView.Reset();
-}
-
-void WhiteListView::reloadUri(void)
-{
- WrtDB::WidgetAccessInfoList uriList;
-
- if (getBase() && m_gl) {
- elm_genlist_clear(m_gl);
- uriList = WrtDB::GlobalDAOReadOnly::GetWhiteURIList();
- m_uriCnt = 0;
- FOREACH(uri, uriList)
- addUri(uri->strIRI);
-
- if (!m_uriCnt) {
- elm_object_item_disabled_set(m_editModeBtn, EINA_TRUE);
- elm_object_signal_emit(getBase(), SIG_SHOW_NOCONTENT, SRC_PROG);
- } else {
- elm_object_item_disabled_set(m_editModeBtn, EINA_FALSE);
- elm_object_signal_emit(getBase(), SIG_SHOW_CONTENT, SRC_PROG);
- }
- }
-}
-
-void WhiteListView::handleEditModeBtn(void)
-{
- Evas_Object *chk;
-
- Assert(m_editModeBtn && m_optBtn);
- Assert(m_bx);
-
- if (!elm_genlist_decorate_mode_get(m_gl)) {
- m_selectAll = elm_layout_add(m_gl);
- if (!m_selectAll)
- return;
- elm_layout_theme_set(m_selectAll,
- "genlist",
- "item",
- "select_all/default");
- chk = elm_check_add(m_gl);
- if (!chk) {
- evas_object_del(m_selectAll);
- m_selectAll = NULL;
- return;
- }
- evas_object_propagate_events_set(chk, EINA_FALSE);
- evas_object_smart_callback_add(chk,
- "changed",
- onSelectAllChkClicked,
- this);
- evas_object_event_callback_add(m_selectAll,
- EVAS_CALLBACK_MOUSE_DOWN,
- onSelectAllClicked,
- this);
- elm_object_part_content_set(m_selectAll, "elm.icon", chk);
- elm_object_part_text_set(m_selectAll, "elm.text", "Select all");
- evas_object_size_hint_align_set(m_selectAll,
- EVAS_HINT_FILL,
- 0.0);
- evas_object_show(m_selectAll);
- elm_box_pack_start(m_bx, m_selectAll);
- elm_object_item_disabled_set(m_editModeBtn, EINA_TRUE);
- elm_toolbar_item_icon_file_set(m_optBtn, ICON_DELETE, NULL);
- elm_object_item_disabled_set(m_optBtn, EINA_TRUE);
- elm_genlist_decorate_mode_set(m_gl, EINA_TRUE);
- }
-}
-
-void WhiteListView::handleOptBtn(void)
-{
- Assert(m_gl);
- if (elm_genlist_decorate_mode_get(m_gl)) {
- showPopup("Do you really want to remove selected white URL?",
- onRemoveWhiteUriPopupOk,
- onRemoveWhiteUriPopupCancel,
- this);
- } else {
- loadWhiteUriView();
- }
-}
-
-void WhiteListView::handleBackBtn(void)
-{
- if (!elm_genlist_decorate_mode_get(m_gl)) {
- popFromNaviFrame();
- } else {
- selectAll(EINA_FALSE);
- Assert(m_bx);
- elm_box_unpack(m_bx, m_selectAll);
- evas_object_del(m_selectAll);
- m_selectAll = NULL;
- m_selectCnt = 0;
- Assert(m_editModeBtn && m_optBtn);
- if (!m_uriCnt) {
- elm_object_item_disabled_set(m_editModeBtn, EINA_TRUE);
- elm_object_signal_emit(getBase(), SIG_SHOW_NOCONTENT, SRC_PROG);
- } else {
- elm_object_item_disabled_set(m_editModeBtn, EINA_FALSE);
- elm_object_signal_emit(getBase(), SIG_SHOW_CONTENT, SRC_PROG);
- }
- elm_toolbar_item_icon_file_set(m_optBtn, ICON_ADD, NULL);
- elm_object_item_disabled_set(m_optBtn, EINA_FALSE);
- elm_genlist_decorate_mode_set(m_gl, EINA_FALSE);
- }
-}
-
-void WhiteListView::removeWhiteUri(void)
-{
- UriData *uriData;
- Elm_Object_Item *it;
- Elm_Object_Item *trailIt;
-
- Assert(m_gl);
-
- it = elm_genlist_first_item_get(m_gl);
- while (it) {
- uriData = static_cast<UriData *>(elm_object_item_data_get(it));
- Assert(uriData);
-
- trailIt = elm_genlist_item_next_get(it);
- if (uriData->m_selected) {
- WrtDB::GlobalDAO::RemoveWhiteURI(uriData->m_uri);
- /* TODO: deprecated API */
- //elm_object_item_del(it);
- elm_object_item_del(it);
- m_uriCnt--;
- decreaseSelectCnt();
- }
- it = trailIt;
- }
- if (!m_uriCnt)
- handleBackBtn();
-}
-
-void WhiteListView::increaseSelectCnt(void)
-{
- Evas_Object *chk;
-
- Assert(m_selectAll);
- chk = elm_object_part_content_get(m_selectAll, "elm.icon");
- Assert(chk);
-
- if (!m_selectCnt)
- elm_object_item_disabled_set(m_optBtn, EINA_FALSE);
- m_selectCnt++;
- if (m_selectCnt >= m_uriCnt) {
- m_selectCnt = m_uriCnt;
- elm_check_state_set(chk, EINA_TRUE);
- }
-}
-
-void WhiteListView::decreaseSelectCnt(void)
-{
- Evas_Object *chk;
-
- Assert(m_selectAll);
- chk = elm_object_part_content_get(m_selectAll, "elm.icon");
- Assert(chk);
-
- if (m_selectCnt > 0)
- m_selectCnt--;
-
- if (m_selectCnt <= 0)
- elm_object_item_disabled_set(m_optBtn, EINA_TRUE);
- elm_check_state_set(chk, EINA_FALSE);
-}
-
-void WhiteListView::selectAll(Eina_Bool select)
-{
- Elm_Object_Item *it;
- UriData *uriData;
-
- Assert(m_gl);
- it = elm_genlist_first_item_get(m_gl);
-
- while (it) {
- uriData = static_cast<UriData *>(elm_object_item_data_get(it));
- Assert(uriData);
- uriData->m_selected = select;
- it = elm_genlist_item_next_get(it);
- }
-
- elm_object_item_disabled_set(m_optBtn, !select);
- if (select)
- m_selectCnt = m_uriCnt;
- else
- m_selectCnt = 0;
- elm_genlist_realized_items_update(m_gl);
-}
-
-bool WhiteListView::showPopup(const char *desc,
- Evas_Smart_Cb ok_cb,
- Evas_Smart_Cb cancel_cb,
- void *data)
-{
- return m_popup.showPopup(desc, ok_cb, cancel_cb, data);
-}
-
-void WhiteListView::hidePopup(void)
-{
- m_popup.hidePopup();
-}
-
-WhiteListView::WhiteListView(Evas_Object *naviFrame) :
- m_naviFrame(naviFrame),
- m_bx(NULL),
- m_gl(NULL),
- m_selectAll(NULL),
- m_selectCnt(0),
- m_uriCnt(0),
- m_editModeBtn(NULL),
- m_optBtn(NULL)
-{
- m_whiteUriView.Reset();
-}
-
-WhiteListView::~WhiteListView(void)
-{
-}
-
-} /* WebAppCommonSetting */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 WEB_SRC_SETTING_WEBAPP_COMMON_WHITELISTVIEW_H_
-#define WEB_SRC_SETTING_WEBAPP_COMMON_WHITELISTVIEW_H_
-
-#include <Evas.h>
-
-#include <dpl/scoped_ptr.h>
-
-#include "whiteuriview.h"
-#include "view.h"
-#include "popup.h"
-
-namespace WebAppCommonSetting {
-
-class WhiteListView : public View
-{
- Evas_Object *m_naviFrame;
- Evas_Object *m_bx;
- Evas_Object *m_gl;
- Evas_Object *m_selectAll;
- unsigned int m_selectCnt;
- unsigned int m_uriCnt;
- Elm_Object_Item *m_editModeBtn;
- Elm_Object_Item *m_optBtn;
- Popup m_popup;
- DPL::ScopedPtr<WhiteUriView> m_whiteUriView;
-
- static char *getUriStr(void *data,
- Evas_Object *obj,
- const char *part);
- static Evas_Object *getUriChk(void *data,
- Evas_Object *obj,
- const char *part);
- static void delUriData(void *data, Evas_Object *obj);
-
- static void onBackBtnClicked(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onEditModeBtnClicked(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onOptBtnClicked(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onUriClicked(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onUriChkClicked(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onSelectAllChkClicked(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onSelectAllClicked(void *data,
- Evas *e,
- Evas_Object *obj,
- void *event_info);
- static void onRemoveWhiteUriPopupOk(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onRemoveWhiteUriPopupCancel(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onWhiteUriViewUnload(void *data);
-
- void addUri(DPL::String &uri);
- Evas_Object *addToolBar(Evas_Object *parent);
- bool pushToNaviFrame(void);
- void popFromNaviFrame(void);
- bool addNoContent(Evas_Object *ly);
- bool addContents(Evas_Object *ly);
-
- public:
- WhiteListView(Evas_Object *naviFrame);
- ~WhiteListView(void);
-
- bool loadView(void);
- void loadWhiteUriView(std::string *uri = NULL);
- void delWhiteUriView(void);
- void reloadUri(void);
- void handleEditModeBtn(void);
- void handleOptBtn(void);
- void handleBackBtn(void);
- void removeWhiteUri(void);
- void increaseSelectCnt(void);
- void decreaseSelectCnt(void);
- void selectAll(Eina_Bool select);
- bool showPopup(const char *desc,
- Evas_Smart_Cb ok_cb,
- Evas_Smart_Cb cancel_cb,
- void *data);
- void hidePopup(void);
-};
-
-class UriData
-{
- public:
- WhiteListView *m_whiteListView;
- std::string m_uri;
- Evas_Object *m_chk;
- Eina_Bool m_selected;
-
- UriData(WhiteListView *whiteListView, std::string uri) :
- m_whiteListView(whiteListView),
- m_uri(uri),
- m_chk(NULL),
- m_selected(EINA_FALSE) { };
-
- ~UriData(void) { };
-};
-
-} /* WebAppCommonSetting */
-
-#endif /* WEB_SRC_SETTING_WEBAPP_COMMON_WHITELISTVIEW_H_ */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 <Elementary.h>
-#include <ui-gadget.h>
-
-#include <dpl/wrt-dao-rw/global_dao.h>
-#include <dpl/assert.h>
-
-#include "whiteuriview.h"
-#include "icons.h"
-
-namespace WebAppCommonSetting {
-
-void WhiteUriView::onBackBtnClicked(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- WhiteUriView *whiteUriView;
-
- whiteUriView = static_cast<WhiteUriView *>(data);
- Assert(whiteUriView);
- whiteUriView->popFromNaviFrame();
-}
-
-void WhiteUriView::onSaveBtnClicked(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- WhiteUriView *whiteUriView;
-
- whiteUriView = static_cast<WhiteUriView *>(data);
- Assert(whiteUriView);
- whiteUriView->save();
-}
-
-void WhiteUriView::onUriErase(void *data,
- Evas_Object */*obj*/,
- const char */*emission*/,
- const char */*source*/)
-{
- Evas_Object *entry;
-
- entry = static_cast<Evas_Object *>(data);
- Assert(entry);
- elm_entry_entry_set(entry, "");
-}
-
-void WhiteUriView::onUriFocused(void *data,
- Evas_Object *obj,
- void */*event_info*/)
-{
- Evas_Object *ef;
-
- Assert(obj);
- ef = static_cast<Evas_Object *>(data);
- Assert(ef);
-
- if (!elm_entry_is_empty(obj))
- elm_object_signal_emit(ef, "elm,state,eraser,show", "elm");
- elm_object_signal_emit(ef, "elm,state,guidetext,hide", "elm");
-}
-
-void WhiteUriView::onUriUnfocused(void *data,
- Evas_Object *obj,
- void */*event_info*/)
-{
- Evas_Object *ef;
-
- Assert(obj);
- ef = static_cast<Evas_Object *>(data);
- Assert(ef);
-
- if (elm_entry_is_empty(obj))
- elm_object_signal_emit(ef, "elm,state,guidetext,show", "elm");
- elm_object_signal_emit(ef, "elm,state,eraser,hide", "elm");
-}
-
-void WhiteUriView::onUriChanged(void *data,
- Evas_Object *obj,
- void */*event_info*/)
-{
- WhiteUriView *whiteUriView;
- Evas_Object *ef;
-
- if (!elm_object_focus_get(obj))
- return;
- ef = static_cast<Evas_Object *>(evas_object_data_get(obj, "editfield"));
- Assert(ef);
-
- if (elm_entry_is_empty(obj))
- elm_object_signal_emit(ef, "elm,state,eraser,hide", "elm");
- else
- elm_object_signal_emit(ef, "elm,state,eraser,show", "elm");
-
- whiteUriView = static_cast<WhiteUriView *>(data);
- Assert(whiteUriView);
- whiteUriView->updateUri(elm_entry_entry_get(obj));
-}
-
-void WhiteUriView::onSubDomainReleased(void */*data*/,
- Evas */*e*/,
- Evas_Object *obj,
- void */*event_info*/)
-{
- Assert(obj);
- elm_object_signal_emit(obj, "elm,state,unselected", "elm");
-}
-
-void WhiteUriView::onSubDomainClicked(void *data,
- Evas */*e*/,
- Evas_Object *obj,
- void */*event_info*/)
-{
- Evas_Object *chk;
-
- chk = static_cast<Evas_Object *>(data);
- Assert(obj && chk);
- elm_check_state_set(chk, !elm_check_state_get(chk));
- elm_object_signal_emit(obj, "elm,state,selected", "elm");
-}
-
-bool WhiteUriView::pushToNaviFrame(void)
-{
- Evas_Object *btn;
- Evas_Object *toolBar;
- Elm_Object_Item *it;
-
- Assert(m_naviFrame);
-
- btn = elm_button_add(m_naviFrame);
- if (!btn)
- return false;
-
- toolBar = addToolBar(m_naviFrame);
- if (!toolBar) {
- evas_object_del(btn);
- return false;
- }
- elm_object_style_set(btn, "naviframe/end_btn/default");
- evas_object_smart_callback_add(btn, "clicked", onBackBtnClicked, this);
- it = elm_naviframe_item_push(m_naviFrame,
- m_isModify ? "Modify white URI" : "New white URI",
- btn,
- NULL,
- getBase(),
- NULL);
- if (!it) {
- evas_object_del(btn);
- evas_object_del(toolBar);
- return false;
- }
-
- elm_object_item_part_content_set(it, "controlbar", toolBar);
-
-
- return false;
-}
-
-void WhiteUriView::popFromNaviFrame(void)
-{
- Assert(m_naviFrame);
- elm_naviframe_item_pop(m_naviFrame);
-}
-
-bool WhiteUriView::addUriField(Evas_Object *bx)
-{
- Evas_Object *ly;
- Evas_Object *ef;
- Evas_Object *entry;
- const char *str;
-
- Assert(bx);
-
- ly = elm_layout_add(bx);
- if (!ly)
- return false;
- elm_layout_theme_set(ly, "layout", "dialogue", "1icon");
- evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, 0.0);
- evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, 0.0);
-
- ef = elm_layout_add(ly);
- if (!ef) {
- evas_object_del(ly);
- return false;
- }
- elm_layout_theme_set(ef, "layout", "editfield", "title");
-
- entry = elm_entry_add(ef);
- if (!entry) {
- evas_object_del(ly);
- return false;
- }
- evas_object_data_set(entry, "editfield", static_cast<void *>(ef));
- elm_entry_single_line_set(entry, EINA_TRUE);
- elm_object_part_content_set(ef, "elm.swallow.content", entry);
-
- elm_object_signal_callback_add(ef,
- "elm,eraser,clicked",
- "elm",
- onUriErase,
- static_cast<void *>(entry));
- evas_object_smart_callback_add(entry,
- "focused",
- onUriFocused,
- static_cast<void *>(ef));
- evas_object_smart_callback_add(entry,
- "unfocused",
- onUriUnfocused,
- static_cast<void *>(ef));
- evas_object_smart_callback_add(entry, "changed", onUriChanged, this);
-
- elm_object_part_text_set(ef, "elm.text", "URI");
- if (m_isModify) {
- str = m_uri.c_str();
- if (str) {
- elm_entry_entry_set(entry, str);
- elm_object_signal_emit(ef, "elm,state,guidetext,hide", "elm");
- }
- }
-
- elm_object_part_text_set(ef, "elm.guidetext", "Put white URI");
- elm_object_part_content_set(ly, "elm.icon", ef);
- elm_box_pack_end(bx, ly);
- evas_object_show(ly);
-
- return true;
-}
-
-bool WhiteUriView::addSubDomainField(Evas_Object *bx)
-{
- Evas_Object *ly;
- Evas_Object *chk;
-
- Assert(bx);
- ly = elm_layout_add(bx);
- if (!ly)
- return false;
- elm_object_focus_allow_set(ly, EINA_TRUE);
-
- chk = elm_check_add(ly);
- if (!chk) {
- evas_object_del(ly);
- return false;
- }
- elm_check_state_pointer_set(chk, &m_supportSubDomain);
- evas_object_propagate_events_set(chk, EINA_FALSE);
- elm_layout_theme_set(ly, "layout", "dialogue", "1text.1icon");
- elm_object_part_text_set(ly, "elm.text", "Include sub-domains");
- elm_object_part_content_set(ly, "elm.icon", chk);
- evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, 0.0);
- evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, 0.0);
- evas_object_event_callback_add(ly,
- EVAS_CALLBACK_MOUSE_UP,
- onSubDomainReleased,
- NULL);
- evas_object_event_callback_add(ly,
- EVAS_CALLBACK_MOUSE_DOWN,
- onSubDomainClicked,
- static_cast<void *>(chk));
- elm_box_pack_end(bx, ly);
- evas_object_show(ly);
-
- return true;
-}
-
-Evas_Object *WhiteUriView::addToolBar(Evas_Object *parent)
-{
- Evas_Object *toolBar;
-
- toolBar = elm_toolbar_add(parent);
- if (!toolBar)
- return NULL;
- elm_object_style_set(toolBar, "naviframe");
- elm_toolbar_shrink_mode_set(toolBar, ELM_TOOLBAR_SHRINK_EXPAND);
- m_saveBtn = elm_toolbar_item_append(toolBar,
- ICON_SAVE,
- NULL,
- onSaveBtnClicked,
- this);
-
- if (!m_uri.size())
- elm_object_item_disabled_set(m_saveBtn, EINA_TRUE);
-
- return toolBar;
-}
-
-bool WhiteUriView::loadView(void)
-{
- Evas_Object *win;
- Evas_Object *conform;
- Evas_Object *scr;
- Evas_Object *bx;
-
- Assert(m_naviFrame);
- resetBase();
-
- win = static_cast<Evas_Object *>(ug_get_window());
- Assert(win);
-
- elm_win_conformant_set(win, EINA_TRUE);
- conform = elm_conformant_add(m_naviFrame);
- if (!conform)
- return NULL;
- elm_object_style_set(conform, "internal_layout");
-
- scr = elm_scroller_add(conform);
- if (!scr)
- return false;
-
- bx = elm_box_add(scr);
- if (!bx) {
- evas_object_del(conform);
- return false;
- }
-
- evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
- evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.0);
- elm_object_content_set(scr, bx);
- evas_object_show(bx);
- evas_object_show(scr);
- if (!addUriField(bx) || !addSubDomainField(bx)) {
- evas_object_del(conform);
- return false;
- }
-
- elm_object_content_set(conform, scr);
- resetBase(conform);
- pushToNaviFrame();
-
- return true;
-}
-
-void WhiteUriView::save(void)
-{
- /* FIXME: what if uri is already exist?
- there is no error code */
- WrtDB::GlobalDAO::AddWhiteURI(m_uri, m_supportSubDomain);
- elm_naviframe_item_pop(m_naviFrame);
-}
-
-void WhiteUriView::updateUri(const char *uri)
-{
- m_uri.clear();
- if (uri && strlen(uri)) {
- m_uri.assign(uri);
- elm_object_item_disabled_set(m_saveBtn, EINA_FALSE);
- } else {
- elm_object_item_disabled_set(m_saveBtn, EINA_TRUE);
- }
-}
-
-WhiteUriView::WhiteUriView(Evas_Object *naviFrame) :
- m_naviFrame(naviFrame),
- m_saveBtn(NULL),
- m_isModify(false),
- m_supportSubDomain(false)
-{
-}
-
-WhiteUriView::WhiteUriView(Evas_Object *naviFrame,
- std::string uri) :
- m_naviFrame(naviFrame),
- m_saveBtn(NULL),
- m_uri(uri),
- m_isModify(true),
- m_supportSubDomain(false)
-{
-}
-
-WhiteUriView::~WhiteUriView(void)
-{
-}
-
-} /* WebAppCommonSetting */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 WEB_SRC_SETTING_WEBAPP_COMMON_WHITEURIVIEW_H_
-#define WEB_SRC_SETTING_WEBAPP_COMMON_WHITEURIVIEW_H_
-
-#include <Evas.h>
-
-#include <string>
-
-#include "view.h"
-
-namespace WebAppCommonSetting {
-
-class WhiteUriView : public View
-{
- Evas_Object *m_naviFrame;
- Elm_Object_Item *m_saveBtn;
- std::string m_uri;
- bool m_isModify;
- Eina_Bool m_supportSubDomain;
-
- static void onBackBtnClicked(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onSaveBtnClicked(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onUriErase(void *data,
- Evas_Object *obj,
- const char *emission,
- const char *source);
- static void onUriFocused(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onUriUnfocused(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onUriChanged(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onSubDomainReleased(void *data,
- Evas *e,
- Evas_Object *obj,
- void *event_info);
- static void onSubDomainClicked(void *data,
- Evas *e,
- Evas_Object *obj,
- void *event_info);
-
- bool pushToNaviFrame(void);
- void popFromNaviFrame(void);
- bool addUriField(Evas_Object *bx);
- bool addSubDomainField(Evas_Object *bx);
- Evas_Object *addToolBar(Evas_Object *parent);
-
- public:
- WhiteUriView(Evas_Object *naviFrame);
- WhiteUriView(Evas_Object *naviFrame,
- std::string uri);
- ~WhiteUriView(void);
-
- bool loadView(void);
- void save(void);
- void updateUri(const char *uri);
-};
-
-} /* WebAppCommonSetting */
-
-#endif /* WEB_SRC_SETTING_WEBAPP_COMMON_WHITEURIVIEW_H_ */
SET(TARGET_UG_DETAIL_LIB "ug-webapp-detail-efl")
SET(TARGET_UG_EDJ "webapp-detail.edj")
SET(UGDIR "${UG_INSTALL_PREFIX}/ug/lib")
-SET(EDJDIR "${UG_INSTALL_PREFIX}/ug/res/edje/${TARGET_UG_DETAIL_LIB}")
# Compiler flags
SET(CMAKE_BUILD_TYPE "Release")
SET(UG_DETAIL_SOURCES
ug.cpp
- view.cpp
mainview.cpp
- detailview.cpp
- permview.cpp
- advancedview.cpp
exceptionsview.cpp
- wac_feature.cpp
- tizen_feature.cpp
)
INCLUDE_DIRECTORIES(${UG_WEB_APP_DETAIL_DEPS_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(${TARGET_UG_DETAIL_LIB} ${UG_WEB_APP_DETAIL_DEPS_LDFLAGS} ${UG_WEB_APP_DETAIL_DEPS_LIBRARIES})
INSTALL(TARGETS ${TARGET_UG_DETAIL_LIB} DESTINATION ${UGDIR})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ug.webapp-detail-efl.include DESTINATION /etc/smack/accesses2.d)
-
-ADD_SUBDIRECTORY(edc)
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 "advancedview.h"
-
-#include <vector>
-#include <map>
-#include <string>
-#include <cstring>
-#include <Elementary.h>
-
-#include <dpl/foreach.h>
-#include <dpl/assert.h>
-#include <dpl/wrt-dao-ro/WrtDatabase.h>
-#include <dpl/wrt-dao-rw/widget_dao.h>
-#include "exceptionsview.h"
-#include "util.h"
-
-namespace WebAppDetailSetting {
-
-namespace {
-const char* const ELM_STYLE_CHECKBOX = "checkbox";
-const char* const ELM_PART_ICON = "elm.icon";
-const char* const EVAS_SMART_CALLBACK_CHANGED = "changed";
-const char* const ELM_GENLIST_ITEM_CLASS_STYLE_GROUPINDEX = "groupindex";
-const char* const ELM_GENLIST_ITEM_CLASS_STYLE_1TEXT = "1text";
-const char* const ELM_GENLIST_ITEM_CLASS_STYLE_1TEXT_1ICON_6 = "1text.1icon.2";
-const char* const TEXT_NAVIFRAME_TITLE = "ALLOW LIST";
-}
-
-AdvancedView::AdvancedView(Evas_Object *navi, DPL::String appID) :
- m_naviframe(navi),
- m_appID(appID)
-{
- m_groupMenuMap[GROUP_IDX_SECURITY_SETTINGS] = "Security Settings";
- m_groupMenuMap[GROUP_IDX_DEVELOPER_OPTIONS] = "Developer Options";
-
- m_menuMap[SECURITY_SETTINGS_IDX_SECURITY_POPUP_USAGE] =
- "Show security warnings";
- m_menuMap[SECURITY_SETTINGS_IDX_GEOLOCATION_USAGE] =
- "Location";
- m_menuMap[SECURITY_SETTINGS_IDX_WEB_NOTIFICATION_USAGE] =
- "Web notification";
- m_menuMap[SECURITY_SETTINGS_IDX_WEB_STORAGE_USAGE] =
- "Web storage";
- m_menuMap[SECURITY_SETTINGS_IDX_EXCEPTIONS_SETTINGS] =
- "Exceptions Settings";
- m_menuMap[DEVELOPER_OPTIONS_IDX_MEMORY_SAVING_MODE] =
- "Memory Saving Mode";
-}
-
-AdvancedView::~AdvancedView(void)
-{
-}
-
-char* AdvancedView::getGroupText(void* data,
- Evas_Object* /*obj*/,
- const char* /*part*/)
-{
- Assert(data);
- AdvancedSettingsGroupData* advancedSettingsData =
- static_cast<AdvancedSettingsGroupData*>(data);
- return strdup(advancedSettingsData->m_menuText.c_str());
-}
-
-void AdvancedView::delGroupData(void* data,
- Evas_Object* /*obj*/)
-{
- Assert(data);
- AdvancedSettingsGroupData* advancedSettingsData =
- static_cast<AdvancedSettingsGroupData*>(data);
- delete advancedSettingsData;
-}
-
-char* AdvancedView::getSettingText(void *data,
- Evas_Object* /*obj*/,
- const char* /*part*/)
-{
- Assert(data);
- SettingData* settingData = static_cast<SettingData*>(data);
- return strdup(settingData->m_menuText.c_str());
-}
-
-Evas_Object* AdvancedView::getSettingContent(void* data,
- Evas_Object* obj,
- const char* /*part*/)
-{
- Assert(data);
- SettingData* settingData =
- static_cast<SettingData*>(data);
-
- Assert(obj);
- Evas_Object* icon = elm_check_add(obj);
- elm_check_state_set(icon, EINA_TRUE);
- elm_object_style_set(icon, ELM_STYLE_CHECKBOX);
- settingData->m_iconPart = ELM_PART_ICON;
-
- evas_object_propagate_events_set(
- icon,
- EINA_FALSE);
- elm_check_state_set(icon, settingData->isEnabled() ? EINA_TRUE : EINA_FALSE);
- evas_object_smart_callback_add(icon,
- EVAS_SMART_CALLBACK_CHANGED,
- settingChangedCallback,
- data);
-
- return icon;
-}
-
-void AdvancedView::delSettingData(void* data,
- Evas_Object* /*obj*/)
-{
- Assert(data);
- SettingData* settingData = static_cast<SettingData*>(data);
- delete settingData;
-}
-
-void AdvancedView::settingSelectedCallback(void* data,
- Evas_Object* obj,
- void* eventInfo)
-{
- Assert(eventInfo);
- Elm_Object_Item* item = static_cast<Elm_Object_Item*>(eventInfo);
- elm_genlist_item_selected_set(item, EINA_FALSE);
-
- SettingData* settingData =
- static_cast<SettingData*>(elm_object_item_data_get(item));
- Assert(settingData);
-
- Evas_Object* check =
- elm_object_item_part_content_get(item,
- settingData->m_iconPart.c_str());
- Assert(check);
- bool state = !elm_check_state_get(check);
- settingData->saveChange(state);
- elm_check_state_set(check, state);
-}
-
-void AdvancedView::settingChangedCallback(void* data,
- Evas_Object* obj,
- void* eventInfo)
-{
- Assert(data);
- SettingData* settingData =
- static_cast<SettingData*>(data);
- Assert(obj);
- settingData->saveChange(elm_check_state_get(obj));
-}
-
-char* AdvancedView::getSecurityExceptionsSettingsText(void *data,
- Evas_Object *obj,
- const char *part)
-{
- Assert(data);
- return strdup("Exceptions Settings");
-}
-
-void AdvancedView::securityExceptionsSettingsSelectedCallback(void* data,
- Evas_Object* obj,
- void* eventInfo)
-{
- Assert(eventInfo);
- Elm_Object_Item* item = static_cast<Elm_Object_Item*>(eventInfo);
- elm_genlist_item_selected_set(item, EINA_FALSE);
-
- AdvancedView* This =
- static_cast<AdvancedView*>(elm_object_item_data_get(item));
- Assert(This);
- This->m_exceptionsView.Reset(
- new ExceptionsView(This->m_naviframe, This->m_appID));
- if (!This->m_exceptionsView->loadView()) {
- This->m_exceptionsView.Reset();
- }
-}
-
-bool AdvancedView::loadView(void)
-{
- m_exceptionsView.Reset(
- new ExceptionsView(m_naviframe, m_appID));
- if (!m_exceptionsView->loadView()) {
- m_exceptionsView.Reset();
- }
- return true;
-}
-
-void AdvancedView::loadSecuritySettingsMenu(Evas_Object* genlist)
-{
- for (int index = SECURITY_SETTINGS_IDX_START; index <= SECURITY_SETTINGS_IDX_END; index++) {
- if (index == SECURITY_SETTINGS_IDX_EXCEPTIONS_SETTINGS) {
- // create exceptions security settings menu
- static Elm_Genlist_Item_Class itcSecurityExceptionsSettings = {0,};
- itcSecurityExceptionsSettings.item_style =
- ELM_GENLIST_ITEM_CLASS_STYLE_1TEXT;
- itcSecurityExceptionsSettings.func.text_get = getSecurityExceptionsSettingsText;
- itcSecurityExceptionsSettings.func.content_get = NULL;
- itcSecurityExceptionsSettings.func.state_get = NULL;
- itcSecurityExceptionsSettings.func.del = NULL;
- elm_genlist_item_append(genlist,
- &itcSecurityExceptionsSettings,
- static_cast<void*>(this),
- NULL,
- ELM_GENLIST_ITEM_NONE,
- securityExceptionsSettingsSelectedCallback,
- NULL);
-
- } else {
- // create usage menu
- static Elm_Genlist_Item_Class itcSecuritySettings = {0,};
- itcSecuritySettings.item_style =
- ELM_GENLIST_ITEM_CLASS_STYLE_1TEXT_1ICON_6;
- itcSecuritySettings.func.text_get = getSettingText;
- itcSecuritySettings.func.content_get = getSettingContent;
- itcSecuritySettings.func.state_get = NULL;
- itcSecuritySettings.func.del = delSettingData;
-
- elm_genlist_item_append(genlist,
- &itcSecuritySettings,
- static_cast<void*>(
- new SettingData(
- m_appID, index, m_menuMap[index])),
- NULL,
- ELM_GENLIST_ITEM_NONE,
- settingSelectedCallback,
- NULL);
- }
- }
-}
-
-void AdvancedView::loadDeveloperOptionsMenu(Evas_Object* genlist)
-{
- static Elm_Genlist_Item_Class itcDeveloperOptions = {0,};
- itcDeveloperOptions.item_style =
- ELM_GENLIST_ITEM_CLASS_STYLE_1TEXT_1ICON_6;
- itcDeveloperOptions.func.text_get = getSettingText;
- itcDeveloperOptions.func.content_get = getSettingContent;
- itcDeveloperOptions.func.state_get = NULL;
- itcDeveloperOptions.func.del = delSettingData;
-
- for (int index = DEVELOPER_OPTIONS_IDX_START; index <= DEVELOPER_OPTIONS_IDX_END; index++) {
- elm_genlist_item_append(genlist,
- &itcDeveloperOptions,
- static_cast<void*>(
- new SettingData(
- m_appID, index, m_menuMap[index])),
- NULL,
- ELM_GENLIST_ITEM_NONE,
- settingSelectedCallback,
- NULL);
- }
-}
-
-SettingData::SettingData(DPL::String appID, int index, std::string menuText) :
- m_index(static_cast<MenuIndex>(index)),
- m_menuText(menuText)
-{
- m_dao.Reset(new WrtDB::WidgetDAO(appID));
-}
-
-bool SettingData::isEnabled()
-{
- using namespace WrtDB;
- SettingsType ret = SETTINGS_TYPE_UNKNOWN;
- if (m_index == SECURITY_SETTINGS_IDX_SECURITY_POPUP_USAGE) {
- ret = m_dao->getSecurityPopupUsage();
- } else if (m_index == SECURITY_SETTINGS_IDX_GEOLOCATION_USAGE) {
- ret = m_dao->getSecurityPopupUsage();
- } else if (m_index == SECURITY_SETTINGS_IDX_WEB_NOTIFICATION_USAGE) {
- ret = m_dao->getSecurityPopupUsage();
- } else if (m_index == SECURITY_SETTINGS_IDX_WEB_STORAGE_USAGE) {
- ret = m_dao->getSecurityPopupUsage();
- } else {
- Assert("Wrong menu index");
- }
-
- if (ret == SETTINGS_TYPE_ON) {
- return true;
- } else if (ret == SETTINGS_TYPE_OFF) {
- return false;
- }
-
- Assert("Unsupported value");
- // For preventing compile warning, even this code isn't necessary.
- return false;
-}
-
-void SettingData::saveChange(bool state)
-{
- using namespace WrtDB;
- SettingsType result = state ? SETTINGS_TYPE_ON : SETTINGS_TYPE_OFF;
-
- if (m_index == SECURITY_SETTINGS_IDX_SECURITY_POPUP_USAGE) {
- m_dao->setSecurityPopupUsage(result);
- } else if (m_index == SECURITY_SETTINGS_IDX_GEOLOCATION_USAGE) {
- m_dao->setGeolocationUsage(result);
- } else if (m_index == SECURITY_SETTINGS_IDX_WEB_NOTIFICATION_USAGE) {
- m_dao->setWebNotificationUsage(result);
- } else if (m_index == SECURITY_SETTINGS_IDX_WEB_STORAGE_USAGE) {
- m_dao->setWebDatabaseUsage(result);
- } else {
- Assert("Wrong menu index");
- }
-}
-
-} /* WebAppDetailSetting */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 WEB_SRC_SETTING_WEBAPP_DETAIL_ADVANCEDVIEW_H_
-#define WEB_SRC_SETTING_WEBAPP_DETAIL_ADVANCEDVIEW_H_
-
-#include <Evas.h>
-
-#undef None
-#include <string>
-#include <map>
-#include <dpl/scoped_ptr.h>
-#include <dpl/string.h>
-
-#include "view.h"
-
-namespace WrtDB {
-class WidgetDAO;
-}
-
-namespace WebAppDetailSetting {
-
-class ExceptionsView;
-
-enum GroupSettingsIndex {
- GROUP_IDX_START = 0,
- GROUP_IDX_SECURITY_SETTINGS = GROUP_IDX_START,
- GROUP_IDX_DEVELOPER_OPTIONS,
- GROUP_IDX_END = GROUP_IDX_DEVELOPER_OPTIONS,
-};
-
-enum MenuIndex {
- SECURITY_SETTINGS_IDX_START = 0,
- SECURITY_SETTINGS_IDX_SECURITY_POPUP_USAGE,
- SECURITY_SETTINGS_IDX_GEOLOCATION_USAGE = SECURITY_SETTINGS_IDX_START,
- SECURITY_SETTINGS_IDX_WEB_NOTIFICATION_USAGE,
- SECURITY_SETTINGS_IDX_WEB_STORAGE_USAGE,
- SECURITY_SETTINGS_IDX_EXCEPTIONS_SETTINGS,
- SECURITY_SETTINGS_IDX_END = SECURITY_SETTINGS_IDX_EXCEPTIONS_SETTINGS,
- DEVELOPER_OPTIONS_IDX_START = SECURITY_SETTINGS_IDX_END,
- DEVELOPER_OPTIONS_IDX_MEMORY_SAVING_MODE = DEVELOPER_OPTIONS_IDX_START,
- DEVELOPER_OPTIONS_IDX_END = DEVELOPER_OPTIONS_IDX_MEMORY_SAVING_MODE,
-};
-
-class AdvancedView : public View
-{
- public:
- AdvancedView(Evas_Object *naviframe, DPL::String appID);
- ~AdvancedView(void);
-
- bool loadView(void);
- void loadSecuritySettingsMenu(Evas_Object* genlist);
- void loadDeveloperOptionsMenu(Evas_Object* genlist);
-
- private:
- Evas_Object *m_naviframe;
- DPL::String m_appID;
- DPL::ScopedPtr<ExceptionsView> m_exceptionsView;
- std::map<int, std::string> m_groupMenuMap;
- std::map<int, std::string> m_menuMap;
-
- static char* getGroupText(
- void* data,
- Evas_Object* obj,
- const char* part);
- static void delGroupData(
- void* data,
- Evas_Object* obj);
-
- static char* getSettingText(
- void* data,
- Evas_Object* obj,
- const char* part);
- static Evas_Object* getSettingContent(
- void* data,
- Evas_Object* obj,
- const char* part);
- static void delSettingData(
- void* data,
- Evas_Object* obj);
- static void settingSelectedCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
- static void settingChangedCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
- static char* getSecurityExceptionsSettingsText(
- void* data,
- Evas_Object* obj,
- const char* part);
- static void securityExceptionsSettingsSelectedCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
-};
-
-class AdvancedSettingsGroupData
-{
- public:
- std::string m_menuText;
- AdvancedSettingsGroupData(std::string menuText) :
- m_menuText(menuText)
- {
- };
-};
-
-class SettingData
-{
- public:
- DPL::ScopedPtr<WrtDB::WidgetDAO> m_dao;
- MenuIndex m_index;
- std::string m_menuText;
- std::string m_iconPart;
-
- SettingData(DPL::String appID, int index, std::string menuText);
- bool isEnabled();
- void saveChange(bool state);
-};
-
-} /* WebAppDetailSetting */
-
-#endif /* WEB_SRC_SETTING_WEBAPP_DETAIL_ADVANCEDVIEW_H_ */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 <sstream>
-#include <Elementary.h>
-#include <efl_assist.h>
-
-#include <dpl/wrt-dao-rw/widget_dao.h>
-#include <dpl/foreach.h>
-#include <dpl/assert.h>
-#include <dpl/utils/wrt_global_settings.h>
-#include <dpl/localization/w3c_file_localization.h>
-
-#include <ui-gadget-module.h>
-
-#include "detailview.h"
-#include "advancedview.h"
-#include "util.h"
-
-namespace WebAppDetailSetting {
-namespace {
-const int MAX_PATH_LENGTH = 255;
-const int ERROR_READ_LINK = -1;
-// need to move widget_config.h
-const char* const WRT_LAUNCHER = "wrt-launcher";
-const char* const WRT_LAUNCHER_WK_MODE_CHANGE_OPTION = "-w";
-}
-
-void DetailView::getLocalizedInfo(void)
-{
- m_localizedInfo = W3CFileLocalization::getLocalizedInfo(m_appID);
-}
-
-Evas_Object *DetailView::loadView(void)
-{
- Evas_Object *win;
-
- resetBase();
- try {
- win = static_cast<Evas_Object *>(ug_get_window());
- Assert(win);
- ea_object_event_callback_add(m_naviframe,
- EA_CALLBACK_BACK,
- onBackBtnClicked,
- this);
- m_dao.Reset(new WrtDB::WidgetDAO(m_appID));
- getLocalizedInfo();
-
- bindtextdomain("ug-webapp-common-efl", "/usr/ug/res/locale");
-
- m_advancedView.Reset(
- new AdvancedView(m_naviframe,
- m_appID));
- m_advancedView->loadView();
- return win;
- } catch (const std::bad_alloc &) {
- return NULL;
- }
-}
-
-void DetailView::onBackBtnClicked(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- DetailView* This;
-
- This= static_cast<DetailView *>(data);
- Assert(This);
- ug_destroy_me(This->m_ug);
-}
-
-DetailView::DetailView(Evas_Object* navi, ui_gadget_h ug, DPL::String appID) :
- m_naviframe(navi),
- m_bx(NULL),
- m_appID(appID),
- m_licenseInfo(NULL),
- m_ug(ug)
-{
- Assert(navi);
- m_dao.Reset();
-}
-
-DetailView::~DetailView(void)
-{
- if (m_licenseInfo)
- delete m_licenseInfo;
-}
-}
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 WEB_SRC_SETTING_WEBAPP_DETAIL_DETAILVIEW_H_
-#define WEB_SRC_SETTING_WEBAPP_DETAIL_DETAILVIEW_H_
-
-#include <Evas.h>
-#include <ui-gadget.h>
-
-#undef None
-#include <dpl/wrt-dao-rw/widget_dao.h>
-#include <dpl/scoped_ptr.h>
-
-#include "view.h"
-
-namespace WebAppDetailSetting {
-
-class AdvancedView;
-
-typedef struct {
- std::string license;
- std::string href;
- Evas_Object* evasObj;
-} LicenseInfo;
-
-class DetailView : public View
-{
- enum WebkitVersion {
- WEBKIT_VERSION_WK1,
- WEBKIT_VERSION_WK2,
- WEBKIT_VERSION_UNKNOWN
- };
-
- Evas_Object *m_naviframe;
- Evas_Object *m_parent;
- Evas_Object *m_bx;
- Evas_Object *check_webkit;
- Evas_Object *check_login;
- ui_gadget_h m_ug;
- DPL::ScopedPtr<WrtDB::WidgetDAO> m_dao;
- WrtDB::WidgetLocalizedInfo m_localizedInfo;
- DPL::String m_appID;
- LicenseInfo *m_licenseInfo;
- DPL::ScopedPtr<AdvancedView> m_advancedView;
-
- void getLocalizedInfo(void);
- static void onBackBtnClicked(void *data,
- Evas_Object *obj,
- void *event_info);
- public:
- DetailView(Evas_Object* naviframe, ui_gadget_h ug, DPL::String appID);
- ~DetailView(void);
-
- Evas_Object *loadView(void);
-};
-
-class DetailData
-{
- public:
- DetailView *m_detailView;
- std::string m_title;
- std::string m_subtitle;
- int m_dataType;
- DetailData(DetailView *detailView,
- const char *title,
- const char *subtitle) :
- m_detailView(detailView),
- m_title(title),
- m_subtitle(subtitle) { };
-
- ~DetailData(void) { };
-};
-
-} /* WebAppDetailSetting */
-
-#endif /* WEB_SRC_SETTING_WEBAPP_DETAIL_DETAILVIEW_H_ */
+++ /dev/null
-#
-# Copyright 2012 Samsung Electronics Co., Ltd
-#
-# Licensed under the Flora License, Version 1.1 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://floralicense.org/license/
-#
-# 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.
-#
-
-ADD_CUSTOM_TARGET(${TARGET_UG_EDJ}
- COMMAND edje_cc
- ${CMAKE_CURRENT_SOURCE_DIR}/main.edc ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_UG_EDJ}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/main.edc
-)
-ADD_DEPENDENCIES(${TARGET_UG_DETAIL_LIB} ${TARGET_UG_EDJ})
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_UG_EDJ} DESTINATION ${EDJDIR})
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 WEB_SRC_SETTING_WEBAPP_DETAIL_EDC_DEFS_H_
-#define WEB_SRC_SETTING_WEBAPP_DETAIL_EDC_DEFS_H_
-
-#define GRP_CONTENT "content"
-#define PART_DETAIL "swallow.detail"
-#define PART_PERM "swallow.permission"
-#define SIG_SHOW_PERM "show,permission"
-#define SIG_SHOW_DETAIL "show,detail"
-#define SRC_PROG "prog"
-
-#endif /* WEB_SRC_SETTING_WEBAPP_DETAIL_EDC_DEFS_H_ */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 "defs.h"
-
-collections {
- group {
- name, GRP_CONTENT;
-
- parts {
- part {
- name, PART_DETAIL;
- type, SWALLOW;
- description {
- state, "default" 0.0;
- }
- description {
- state, "permission" 0.0;
- inherit, "default" 0.0;
- rel1.relative, -1.0 0.0;
- rel2.relative, 0.0 1.0;
- }
- }
-
- part {
- name, PART_PERM;
- type, SWALLOW;
- description {
- state, "default" 0.0;
- rel1.relative, 1.0 0.0;
- rel2.relative, 2.0 1.0;
- }
- description {
- state, "permission" 0.0;
- inherit, "default" 0.0;
- rel1.relative, 0.0 0.0;
- rel2.relative, 1.0 1.0;
- }
- }
- }
-
- programs {
- program {
- name, "show_detail";
- signal, SIG_SHOW_DETAIL;
- source, SRC_PROG;
- action, STATE_SET "default" 0.0;
- target, PART_DETAIL;
- target, PART_PERM;
- }
- program {
- name, "show_permission";
- signal, SIG_SHOW_PERM;
- source, SRC_PROG;
- action, STATE_SET "permission" 0.0;
- target, PART_DETAIL;
- target, PART_PERM;
- }
- }
- }
-}
bool ExceptionsView::loadView(void)
{
using namespace SecurityOriginDB;
- resetBase();
Evas_Object* genlist = NULL;
genlist = elm_genlist_add(m_naviframe);
NULL,
genlist,
NULL);
- resetBase(genlist);
return true;
}
#include <wrt-commons/security-origin-dao/security_origin_dao.h>
#include <wrt-commons/security-origin-dao/security_origin_dao_types.h>
-#include "view.h"
-
namespace SecurityOriginDB {
class SecurityOriginDAO;
struct SecurityOriginData;
namespace WebAppDetailSetting {
-class ExceptionsView : public View
+class ExceptionsView
{
public:
ExceptionsView(Evas_Object *naviframe, DPL::String appID);
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 WEB_SRC_SETTING_WEBAPP_DETAIL_FEATURE_H_
-#define WEB_SRC_SETTING_WEBAPP_DETAIL_FEATURE_H_
-
-#include <dpl/wrt-dao-rw/widget_dao.h>
-#include <ace-settings/ace_api_settings.h>
-
-namespace WebAppDetailSetting {
-
-class Feature
-{
- std::string m_name;
- std::string m_uri;
- ace_preference_t m_perm;
-
- public:
- Feature(const char *name = NULL, const char *uri = NULL) :
- m_perm(ACE_PREFERENCE_DEFAULT)
- {
- if (name)
- m_name.assign(name);
- if (uri)
- m_uri.assign(uri);
- }
- void setPerm(ace_preference_t perm) { m_perm = perm; }
-
- std::string& getName(void) { return m_name; }
- std::string& getUri(void) { return m_uri; }
- ace_preference_t getPerm(void) { return m_perm; }
-};
-
-} /* WebAppDetailSetting */
-
-#endif /* WEB_SRC_SETTING_WEBAPP_DETAIL_FEATURE_H_ */
#include <ui-gadget-module.h>
#include <dpl/assert.h>
+#include <efl_assist.h>
#include "mainview.h"
-#include "edc/defs.h"
#include "util.h"
namespace WebAppDetailSetting {
ug_destroy_me(mainView->getUG());
}
-void MainView::onSegCtrlChanged(void *data,
- Evas_Object */*eo*/,
- void *event_info)
-{
- MainView *mainView;
- Evas_Object *subCtnt;
- Elm_Object_Item *it;
-
- mainView = static_cast<MainView *>(data);
- Assert(mainView);
- it = reinterpret_cast<Elm_Object_Item *>(event_info);
- Assert(it);
-
- subCtnt = mainView->getSubCtnt();
- if (!subCtnt)
- return;
-
- if (it == mainView->getSegCtrlDetail())
- elm_object_signal_emit(subCtnt,
- SIG_SHOW_DETAIL, SRC_PROG);
- else if (it == mainView->getSegCtrlPerm())
- elm_object_signal_emit(subCtnt,
- SIG_SHOW_PERM, SRC_PROG);
-}
-
-Evas_Object *MainView::createToolBar(Evas_Object *parent)
-{
- Evas_Object *toolBar;
- Evas_Object *segCtrl;
- Elm_Object_Item *it;
-
- toolBar = elm_toolbar_add(parent);
- if (!toolBar)
- return NULL;
- elm_object_style_set(toolBar, "naviframe");
- elm_toolbar_shrink_mode_set(toolBar, ELM_TOOLBAR_SHRINK_EXPAND);
- elm_toolbar_select_mode_set(toolBar, ELM_OBJECT_SELECT_MODE_ALWAYS);
-
- segCtrl = elm_segment_control_add(toolBar);
- if (!segCtrl) {
- evas_object_del(toolBar);
- return NULL;
- }
-
- m_segCtrlDetail = elm_segment_control_item_add(segCtrl,
- NULL,
- D_("IDS_COM_BODY_DETAILS"));
- /* FIXME: i18n */
- m_segCtrlPerm = elm_segment_control_item_add(segCtrl, NULL, "Permissions");
- elm_segment_control_item_selected_set(m_segCtrlDetail, EINA_TRUE);
- it = elm_toolbar_item_append(toolBar, NULL, NULL, NULL, NULL);
- elm_object_item_part_content_set(it, "object", segCtrl);
- evas_object_smart_callback_add(segCtrl, "changed", onSegCtrlChanged, this);
-
- return toolBar;
-}
-
Evas_Object *MainView::createContent(Evas_Object *parent)
{
Evas_Object *nf;
Assert(parent);
nf = elm_naviframe_add(parent);
+ ea_object_event_callback_add(nf, EA_CALLBACK_BACK, onBackBtnClicked, this);
+
if (!nf)
return NULL;
try {
- m_detail.Reset(new DetailView(nf, m_ug, m_appID));
- if (!m_detail->loadView())
+ m_exception.Reset(new ExceptionsView(nf, m_appID));
+ if (!m_exception->loadView())
goto del_list;
return nf;
} catch (const std::bad_alloc &) {
- m_detail.Reset();
+ m_exception.Reset();
goto del_nf;
}
del_list:
- m_detail.Reset();
+ m_exception.Reset();
del_nf:
evas_object_del(nf);
return NULL;
Evas_Object *parent;
Assert(m_ug);
- resetBase();
parent = static_cast<Evas_Object *>(ug_get_parent_layout(m_ug));
Assert(parent);
goto del_ly;
elm_object_part_content_set(ly, "elm.swallow.content", eo);
- resetBase(ly);
-
return ly;
del_ly:
MainView::MainView(ui_gadget_h ug, DPL::String appId) :
m_ug(ug),
- m_appID(appId),
- m_subCtnt(NULL),
- m_segCtrlDetail(NULL),
- m_segCtrlPerm(NULL)
+ m_appID(appId)
{
Assert(ug);
- m_detail.Reset();
- m_perm.Reset();
+ m_exception.Reset();
}
MainView::~MainView(void)
#include <ui-gadget.h>
#include <dpl/scoped_ptr.h>
-#include "detailview.h"
-#include "permview.h"
-#include "view.h"
+#include "exceptionsview.h"
namespace WebAppDetailSetting {
-class MainView : public View
+class MainView
{
ui_gadget_h m_ug;
DPL::String m_appID;
- Evas_Object *m_subCtnt;
- DPL::ScopedPtr<DetailView> m_detail;
- DPL::ScopedPtr<PermView> m_perm;
- Elm_Object_Item *m_segCtrlDetail;
- Elm_Object_Item *m_segCtrlPerm;
+ DPL::ScopedPtr<ExceptionsView> m_exception;
static void onBackBtnClicked(void *data,
Evas_Object *eo,
void *event_info);
- static void onSegCtrlChanged(void *data,
- Evas_Object *eo,
- void *event_info);
Evas_Object *createContent(Evas_Object *parent);
- Evas_Object *createToolBar(Evas_Object *parent);
public:
MainView(ui_gadget_h ug, DPL::String appId);
Evas_Object *loadView(void);
ui_gadget_h getUG(void) { return m_ug; }
- Evas_Object *getSubCtnt(void) { return m_subCtnt; }
- Elm_Object_Item *getSegCtrlDetail(void) { return m_segCtrlDetail; }
- Elm_Object_Item *getSegCtrlPerm(void) { return m_segCtrlPerm; }
};
} /* WebAppDetailSetting */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 <Elementary.h>
-
-#include <dpl/wrt-dao-rw/widget_dao.h>
-#include <dpl/foreach.h>
-#include <dpl/assert.h>
-
-#include "permview.h"
-#include "wac_feature.h"
-#include "tizen_feature.h"
-#include "util.h"
-
-namespace WebAppDetailSetting {
-
-void PermView::onFeatureClicked(void */*data*/,
- Evas_Object */*obj*/,
- void *event_info)
-{
- Elm_Object_Item *it;
-
- it = static_cast<Elm_Object_Item*>(event_info);
- Assert(it);
- elm_genlist_item_selected_set(it, EINA_FALSE);
- elm_genlist_item_expanded_set(it, !elm_genlist_item_expanded_get(it));
-}
-
-void PermView::onPermClicked(void *data,
- Evas_Object */*obj*/,
- void *event_info)
-{
- PermData *permData;
- FeatureData *featureData;
- Elm_Object_Item *it;
- Elm_Object_Item *parent_it;
-
- it = static_cast<Elm_Object_Item*>(event_info);
- Assert(it);
- permData = static_cast<PermData *>(data);
- Assert(permData);
- featureData = permData->m_featureData;
- Assert(featureData);
- ace_set_widget_resource_preference(
- featureData->m_appID,
- const_cast<char *>(featureData->m_feature->getUri().c_str()),
- permData->m_type);
- ace_preference_t perm;
- ace_get_widget_resource_preference(
- featureData->m_appID,
- const_cast<char *>(featureData->m_feature->getUri().c_str()),
- &perm);
- featureData->m_feature->setPerm(perm);
- elm_genlist_item_selected_set(it, EINA_FALSE);
- elm_genlist_item_update(it);
- parent_it = elm_genlist_item_parent_get(it);
- if (parent_it)
- elm_genlist_item_update(parent_it);
-}
-
-void PermView::onExpanded(void */*data*/, Evas_Object *obj, void *event_info)
-{
- static Elm_Genlist_Item_Class itc;
- Elm_Object_Item *it;
- Elm_Object_Item *newIt;
- PermData *permData;
- FeatureData *featureData;
-
- Assert(obj && event_info);
- it = static_cast<Elm_Object_Item *>(event_info);
- featureData = static_cast<FeatureData *>(elm_object_item_data_get(it));
- Assert(featureData);
-
- itc.item_style = "dialogue/1text.1icon.2/expandable2";
- itc.func.text_get = getPermStr;
- itc.func.content_get = getPermRadio;
- itc.func.state_get = NULL;
- itc.func.del = delPermData;
-
- try {
- permData = new PermData(featureData, ACE_PREFERENCE_DENY);
- newIt = elm_genlist_item_append(obj,
- &itc,
- permData,
- it,
- ELM_GENLIST_ITEM_NONE,
- onPermClicked,
- permData);
- if (!newIt)
- delete permData;
-
- permData = new PermData(featureData, ACE_PREFERENCE_DENY);
- newIt = elm_genlist_item_append(obj,
- &itc,
- permData,
- it,
- ELM_GENLIST_ITEM_NONE,
- onPermClicked,
- permData);
- if (!newIt)
- delete permData;
-
- } catch (const std::bad_alloc &) {
- }
-
-}
-
-void PermView::onContracted(void */*data*/,
- Evas_Object */*obj*/,
- void *event_info)
-{
- Elm_Object_Item *it;
-
- Assert(event_info);
- it = static_cast<Elm_Object_Item *>(event_info);
- elm_genlist_item_subitems_clear(it);
-
-}
-char *PermView::getPermStr(void *data,
- Evas_Object */*obj*/,
- const char */*part*/)
-{
- PermData *permData;
-
- Assert(data);
- permData = static_cast<PermData *>(data);
- switch (permData->m_type) {
- case ACE_PREFERENCE_DENY:
- /* FIXME: i18n */
- return strdup("Deny");
- case ACE_PREFERENCE_DEFAULT:
- default:
- /* FIXME: i18n */
- return strdup("Default");
- }
-
- return NULL;
-}
-
-Evas_Object *PermView::getPermRadio(void *data,
- Evas_Object */*obj*/,
- const char */*part*/)
-{
- PermData *permData;
- FeatureData *featureData;
- Evas_Object *radio;
- Evas_Object *radio_grp;
- int type;
-
- Assert(data);
- permData = static_cast<PermData *>(data);
- featureData = permData->m_featureData;
- Assert(featureData);
-
- radio_grp = featureData->m_rg;
- Assert(radio_grp);
- radio = elm_radio_add(radio_grp);
- if (!radio)
- return NULL;
-
- type = static_cast<int>(permData->m_type);
- elm_radio_state_value_set(radio, type);
- elm_radio_group_add(radio, radio_grp);
- if (permData->m_type == featureData->m_feature->getPerm())
- elm_radio_value_set(radio, type);
-
- return radio;
-}
-
-void PermView::delPermData(void *data, Evas_Object */*obj*/)
-{
- PermData *permData;
-
- permData = static_cast<PermData *>(data);
- delete permData;
-}
-
-char *PermView::getFeatureTitle(void */*data*/,
- Evas_Object */*obj*/,
- const char */*part*/)
-{
- const char *title;
-
- /* FIXME: i18n */
- title = "Features";
-
- return strdup(title);
-}
-
-char *PermView::getFeatureStr(void *data,
- Evas_Object */*obj*/,
- const char */*part*/)
-{
- const char *str;
- FeatureData *featureData;
-
- featureData = static_cast<FeatureData *>(data);
- if (!featureData)
- return NULL;
-
- str = featureData->m_feature->getName().c_str();
- if (!str)
- return NULL;
-
- return strdup(str);
-}
-
-char *PermView::getFeatureStrWithPerm(void *data,
- Evas_Object */*obj*/,
- const char *part)
-{
- const char *str;
- FeatureData *featureData;
-
- featureData = static_cast<FeatureData *>(data);
- if (!featureData)
- return NULL;
-
- str = NULL;
- if (!strcmp(part, "elm.text.1")) {
- str = featureData->m_feature->getName().c_str();
- } else if (!strcmp(part, "elm.text.2")) {
-
- switch (featureData->m_feature->getPerm()) {
- case ACE_PREFERENCE_DENY:
- /* FIXME: i18n */
- str = "Deny";
- break;
- case ACE_PREFERENCE_DEFAULT:
- default:
- /* FIXME: i18n */
- str = "Default";
- break;
- }
- }
-
- if (!str)
- return NULL;
-
- return strdup(str);
-}
-
-void PermView::delFeatureData(void *data, Evas_Object */*obj*/)
-{
- FeatureData *featureData;
-
- featureData = static_cast<FeatureData *>(data);
- if (featureData) {
- if (featureData->m_rg)
- evas_object_del(featureData->m_rg);
- delete featureData;
- }
-}
-
-char *PermView::getUriTitle(void */*data*/,
- Evas_Object */*obj*/,
- const char */*part*/)
-{
- const char *title;
-
- /* FIXME: i18n */
- title = "URI";
-
- return strdup(title);
-}
-
-char *PermView::getUriStr(void *data,
- Evas_Object */*obj*/,
- const char */*part*/)
-{
- const char *str;
- UriData *uriData;
-
- uriData = static_cast<UriData *>(data);
- if (!uriData)
- return NULL;
-
- str = uriData->m_uri.c_str();
- if (!str)
- return NULL;
-
- return strdup(str);
-}
-
-void PermView::delUriData(void *data, Evas_Object */*obj*/)
-{
- UriData *uriData;
-
- uriData = static_cast<UriData*>(data);
- delete uriData;
-}
-
-void PermView::addFeatureTitle(Evas_Object *gl)
-{
- static Elm_Genlist_Item_Class itc;
-
- Assert(gl);
- itc.item_style = "dialogue/title";
- itc.func.text_get = getFeatureTitle;
- itc.func.content_get = NULL;
- itc.func.state_get = NULL;
- itc.func.del = NULL;
- elm_genlist_item_append(gl,
- &itc,
- NULL,
- NULL,
- ELM_GENLIST_ITEM_NONE,
- NULL,
- NULL);
-}
-
-void PermView::addFeatureWithPerm(Evas_Object *gl, int idx)
-{
- static Elm_Genlist_Item_Class itc;
- FeatureData *featureData;
- Elm_Object_Item *it;
- Evas_Object *rg;
-
- Assert(gl);
- itc.item_style = "dialogue/2text.3/expandable";
- itc.func.text_get = getFeatureStrWithPerm;
- itc.func.content_get = NULL;
- itc.func.state_get = NULL;
- itc.func.del = delFeatureData;
-
- rg = elm_radio_add(gl);
- if (!rg)
- return;
-
- try {
- featureData = new FeatureData(&m_featureMap[idx], m_appID, rg);
- it = elm_genlist_item_append(gl,
- &itc,
- static_cast<void *>(featureData),
- NULL,
- ELM_GENLIST_ITEM_TREE,
- onFeatureClicked,
- NULL);
- if (!it) {
- delete featureData;
- return;
- }
- } catch (const std::bad_alloc &) {
- evas_object_del(rg);
- }
-}
-
-void PermView::addFeature(Evas_Object *gl, int idx)
-{
- static Elm_Genlist_Item_Class itc;
- FeatureData *featureData;
- Elm_Object_Item *it;
-
- Assert(gl);
- itc.item_style = "dialogue/1text";
- itc.func.text_get = getFeatureStr;
- itc.func.content_get = NULL;
- itc.func.state_get = NULL;
- itc.func.del = delFeatureData;
-
- try {
- featureData = new FeatureData(&m_featureMap[idx], m_appID);
- it = elm_genlist_item_append(gl,
- &itc,
- static_cast<void *>(featureData),
- NULL,
- ELM_GENLIST_ITEM_NONE,
- NULL,
- NULL);
- if (!it) {
- delete featureData;
- return;
- }
- elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
- } catch (const std::bad_alloc &) {
- }
-}
-
-void PermView::addFeatureList(Evas_Object *gl)
-{
- std::map<int, Feature>::iterator it;
-
- if (m_featureMap.empty())
- return;
-
- addFeatureTitle(gl);
- switch (m_appType) {
- case WrtDB::APP_TYPE_TIZENWEBAPP:
- for (it = m_featureMap.begin(); it != m_featureMap.end(); it++)
- addFeature(gl, it->first);
- break;
- default:
- break;
- }
-
- evas_object_smart_callback_add(gl, "expanded", onExpanded, NULL);
- evas_object_smart_callback_add(gl, "contracted", onContracted, NULL);
-}
-
-void PermView::addUriTitle(Evas_Object *gl)
-{
- static Elm_Genlist_Item_Class itc;
-
- Assert(gl);
- itc.item_style = "dialogue/title";
- itc.func.text_get = getUriTitle;
- itc.func.content_get = NULL;
- itc.func.state_get = NULL;
- itc.func.del = NULL;
- elm_genlist_item_append(gl,
- &itc,
- NULL,
- NULL,
- ELM_GENLIST_ITEM_NONE,
- NULL,
- NULL);
-}
-
-void PermView::addUri(Evas_Object *gl, DPL::String &uri)
-{
- UriData *uriData;
- static Elm_Genlist_Item_Class itc;
- Elm_Object_Item *it;
-
- Assert(gl);
- itc.item_style = "dialogue/1text";
- itc.func.text_get = getUriStr;
- itc.func.content_get = NULL;
- itc.func.state_get = NULL;
- itc.func.del = delUriData;
-
- try {
- uriData = new UriData(DPL::ToUTF8String(uri));
- it = elm_genlist_item_append(gl,
- &itc,
- static_cast<void *>(uriData),
- NULL,
- ELM_GENLIST_ITEM_NONE,
- NULL,
- NULL);
- if (!it) {
- delete uriData;
- return;
- }
- elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
- } catch (const std::bad_alloc &) {
- }
-}
-
-void PermView::addAccessInfo(Evas_Object *gl)
-{
- if (m_accessInfo.empty())
- return;
-
- addUriTitle(gl);
- FOREACH(accessInfo, m_accessInfo)
- addUri(gl, accessInfo->strIRI);
-}
-
-Evas_Object *PermView::createContent(Evas_Object *parent)
-{
- Evas_Object *eo;
-
- Assert(parent);
- if (m_featureMap.empty() && m_accessInfo.empty()) {
- eo = elm_layout_add(parent);
- if (!eo)
- return NULL;
- elm_layout_theme_set(eo, "layout", "nocontents", "full");
- elm_object_part_text_set(eo, "elm.text", D_("IDS_COM_BODY_NO_CONTENTS"));
- return eo;
- }
-
- eo = elm_genlist_add(parent);
- if (!eo)
- return NULL;
-
- addFeatureList(eo);
- addAccessInfo(eo);
-
- return eo;
-}
-
-Evas_Object *PermView::loadView(void)
-{
- Evas_Object *ctnt;
- WrtDB::DbWidgetFeatureSet features;
-
- resetBase();
-
- try {
- m_dao.Reset(new WrtDB::WidgetDAO(m_appID));
- features = m_dao->getFeaturesList();
- m_appType = m_dao->getWidgetType().appType;
- switch (m_appType) {
- case WrtDB::APP_TYPE_TIZENWEBAPP:
- m_featureMap = TizenFeature::getFeatureMap(features);
- break;
- default:
- break;
- }
- m_dao->getWidgetAccessInfo(m_accessInfo);
-
- ctnt = createContent(m_parent);
- if (!ctnt)
- return NULL;
- resetBase(ctnt);
-
- return ctnt;
-
- } catch (const std::bad_alloc &) {
- return NULL;
- }
-}
-
-PermView::PermView(Evas_Object *parent, int appID) :
- m_parent(parent),
- m_appType(WrtDB::APP_TYPE_UNKNOWN),
- m_appID(appID)
-{
- m_dao.Reset();
- m_featureMap.clear();
- m_accessInfo.clear();
-}
-
-PermView::~PermView(void)
-{
-}
-
-} /* WebAppDetailSetting */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 WEB_SRC_SETTING_WEBAPP_DETAIL_PERMVIEW_H_
-#define WEB_SRC_SETTING_WEBAPP_DETAIL_PERMVIEW_H_
-
-#include <Evas.h>
-
-#include <dpl/wrt-dao-rw/widget_dao.h>
-#include <dpl/scoped_ptr.h>
-
-#include "view.h"
-#include "feature.h"
-
-namespace WebAppDetailSetting {
-
-class PermView : public View
-{
- Evas_Object *m_parent;
- WrtDB::AppType m_appType;
- int m_appID;
- DPL::ScopedPtr<WrtDB::WidgetDAO> m_dao;
- std::map<int, Feature> m_featureMap;
- WrtDB::WidgetAccessInfoList m_accessInfo;
-
- /* Smart callbacks */
- static void onFeatureClicked(void *data,
- Evas_Object *obj,
- void *event_info);
- static void onPermClicked(void *data, Evas_Object *obj, void *event_info);
- static void onExpanded(void *data, Evas_Object *obj, void *event_info);
- static void onContracted(void *data, Evas_Object *obj, void *event_info);
-
- /* Genlist item callbacks */
- static char *getPermStr(void *data, Evas_Object *obj, const char *part);
- static Evas_Object *getPermRadio(void *data,
- Evas_Object *obj,
- const char *part);
- static void delPermData(void *data, Evas_Object *obj);
- static char *getFeatureTitle(void *data, Evas_Object *obj, const char *part);
- static char *getFeatureStr(void *data, Evas_Object *obj, const char *part);
- static char *getFeatureStrWithPerm(void *data,
- Evas_Object *obj,
- const char *part);
- static void delFeatureData(void *data, Evas_Object *obj);
- static char *getUriTitle(void *data, Evas_Object *obj, const char *part);
- static char *getUriStr(void *data, Evas_Object *obj, const char *part);
- static void delUriData(void *data, Evas_Object *obj);
-
- void addFeatureTitle(Evas_Object *gl);
- void addFeature(Evas_Object *gl, int idx);
- void addFeatureWithPerm(Evas_Object *gl, int idx);
- void addFeatureList(Evas_Object *gl);
- void addUriTitle(Evas_Object *gl);
- void addUri(Evas_Object *gl, DPL::String &uri);
- void addAccessInfo(Evas_Object *gl);
- Evas_Object *createContent(Evas_Object *parent);
-
- public:
- PermView(Evas_Object *parent, int appID);
- ~PermView(void);
-
- Evas_Object *loadView(void);
-
-};
-
-class FeatureData
-{
- public:
- Feature *m_feature;
- Evas_Object *m_rg;
- int m_appID;
-
- FeatureData(Feature *feature, int appID, Evas_Object *rg = NULL) :
- m_feature(feature),
- m_rg(rg),
- m_appID(appID) { };
-};
-
-class PermData
-{
- public:
- FeatureData *m_featureData;
- ace_preference_t m_type;
-
- PermData(FeatureData *featureData, ace_preference_t type) :
- m_featureData(featureData),
- m_type(type) { };
-};
-
-class UriData
-{
- public:
- std::string m_uri;
-
- UriData(std::string uri) :
- m_uri(uri) { };
-};
-
-} /* WebAppDetailSetting */
-
-#endif /* WEB_SRC_SETTING_WEBAPP_DETAIL_PERMVIEW_H_ */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 <dpl/foreach.h>
-
-#include "tizen_feature.h"
-#include "util.h"
-
-namespace WebAppDetailSetting {
-
-const char *TizenFeature::m_feature[] = {
- "http://tizen.org/api/application",
- "http://tizen.org/api/time",
- "http://tizen.org/api/contact",
- "http://tizen.org/api/calendar",
- "http://tizen.org/api/call",
- "http://tizen.org/api/messaging",
- "http://tizen.org/api/bluetooth",
- "http://tizen.org/api/geocoder",
- "http://tizen.org/api/nfc",
- "http://tizen.org/api/sensors",
- "http://tizen.org/api/systeminfo",
-};
-
-/* FIXME: i18n */
-const char *TizenFeature::m_featureName[] = {
- N_("Installed application"),
- N_("Timezone"),
- N_("Contacts"),
- N_("Calendar"),
- N_("Call Log"),
- N_("Messaging"),
- N_("Bluetooth"),
- N_("Geocoder"),
- N_("NFC"),
- N_("Sensor"),
- N_("System infomation"),
-};
-
-std::map<int, Feature> TizenFeature::getFeatureMap(
- WrtDB::DbWidgetFeatureSet &features)
-{
- std::string uri;
- std::map<int, Feature> featureMap;
- unsigned int i;
-
- FOREACH(feature, features) {
- for (i = 0; i < sizeof(m_feature) / sizeof(*m_feature); i++) {
- if (featureMap.find(i) != featureMap.end())
- continue;
-
- uri = DPL::ToUTF8String(feature->name);
- if (!uri.compare(0,
- strlen(m_feature[i]),
- m_feature[i])) {
- featureMap[i] = Feature(m_featureName[i],
- uri.c_str());
- break;
- }
- }
- }
-
- return featureMap;
-}
-
-} /* WebAppDetailSetting */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 WEB_SRC_SETTING_WEBAPP_DETAIL_TIZEN_FEATURE_H_
-#define WEB_SRC_SETTING_WEBAPP_DETAIL_TIZEN_FEATURE_H_
-
-#include <dpl/wrt-dao-rw/widget_dao.h>
-
-#include "feature.h"
-
-namespace WebAppDetailSetting {
-
-enum tizenFeature {
- TIZEN_FEATURE_APP = 0x00,
- TIZEN_FEATURE_TIME,
- TIZEN_FEATURE_CONTACTS,
- TIZEN_FEATURE_CALENDAR,
- TIZEN_FEATURE_CALL,
- TIZEN_FEATURE_MESSAGING,
- TIZEN_FEATURE_BLUETOOTH,
- TIZEN_FEATURE_GEOCODER,
- TIZEN_FEATURE_NFC,
- TIZEN_FEATURE_SENSOR,
- TIZEN_FEATURE_SYSTEMINFO,
- TIZEN_FEATURE_MAX,
-};
-
-class TizenFeature
-{
- static const char *m_feature[];
- static const char *m_featureName[];
- public:
- static std::map<int, Feature> getFeatureMap(
- WrtDB::DbWidgetFeatureSet &features);
-};
-
-} /* WebAppDetailSetting */
-
-#endif /* WEB_SRC_SETTING_WEBAPP_DETAIL_TIZEN_FEATURE_H_ */
#define D_(str) dgettext("sys_string", str)
#define gettext_noop(str) (str)
#define N_(str) gettext_noop(str)
-#define U_(str) dgettext("ug-webapp-common-efl", str)
+#define U_(str) dgettext("ug-webapp-detail-efl", str)
#endif /* WEB_SRC_SETTING_WEBAPP_DETAIL_UTIL_H_ */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 <Evas.h>
-#include <dpl/assert.h>
-#include "view.h"
-
-namespace WebAppDetailSetting {
-
-void delCb(void *data,
- Evas */*e*/,
- Evas_Object */*eo*/,
- void */*event_info*/)
-{
- View *v;
-
- v = static_cast<View *>(data);
- Assert(v);
- v->onDel();
- v->resetBase();
-}
-
-void showCb(void *data,
- Evas */*e*/,
- Evas_Object */*eo*/,
- void */*event_info*/)
-{
- View *v;
-
- v = static_cast<View *>(data);
- Assert(v);
- v->onShow();
-}
-
-void hideCb(void *data,
- Evas */*e*/,
- Evas_Object */*eo*/,
- void */*event_info*/)
-{
- View *v;
-
- v = static_cast<View *>(data);
- Assert(v);
- v->onHide();
-}
-
-void View::resetBase(Evas_Object *base)
-{
- if (m_base) {
- evas_object_event_callback_del_full(m_base, EVAS_CALLBACK_DEL, delCb, this);
- evas_object_event_callback_del_full(m_base, EVAS_CALLBACK_SHOW, showCb, this);
- evas_object_event_callback_del_full(m_base, EVAS_CALLBACK_HIDE, hideCb, this);
- }
-
- m_base = base;
-
- if (m_base) {
- evas_object_event_callback_add(base, EVAS_CALLBACK_DEL, delCb, this);
- evas_object_event_callback_add(base, EVAS_CALLBACK_SHOW, showCb, this);
- evas_object_event_callback_add(base, EVAS_CALLBACK_HIDE, hideCb, this);
- }
-}
-
-View::~View(void)
-{
- if (m_base) {
- evas_object_event_callback_del_full(m_base, EVAS_CALLBACK_DEL, delCb, this);
- evas_object_event_callback_del_full(m_base, EVAS_CALLBACK_SHOW, showCb, this);
- evas_object_event_callback_del_full(m_base, EVAS_CALLBACK_HIDE, hideCb, this);
- evas_object_del(m_base);
- }
-}
-
-} /* WebAppDetailSetting */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 WEB_SRC_SETTING_WEBAPP_DETAIL_VIEW_H_
-#define WEB_SRC_SETTING_WEBAPP_DETAIL_VIEW_H_
-
-#include <Evas.h>
-
-namespace WebAppDetailSetting {
-class View
-{
- Evas_Object *m_base;
-
- public:
- View(void) : m_base(NULL) { };
- virtual ~View(void);
-
- void resetBase(Evas_Object *base = NULL);
- Evas_Object *getBase(void) { return m_base; }
- virtual void onShow(void) { };
- virtual void onHide(void) { };
- virtual void onDel(void) { };
-};
-
-} /* WebAppDetailSetting */
-
-#endif /* WEB_SRC_SETTING_WEBAPP_DETAIL_VIEW_H_ */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 <dpl/foreach.h>
-#include "wac_feature.h"
-#include "util.h"
-#include <ace-settings/ace_api_settings.h>
-
-namespace WebAppDetailSetting {
-
-const char *WacFeature::m_feature[] = {
- "http://wacapps.net/api/accelerometer",
- "http://wacapps.net/api/orientation",
- "http://wacapps.net/api/camera",
- "http://wacapps.net/api/devicestatus",
- "http://wacapps.net/api/filesystem",
- "http://wacapps.net/api/messaging",
- "http://www.w3.org/TR/geolocation-API/",
- "http://wacapps.net/api/pim.contact",
- "http://wacapps.net/api/pim.calendar",
- "http://wacapps.net/api/pim.task",
- "http://wacapps.net/api/deviceinteraction",
-};
-
-/* FIXME: i18n */
-const char *WacFeature::m_featureName[] = {
- N_("Accelerometer"),
- N_("Rotation"),
- N_("Camera"),
- N_("Device status"),
- N_("File system"),
- N_("Messaging"),
- N_("Location"),
- N_("Contacts"),
- N_("Calendar"),
- N_("Task"),
- N_("Device interaction"),
-};
-
-std::map<int, Feature> WacFeature::getFeatureMap(
- WrtDB::DbWidgetFeatureSet &features,
- int appID)
-{
- std::string uri;
- std::map<int, Feature> featureMap;
- unsigned int i;
-
- FOREACH(feature, features) {
- for (i = 0; i < sizeof(m_feature) / sizeof(*m_feature); i++) {
- if (featureMap.find(i) != featureMap.end())
- continue;
-
- uri = DPL::ToUTF8String(feature->name);
- if (!uri.compare(0,
- strlen(m_feature[i]),
- m_feature[i])) {
- featureMap[i] = Feature(m_featureName[i],
- m_feature[i]);
- ace_preference_t perm;
- ace_get_widget_resource_preference(
- appID,
- const_cast<char *>(m_feature[i]),
- &perm);
- featureMap[i].setPerm(perm);
-
- break;
- }
- }
- }
-
- return featureMap;
-}
-
-} /* WebAppDetailSetting */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 WEB_SRC_SETTING_WEBAPP_DETAIL_WAC_FEATURE_H_
-#define WEB_SRC_SETTING_WEBAPP_DETAIL_WAC_FEATURE_H_
-
-#include <dpl/wrt-dao-rw/widget_dao.h>
-
-#include "feature.h"
-
-namespace WebAppDetailSetting {
-
-enum wacFeature {
- WAC_FEATURE_ACCELEROMETER = 0x00,
- WAC_FEATURE_ORIENTATION,
- WAC_FEATURE_CAMERA,
- WAC_FEATURE_DEV_STAT,
- WAC_FEATURE_FILE_SYSTEM,
- WAC_FEATURE_MESSAGING,
- WAC_FEATURE_GEOLOCATION,
- WAC_FEATURE_CONTACTS,
- WAC_FEATURE_CALENDAR,
- WAC_FEATURE_TASK,
- WAC_FEATURE_DEV_INTERATION,
- WAC_FEATURE_MAX,
-};
-
-class WacFeature
-{
- static const char *m_feature[];
- static const char *m_featureName[];
- public:
- static std::map<int, Feature> getFeatureMap(
- WrtDB::DbWidgetFeatureSet &features,
- int appID);
-};
-
-} /* WebAppDetailSetting */
-
-#endif /* WEB_SRC_SETTING_WEBAPP_DETAIL_WAC_FEATURE_H_ */