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 task_widget_config.h
18 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
20 * @brief Implementation file for installer task widget config
22 #ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_WIDGET_CONFIG_H
23 #define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_WIDGET_CONFIG_H
29 #include <dpl/task_list.h>
30 #include <dpl/string.h>
31 #include <dpl/optional.h>
32 #include <dpl/wrt-dao-ro/config_parser_data.h>
33 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
34 #include <dpl/wrt-dao-ro/global_config.h>
36 #include <wrt_common_types.h>
38 class InstallerContext;
41 namespace WidgetInstall {
42 namespace InstallerTaskWidgetPopupData {
45 DPL::String widgetInfo;
46 void addWidgetInfo(const DPL::String &info);
48 } // InstalllerTaskWidgetPopupData
50 class TaskWidgetConfig :
51 public DPL::TaskDecl<TaskWidgetConfig>
57 DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
58 DECLARE_EXCEPTION_TYPE(Base, ConfigParseFailed)
61 typedef std::list<std::pair<DPL::String, DPL::String> > StringPairList;
63 InstallerContext& m_installContext;
64 WrtDB::LocaleSet m_localeFolders;
65 std::set<DPL::String> m_processedIconSet;
66 InstallerTaskWidgetPopupData::PopupData m_popupData;
68 void StepProcessConfigurationFile();
69 void ReadLocaleFolders();
70 void ProcessLocalizedStartFiles();
71 void ProcessStartFile(
72 const DPL::OptionalString& path,
73 const DPL::OptionalString& type,
74 const DPL::OptionalString& encoding =
75 DPL::OptionalString::Null,
76 bool typeForcedInConfig = false);
77 void ProcessBackgroundPageFile();
78 void ProcessLocalizedIcons();
79 void ProcessIcon(const WrtDB::ConfigParserData::Icon& icon);
80 void ProcessWidgetInstalledPath();
81 void ProcessAppControlInfo();
82 void StepVerifyFeatures();
83 void StepCheckMinVersionInfo();
85 template <typename Ex, const char* Msg>
86 void StepCancelInstallation();
88 DPL::String createAuthorWidgetInfo() const;
89 bool isFeatureAllowed(
90 WrtDB::AppType appType, DPL::String featureName);
91 bool isMinVersionCompatible(
92 WrtDB::AppType appType,
93 const DPL::OptionalString &widgetVersion) const;
95 * @brief Parses version string in format "major.minor.micro anything"
96 * Returns false if format is invalid
98 bool isTizenWebApp() const;
99 bool parseVersionString(const std::string &version, long &majorVersion,
100 long &minorVersion, long µVersion) const;
102 * This method is used to process the config.xml of widget, get
103 * the corresponding configuration to pWidgetConfigInfo
105 * @param[in] path Specified the widget archive file path (absolute path).
106 * @return Configuration information of widget
108 void processFile(const std::string& path,
109 WrtDB::WidgetRegisterInfo &wConfig);
111 bool locateAndParseConfigurationFile(
112 const std::string& currentPath,
113 WrtDB::WidgetRegisterInfo&
115 const std::string& baseFolder);
116 bool parseConfigurationFileBrowser(WrtDB::ConfigParserData& configInfo,
117 const std::string& _currentPath);
118 bool parseConfigurationFileWidget(WrtDB::ConfigParserData& configInfo,
119 const std::string& _currentPath);
120 bool fillWidgetConfig(WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
121 WrtDB::ConfigParserData& configInfo);
124 TaskWidgetConfig(InstallerContext& installTaskContext);
126 } //namespace WidgetInstall
129 #endif // INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_WIDGET_CONFIG_H