apply FSL(Flora Software License)
authorKim Kibum <kb0929.kim@samsung.com>
Fri, 8 Jun 2012 05:54:22 +0000 (14:54 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Fri, 8 Jun 2012 05:54:22 +0000 (14:54 +0900)
51 files changed:
CMakeLists.txt [new file with mode: 0755]
LICENSE [new file with mode: 0755]
NOTICE [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/wrt-setting.install.in [new file with mode: 0644]
packaging/wrt-setting.spec [new file with mode: 0644]
webapp-common/CMakeLists.txt [new file with mode: 0644]
webapp-common/edc/CMakeLists.txt [new file with mode: 0644]
webapp-common/edc/defs.h [new file with mode: 0644]
webapp-common/edc/main.edc [new file with mode: 0644]
webapp-common/icons.h [new file with mode: 0644]
webapp-common/icons/01_controlbar_icon_create.png [new file with mode: 0644]
webapp-common/icons/01_controlbar_icon_delete.png [new file with mode: 0644]
webapp-common/icons/01_controlbar_icon_edit.png [new file with mode: 0644]
webapp-common/icons/01_controlbar_icon_save.png [new file with mode: 0644]
webapp-common/listview.cpp [new file with mode: 0644]
webapp-common/listview.h [new file with mode: 0644]
webapp-common/mainview.cpp [new file with mode: 0644]
webapp-common/mainview.h [new file with mode: 0644]
webapp-common/popup.cpp [new file with mode: 0644]
webapp-common/popup.h [new file with mode: 0644]
webapp-common/ug.cpp [new file with mode: 0644]
webapp-common/util.h [new file with mode: 0644]
webapp-common/view.cpp [new file with mode: 0644]
webapp-common/view.h [new file with mode: 0644]
webapp-common/whitelistview.cpp [new file with mode: 0644]
webapp-common/whitelistview.h [new file with mode: 0644]
webapp-common/whiteuriview.cpp [new file with mode: 0644]
webapp-common/whiteuriview.h [new file with mode: 0644]
webapp-detail/CMakeLists.txt [new file with mode: 0644]
webapp-detail/detailview.cpp [new file with mode: 0644]
webapp-detail/detailview.h [new file with mode: 0644]
webapp-detail/edc/CMakeLists.txt [new file with mode: 0644]
webapp-detail/edc/defs.h [new file with mode: 0644]
webapp-detail/edc/main.edc [new file with mode: 0644]
webapp-detail/feature.h [new file with mode: 0644]
webapp-detail/mainview.cpp [new file with mode: 0644]
webapp-detail/mainview.h [new file with mode: 0644]
webapp-detail/permview.cpp [new file with mode: 0644]
webapp-detail/permview.h [new file with mode: 0644]
webapp-detail/tizen_feature.cpp [new file with mode: 0644]
webapp-detail/tizen_feature.h [new file with mode: 0644]
webapp-detail/ug.cpp [new file with mode: 0644]
webapp-detail/util.h [new file with mode: 0644]
webapp-detail/view.cpp [new file with mode: 0644]
webapp-detail/view.h [new file with mode: 0644]
webapp-detail/wac_feature.cpp [new file with mode: 0644]
webapp-detail/wac_feature.h [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..972d6ff
--- /dev/null
@@ -0,0 +1,21 @@
+#
+# Copyright 2012  Samsung Electronics Co., Ltd
+#
+# Licensed under the Flora License, Version 1.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.tizenopensource.org/license
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+#
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+INCLUDE(FindPkgConfig)
+
+ADD_SUBDIRECTORY(webapp-common)
+ADD_SUBDIRECTORY(webapp-detail)
diff --git a/LICENSE b/LICENSE
new file mode 100755 (executable)
index 0000000..7ccb5b5
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,75 @@
+Flora License
+
+Version 1.0, May, 2012
+
+http://www.tizenopensource.org/license
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+"Tizen Certified Platform" shall mean a software platform that complies with the standards set forth in the Compatibility Definition Document and passes the Compatibility Test Suite as defined from time to time by the Tizen Technical Steering Group and certified by the Tizen Association or its designated agent.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work solely as incorporated into a Tizen Certified Platform, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work solely as incorporated into a Tizen Certified Platform to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof pursuant to the copyright license above, in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+  1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+  2. You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+  3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+  4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Flora License to your work
+
+To apply the Flora License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Flora License, Version 1.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.tizenopensource.org/license
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   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.
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..5edd5a8
--- /dev/null
@@ -0,0 +1,8 @@
+wrt-setting (0.0.1) unstable; urgency=low
+
+  * Initial draft
+
+  * Git : pkgs/w/wrt-setting
+  * Tag : wrt_setting_0.0.1
+
+ -- Wonguk Jeong <wonguk.jeong@samsung.com>  Fri, 16 Mar 2012 14:27:00 +0900
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..821b8dc
--- /dev/null
@@ -0,0 +1,18 @@
+Source: wrt-setting
+Section: devel
+Priority: extra
+Maintainer: Kyungeun Lee <lke01.lee@samsung.com>, Wonguk Jeong <wonguk.jeong@samsung.com>
+Build-Depends: debhelper (>= 5), libelm-dev, libecore-dev, libeina-dev, libui-gadget-dev, wrt-commons-dev (>= 0.2.25), wrt-security-dev (>=0.0.16)
+Standards-Version: 3.9.2
+
+Package: wrt-setting
+Architecture: any
+Section: libs
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Setting UI Gadgets of WRT
+
+Package: wrt-setting-dbg
+Architecture: any
+Section: debug
+Depends: ${shlibs:Depends}, ${misc:Depends}, wrt-setting (= ${Source-Version})
+Description: Setting UI Gadgets of WRT (debug symbols)
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..c5a5b2e
--- /dev/null
@@ -0,0 +1,91 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+PACKAGE_VERSION ?= $(shell dpkg-parsechangelog | sed -n 's/^Version: // p')
+PACKAGE_API_VERSION ?= $(firstword $(subst ., ,$(PACKAGE_VERSION)))
+
+PREFIX ?= /usr
+DATADIR ?= /opt
+LDFLAGS += --Wl,--rpath=$(PREFIX)/lib --Wl,--as-needed
+CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
+
+configure-stamp:
+       dh_testdir
+       mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && \
+       CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
+       cmake ${SRCDIR}                                                                 \
+               -DCMAKE_INSTALL_PREFIX="${PREFIX}"                                      \
+               -DUG_INSTALL_PREFIX="${DATADIR}"                                        \
+               -DPROJECT_API_VERSION="$(PACKAGE_API_VERSION)"\
+               -DPROJECT_VERSION="${PACKAGE_VERSION}" .. && \
+       touch $@
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+       dh_testdir
+       cd $(CMAKE_BUILD_DIR) && $(MAKE) -j4
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               cat $$f > $${f%.in}; \
+               sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
+               sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
+       done
+       touch $@
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+       rm -rf $(CMAKE_BUILD_DIR)
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               rm -f $${f%.in}; \
+       done
+       dh_clean
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+       cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs
+       dh_installdocs
+       dh_installexamples
+       dh_install --sourcedir=debian/tmp
+       dh_installman
+       dh_link
+       dh_strip --dbg-package=wrt-setting-dbg
+       dh_compress
+       dh_fixperms
+       dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/debian/wrt-setting.install.in b/debian/wrt-setting.install.in
new file mode 100644 (file)
index 0000000..60afb69
--- /dev/null
@@ -0,0 +1 @@
+/opt/ug/*
diff --git a/packaging/wrt-setting.spec b/packaging/wrt-setting.spec
new file mode 100644 (file)
index 0000000..fe3dbef
--- /dev/null
@@ -0,0 +1,39 @@
+Name: wrt-setting
+Version: 0.0.1
+Release: 1
+Summary: WRT Setting UI Gadgets
+Group:   Development/Libraries
+License: Flora Software License
+Source0: %{name}-%{version}.tar.gz
+
+BuildRequires: edje-bin
+BuildRequires: cmake
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(ecore)
+BuildRequires: pkgconfig(ui-gadget)
+BuildRequires: pkgconfig(dpl-wrt-dao-ro)
+BuildRequires: pkgconfig(dpl-wrt-dao-rw)
+BuildRequires: pkgconfig(ace)
+BuildRequires: pkgconfig(ace-dao-rw)
+BuildRequires: pkgconfig(dpl-efl)
+
+%description
+WRT Setting UI Gadgets
+
+%prep
+%setup -q
+%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DUG_INSTALL_PREFIX=/opt -DPROJECT_API_VERSION=0 -DPROJECT_VERSION=%{version}
+
+%build
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+/opt/ug/*
diff --git a/webapp-common/CMakeLists.txt b/webapp-common/CMakeLists.txt
new file mode 100644 (file)
index 0000000..839f46d
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright 2012  Samsung Electronics Co., Ltd
+#
+# Licensed under the Flora License, Version 1.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.tizenopensource.org/license
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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/icons/${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
+    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(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/icons/ DESTINATION ${ICONDIR} FILES_MATCHING PATTERN "*.png")
+
+ADD_SUBDIRECTORY(edc)
diff --git a/webapp-common/edc/CMakeLists.txt b/webapp-common/edc/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ba342f1
--- /dev/null
@@ -0,0 +1,23 @@
+#
+# Copyright 2012  Samsung Electronics Co., Ltd
+#
+# Licensed under the Flora License, Version 1.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.tizenopensource.org/license
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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})
diff --git a/webapp-common/edc/defs.h b/webapp-common/edc/defs.h
new file mode 100644 (file)
index 0000000..1604a2e
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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_ */
diff --git a/webapp-common/edc/main.edc b/webapp-common/edc/main.edc
new file mode 100644 (file)
index 0000000..802ad63
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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;
+                       }
+               }
+       }
+}
diff --git a/webapp-common/icons.h b/webapp-common/icons.h
new file mode 100644 (file)
index 0000000..ce415c6
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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_ */
diff --git a/webapp-common/icons/01_controlbar_icon_create.png b/webapp-common/icons/01_controlbar_icon_create.png
new file mode 100644 (file)
index 0000000..0dc1144
Binary files /dev/null and b/webapp-common/icons/01_controlbar_icon_create.png differ
diff --git a/webapp-common/icons/01_controlbar_icon_delete.png b/webapp-common/icons/01_controlbar_icon_delete.png
new file mode 100644 (file)
index 0000000..faaa0d3
Binary files /dev/null and b/webapp-common/icons/01_controlbar_icon_delete.png differ
diff --git a/webapp-common/icons/01_controlbar_icon_edit.png b/webapp-common/icons/01_controlbar_icon_edit.png
new file mode 100644 (file)
index 0000000..4ddc598
Binary files /dev/null and b/webapp-common/icons/01_controlbar_icon_edit.png differ
diff --git a/webapp-common/icons/01_controlbar_icon_save.png b/webapp-common/icons/01_controlbar_icon_save.png
new file mode 100644 (file)
index 0000000..f8a9278
Binary files /dev/null and b/webapp-common/icons/01_controlbar_icon_save.png differ
diff --git a/webapp-common/listview.cpp b/webapp-common/listview.cpp
new file mode 100644 (file)
index 0000000..1f23bd7
--- /dev/null
@@ -0,0 +1,1008 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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"
+
+namespace WebAppCommonSetting {
+
+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::getOnOffTitle(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.1"))
+        str = onOffData->m_title.c_str();
+    else if (!strcmp(part, "elm.text.2"))
+        str = onOffData->m_desc.c_str();
+    else
+        str = NULL;
+
+    if (!str)
+        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_FALSE);
+    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;
+}
+
+char *ListView::getComplianceModeTitle(void */*data*/,
+                                       Evas_Object */*obj*/,
+                                       const char *part)
+{
+    const char *str;
+
+    if (!strcmp(part, "elm.text.1"))
+        str = "Compliance mode";
+    else if (!strcmp(part, "elm.text.2"))
+        str = "Enable compliance mode";
+    else
+        str = NULL;
+
+    if (!str)
+        return NULL;
+
+    return strdup(str);
+}
+
+Evas_Object *ListView::getComplianceModeIcon(void *data,
+                                    Evas_Object *obj,
+                                    const char */*part*/)
+{
+    Evas_Object *chk;
+    ComplianceModeData *compModeData;
+    bool val;
+
+    compModeData = static_cast<ComplianceModeData *>(data);
+    Assert(compModeData);
+
+    chk = elm_check_add(obj);
+    if (!chk)
+        return NULL;
+    evas_object_propagate_events_set(chk, EINA_FALSE);
+    elm_object_style_set(chk, "on&off");
+    val = WrtDB::GlobalDAOReadOnly::getComplianceMode();
+    elm_check_state_set(chk, static_cast<Eina_Bool>(val));
+    compModeData->m_chk = chk;
+    evas_object_smart_callback_add(chk,
+                                   "changed",
+                                   onComplianceModeChanged,
+                                   data);
+
+    return chk;
+}
+
+void ListView::delComlianceModeData(void *data, Evas_Object */*obj*/)
+{
+    ComplianceModeData *compModeData;
+
+    compModeData = static_cast<ComplianceModeData *>(data);
+    delete compModeData;
+}
+
+Evas_Object *ListView::getComplianceModeOptEntry(void *data,
+                                                 Evas_Object *obj,
+                                                 const char */*part*/)
+{
+    int opt;
+    Evas_Object *ef;
+    Evas_Object *entry;
+    std::string val;
+
+    opt = reinterpret_cast<int>(data);
+
+    ef = elm_layout_add(obj);
+    if (!ef)
+        return NULL;
+    elm_layout_theme_set(ef, "layout", "editfield", "title");
+
+    entry = elm_entry_add(ef);
+    if (!entry) {
+        evas_object_del(ef);
+        return NULL;
+    }
+    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);
+
+    switch (opt) {
+    case COMPLIANCE_OPT_IMEI:
+        elm_object_part_text_set(ef, "elm.text", "IMEI");
+        elm_object_part_text_set(ef, "elm.guidetext", "Put fake IMEI");
+        val = WrtDB::GlobalDAOReadOnly::getComplianceFakeImei();
+        break;
+    case COMPLIANCE_OPT_MEID:
+        elm_object_part_text_set(ef, "elm.text", "MEID");
+        elm_object_part_text_set(ef, "elm.guidetext", "Put fake MEID");
+        val = WrtDB::GlobalDAOReadOnly::getComplianceFakeMeid();
+        break;
+    default:
+        evas_object_del(ef);
+        return NULL;
+    }
+
+    if (!val.empty()) {
+        elm_entry_entry_set(entry, val.c_str());
+        elm_object_signal_emit(ef, "elm,state,guidetext,hide", "elm");
+    }
+
+    elm_object_signal_callback_add(ef,
+                                   "elm,eraser,clicked",
+                                   "elm",
+                                   onComplianceModeOptErase,
+                                   static_cast<void *>(entry));
+    evas_object_smart_callback_add(entry,
+                                   "focused",
+                                   onComplianceModeOptFocused,
+                                   static_cast<void *>(ef));
+    evas_object_smart_callback_add(entry,
+                                   "unfocused",
+                                   onComplianceModeOptUnfocused,
+                                   static_cast<void *>(ef));
+    /* FIXME: The callback is invoked unexpectedly. Why? DO report to EFL team */
+    evas_object_smart_callback_add(entry,
+                                   "changed",
+                                   onComplianceModeOptChanged,
+                                   data);
+
+    return ef;
+}
+
+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);
+
+    /* TODO: Cookie Sharing On */
+    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);
+
+    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);
+
+    /* TODO: get cookie sharing val
+    state = 
+    */
+    state = true;
+
+    if (!state) {
+        if (!listView->showPopup("Do you really want to share cookies "
+                                 "between web applications?",
+                                  onCookieSharingPopupOk,
+                                  onCookieSharingPopupCancel,
+                                  static_cast<void *>(onOffData)))
+            return;
+    } else {
+        /* TODO: cookie sharing off */
+    }
+    elm_check_state_set(onOffData->m_chk, !state);
+}
+
+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::onDevModeChanged(void *data,
+                                Evas_Object */*obj*/,
+                                void */*event_info*/)
+{
+    OnOffData *onOffData;
+    ListView *listView;
+    Eina_Bool state;
+
+    onOffData = static_cast<OnOffData *>(data);
+    listView = onOffData->m_listView;
+    Assert(onOffData && onOffData->m_chk && listView);
+
+    state = WrtDB::GlobalDAOReadOnly::GetDeveloperMode();
+    WrtDB::GlobalDAO::SetDeveloperMode(!state);
+    elm_check_state_set(onOffData->m_chk, !state);
+}
+
+void ListView::onComplianceModeClicked(void *data,
+                                       Evas_Object */*obj*/,
+                                       void *event_info)
+{
+    Elm_Object_Item *it;
+    ComplianceModeData *compModeData;
+
+    it = static_cast<Elm_Object_Item *>(event_info);
+    Assert(it);
+    elm_genlist_item_selected_set(it, EINA_FALSE);
+    compModeData = static_cast<ComplianceModeData *>(data);
+    evas_object_smart_callback_call(compModeData->m_chk, "changed", NULL);
+}
+
+void ListView::onComplianceModeChanged(void *data,
+                                       Evas_Object */*obj*/,
+                                       void */*event_info*/)
+{
+    ComplianceModeData *compModeData;
+    ListView *listView;
+    Eina_Bool state;
+
+    compModeData = static_cast<ComplianceModeData *>(data);
+    listView = compModeData->m_listView;
+    Assert(compModeData && compModeData->m_chk && listView);
+
+    state = WrtDB::GlobalDAOReadOnly::getComplianceMode();
+    WrtDB::GlobalDAO::setComplianceMode(!state);
+    if (!state)
+        listView->addComplianceModeOpts(compModeData->m_gl, compModeData->m_it);
+    else
+        elm_genlist_item_subitems_clear(compModeData->m_it);
+    elm_check_state_set(compModeData->m_chk, !state);
+}
+
+void ListView::onComplianceModeOptErase(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 ListView::onComplianceModeOptFocused(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 ListView::onComplianceModeOptUnfocused(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 ListView::onComplianceModeOptChanged(void *data,
+                                          Evas_Object *obj,
+                                          void */*event_info*/)
+{
+    int opt;
+    std::string val;
+    const char *str;
+    Evas_Object *ef;
+
+    Assert(obj);
+    opt = reinterpret_cast<int>(data);
+    if (!elm_object_focus_get(obj))
+        return;
+
+    ef = static_cast<Evas_Object *>(evas_object_data_get(obj, "editfield"));
+    Assert(ef);
+
+    str = elm_entry_entry_get(obj);
+    if (str) {
+        elm_object_signal_emit(ef, "elm,state,eraser,show", "elm");
+        val.assign(str);
+    } else {
+        elm_object_signal_emit(ef, "elm,state,eraser,hide", "elm");
+    }
+
+    switch (opt) {
+    case COMPLIANCE_OPT_IMEI:
+        WrtDB::GlobalDAO::setComplianceFakeImei(val);
+        break;
+    case COMPLIANCE_OPT_MEID:
+        WrtDB::GlobalDAO::setComplianceFakeMeid(val);
+        break;
+    default:
+        return;
+    }
+}
+
+void ListView::onWhiteListViewUnload(void *data)
+{
+    ListView *listView;
+
+    listView = static_cast<ListView *>(data);
+    Assert(listView);
+    listView->delWhiteListView();
+}
+
+bool ListView::getCookieSharingVal(void)
+{
+    /* TODO: get Cookie Sharing*/
+    return false;
+}
+
+bool ListView::getUntrustedAppApprovalVal(void)
+{
+    return WrtDB::GlobalDAOReadOnly::GetSecureByDefault();
+}
+
+bool ListView::getDevModeVal(void)
+{
+    return WrtDB::GlobalDAOReadOnly::GetDeveloperMode();
+}
+
+bool ListView::getComplianceModeVal(void)
+{
+    return WrtDB::GlobalDAOReadOnly::getComplianceMode();
+}
+
+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,
+                            const char *desc,
+                            GetOnOffVal getOnOffVal,
+                            Evas_Smart_Cb changedCb)
+{
+    OnOffData *onOffData;
+    static Elm_Genlist_Item_Class itc;
+
+    Assert(gl);
+
+    try {
+        onOffData = new OnOffData(this,
+                                  title,
+                                  desc,
+                                  getOnOffVal,
+                                  changedCb);
+        itc.item_style = "dialogue/2text.1icon.6";
+        itc.func.text_get = getOnOffTitle;
+        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::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 &) {
+        }
+    }
+}
+
+void ListView::addComplianceModeItem(Evas_Object *gl)
+{
+    Elm_Object_Item *it;
+    ComplianceModeData *compModeData;
+    static Elm_Genlist_Item_Class itc;
+
+    Assert(gl);
+
+    try {
+        compModeData = new ComplianceModeData(this, gl);
+        itc.item_style = "dialogue/2text.1icon.6";
+        itc.func.text_get = getComplianceModeTitle;
+        itc.func.content_get = getComplianceModeIcon;
+        itc.func.state_get = NULL;
+        itc.func.del = delComlianceModeData;
+        it = elm_genlist_item_append(gl,
+                                     &itc,
+                                     static_cast<void *>(compModeData),
+                                     NULL,
+                                     ELM_GENLIST_ITEM_NONE,
+                                     onComplianceModeClicked,
+                                     static_cast<void *>(compModeData));
+        if (!it)
+            delete compModeData;
+
+        if (WrtDB::GlobalDAOReadOnly::getComplianceMode())
+            addComplianceModeOpts(gl, it);
+
+        compModeData->m_it = it;
+    } catch (const std::bad_alloc &) {
+    }
+}
+
+void ListView::addComplianceModeOpts(Evas_Object *obj, Elm_Object_Item *it)
+{
+    static Elm_Genlist_Item_Class itc;
+    Elm_Object_Item *optIt;
+    unsigned int i;
+    ComplianceOpt opt[] = {
+        COMPLIANCE_OPT_IMEI,
+        COMPLIANCE_OPT_MEID,
+    };
+
+    Assert(obj && it);
+
+    itc.item_style = "dialogue/1icon";
+    itc.func.text_get = NULL;
+    itc.func.content_get = getComplianceModeOptEntry;
+    itc.func.state_get = NULL;
+    itc.func.del = NULL;
+
+    for (i = 0; i < sizeof(opt) / sizeof(*opt); i++) {
+        optIt = elm_genlist_item_append(obj,
+                                        &itc,
+                                        reinterpret_cast<void *>(opt[i]),
+                                        it,
+                                        ELM_GENLIST_ITEM_NONE,
+                                        NULL,
+                                        NULL);
+        if (optIt)
+            elm_genlist_item_select_mode_set(optIt, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+    }
+
+}
+
+bool ListView::loadView(void)
+{
+    Evas_Object *gl;
+    Evas_Object *win;
+    Evas_Object *conform;
+
+    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 false;
+    elm_object_style_set(conform, "internal_layout");
+
+    gl = elm_genlist_add(conform);
+    if (!gl) {
+        evas_object_del(conform);
+        return false;
+    }
+    elm_object_content_set(conform, gl);
+    resetBase(conform);
+
+    addOnOffItem(gl,
+                 "Cookie sharing",
+                 "Share cookies between web apps",
+                 getCookieSharingVal,
+                 onCookieSharingChanged);
+    addOnOffItem(gl,
+                 "Untrusted applications",
+                 "Allow untrusted applications",
+                 getUntrustedAppApprovalVal,
+                 onUntrustedAppApprovalChanged);
+    addRoamingItem(gl);
+    addWhiteList(gl);
+    addWacTitle(gl);
+    addOnOffItem(gl,
+                 "Developer mode",
+                 "Enable developer mode",
+                 getDevModeVal,
+                 onDevModeChanged);
+    addComplianceModeItem(gl);
+    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,
+                            getBase(),
+                            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 */
diff --git a/webapp-common/listview.h b/webapp-common/listview.h
new file mode 100644 (file)
index 0000000..c75ec91
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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;
+    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 *getOnOffTitle(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);
+    static char *getComplianceModeTitle(void *data,
+                                        Evas_Object *obj,
+                                        const char *part);
+    static Evas_Object *getComplianceModeIcon(void *data,
+                                              Evas_Object *obj,
+                                              const char *part);
+    static void delComlianceModeData(void *data, Evas_Object *obj);
+    static Evas_Object *getComplianceModeOptEntry(void *data,
+                                                  Evas_Object *obj,
+                                                  const char *part);
+
+    /* 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);
+    static void onDevModeChanged(void *data,
+                                 Evas_Object *obj,
+                                 void *event_info);
+    static void onComplianceModeClicked(void *data,
+                                        Evas_Object *obj,
+                                        void *event_info);
+    static void onComplianceModeChanged(void *data,
+                                        Evas_Object *obj,
+                                        void *event_info);
+    static void onComplianceModeOptErase(void *data,
+                                         Evas_Object *obj,
+                                         const char *emission,
+                                         const char *source);
+    static void onComplianceModeOptFocused(void *data,
+                                           Evas_Object *obj,
+                                           void *event_info);
+    static void onComplianceModeOptUnfocused(void *data,
+                                             Evas_Object *obj,
+                                             void *event_info);
+    static void onComplianceModeOptChanged(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);
+    static bool getDevModeVal(void);
+    static bool getComplianceModeVal(void);
+    void addWacTitle(Evas_Object *gl);
+    void addWhiteList(Evas_Object *gl);
+    void addOnOffItem(Evas_Object *gl,
+                      const char *title,
+                      const char *desc,
+                      GetOnOffVal getOnOffVal,
+                      Evas_Smart_Cb cb);
+    void addRoamingItem(Evas_Object *gl);
+    void addRoamingOpts(Evas_Object *obj, Elm_Object_Item *it);
+    enum ComplianceOpt {
+        COMPLIANCE_OPT_IMEI = 0x00,
+        COMPLIANCE_OPT_MEID,
+    };
+    void addComplianceModeItem(Evas_Object *gl);
+    void addComplianceModeOpts(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;
+    std::string m_desc;
+    Evas_Object *m_chk;
+    GetOnOffVal m_getOnOffVal;
+    Evas_Smart_Cb m_changedCb;
+
+    OnOffData(ListView *listView,
+              const char *title,
+              const char *desc,
+              GetOnOffVal getOnOffVal,
+              Evas_Smart_Cb changedCb) :
+        m_listView(listView),
+        m_title(title),
+        m_desc(desc),
+        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_ */
diff --git a/webapp-common/mainview.cpp b/webapp-common/mainview.cpp
new file mode 100644 (file)
index 0000000..3c8b30a
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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(struct ui_gadget *ug) :
+    m_ug(ug)
+{
+    Assert(ug);
+
+    m_list.Reset();
+}
+
+MainView::~MainView(void)
+{
+}
+
+} /* WebAppCommonSetting */
diff --git a/webapp-common/mainview.h b/webapp-common/mainview.h
new file mode 100644 (file)
index 0000000..8cfad16
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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
+{
+    struct ui_gadget *m_ug;
+    DPL::ScopedPtr<ListView> m_list;
+
+    static void onListViewUnload(void *data);
+    Evas_Object *createContent(Evas_Object *parent);
+
+  public:
+    MainView(struct ui_gadget *ug);
+    ~MainView(void);
+
+    bool loadView(void);
+    struct ui_gadget *getUG(void) { return m_ug; }
+};
+
+} /* WebAppCommonSetting */
+
+#endif /* WEB_SRC_SETTING_WEBAPP_COMMON_MAINVIEW_H_ */
diff --git a/webapp-common/popup.cpp b/webapp-common/popup.cpp
new file mode 100644 (file)
index 0000000..33dd6f3
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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 */
diff --git a/webapp-common/popup.h b/webapp-common/popup.h
new file mode 100644 (file)
index 0000000..dc88c26
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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_ */
diff --git a/webapp-common/ug.cpp b/webapp-common/ug.cpp
new file mode 100644 (file)
index 0000000..fec2f25
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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(struct ui_gadget *ug,
+                      enum ug_mode /*mode*/,
+                      bundle */*data*/,
+                      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(struct ui_gadget */*ug*/,
+                      bundle */*data*/,
+                      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();
+}
diff --git a/webapp-common/util.h b/webapp-common/util.h
new file mode 100644 (file)
index 0000000..e0418b2
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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_ */
diff --git a/webapp-common/view.cpp b/webapp-common/view.cpp
new file mode 100644 (file)
index 0000000..a4111b9
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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 */
diff --git a/webapp-common/view.h b/webapp-common/view.h
new file mode 100644 (file)
index 0000000..5afe479
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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_ */
diff --git a/webapp-common/whitelistview.cpp b/webapp-common/whitelistview.cpp
new file mode 100644 (file)
index 0000000..aba2d72
--- /dev/null
@@ -0,0 +1,653 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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 */
diff --git a/webapp-common/whitelistview.h b/webapp-common/whitelistview.h
new file mode 100644 (file)
index 0000000..7850e77
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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_ */
diff --git a/webapp-common/whiteuriview.cpp b/webapp-common/whiteuriview.cpp
new file mode 100644 (file)
index 0000000..4c73a66
--- /dev/null
@@ -0,0 +1,388 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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 */
diff --git a/webapp-common/whiteuriview.h b/webapp-common/whiteuriview.h
new file mode 100644 (file)
index 0000000..b63d46a
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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_ */
diff --git a/webapp-detail/CMakeLists.txt b/webapp-detail/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ea35217
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright 2012  Samsung Electronics Co., Ltd
+#
+# Licensed under the Flora License, Version 1.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.tizenopensource.org/license
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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-detail-efl")
+SET(TARGET_UG_EDJ "web-app.edj")
+SET(UGDIR "${UG_INSTALL_PREFIX}/ug/lib")
+SET(EDJDIR "${UG_INSTALL_PREFIX}/ug/res/edje/${TARGET_UG_LIB}")
+SET(CMAKE_CXX_FLAGS "-std=c++0x")
+
+PKG_CHECK_MODULES(UG_WEB_APP_DETAIL_DEPS
+    ecore
+    elementary
+    ui-gadget
+    dpl-efl
+    ace
+    ace-dao-rw
+    dpl-wrt-dao-rw
+    REQUIRED)
+
+SET(UG_SOURCES
+    ug.cpp
+    view.cpp
+    mainview.cpp
+    detailview.cpp
+    permview.cpp
+    wac_feature.cpp
+    tizen_feature.cpp
+)
+
+INCLUDE_DIRECTORIES(${UG_WEB_APP_DETAIL_DEPS_INCLUDE_DIRS})
+ADD_LIBRARY(${TARGET_UG_LIB} SHARED ${UG_SOURCES})
+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_DETAIL_DEPS_LDFLAGS})
+INSTALL(TARGETS ${TARGET_UG_LIB} DESTINATION ${UGDIR})
+
+ADD_SUBDIRECTORY(edc)
diff --git a/webapp-detail/detailview.cpp b/webapp-detail/detailview.cpp
new file mode 100644 (file)
index 0000000..cbc437b
--- /dev/null
@@ -0,0 +1,220 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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 "detailview.h"
+#include "util.h"
+
+namespace WebAppDetailSetting {
+
+void DetailView::getLocalizedInfo(void)
+{
+    DPL::OptionalString locale;
+
+    Assert(m_dao);
+
+    locale = m_dao->getDefaultlocale();
+    if (locale.IsNull()) {
+        DPL::String lang_tag(L"");
+        m_localizedInfo = m_dao->getLocalizedInfo(lang_tag);
+    } else {
+        m_localizedInfo = m_dao->getLocalizedInfo(*locale);
+    }
+}
+
+void DetailView::addField(const char *title)
+{
+    Evas_Object *ly;
+
+    Assert(m_bx && title);
+
+    ly = elm_layout_add(m_bx);
+    if (!ly)
+        return;
+    elm_layout_theme_set(ly, "layout", "dialogue", "title");
+    evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, 0.0);
+    evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, 0.0);
+    elm_object_part_text_set(ly, "elm.text", title);
+    evas_object_show(ly);
+    elm_box_pack_end(m_bx, ly);
+}
+
+void DetailView::addField(const char *title, const char *str)
+{
+    Evas_Object *ly;
+    Evas_Object *field;
+    Evas_Object *entry;
+
+    Assert(m_bx && title);
+
+    ly = elm_layout_add(m_bx);
+    if (!ly)
+        return;
+    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);
+
+    field = elm_layout_add(ly);
+    if (!field) {
+        evas_object_del(ly);
+        return;
+    }
+    elm_layout_theme_set(field, "layout", "editfield", "title");
+    elm_object_part_text_set(field, "elm.text", title);
+    if (str) {
+           entry = elm_entry_add(field);
+           if (entry) {
+                   elm_entry_editable_set(entry, EINA_FALSE);
+//                 elm_entry_single_line_set(entry, EINA_TRUE);
+                   elm_object_text_set(entry, str);
+                   elm_object_part_content_set(field,
+                                   "elm.swallow.content", entry);
+           }
+    }
+    elm_object_part_content_set(ly, "elm.icon", field);
+    evas_object_show(ly);
+    elm_box_pack_end(m_bx, ly);
+}
+
+void DetailView::addDefInfo(void)
+{
+    DPL::OptionalString ver;
+
+    Assert(m_dao);
+
+    addField(D_("IDS_COM_BODY_DETAILS_NAME"),
+            m_localizedInfo.name.IsNull() ? NULL :
+            DPL::ToUTF8String((*m_localizedInfo.name)).c_str());
+
+    ver = m_dao->getVersion();
+    /* FIXME: i18n */
+    addField("Version",
+            ver.IsNull() ? NULL :
+            DPL::ToUTF8String((*ver)).c_str());
+
+    /* FIXME: i18n */
+    addField("Domain",
+            m_dao->isTrusted() ? "Trusted" : "Untrusted");
+
+    addField(D_("IDS_COM_BODY_DESCRIPTION"),
+            m_localizedInfo.description.IsNull() ? NULL :
+            DPL::ToUTF8String((*m_localizedInfo.description)).c_str());
+}
+
+void DetailView::addViewModes(void)
+{
+    DPL::String mode;
+    WrtDB::WindowModeList modes;
+
+    Assert(m_dao);
+
+    modes = m_dao->getWindowModes();
+    if (modes.size() > 0) {
+        FOREACH(it, modes)
+            mode += *it + L",";
+        /* remove comma */
+        mode.resize(mode.length() - 1);
+        /* FIXME: i18n */
+        addField("View modes",
+                DPL::ToUTF8String(mode).c_str());
+    } else {
+        /* FIXME: i18n */
+        addField("View modes", NULL);
+    }
+}
+
+void DetailView::addAuthorInfo(void)
+{
+    DPL::OptionalString name;
+    DPL::OptionalString email;
+    DPL::OptionalString homepage;
+
+    Assert(m_dao);
+
+    addField(D_("IDS_COM_BODY_AUTHOR"));
+
+    name = m_dao->getAuthorName();
+    addField(D_("IDS_COM_BODY_DETAILS_NAME"),
+            name.IsNull() ? NULL :
+            DPL::ToUTF8String((*name)).c_str());
+
+    email = m_dao->getAuthorEmail();
+    if (!email.IsNull())
+        addField(D_("IDS_COM_BODY_EMAIL"),
+                DPL::ToUTF8String((*email)).c_str());
+
+    homepage = m_dao->getAuthorHref();
+    /* FIXME: i18n */
+    if (!homepage.IsNull())
+        addField("Homepage",
+                DPL::ToUTF8String((*homepage)).c_str());
+}
+
+Evas_Object *DetailView::loadView(void)
+{
+    Evas_Object *scr;
+
+    resetBase();
+
+    try {
+        m_dao.Reset(new WrtDB::WidgetDAO(m_appID));
+        getLocalizedInfo();
+
+        scr = elm_scroller_add(m_parent);
+        if (!scr)
+            return NULL;
+
+        m_bx = elm_box_add(scr);
+        if (!m_bx) {
+            evas_object_del(scr);
+            return NULL;
+        }
+        evas_object_size_hint_weight_set(m_bx, EVAS_HINT_EXPAND, 0.0);
+        evas_object_size_hint_align_set(m_bx, EVAS_HINT_FILL, 0.0);
+        elm_object_content_set(scr, m_bx);
+        evas_object_show(m_bx);
+
+        addDefInfo();
+        addViewModes();
+        addAuthorInfo();
+        resetBase(scr);
+
+        return scr;
+
+    } catch (const std::bad_alloc &) {
+        return NULL;
+    }
+}
+
+DetailView::DetailView(Evas_Object *parent, int appID) :
+    m_parent(parent),
+    m_bx(NULL),
+    m_appID(appID)
+{
+    Assert(parent);
+    m_dao.Reset();
+}
+
+DetailView::~DetailView(void)
+{
+}
+
+} /* WebAppDetailSetting */
diff --git a/webapp-detail/detailview.h b/webapp-detail/detailview.h
new file mode 100644 (file)
index 0000000..5607231
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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>
+
+#undef None
+#include <dpl/wrt-dao-rw/widget_dao.h>
+
+#include "view.h"
+
+namespace WebAppDetailSetting {
+
+class DetailView : public View
+{
+    Evas_Object *m_parent;
+    Evas_Object *m_bx;
+    DPL::ScopedPtr<WrtDB::WidgetDAO> m_dao;
+    WrtDB::WidgetLocalizedInfo m_localizedInfo;
+    int m_appID;
+
+    void getLocalizedInfo(void);
+
+    void addField(const char *title);
+    void addField(const char *title, const char *str);
+
+    void addDefInfo(void);
+    void addViewModes(void);
+    void addAuthorInfo(void);
+
+  public:
+    DetailView(Evas_Object *parent, int appID);
+    ~DetailView(void);
+
+    Evas_Object *loadView(void);
+};
+
+} /* WebAppDetailSetting */
+
+#endif /* WEB_SRC_SETTING_WEBAPP_DETAIL_DETAILVIEW_H_ */
diff --git a/webapp-detail/edc/CMakeLists.txt b/webapp-detail/edc/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ba342f1
--- /dev/null
@@ -0,0 +1,23 @@
+#
+# Copyright 2012  Samsung Electronics Co., Ltd
+#
+# Licensed under the Flora License, Version 1.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.tizenopensource.org/license
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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})
diff --git a/webapp-detail/edc/defs.h b/webapp-detail/edc/defs.h
new file mode 100644 (file)
index 0000000..ffd9295
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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_ */
diff --git a/webapp-detail/edc/main.edc b/webapp-detail/edc/main.edc
new file mode 100644 (file)
index 0000000..9bfb7a5
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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;
+                       }
+               }
+       }
+}
diff --git a/webapp-detail/feature.h b/webapp-detail/feature.h
new file mode 100644 (file)
index 0000000..5255346
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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/SettingsLogic.h>
+
+namespace WebAppDetailSetting {
+
+class Feature
+{
+    std::string m_name;
+    std::string m_uri;
+    AceDB::PreferenceTypes m_perm;
+
+  public:
+    Feature(const char *name = NULL, const char *uri = NULL) :
+        m_perm(AceDB::PreferenceTypes::PREFERENCE_DEFAULT)
+    {
+        if (name)
+            m_name.assign(name);
+        if (uri)
+            m_uri.assign(uri);
+    }
+    void setPerm(AceDB::PreferenceTypes perm) { m_perm = perm; }
+
+    std::string& getName(void) { return m_name; }
+    std::string& getUri(void) { return m_uri; }
+    AceDB::PreferenceTypes getPerm(void) { return m_perm; }
+};
+
+} /* WebAppDetailSetting */
+
+#endif /* WEB_SRC_SETTING_WEBAPP_DETAIL_FEATURE_H_ */
diff --git a/webapp-detail/mainview.cpp b/webapp-detail/mainview.cpp
new file mode 100644 (file)
index 0000000..ec3bb0e
--- /dev/null
@@ -0,0 +1,201 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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-module.h>
+
+#include <dpl/assert.h>
+
+#include "mainview.h"
+#include "edc/defs.h"
+#include "util.h"
+
+namespace WebAppDetailSetting {
+
+void MainView::onBackBtnClicked(void *data,
+                                Evas_Object */*eo*/,
+                                void */*event_info*/)
+{
+    MainView *mainView;
+
+    mainView = static_cast<MainView *>(data);
+    Assert(mainView);
+    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;
+    Evas_Object *btn;
+    Evas_Object *toolBar;
+    Evas_Object *ly;
+    Elm_Object_Item *it;
+
+    Assert(parent);
+    nf = elm_naviframe_add(parent);
+    if (!nf)
+        return NULL;
+
+    ly = elm_layout_add(nf);
+    if (!ly)
+        goto del_nf;
+    elm_layout_file_set(ly, EDJFILE, GRP_CONTENT);
+
+    btn = elm_button_add(nf);
+    if (!btn)
+        goto del_nf;
+    elm_object_style_set(btn, "naviframe/end_btn/default");
+    evas_object_smart_callback_add(btn, "clicked", onBackBtnClicked, this);
+    /* FIXME: i18n */
+    it = elm_naviframe_item_push(nf, "More details", btn, NULL, ly, NULL);
+
+    toolBar = createToolBar(nf);
+    if (!toolBar)
+        goto del_nf;
+    elm_object_item_part_content_set(it, "optionheader", toolBar);
+
+    try {
+        m_detail.Reset(new DetailView(ly, m_appID));
+        elm_object_part_content_set(ly, PART_DETAIL, m_detail->loadView());
+        m_perm.Reset(new PermView(ly, m_appID));
+        elm_object_part_content_set(ly, PART_PERM, m_perm->loadView());
+        m_subCtnt = ly;
+
+        return nf;
+
+    } catch (const std::bad_alloc &) {
+        m_detail.Reset();
+        m_perm.Reset();
+    }
+
+del_nf:
+    evas_object_del(nf);
+
+    return NULL;
+}
+
+Evas_Object *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 NULL;
+    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 ly;
+
+del_ly:
+    evas_object_del(ly);
+
+    return NULL;
+}
+
+MainView::MainView(struct ui_gadget *ug, int appId) :
+    m_ug(ug),
+    m_appID(appId),
+    m_subCtnt(NULL),
+    m_segCtrlDetail(NULL),
+    m_segCtrlPerm(NULL)
+{
+    Assert(ug);
+
+    m_detail.Reset();
+    m_perm.Reset();
+}
+
+MainView::~MainView(void)
+{
+}
+
+} /* WebAppDetailSetting */
diff --git a/webapp-detail/mainview.h b/webapp-detail/mainview.h
new file mode 100644 (file)
index 0000000..d2ea43d
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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_MAINVIEW_H_ 
+#define WEB_SRC_SETTING_WEBAPP_DETAIL_MAINVIEW_H_
+
+#include <Evas.h>
+#include <ui-gadget.h>
+
+#include "detailview.h"
+#include "permview.h"
+#include "view.h"
+
+namespace WebAppDetailSetting {
+
+class MainView : public View
+{
+    struct ui_gadget *m_ug;
+    int 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;
+
+    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(struct ui_gadget *ug, int appId);
+    ~MainView(void);
+
+    Evas_Object *loadView(void);
+    struct ui_gadget *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 */
+
+#endif /* WEB_SRC_SETTING_WEBAPP_DETAIL_MAINVIEW_H_ */
diff --git a/webapp-detail/permview.cpp b/webapp-detail/permview.cpp
new file mode 100644 (file)
index 0000000..4d11031
--- /dev/null
@@ -0,0 +1,551 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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 <ace/SettingsLogic.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);
+    SettingsLogic::setWidgetDevCapSetting(
+            featureData->m_feature->getUri(),
+            featureData->m_appID,
+            permData->m_type);
+    featureData->m_feature->setPerm(
+            SettingsLogic::getWidgetDevCapSetting(
+                featureData->m_feature->getUri(),
+                featureData->m_appID));
+    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, AceDB::PreferenceTypes::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, AceDB::PreferenceTypes::PREFERENCE_DEFAULT);
+        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 AceDB::PreferenceTypes::PREFERENCE_DENY:
+            /* FIXME: i18n */
+            return strdup("Deny");
+        case AceDB::PreferenceTypes::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 AceDB::PreferenceTypes::PREFERENCE_DENY:
+            /* FIXME: i18n */
+            str = "Deny";
+            break;
+        case AceDB::PreferenceTypes::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_WAC10:
+    case WrtDB::APP_TYPE_WAC20:
+        for (it = m_featureMap.begin(); it != m_featureMap.end(); it++)
+            addFeatureWithPerm(gl, it->first);
+        break;
+    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_WAC10:
+        case WrtDB::APP_TYPE_WAC20:
+            m_featureMap = WacFeature::getFeatureMap(features, m_appID);
+            break;
+        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 */
diff --git a/webapp-detail/permview.h b/webapp-detail/permview.h
new file mode 100644 (file)
index 0000000..cc1dafd
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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 "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;
+    AceDB::PreferenceTypes m_type;
+
+    PermData(FeatureData *featureData, AceDB::PreferenceTypes 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_ */
diff --git a/webapp-detail/tizen_feature.cpp b/webapp-detail/tizen_feature.cpp
new file mode 100644 (file)
index 0000000..abdd652
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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 */
diff --git a/webapp-detail/tizen_feature.h b/webapp-detail/tizen_feature.h
new file mode 100644 (file)
index 0000000..3e77d4f
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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_ */
diff --git a/webapp-detail/ug.cpp b/webapp-detail/ug.cpp
new file mode 100644 (file)
index 0000000..1e7f40b
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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 <malloc.h>
+#include <ui-gadget.h>
+#include <ui-gadget-module.h>
+#include <string.h>
+#include <Elementary.h>
+#include <bundle.h>
+
+#undef None
+#include <dpl/wrt-dao-ro/WrtDatabase.h>
+#include <ace-dao-ro/AceDAOReadOnly.h>
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+
+#include "mainview.h"
+
+#define EXPORT_SYMBOL extern "C" __attribute__((visibility("default")))
+
+struct priv {
+    WebAppDetailSetting::MainView *mainView;
+};
+
+static void *onCreate(struct ui_gadget *ug,
+                      enum ug_mode /*mode*/,
+                      bundle *data,
+                      void *user_data)
+{
+    struct priv *priv;
+    int appID;
+    const char *pkgname;
+
+    Assert(ug && user_data);
+    priv = static_cast<struct priv *>(user_data);
+
+    pkgname = bundle_get_val(data, "pkg_name");
+    if (!pkgname)
+        return NULL;
+
+    appID = static_cast<int>
+        (WrtDB::WidgetDAOReadOnly::getHandle(DPL::FromASCIIString
+                                             (std::string(pkgname))));
+
+    /* Create MainView */
+    try {
+        priv->mainView = new WebAppDetailSetting::MainView(ug, appID);
+        return priv->mainView->loadView();
+    } catch (const std::bad_alloc &) {
+        return NULL;
+    }
+}
+
+static void onDestroy(struct ui_gadget */*ug*/,
+                      bundle */*data*/,
+                      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();
+    AceDB::AceDAOReadOnly::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);
+
+    AceDB::AceDAOReadOnly::detachFromThread();
+    WrtDB::WrtDatabase::detachFromThread();
+}
diff --git a/webapp-detail/util.h b/webapp-detail/util.h
new file mode 100644 (file)
index 0000000..e98062c
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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_UTIL_H_ 
+#define WEB_SRC_SETTING_WEBAPP_DETAIL_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_DETAIL_UTIL_H_ */
diff --git a/webapp-detail/view.cpp b/webapp-detail/view.cpp
new file mode 100644 (file)
index 0000000..99789e6
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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 */
diff --git a/webapp-detail/view.h b/webapp-detail/view.h
new file mode 100644 (file)
index 0000000..f8e3095
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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_ */
diff --git a/webapp-detail/wac_feature.cpp b/webapp-detail/wac_feature.cpp
new file mode 100644 (file)
index 0000000..ed98601
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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 <ace/SettingsLogic.h>
+
+#include "wac_feature.h"
+#include "util.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]);
+
+                featureMap[i].setPerm(
+                        SettingsLogic::getWidgetDevCapSetting(
+                            m_feature[i], appID));
+
+                break;
+            }
+        }
+    }
+
+    return featureMap;
+}
+
+} /* WebAppDetailSetting */
diff --git a/webapp-detail/wac_feature.h b/webapp-detail/wac_feature.h
new file mode 100644 (file)
index 0000000..30e5a82
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * 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_ */