The license change version 1.0 to version 1.1
[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.1 (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 #include <dpl/string.h>
27
28 #include "view.h"
29
30 namespace WrtDB {
31 class WidgetDAO;
32 }
33
34 namespace WebAppDetailSetting {
35
36 class ExceptionsView;
37
38 enum GroupSettingsIndex {
39     GROUP_IDX_START = 0,
40     GROUP_IDX_SECURITY_SETTINGS = GROUP_IDX_START,
41     GROUP_IDX_DEVELOPER_OPTIONS,
42     GROUP_IDX_END = GROUP_IDX_DEVELOPER_OPTIONS,
43 };
44
45 enum MenuIndex {
46     SECURITY_SETTINGS_IDX_START = 0,
47     SECURITY_SETTINGS_IDX_SECURITY_POPUP_USAGE,
48     SECURITY_SETTINGS_IDX_GEOLOCATION_USAGE = SECURITY_SETTINGS_IDX_START,
49     SECURITY_SETTINGS_IDX_WEB_NOTIFICATION_USAGE,
50     SECURITY_SETTINGS_IDX_EXCEPTIONS_SETTINGS,
51     SECURITY_SETTINGS_IDX_END = SECURITY_SETTINGS_IDX_EXCEPTIONS_SETTINGS,
52     DEVELOPER_OPTIONS_IDX_START = SECURITY_SETTINGS_IDX_END,
53     DEVELOPER_OPTIONS_IDX_MEMORY_SAVING_MODE = DEVELOPER_OPTIONS_IDX_START,
54     DEVELOPER_OPTIONS_IDX_END = DEVELOPER_OPTIONS_IDX_MEMORY_SAVING_MODE,
55 };
56
57 class AdvancedView : public View
58 {
59   public:
60     AdvancedView(Evas_Object *naviframe, DPL::String appID);
61     ~AdvancedView(void);
62
63     bool loadView(void);
64     void loadSecuritySettingsMenu(Evas_Object* genlist);
65     void loadDeveloperOptionsMenu(Evas_Object* genlist);
66
67   private:
68     Evas_Object *m_naviframe;
69     DPL::String m_appID;
70     DPL::ScopedPtr<ExceptionsView> m_exceptionsView;
71     std::map<int, std::string> m_groupMenuMap;
72     std::map<int, std::string> m_menuMap;
73
74     static char* getGroupText(
75         void* data,
76         Evas_Object* obj,
77         const char* part);
78     static void delGroupData(
79         void* data,
80         Evas_Object* obj);
81
82     static char* getSettingText(
83         void* data,
84         Evas_Object* obj,
85         const char* part);
86     static Evas_Object* getSettingContent(
87         void* data,
88         Evas_Object* obj,
89         const char* part);
90     static void delSettingData(
91         void* data,
92         Evas_Object* obj);
93     static void settingSelectedCallback(
94         void* data,
95         Evas_Object* obj,
96         void* eventInfo);
97     static void settingChangedCallback(
98         void* data,
99         Evas_Object* obj,
100         void* eventInfo);
101     static char* getSecurityExceptionsSettingsText(
102         void* data,
103         Evas_Object* obj,
104         const char* part);
105     static void securityExceptionsSettingsSelectedCallback(
106         void* data,
107         Evas_Object* obj,
108         void* eventInfo);
109 };
110
111 class AdvancedSettingsGroupData
112 {
113   public:
114     std::string m_menuText;
115     AdvancedSettingsGroupData(std::string menuText) :
116         m_menuText(menuText)
117     {
118     };
119 };
120
121 class SettingData
122 {
123   public:
124     DPL::ScopedPtr<WrtDB::WidgetDAO> m_dao;
125     MenuIndex m_index;
126     std::string m_menuText;
127     std::string m_iconPart;
128
129     SettingData(DPL::String appID, int index, std::string menuText);
130     bool isEnabled();
131     void saveChange(bool state);
132 };
133
134 } /* WebAppDetailSetting */
135
136 #endif /* WEB_SRC_SETTING_WEBAPP_DETAIL_ADVANCEDVIEW_H_ */