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"
36 * Widget model is the core object that hold information about state and
37 * properties of widget. After wrt launch each widget contained in database is
38 * mapped to WidgetModel.
40 * Widget model is a type of MVC model, so it is possible to listen for it's
41 * changes. If widget model is in running state @see WidgetState it has some
42 * corresponding view. A widget model view is displaying contents of widget
46 class WidgetModel : public DPL::Event::Model
50 * @brief Current widget model state
52 DPL::Event::Property<WidgetState> State;
55 * @brief Widget handle
57 * Note: This is a readonly property
59 DPL::Event::Property<WidgetHandle, DPL::Event::PropertyReadOnly> Handle;
64 * Note: This is a readonly property
66 DPL::Event::Property<WrtDB::WidgetType,
67 DPL::Event::PropertyReadOnly,
68 DPL::Event::PropertyStorageDynamicCached> Type;
71 * @brief Current widget actual size
73 DPL::Event::Property<WidgetSize> ActualSize;
76 * @brief Current widget preferred size
78 DPL::Event::Property<WidgetSize,
79 DPL::Event::PropertyReadOnly,
80 DPL::Event::PropertyStorageDynamicCached> PreferredSize;
83 * @brief Start URL for widget
85 DPL::Event::Property<DPL::OptionalString> StartURL;
88 * @brief Start URL information for widget
90 DPL::Event::Property<OptionalWidgetStartFileInfo> StartFileInfo;
93 * @brief Prefix URL for widget
95 * This is a prefix address of html file that widget is displaying.
96 * The whole address is PrefixURL + StartURL.
98 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PrefixURL;
101 * @brief Install path for widget
103 * Gets path in which files of widget are being kept
105 DPL::Event::Property<DPL::String,
106 DPL::Event::PropertyReadOnly,
107 DPL::Event::PropertyStorageDynamicCached> InstallPath;
110 * @brief Path to widget's persistent storage.
112 * Gets path in which widget may store its persistent private data.
114 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PersistentStoragePath;
117 * @brief Path to widget's temporary storage.
119 * Gets path in which widget may store its temporary private data.
121 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> TemporaryStoragePath;
126 DPL::Event::Property<WrtDB::WidgetGUID,
127 DPL::Event::PropertyReadOnly,
128 DPL::Event::PropertyStorageDynamicCached> GUID;
131 * @brief Widget defaultlocale
133 DPL::Event::Property<DPL::OptionalString,
134 DPL::Event::PropertyReadOnly,
135 DPL::Event::PropertyStorageDynamicCached> defaultlocale;
138 * @brief Widget version
140 DPL::Event::Property<OptionalWidgetVersion,
141 DPL::Event::PropertyReadOnly,
142 DPL::Event::PropertyStorageDynamicCached> Version;
147 DPL::Event::Property<DPL::OptionalString> Name;
150 * @brief Widget short name
152 DPL::Event::Property<DPL::OptionalString> ShortName;
155 * @brief Widget description
157 DPL::Event::Property<DPL::OptionalString> Description;
160 * @brief Widget license
162 DPL::Event::Property<DPL::OptionalString> License;
165 * @brief Widget license href
167 DPL::Event::Property<DPL::OptionalString> LicenseHref;
172 DPL::Event::Property<OptionalWidgetIcon> Icon;
175 * @brief Widget name if running
177 DPL::Event::Property<DPL::OptionalString> RunningName;
180 * @brief Widget icon if running
182 DPL::Event::Property<OptionalWidgetIcon> RunningIcon;
185 * @brief Start URL for widget if running
187 DPL::Event::Property<DPL::OptionalString> RunningStartURL;
190 * @brief Widget short name for widget if running
192 DPL::Event::Property<DPL::OptionalString> RunningShortName;
195 * @brief Widget description for widget if running
197 DPL::Event::Property<DPL::OptionalString> RunningDescription;
200 * @brief Widget license
202 DPL::Event::Property<DPL::OptionalString> RunningLicense;
205 * @brief Widget license href
207 DPL::Event::Property<DPL::OptionalString> RunningLicenseHref;
210 * @brief Start URL information for widget
212 DPL::Event::Property<OptionalWidgetStartFileInfo> RunningStartFileInfo;
217 DPL::Event::Property<WrtDB::WindowModeList,
218 DPL::Event::PropertyReadOnly,
219 DPL::Event::PropertyStorageDynamic> WindowModes;
222 * @brief Package name
224 DPL::Event::Property<DPL::String,
225 DPL::Event::PropertyReadOnly,
226 DPL::Event::PropertyStorageDynamicCached> PkgName;
229 * @brief Current widget language tags
231 DPL::Event::Property<LanguageTagsList> LanguageTags;
234 * @brief Minimum of the WAC Engine Standard required to run widget.
236 DPL::Event::Property<WidgetStandard,
237 DPL::Event::PropertyReadOnly,
238 DPL::Event::PropertyStorageDynamicCached> Standard;
241 * @brief How much space application and its storage takes.
243 DPL::Event::Property<WidgetStorageSize,
244 DPL::Event::PropertyReadOnly,
245 DPL::Event::PropertyStorageDynamicCached> ApplicationStorage;
247 // * @brief Value of network element.
249 // DPL::Event::Property<bool,
250 // DPL::Event::PropertyReadOnly> AccessNetwork;
253 // * @brief Does widget contain WARP definitions.
255 // DPL::Event::Property<bool> WarpDefinitionEmpty;
258 * @brief Certificates required OCSP check.
260 DPL::Event::Property<ValidationCore::CertificateCollectionList,
261 DPL::Event::PropertyReadOnly,
262 DPL::Event::PropertyStorageDynamic> OCSPCertificateChainList;
265 * @brief Is back supported
267 DPL::Event::Property<bool,
268 DPL::Event::PropertyReadOnly,
269 DPL::Event::PropertyStorageDynamicCached> BackSupported;
272 * @brief Widget access list
274 DPL::Event::Property<WidgetAccessList> AccessList;
277 * @brief Is this DeveloperWidget
279 DPL::Event::Property<bool,
280 DPL::Event::PropertyReadOnly,
281 DPL::Event::PropertyStorageDynamicCached> IsTestWidget;
283 DPL::Event::Property<bool,
284 DPL::Event::PropertyReadOnly,
285 DPL::Event::PropertyStorageDynamicCached> IsDeletable;
287 DPL::Event::Property<WidgetSettingList> SettingList;
290 * @brief Widget Application Service list
292 DPL::Event::Property<WidgetApplicationServiceList> AppServiceList;
294 WidgetModel(const WidgetHandle &handle);
297 // Custom read write delegates
298 static DPL::String readPkgName(DPL::Event::Model *model);
299 static WidgetStandard readStandard(DPL::Event::Model *model);
300 static OptionalWidgetVersion readVersion(DPL::Event::Model *model);
301 static WidgetStorageSize getApplicationStorage(DPL::Event::Model *model);
302 static ValidationCore::CertificateCollectionList
303 readWidgetCertificate(DPL::Event::Model *model);
305 WidgetHandle getHandle() const;
308 #endif // SRC_DOMAIN_WIDGET_MODEL_H