Tizen 2.0 Release
[apps/home/wrt-setting.git] / webapp-detail / advancedview.h
1 /*
2   * Copyright 2012  Samsung Electronics Co., Ltd
3   *
4   * Licensed under the Flora License, Version 1.0 (the "License");
5   * you may not use this file except in compliance with the License.
6   * You may obtain a copy of the License at
7   *
8   *     http://floralicense.org/license/
9   *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16
17 #ifndef WEB_SRC_SETTING_WEBAPP_DETAIL_ADVANCEDVIEW_H_
18 #define WEB_SRC_SETTING_WEBAPP_DETAIL_ADVANCEDVIEW_H_
19
20 #include <Evas.h>
21
22 #undef None
23 #include <string>
24 #include <map>
25 #include <dpl/scoped_ptr.h>
26
27 #include "view.h"
28
29 namespace WrtDB {
30 class WidgetDAO;
31 }
32
33 namespace WebAppDetailSetting {
34
35 class ExceptionsView;
36
37 enum GroupSettingsIndex {
38     GROUP_IDX_START = 0,
39     GROUP_IDX_SECURITY_SETTINGS = GROUP_IDX_START,
40     GROUP_IDX_DEVELOPER_OPTIONS,
41     GROUP_IDX_END = GROUP_IDX_DEVELOPER_OPTIONS,
42 };
43
44 enum MenuIndex {
45     SECURITY_SETTINGS_IDX_START = 0,
46     SECURITY_SETTINGS_IDX_SECURITY_POPUP_USAGE = SECURITY_SETTINGS_IDX_START,
47     SECURITY_SETTINGS_IDX_GEOLOCATION_USAGE,
48     SECURITY_SETTINGS_IDX_WEB_NOTIFICATION_USAGE,
49     SECURITY_SETTINGS_IDX_WEB_DATABASE_USAGE,
50     SECURITY_SETTINGS_IDX_FILE_SYSTEM_USAGE,
51     SECURITY_SETTINGS_IDX_EXCEPTIONS_SETTINGS,
52     SECURITY_SETTINGS_IDX_END = SECURITY_SETTINGS_IDX_EXCEPTIONS_SETTINGS,
53     DEVELOPER_OPTIONS_IDX_START = SECURITY_SETTINGS_IDX_END,
54     DEVELOPER_OPTIONS_IDX_MEMORY_SAVING_MODE = DEVELOPER_OPTIONS_IDX_START,
55     DEVELOPER_OPTIONS_IDX_END = DEVELOPER_OPTIONS_IDX_MEMORY_SAVING_MODE,
56 };
57
58 class AdvancedView : public View
59 {
60   public:
61     AdvancedView(Evas_Object *naviframe, int appID);
62     ~AdvancedView(void);
63
64     bool loadView(void);
65     void loadSecuritySettingsMenu(Evas_Object* genlist);
66     void loadDeveloperOptionsMenu(Evas_Object* genlist);
67
68   private:
69     Evas_Object *m_naviframe;
70     int m_appID;
71     DPL::ScopedPtr<ExceptionsView> m_exceptionsView;
72     std::map<int, std::string> m_groupMenuMap;
73     std::map<int, std::string> m_menuMap;
74
75     static char* getGroupText(
76         void* data,
77         Evas_Object* obj,
78         const char* part);
79     static void delGroupData(
80         void* data,
81         Evas_Object* obj);
82
83     static char* getSettingText(
84         void* data,
85         Evas_Object* obj,
86         const char* part);
87     static Evas_Object* getSettingContent(
88         void* data,
89         Evas_Object* obj,
90         const char* part);
91     static void delSettingData(
92         void* data,
93         Evas_Object* obj);
94     static void settingSelectedCallback(
95         void* data,
96         Evas_Object* obj,
97         void* eventInfo);
98     static void settingChangedCallback(
99         void* data,
100         Evas_Object* obj,
101         void* eventInfo);
102     static char* getSecurityExceptionsSettingsText(
103         void* data,
104         Evas_Object* obj,
105         const char* part);
106     static void securityExceptionsSettingsSelectedCallback(
107         void* data,
108         Evas_Object* obj,
109         void* eventInfo);
110 };
111
112 class AdvancedSettingsGroupData
113 {
114   public:
115     std::string m_menuText;
116     AdvancedSettingsGroupData(std::string menuText) :
117         m_menuText(menuText)
118     {
119     };
120 };
121
122 class SettingData
123 {
124   public:
125     DPL::ScopedPtr<WrtDB::WidgetDAO> m_dao;
126     MenuIndex m_index;
127     std::string m_menuText;
128     std::string m_iconPart;
129
130     SettingData(int appID, int index, std::string menuText);
131     bool isEnabled();
132     void saveChange(bool state);
133 };
134
135 } /* WebAppDetailSetting */
136
137 #endif /* WEB_SRC_SETTING_WEBAPP_DETAIL_ADVANCEDVIEW_H_ */