Initialize Tizen 2.3
[apps/osp/Internet.git] / inc / IntSettingForm.h
1 //
2
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.1 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 //!Internet SettingForm class
19 /*@file:        IntSettingForm.h
20  *@brief:       The %IntSettingForm defines settings.
21  *
22  */
23
24 #ifndef _INT_SETTING_FORM_H_
25 #define _INT_SETTING_FORM_H_
26
27 #include <FBase.h>
28 #include <FUi.h>
29
30 #include "IntMultipleWindowPresentationModel.h"
31 #include "IntConfirmationPopup.h"
32 #include "IntNotificationPanel.h"
33
34 class SettingForm
35         : public Tizen::Ui::Controls::Form
36         , public Tizen::Ui::Controls::IFormBackEventListener
37         , public Tizen::Ui::Controls::IGroupedListViewItemEventListener
38         , public Tizen::Ui::Controls::IGroupedListViewItemProvider
39         , public Tizen::Ui::IActionEventListener
40         , public Tizen::Ui::IOrientationEventListener
41         , public Tizen::Ui::Scenes::ISceneEventListener
42 {
43 public:
44         /**
45          * @brief               The Default Constructor
46          */
47         SettingForm(void);
48
49         /**
50          * @brief               The Default Destructor
51          */
52         virtual ~SettingForm(void);
53
54         /**
55          * @brief               Initializes this SettingForm Form.
56          */
57         bool Initialize(void);
58
59         /**
60          * @brief               Initializes the controls of the UI for SettingForm.
61          */
62         result OnInitializing(void);
63
64         //IActionEventListener
65         void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
66
67         //IGroupedListViewItemProvider
68         Tizen::Ui::Controls::GroupItem* CreateGroupItem(int groupIndex, int itemWidth);
69
70         Tizen::Ui::Controls::ListItemBase* CreateItem(int groupIndex, int itemIndex, int itemWidth);
71
72         bool DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::GroupItem* pItem, int itemWidth);
73
74         bool DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth);
75
76         int GetGroupCount(void);
77
78         int GetItemCount(int groupIndex);
79
80         //IGroupedListViewItemEventListener
81         void OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus status);
82
83         void OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus status);
84
85         void OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction);
86
87         //IFormBackEventListener
88         void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
89
90         //IOrientationEventListener
91         void OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus);
92
93         //ISceneEventListener
94         virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
95
96         virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId);
97
98         void OnUserEventReceivedN (RequestId requestId, Tizen::Base::Collection::IList *pArgs);
99         enum
100         {
101                 SETTING_INVALID = -1,
102                 SETTING_HOMEPAGE_TITLE = 0,
103                 SETTING_CURRENT_PAGE,                           //1
104                 SETTING_BLANK_PAGE,                                     //2
105                 SETTING_MOST_VISITED_SITE,                      //3
106                 //SETTING_EMPTY_PAGE,                 //1
107                 SETTING_FAVORITE_URL,               //4
108                 SETTING_DEFAULT_VIEW_TITLE,         //5
109                 SETTING_FIT_TO_WIDTH,               //6
110                 SETTING_READABLE,                   //7
111                 SETTING_RUN_JAVASCRIPT,             //8
112                 SETTING_DISPLAY_IMAGES,             //9
113                 SETTING_BLOCK_POPUP,                //10
114                 SETTING_CLEAR_CACHE,                //11
115                 SETTING_CLEAR_HISTORY,              //12
116                 SETTING_SHOW_SECURITY_WARNINGS,     //13
117                 SETTING_ACCEPT_COOKIES,                         //14
118                 SETTING_CLEAR_COOKIE_DATA,          //15
119                 SETTING_REMEMBER_FORM_DATA,
120                 SETTING_CLEAR_FORM_DATA,                        //16
121                 SETTING_REMEMBER_PASSWORD,
122                 SETTING_CLEAR_PASSWORDS,                        //17
123                 SETTING_SEARCH_ENGINE_TITLE,        //20
124                 SETTING_SEARCH_ENGINE_YAHOO,        //21
125                 SETTING_SEARCH_ENGINE_NAVER,        //22
126                 SETTING_SEARCH_ENGINE_GOOGLE,       //23
127                 SETTING_RESET_TO_DEFAULT,           //24
128                 SETTING_MAX                                                     //25
129
130         };
131
132         enum SettingListItemType
133         {
134                 ITEM_TYPE_NORMAL = 0,
135                 ITEM_TYPE_TOGGLE,
136                 ITEM_TYPE_DROPDOWN,
137                 ITEM_TYPE_RADIO,
138         };
139
140         class SettingItemInfo
141         {
142         public:
143                 /**
144                  * @brief The Default Constructor
145                  */
146                 SettingItemInfo(void);
147
148                 /**
149                  * @brief The Default Destructor
150                  */
151                 virtual ~SettingItemInfo(void){};
152
153         public:
154                 int childCount;     //only for ITEM_TYPE_DROPDOWN type items
155                 bool isOpen;        //true for opened and false for closed
156                 bool isSelected;        //only for ITEM_TYPE_RADIO && ITEM_TYPE_TOGGLE type of items
157                 SettingListItemType itemType;
158                 Tizen::Base::String titleText;
159                 Tizen::Base::String subText;
160         };
161
162         int groupCount;
163         int* pGroupItemCount;
164         SettingItemInfo settingInfo[SETTING_MAX];
165 private:
166         /**
167          * @brief Initializes this instance of settings default values.
168          */
169         void InitializeSettingValues(void);
170
171         /**
172          * @brief Opens a popup to clear cache data.
173          */
174         void ClearCache(void);
175
176         /**
177          * @brief Opens a popup to clear all the cookies.
178          */
179         void ClearCookie(void);
180
181         /**
182          * @brief Opens a popup to clear all Saved Form Data.
183          */
184         void ClearFormData(void);
185
186         /**
187          * @brief Opens a popup to clear all Saved Passwords.
188          */
189         void ClearPasswords(void);
190
191         /**
192          * @brief Opens a popup to clear the browser history
193          */
194         void ClearHistory(void);
195
196         /**
197          * @brief Opens a popup for resetting the default settings.
198          */
199         void ResetToDefault(void);
200
201 private:
202         Tizen::Base::String __currentURL;
203         int __fontValue;
204         ConfirmationPopup* __pConfirmationPopup;
205         Tizen::Ui::Controls::GroupedListView* __pList;
206         NotificationPanel* __pNotification;
207         Tizen::Ui::Controls::Popup* __pResetPopup;
208         WindowInfo* __pWindowInfo;                          // Contains window information of current scene
209         bool __isCurrentPageDisable;
210         int __fontSize;
211
212 };
213
214
215 #endif /* _INT_SETTING_FORM_H_ */