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>
29 #include "widget_data_types.h"
31 #include <dpl/wrt-dao-ro/wrt_db_types.h> // definition of WidgetHandle
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.
40 * Widget model is a type of MVC model, so it is possible to listen for it's
44 class WidgetModel : public DPL::Event::Model
49 * @brief Widget handle
51 * Note: This is a readonly property
53 DPL::Event::Property<WidgetHandle, DPL::Event::PropertyReadOnly> Handle;
58 * Note: This is a readonly property
60 DPL::Event::Property<WrtDB::WidgetType,
61 DPL::Event::PropertyReadOnly,
62 DPL::Event::PropertyStorageDynamicCached> Type;
65 * @brief Current widget actual size
67 DPL::Event::Property<WidgetSize> ActualSize;
70 * @brief Current widget preferred size
72 DPL::Event::Property<WidgetSize,
73 DPL::Event::PropertyReadOnly,
74 DPL::Event::PropertyStorageDynamicCached> PreferredSize;
77 * @brief Start URL for widget
79 DPL::Event::Property<DPL::OptionalString> StartURL;
82 * @brief Start URL information for widget
84 DPL::Event::Property<OptionalWidgetStartFileInfo> StartFileInfo;
87 * @brief Prefix URL for widget
89 * This is a prefix address of html file that widget is displaying.
90 * The whole address is PrefixURL + StartURL.
92 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PrefixURL;
95 * @brief Install path for widget
97 * Gets path in which files of widget are being kept
99 DPL::Event::Property<DPL::String,
100 DPL::Event::PropertyReadOnly,
101 DPL::Event::PropertyStorageDynamicCached> InstallPath;
104 * @brief Path to widget's persistent storage.
106 * Gets path in which widget may store its persistent private data.
108 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> PersistentStoragePath;
111 * @brief Path to widget's temporary storage.
113 * Gets path in which widget may store its temporary private data.
115 DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> TemporaryStoragePath;
120 DPL::Event::Property<WrtDB::WidgetGUID,
121 DPL::Event::PropertyReadOnly,
122 DPL::Event::PropertyStorageDynamicCached> GUID;
125 * @brief Widget defaultlocale
127 DPL::Event::Property<DPL::OptionalString,
128 DPL::Event::PropertyReadOnly,
129 DPL::Event::PropertyStorageDynamicCached> defaultlocale;
132 * @brief Widget version
134 DPL::Event::Property<OptionalWidgetVersion,
135 DPL::Event::PropertyReadOnly,
136 DPL::Event::PropertyStorageDynamicCached> Version;
141 DPL::Event::Property<DPL::OptionalString> Name;
144 * @brief Widget short name
146 DPL::Event::Property<DPL::OptionalString> ShortName;
149 * @brief Widget description
151 DPL::Event::Property<DPL::OptionalString> Description;
154 * @brief Widget license
156 DPL::Event::Property<DPL::OptionalString> License;
159 * @brief Widget license href
161 DPL::Event::Property<DPL::OptionalString> LicenseHref;
166 DPL::Event::Property<OptionalWidgetIcon> Icon;
169 * @brief Widget name if running
171 DPL::Event::Property<DPL::OptionalString> RunningName;
174 * @brief Widget icon if running
176 DPL::Event::Property<OptionalWidgetIcon> RunningIcon;
179 * @brief Start URL for widget if running
181 DPL::Event::Property<DPL::OptionalString> RunningStartURL;
184 * @brief Widget short name for widget if running
186 DPL::Event::Property<DPL::OptionalString> RunningShortName;
189 * @brief Widget description for widget if running
191 DPL::Event::Property<DPL::OptionalString> RunningDescription;
194 * @brief Widget license
196 DPL::Event::Property<DPL::OptionalString> RunningLicense;
199 * @brief Widget license href
201 DPL::Event::Property<DPL::OptionalString> RunningLicenseHref;
204 * @brief Start URL information for widget
206 DPL::Event::Property<OptionalWidgetStartFileInfo> RunningStartFileInfo;
211 DPL::Event::Property<WrtDB::WindowModeList,
212 DPL::Event::PropertyReadOnly,
213 DPL::Event::PropertyStorageDynamic> WindowModes;
216 * @brief Package name
218 DPL::Event::Property<DPL::String,
219 DPL::Event::PropertyReadOnly,
220 DPL::Event::PropertyStorageDynamicCached> PkgName;
223 * @brief Current widget language tags
225 DPL::Event::Property<LanguageTagsList> LanguageTags;
228 * @brief Minimum of the WAC Engine Standard required to run widget.
230 DPL::Event::Property<WidgetStandard,
231 DPL::Event::PropertyReadOnly,
232 DPL::Event::PropertyStorageDynamicCached> Standard;
235 * @brief How much space application and its storage takes.
237 DPL::Event::Property<WidgetStorageSize,
238 DPL::Event::PropertyReadOnly,
239 DPL::Event::PropertyStorageDynamicCached> ApplicationStorage;
241 // * @brief Value of network element.
243 // DPL::Event::Property<bool,
244 // DPL::Event::PropertyReadOnly> AccessNetwork;
247 // * @brief Does widget contain WARP definitions.
249 // DPL::Event::Property<bool> WarpDefinitionEmpty;
252 * @brief Is back supported
254 DPL::Event::Property<bool,
255 DPL::Event::PropertyReadOnly,
256 DPL::Event::PropertyStorageDynamicCached> BackSupported;
259 * @brief Widget access list
261 DPL::Event::Property<WidgetAccessList> AccessList;
264 * @brief Is this DeveloperWidget
266 DPL::Event::Property<bool,
267 DPL::Event::PropertyReadOnly,
268 DPL::Event::PropertyStorageDynamicCached> IsTestWidget;
270 DPL::Event::Property<bool,
271 DPL::Event::PropertyReadOnly,
272 DPL::Event::PropertyStorageDynamicCached> IsDeletable;
274 DPL::Event::Property<WidgetSettingList> SettingList;
277 * @brief Widget Application Service list
279 DPL::Event::Property<WidgetApplicationServiceList> AppServiceList;
281 WidgetModel(const WidgetHandle &handle);
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);
290 WidgetHandle getHandle() const;
293 #endif // SRC_DOMAIN_WIDGET_MODEL_H