2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file widget_model.h
18 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
20 * @brief Header file for widget model
22 #ifndef SRC_DOMAIN_WIDGET_MODEL_H
23 #define SRC_DOMAIN_WIDGET_MODEL_H
25 #include <dpl/event/model.h>
26 #include <dpl/event/property.h>
27 #include <dpl/optional.h>
28 #include <dpl/event/nested_loop.h>
29 #include <vcore/CertificateCollection.h>
31 #include "widget_data_types.h"
33 #include <dpl/wrt-dao-ro/wrt_db_types.h> // definition of WidgetHandle
38 * Widget model is the core object that hold information about state and
39 * properties of widget. After wrt launch each widget contained in database is
40 * mapped to WidgetModel.
42 * Widget model is a type of MVC model, so it is possible to listen for it's
43 * changes. If widget model is in running state @see WidgetState it has some
44 * corresponding view. A widget model view is displaying contents of widget
48 class WidgetModel : public DPL::Event::Model
52 * @brief Current widget model state
54 DPL::Event::Property<WidgetState> State;
57 * @brief Widget handle
59 * Note: This is a readonly property
61 DPL::Event::Property<WidgetHandle, DPL::Event::PropertyReadOnly> Handle;
66 * Note: This is a readonly property
68 DPL::Event::Property<WrtDB::WidgetType,
69 DPL::Event::PropertyReadOnly,
70 DPL::Event::PropertyStorageDynamicCached> Type;
73 * @brief Current widget actual size
75 DPL::Event::Property<WidgetSize> ActualSize;
78 * @brief Current widget preferred size
80 DPL::Event::Property<WidgetSize,
81 DPL::Event::PropertyReadOnly,
82 DPL::Event::PropertyStorageDynamicCached> PreferredSize;
85 * @brief Start URL for widget
87 DPL::Event::Property<DPL::OptionalString> StartURL;
90 * @brief Start URL information for widget
92 DPL::Event::Property<OptionalWidgetStartFileInfo> StartFileInfo;
95 * @brief Prefix URL for widget
97 * This is a prefix address of html file that widget is displaying.
98 * The whole address is PrefixURL + StartURL.
100 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PrefixURL;
103 * @brief Install path for widget
105 * Gets path in which files of widget are being kept
107 DPL::Event::Property<DPL::String,
108 DPL::Event::PropertyReadOnly,
109 DPL::Event::PropertyStorageDynamicCached> InstallPath;
112 * @brief Path to widget's persistent storage.
114 * Gets path in which widget may store its persistent private data.
116 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PersistentStoragePath;
119 * @brief Path to widget's temporary storage.
121 * Gets path in which widget may store its temporary private data.
123 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> TemporaryStoragePath;
128 DPL::Event::Property<WrtDB::WidgetGUID,
129 DPL::Event::PropertyReadOnly,
130 DPL::Event::PropertyStorageDynamicCached> GUID;
133 * @brief Widget defaultlocale
135 DPL::Event::Property<DPL::OptionalString,
136 DPL::Event::PropertyReadOnly,
137 DPL::Event::PropertyStorageDynamicCached> defaultlocale;
140 * @brief Widget version
142 DPL::Event::Property<OptionalWidgetVersion,
143 DPL::Event::PropertyReadOnly,
144 DPL::Event::PropertyStorageDynamicCached> Version;
149 DPL::Event::Property<DPL::OptionalString> Name;
152 * @brief Widget short name
154 DPL::Event::Property<DPL::OptionalString> ShortName;
157 * @brief Widget description
159 DPL::Event::Property<DPL::OptionalString> Description;
162 * @brief Widget license
164 DPL::Event::Property<DPL::OptionalString> License;
167 * @brief Widget license href
169 DPL::Event::Property<DPL::OptionalString> LicenseHref;
174 DPL::Event::Property<OptionalWidgetIcon> Icon;
177 * @brief Widget name if running
179 DPL::Event::Property<DPL::OptionalString> RunningName;
182 * @brief Widget icon if running
184 DPL::Event::Property<OptionalWidgetIcon> RunningIcon;
187 * @brief Start URL for widget if running
189 DPL::Event::Property<DPL::OptionalString> RunningStartURL;
192 * @brief Widget short name for widget if running
194 DPL::Event::Property<DPL::OptionalString> RunningShortName;
197 * @brief Widget description for widget if running
199 DPL::Event::Property<DPL::OptionalString> RunningDescription;
202 * @brief Widget license
204 DPL::Event::Property<DPL::OptionalString> RunningLicense;
207 * @brief Widget license href
209 DPL::Event::Property<DPL::OptionalString> RunningLicenseHref;
212 * @brief Start URL information for widget
214 DPL::Event::Property<OptionalWidgetStartFileInfo> RunningStartFileInfo;
219 DPL::Event::Property<WrtDB::WindowModeList,
220 DPL::Event::PropertyReadOnly,
221 DPL::Event::PropertyStorageDynamic> WindowModes;
224 * @brief Package name
226 DPL::Event::Property<DPL::String,
227 DPL::Event::PropertyReadOnly,
228 DPL::Event::PropertyStorageDynamicCached> PkgName;
231 * @brief Current widget language tags
233 DPL::Event::Property<LanguageTagsList> LanguageTags;
236 * @brief Minimum of the WAC Engine Standard required to run widget.
238 DPL::Event::Property<WidgetStandard,
239 DPL::Event::PropertyReadOnly,
240 DPL::Event::PropertyStorageDynamicCached> Standard;
243 * @brief How much space application and its storage takes.
245 DPL::Event::Property<WidgetStorageSize,
246 DPL::Event::PropertyReadOnly,
247 DPL::Event::PropertyStorageDynamicCached> ApplicationStorage;
249 // * @brief Value of network element.
251 // DPL::Event::Property<bool,
252 // DPL::Event::PropertyReadOnly> AccessNetwork;
255 // * @brief Does widget contain WARP definitions.
257 // DPL::Event::Property<bool> WarpDefinitionEmpty;
260 * @brief Is back supported
262 DPL::Event::Property<bool,
263 DPL::Event::PropertyReadOnly,
264 DPL::Event::PropertyStorageDynamicCached> BackSupported;
267 * @brief Widget access list
269 DPL::Event::Property<WidgetAccessList> AccessList;
272 * @brief Is this DeveloperWidget
274 DPL::Event::Property<bool,
275 DPL::Event::PropertyReadOnly,
276 DPL::Event::PropertyStorageDynamicCached> IsTestWidget;
278 DPL::Event::Property<bool,
279 DPL::Event::PropertyReadOnly,
280 DPL::Event::PropertyStorageDynamicCached> IsDeletable;
282 DPL::Event::Property<WidgetSettingList> SettingList;
285 * @brief Widget Application Service list
287 DPL::Event::Property<WidgetApplicationServiceList> AppServiceList;
289 WidgetModel(const WidgetHandle &handle);
292 // Custom read write delegates
293 static DPL::String readPkgName(DPL::Event::Model *model);
294 static WidgetStandard readStandard(DPL::Event::Model *model);
295 static OptionalWidgetVersion readVersion(DPL::Event::Model *model);
296 static WidgetStorageSize getApplicationStorage(DPL::Event::Model *model);
298 WidgetHandle getHandle() const;
301 #endif // SRC_DOMAIN_WIDGET_MODEL_H