Update wrt_0.8.85
[platform/framework/web/wrt.git] / src / domain / widget_model.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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  * @file    widget_model.h
18  * @author  Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
19  * @version 1.0
20  * @brief   Header file for widget model
21  */
22 #ifndef SRC_DOMAIN_WIDGET_MODEL_H
23 #define SRC_DOMAIN_WIDGET_MODEL_H
24
25 #include <dpl/event/model.h>
26 #include <dpl/event/property.h>
27 #include <dpl/optional.h>
28
29 #include "widget_data_types.h"
30
31 #include <dpl/wrt-dao-ro/wrt_db_types.h> // definition of WidgetHandle
32
33 /**
34  * @brief Widget model
35  *
36  * Widget model is the core object that hold information about
37  * properties of widget. After wrt launch each widget contained in database is
38  * mapped to WidgetModel.
39  *
40  * Widget model is a type of MVC model, so it is possible to listen for it's
41  * changes.
42  *
43  */
44 class WidgetModel : public DPL::Event::Model
45 {
46   public:
47
48     /**
49      * @brief Widget handle
50      *
51      * Note: This is a readonly property
52      */
53     DPL::Event::Property<WidgetHandle, DPL::Event::PropertyReadOnly> Handle;
54
55     /**
56      * @brief Widget type
57      *
58      * Note: This is a readonly property
59      */
60     DPL::Event::Property<WrtDB::WidgetType,
61     DPL::Event::PropertyReadOnly,
62     DPL::Event::PropertyStorageDynamicCached> Type;
63
64     /**
65      * @brief Current widget actual size
66      */
67     DPL::Event::Property<WidgetSize> ActualSize;
68
69     /**
70      * @brief Current widget preferred size
71      */
72     DPL::Event::Property<WidgetSize,
73                   DPL::Event::PropertyReadOnly,
74                   DPL::Event::PropertyStorageDynamicCached> PreferredSize;
75
76     /**
77      * @brief Start URL for widget
78      */
79     DPL::Event::Property<DPL::OptionalString> StartURL;
80
81     /**
82      * @brief Start URL information for widget
83      */
84     DPL::Event::Property<OptionalWidgetStartFileInfo> StartFileInfo;
85
86     /**
87      * @brief Prefix URL for widget
88      *
89      * This is a prefix address of html file that widget is displaying.
90      * The whole address is PrefixURL + StartURL.
91      */
92     DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PrefixURL;
93
94     /**
95      * @brief Install path for widget
96      *
97      * Gets path in which files of widget are being kept
98      */
99     DPL::Event::Property<DPL::String,
100                   DPL::Event::PropertyReadOnly,
101                   DPL::Event::PropertyStorageDynamicCached> InstallPath;
102
103     /**
104      * @brief Path to widget's persistent storage.
105      *
106      * Gets path in which widget may store its persistent private data.
107      */
108     DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PersistentStoragePath;
109
110     /**
111      * @brief Path to widget's temporary storage.
112      *
113      * Gets path in which widget may store its temporary private data.
114      */
115     DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> TemporaryStoragePath;
116
117     /**
118      * @brief Widget GUID
119      */
120     DPL::Event::Property<WrtDB::WidgetGUID,
121                   DPL::Event::PropertyReadOnly,
122                   DPL::Event::PropertyStorageDynamicCached> GUID;
123
124     /**
125      * @brief Widget defaultlocale
126      */
127     DPL::Event::Property<DPL::OptionalString,
128                   DPL::Event::PropertyReadOnly,
129                   DPL::Event::PropertyStorageDynamicCached> defaultlocale;
130
131     /**
132      * @brief Widget version
133      */
134     DPL::Event::Property<OptionalWidgetVersion,
135                   DPL::Event::PropertyReadOnly,
136                   DPL::Event::PropertyStorageDynamicCached> Version;
137
138     /**
139      * @brief Widget name
140      */
141     DPL::Event::Property<DPL::OptionalString> Name;
142
143     /**
144      * @brief Widget short name
145      */
146     DPL::Event::Property<DPL::OptionalString> ShortName;
147
148     /**
149      * @brief Widget description
150      */
151     DPL::Event::Property<DPL::OptionalString> Description;
152
153     /**
154      * @brief Widget license
155      */
156     DPL::Event::Property<DPL::OptionalString> License;
157
158     /**
159      * @brief Widget license href
160      */
161     DPL::Event::Property<DPL::OptionalString> LicenseHref;
162
163     /**
164      * @brief Widget icon
165      */
166     DPL::Event::Property<OptionalWidgetIcon> Icon;
167
168     /**
169      * @brief Widget name if running
170      */
171     DPL::Event::Property<DPL::OptionalString> RunningName;
172
173     /**
174      * @brief Widget icon if running
175      */
176     DPL::Event::Property<OptionalWidgetIcon> RunningIcon;
177
178     /**
179      * @brief Start URL for widget if running
180      */
181     DPL::Event::Property<DPL::OptionalString> RunningStartURL;
182
183     /**
184      * @brief Widget short name  for widget if running
185      */
186     DPL::Event::Property<DPL::OptionalString> RunningShortName;
187
188     /**
189      * @brief Widget description for widget if running
190      */
191     DPL::Event::Property<DPL::OptionalString> RunningDescription;
192
193     /**
194      * @brief Widget license
195      */
196     DPL::Event::Property<DPL::OptionalString> RunningLicense;
197
198     /**
199      * @brief Widget license href
200      */
201     DPL::Event::Property<DPL::OptionalString> RunningLicenseHref;
202
203     /**
204      * @brief Start URL information for widget
205      */
206     DPL::Event::Property<OptionalWidgetStartFileInfo> RunningStartFileInfo;
207
208     /**
209      * @brief window mode
210      */
211     DPL::Event::Property<WrtDB::WindowModeList,
212                   DPL::Event::PropertyReadOnly,
213                   DPL::Event::PropertyStorageDynamic> WindowModes;
214
215     /**
216      * @brief Package name
217      */
218     DPL::Event::Property<DPL::String,
219                   DPL::Event::PropertyReadOnly,
220                   DPL::Event::PropertyStorageDynamicCached> PkgName;
221
222     /**
223      * @brief Current widget language tags
224      */
225     DPL::Event::Property<LanguageTagsList> LanguageTags;
226
227     /**
228      * @brief Minimum of the WAC Engine Standard required to run widget.
229      */
230     DPL::Event::Property<WidgetStandard,
231                   DPL::Event::PropertyReadOnly,
232                   DPL::Event::PropertyStorageDynamicCached> Standard;
233
234     /**
235      * @brief How much space application and its storage takes.
236      */
237     DPL::Event::Property<WidgetStorageSize,
238                   DPL::Event::PropertyReadOnly,
239                   DPL::Event::PropertyStorageDynamicCached> ApplicationStorage;
240     //    /**
241     //     * @brief Value of network element.
242     //     */
243     //    DPL::Event::Property<bool,
244     //                  DPL::Event::PropertyReadOnly> AccessNetwork;
245
246     //    /**
247     //     * @brief Does widget contain WARP definitions.
248     //     */
249     //    DPL::Event::Property<bool> WarpDefinitionEmpty;
250
251     /**
252      * @brief Is back supported
253      */
254     DPL::Event::Property<bool,
255                   DPL::Event::PropertyReadOnly,
256                   DPL::Event::PropertyStorageDynamicCached> BackSupported;
257
258     /**
259      * @brief Widget access list
260      */
261     DPL::Event::Property<WidgetAccessList> AccessList;
262
263     /**
264      * @brief Is this DeveloperWidget
265      */
266     DPL::Event::Property<bool,
267                   DPL::Event::PropertyReadOnly,
268                   DPL::Event::PropertyStorageDynamicCached> IsTestWidget;
269
270     DPL::Event::Property<bool,
271                   DPL::Event::PropertyReadOnly,
272                   DPL::Event::PropertyStorageDynamicCached> IsDeletable;
273
274     DPL::Event::Property<WidgetSettingList> SettingList;
275
276     /**
277      * @brief Widget Application Service list
278      */
279     DPL::Event::Property<WidgetApplicationServiceList> AppServiceList;
280
281     WidgetModel(const WidgetHandle &handle);
282
283   private:
284     // Custom read write delegates
285     static DPL::String           readPkgName(DPL::Event::Model *model);
286     static WidgetStandard        readStandard(DPL::Event::Model *model);
287     static OptionalWidgetVersion readVersion(DPL::Event::Model *model);
288     static WidgetStorageSize     getApplicationStorage(DPL::Event::Model *model);
289
290     WidgetHandle getHandle() const;
291 };
292
293 #endif // SRC_DOMAIN_WIDGET_MODEL_H