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.cpp
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
25 #include <WidgetConfigurationManager.h>
27 #include <dpl/task_list.h>
28 #include <dpl/string.h>
29 #include <wrt_error.h>
30 #include <dpl/wrt-dao-ro/global_config.h>
32 #include <wrt_common_types.h>
33 #include <widget_install/widget_install_popup.h>
35 class InstallerContext;
38 namespace WidgetInstall {
39 namespace InstallerTaskWidgetPopupData {
42 DPL::String widgetInfo;
43 void addWidgetInfo(const DPL::String &info);
45 } // InstalllerTaskWidgetPopupData
47 class TaskWidgetConfig :
48 public DPL::TaskDecl<TaskWidgetConfig>,
49 public WidgetInstallPopup
52 InstallerContext& m_installContext;
53 WrtDB::LocaleSet m_localeFolders;
54 std::set<DPL::String> m_processedIconSet;
55 InstallerTaskWidgetPopupData::PopupData m_popupData;
57 void StepProcessConfigurationFile();
58 void ReadLocaleFolders();
59 void ProcessLocalizedStartFiles();
60 void ProcessStartFile(const DPL::OptionalString& path,
61 const DPL::OptionalString& type,
62 const DPL::OptionalString& encoding = DPL::OptionalString::Null,
63 bool typeForcedInConfig = false);
64 void ProcessLocalizedIcons();
65 void ProcessIcon(const WrtDB::ConfigParserData::Icon& icon);
66 void StepVerifyFeatures();
67 void StepShowWidgetInfo();
68 void StepCheckMinVersionInfo();
70 template <typename Ex, const char* Msg>
71 void StepCancelInstallation();
73 void StepDeletePopupWin();
74 void StepCancelWidgetInstallationAfterVerifyFeatures();
75 void StepCancelWidgetInstallation();
76 void StepCancelWidgetInstallationAfterMinVersion();
77 void createInstallPopup(PopupType type, const std::string &label);
78 DPL::String createAuthorWidgetInfo() const;
79 void setApplicationType();
80 bool isFeatureAllowed(
81 WrtDB::AppType appType, DPL::String featureName);
82 bool isMinVersionCompatible(
83 WrtDB::AppType appType,
84 const DPL::OptionalString &widgetVersion) const;
86 * @brief Parses version string in format "major.minor.micro anything"
87 * Returns false if format is invalid
89 bool isTizenWebApp() const;
90 bool parseVersionString(const std::string &version, long &majorVersion,
91 long &minorVersion, long µVersion) const;
94 TaskWidgetConfig(InstallerContext& installTaskContext);
96 } //namespace WidgetInstall
99 #endif // INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_WIDGET_CONFIG_H