1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
/*
* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @file task_widget_config.h
* @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
* @version 1.0
* @brief Implementation file for installer task widget config
*/
#ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_WIDGET_CONFIG_H
#define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_WIDGET_CONFIG_H
#include <set>
#include <list>
#include <dpl/task.h>
#include <dpl/task_list.h>
#include <dpl/string.h>
#include <dpl/optional.h>
#include <dpl/wrt-dao-ro/config_parser_data.h>
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
#include <dpl/wrt-dao-ro/global_config.h>
#include <wrt_error.h>
#include <wrt_common_types.h>
#include <widget_install/widget_install_popup.h>
class InstallerContext;
namespace Jobs {
namespace WidgetInstall {
namespace InstallerTaskWidgetPopupData {
struct PopupData
{
DPL::String widgetInfo;
void addWidgetInfo(const DPL::String &info);
};
} // InstalllerTaskWidgetPopupData
class TaskWidgetConfig :
public DPL::TaskDecl<TaskWidgetConfig>,
public WidgetInstallPopup
{
private:
class Exception
{
public:
DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
DECLARE_EXCEPTION_TYPE(Base, ConfigParseFailed)
};
typedef std::list<std::pair<DPL::String, DPL::String> > StringPairList;
InstallerContext& m_installContext;
WrtDB::LocaleSet m_localeFolders;
std::set<DPL::String> m_processedIconSet;
InstallerTaskWidgetPopupData::PopupData m_popupData;
void StepProcessConfigurationFile();
void ReadLocaleFolders();
void ProcessLocalizedStartFiles();
void ProcessStartFile(const DPL::OptionalString& path,
const DPL::OptionalString& type,
const DPL::OptionalString& encoding = DPL::OptionalString::Null,
bool typeForcedInConfig = false);
void ProcessLocalizedIcons();
void ProcessIcon(const WrtDB::ConfigParserData::Icon& icon);
void StepVerifyFeatures();
void StepShowWidgetInfo();
void StepCheckMinVersionInfo();
template <typename Ex, const char* Msg>
void StepCancelInstallation();
void StepDeletePopupWin();
void StepCancelWidgetInstallationAfterVerifyFeatures();
void StepCancelWidgetInstallation();
void StepCancelWidgetInstallationAfterMinVersion();
void createInstallPopup(PopupType type, const std::string &label);
DPL::String createAuthorWidgetInfo() const;
void setApplicationType();
bool isFeatureAllowed(
WrtDB::AppType appType, DPL::String featureName);
bool isMinVersionCompatible(
WrtDB::AppType appType,
const DPL::OptionalString &widgetVersion) const;
/**
* @brief Parses version string in format "major.minor.micro anything"
* Returns false if format is invalid
*/
bool isTizenWebApp() const;
bool parseVersionString(const std::string &version, long &majorVersion,
long &minorVersion, long µVersion) const;
/**
* This method is used to process the config.xml of widget, get
* the corresponding configuration to pWidgetConfigInfo
*
* @param[in] path Specified the widget archive file path (absolute path).
* @return Configuration information of widget
*/
void processFile(const std::string& path,
WrtDB::WidgetRegisterInfo &wConfig);
bool locateAndParseConfigurationFile(const std::string& currentPath,
WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
const std::string& baseFolder,
int* pErrCode);
bool parseConfigurationFileBrowser(WrtDB::ConfigParserData& configInfo,
const std::string& _currentPath, int* pErrCode);
bool parseConfigurationFileWidget(WrtDB::ConfigParserData& configInfo,
const std::string& _currentPath, int* pErrCode);
bool fillWidgetConfig(WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
WrtDB::ConfigParserData& configInfo);
public:
TaskWidgetConfig(InstallerContext& installTaskContext);
};
} //namespace WidgetInstall
} //namespace Jobs
#endif // INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_WIDGET_CONFIG_H
|