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
29 #include <dpl/errno_string.h>
30 #include <dpl/foreach.h>
31 #include <dpl/localization/w3c_file_localization.h>
32 #include <dpl/singleton_impl.h>
33 #include <dpl/utils/mime_type_utils.h>
34 #include <dpl/utils/wrt_global_settings.h>
35 #include <dpl/utils/wrt_utility.h>
36 #include <dpl/wrt-dao-ro/global_config.h>
37 #include <dpl/wrt-dao-ro/config_parser_data.h>
38 #include <dpl/wrt-dao-rw/feature_dao.h>
40 #include <libiriwrapper.h>
41 #include <parser_runner.h>
42 #include <root_parser.h>
44 #include <widget_install/job_widget_install.h>
45 #include <widget_install/task_widget_config.h>
46 #include <widget_install/widget_install_context.h>
47 #include <widget_install/widget_install_errors.h>
48 #include <widget_parser.h>
49 #include <web_provider_plugin_info.h>
50 #include <web_provider_livebox_info.h>
53 namespace { // anonymous
54 const DPL::String BR = DPL::FromUTF8String("<br>");
55 const std::string WIDGET_NOT_COMPATIBLE = "This widget is "
56 "not compatible with WRT.<br><br>";
57 const std::string QUESTION = "Do you want to install it anyway?";
59 const char *const DEFAULT_LANGUAGE = "default";
61 const char *const WRT_WIDGET_CONFIG_FILE_NAME = "config.xml";
63 const std::string WINDGET_INSTALL_NETWORK_ACCESS = "network access";
65 const char WRT_WIDGETS_XML_SCHEMA[] = "/usr/etc/wrt-installer/widgets.xsd";
69 namespace WidgetInstall {
70 void InstallerTaskWidgetPopupData::PopupData::addWidgetInfo(
71 const DPL::String &info)
76 TaskWidgetConfig::TaskWidgetConfig(InstallerContext& installContext) :
77 DPL::TaskDecl<TaskWidgetConfig>(this),
78 m_installContext(installContext)
80 AddStep(&TaskWidgetConfig::StepProcessConfigurationFile);
81 AddStep(&TaskWidgetConfig::ReadLocaleFolders);
82 AddStep(&TaskWidgetConfig::ProcessLocalizedStartFiles);
83 AddStep(&TaskWidgetConfig::ProcessBackgroundPageFile);
84 AddStep(&TaskWidgetConfig::ProcessLocalizedIcons);
85 AddStep(&TaskWidgetConfig::ProcessWidgetInstalledPath);
86 AddStep(&TaskWidgetConfig::ProcessAppControlInfo);
87 AddStep(&TaskWidgetConfig::ProcessSecurityModel);
88 AddStep(&TaskWidgetConfig::StepVerifyFeatures);
89 AddStep(&TaskWidgetConfig::StepCheckMinVersionInfo);
92 void TaskWidgetConfig::StepProcessConfigurationFile()
96 std::string path = m_installContext.locations->getConfigurationDir();
97 LogInfo("path: " << path);
99 processFile(path, m_installContext.widgetConfig);
101 Catch(Exception::ConfigParseFailed)
103 LogError("Parsing failed.");
104 ReThrow(Exceptions::WidgetConfigFileInvalid);
107 m_installContext.job->UpdateProgress(
108 InstallerContext::INSTALL_WIDGET_CONFIG1,
109 "Parse elements of configuration file and save them");
112 void TaskWidgetConfig::ReadLocaleFolders()
114 LogDebug("Reading locale");
115 //Adding default locale
116 m_localeFolders.insert(L"");
118 std::string localePath =
119 m_installContext.locations->getConfigurationDir() + "/locales";
120 DIR* localeDir = opendir(localePath.c_str());
122 LogDebug("No /locales directory in the widget package.");
126 struct stat statStruct;
127 struct dirent dirent;
128 struct dirent *result;
131 for (return_code = readdir_r(localeDir, &dirent, &result);
132 result != NULL && return_code == 0;
133 return_code = readdir_r(localeDir, &dirent, &result))
135 DPL::String dirName = DPL::FromUTF8String(dirent.d_name);
136 std::string absoluteDirName = localePath + "/";
137 absoluteDirName += dirent.d_name;
139 if (stat(absoluteDirName.c_str(), &statStruct) != 0) {
140 LogError("stat() failed with " << DPL::GetErrnoString());
144 if (S_ISDIR(statStruct.st_mode)) {
145 //Yes, we ignore current, parent & hidden directories
146 if (dirName[0] != L'.') {
147 LogDebug("Adding locale directory \"" << dirName << "\"");
148 m_localeFolders.insert(dirName);
153 if (return_code != 0 || errno != 0) {
154 LogError("readdir_r() failed with " << DPL::GetErrnoString());
157 if (-1 == TEMP_FAILURE_RETRY(closedir(localeDir))) {
158 LogError("Failed to close dir: " << localePath << " with error: "
159 << DPL::GetErrnoString());
163 void TaskWidgetConfig::ProcessLocalizedStartFiles()
165 typedef DPL::String S;
167 m_installContext.widgetConfig.configInfo.startFile,
168 m_installContext.widgetConfig.configInfo.
169 startFileContentType,
170 m_installContext.widgetConfig.configInfo.startFileEncoding,
172 ProcessStartFile(S(L"index.htm"), S(L"text/html"));
173 ProcessStartFile(S(L"index.html"), S(L"text/html"));
174 ProcessStartFile(S(L"index.svg"), S(L"image/svg+xml"));
175 ProcessStartFile(S(L"index.xhtml"), S(L"application/xhtml+xml"));
176 ProcessStartFile(S(L"index.xht"), S(L"application/xhtml+xml"));
177 // TODO: we need better check if in current locales widget is valid
178 FOREACH(it, m_installContext.widgetConfig.localizationData.startFiles) {
179 if (it->propertiesForLocales.size() > 0) {
183 ThrowMsg(Exceptions::WidgetConfigFileInvalid,
184 L"The Widget has no valid start file");
187 void TaskWidgetConfig::ProcessStartFile(const DPL::OptionalString& path,
188 const DPL::OptionalString& type,
189 const DPL::OptionalString& encoding,
190 bool typeForcedInConfig)
192 using namespace WrtDB;
195 WidgetRegisterInfo::LocalizedStartFile startFileData;
196 startFileData.path = *path;
198 FOREACH(i, m_localeFolders) {
199 DPL::String pathPrefix = *i;
200 if (!pathPrefix.empty()) {
201 pathPrefix = L"locales/" + pathPrefix + L"/";
204 DPL::String relativePath = pathPrefix + *path;
205 DPL::String absolutePath = DPL::FromUTF8String(
206 m_installContext.locations->getConfigurationDir()) + L"/" +
209 // get property data from packaged app
210 if (WrtUtilFileExists(DPL::ToUTF8String(absolutePath))) {
211 WidgetRegisterInfo::StartFileProperties startFileProperties;
213 startFileProperties.type = *type;
215 startFileProperties.type =
216 MimeTypeUtils::identifyFileMimeType(absolutePath);
219 //proceed only if MIME type is supported
220 if (MimeTypeUtils::isMimeTypeSupportedForStartFile(
221 startFileProperties.type))
224 startFileProperties.encoding = *encoding;
226 MimeTypeUtils::MimeAttributes attributes =
227 MimeTypeUtils::getMimeAttributes(
228 startFileProperties.type);
229 if (attributes.count(L"charset") > 0) {
230 startFileProperties.encoding =
231 attributes[L"charset"];
233 startFileProperties.encoding = L"UTF-8";
237 startFileData.propertiesForLocales[*i] =
241 //(there seems to be no similar requirement in .6,
242 //so let's throw only when mime type is
243 // provided explcitly in config.xml)
244 if (typeForcedInConfig) {
245 ThrowMsg(Exceptions::WidgetConfigFileInvalid,
246 "Unsupported MIME type for start file.");
250 // set property data for hosted start url
251 // Hosted start url only support TIZEN WebApp
252 if (m_installContext.widgetConfig.webAppType ==
253 APP_TYPE_TIZENWEBAPP)
255 std::string startPath = DPL::ToUTF8String(
258 if (strstr(startPath.c_str(),
259 "http") == startPath.c_str())
261 WidgetRegisterInfo::StartFileProperties
264 startFileProperties.type = *type;
267 startFileProperties.encoding = *encoding;
269 startFileData.propertiesForLocales[*i] =
276 m_installContext.widgetConfig.localizationData.startFiles.push_back(
281 void TaskWidgetConfig::ProcessBackgroundPageFile()
283 if (!!m_installContext.widgetConfig.configInfo.backgroundPage) {
284 // check whether file exists
285 DPL::String backgroundPagePath = DPL::FromUTF8String(
286 m_installContext.locations->getConfigurationDir()) + L"/" +
287 *m_installContext.widgetConfig.configInfo.backgroundPage;
288 //if no then cancel installation
289 if (!WrtUtilFileExists(DPL::ToUTF8String(backgroundPagePath))) {
290 ThrowMsg(Exceptions::WidgetConfigFileInvalid,
291 L"Given background page file not found in archive");
296 void TaskWidgetConfig::ProcessLocalizedIcons()
298 using namespace WrtDB;
299 ProcessIcon(ConfigParserData::Icon(L"icon.svg"));
300 ProcessIcon(ConfigParserData::Icon(L"icon.ico"));
301 ProcessIcon(ConfigParserData::Icon(L"icon.png"));
302 ProcessIcon(ConfigParserData::Icon(L"icon.gif"));
303 ProcessIcon(ConfigParserData::Icon(L"icon.jpg"));
305 FOREACH(i, m_installContext.widgetConfig.configInfo.iconsList)
311 void TaskWidgetConfig::ProcessIcon(const WrtDB::ConfigParserData::Icon& icon)
314 bool isAnyIconValid = false;
315 //In case a default filename is passed as custom filename in config.xml, we
316 //need to keep a set of already processed filenames to avoid icon
320 using namespace WrtDB;
322 if (m_processedIconSet.count(icon.src) > 0) {
325 m_processedIconSet.insert(icon.src);
327 LocaleSet localesAvailableForIcon;
329 FOREACH(i, m_localeFolders)
331 DPL::String pathPrefix = *i;
332 if (!pathPrefix.empty()) {
333 pathPrefix = L"locales/" + pathPrefix + L"/";
336 DPL::String relativePath = pathPrefix + icon.src;
337 DPL::String absolutePath = DPL::FromUTF8String(
338 m_installContext.locations->getConfigurationDir()) + L"/" +
341 if (WrtUtilFileExists(DPL::ToUTF8String(absolutePath))) {
342 DPL::String type = MimeTypeUtils::identifyFileMimeType(absolutePath);
344 if (MimeTypeUtils::isMimeTypeSupportedForIcon(type)) {
345 isAnyIconValid = true;
346 localesAvailableForIcon.insert(*i);
347 LogInfo("Icon absolutePath :" << absolutePath <<
348 ", assigned locale :" << *i << ", type: " << type);
353 if (isAnyIconValid) {
354 WidgetRegisterInfo::LocalizedIcon localizedIcon(icon,
355 localesAvailableForIcon);
356 m_installContext.widgetConfig.localizationData.icons.push_back(
361 void TaskWidgetConfig::ProcessWidgetInstalledPath()
363 LogDebug("ProcessWidgetInstalledPath");
364 m_installContext.widgetConfig.widgetInstalledPath =
366 m_installContext.locations->getPackageInstallationDir());
369 void TaskWidgetConfig::ProcessAppControlInfo()
371 LogDebug("ProcessAppControlInfo");
372 using namespace WrtDB;
374 WrtDB::ConfigParserData::AppControlInfo::Disposition disposition =
375 WrtDB::ConfigParserData::AppControlInfo::Disposition::WINDOW;
376 FOREACH(it, m_installContext.widgetConfig.configInfo.settingsList) {
377 if (!strcmp(DPL::ToUTF8String(it->m_name).c_str(), "nodisplay") &&
378 !strcmp(DPL::ToUTF8String(it->m_value).c_str(), "true"))
381 WrtDB::ConfigParserData::AppControlInfo::Disposition::INLINE;
385 std::map<std::string, int> srcMap;
387 // index = 0 is reserved for start file
388 FOREACH(startFileIt, m_installContext.widgetConfig.localizationData.startFiles)
390 if (!startFileIt->propertiesForLocales.empty()) {
391 std::string src = DPL::ToUTF8String(startFileIt->path);
392 if (srcMap.find(src) == srcMap.end()) {
393 LogDebug("Insert [" << src << "," << index << "]");
394 srcMap.insert(std::pair<std::string, int>(src, index++));
399 FOREACH(appControlIt, m_installContext.widgetConfig.configInfo.appControlList)
401 appControlIt->m_disposition = disposition;
402 std::string src = DPL::ToUTF8String(appControlIt->m_src);
403 LogDebug("src = [" << src << "]");
404 std::map<std::string, int>::iterator findIt = srcMap.find(src);
405 if (findIt == srcMap.end()) {
406 LogDebug("Insert [" << src << "," << index << "]");
407 srcMap.insert(std::pair<std::string, int>(src, index));
408 appControlIt->m_index = index++;
410 LogDebug("Exist [" << src << "," << findIt->second << "]");
411 appControlIt->m_index = findIt->second;
416 void TaskWidgetConfig::ProcessSecurityModel()
418 // 0104. If the "required_version" specified in the Web Application's
419 // configuration is 2.2 or higher and if the Web Application's
420 // configuration is "CSP-compatible configuration", then the WRT MUST be
421 // set to "CSP-based security mode". Otherwise, the WRT MUST be set to
422 // "WARP-based security mode".
423 // 0105. A Web Application configuration is "CSP-compatible configuration"
424 // if the configuration includes one or more of
425 // <tizen:content-security-policy> /
426 // <tizen:content-security-policy-report-only> /
427 // <tizen:allow-navigation> elements.
429 bool isSecurityModelV1 = false;
430 bool isSecurityModelV2 = false;
431 WrtDB::ConfigParserData &data = m_installContext.widgetConfig.configInfo;
433 if (!data.cspPolicy.IsNull() ||
434 !data.cspPolicyReportOnly.IsNull() ||
435 !data.allowNavigationInfoList.empty())
437 data.accessInfoSet.clear();
441 if (!data.accessInfoSet.empty()) {
442 isSecurityModelV1 = true;
445 // CSP & allow-navigation is V2
446 if (!data.cspPolicy.IsNull() ||
447 !data.cspPolicyReportOnly.IsNull() ||
448 !data.allowNavigationInfoList.empty())
450 isSecurityModelV2 = true;
453 if (isSecurityModelV1 && isSecurityModelV2) {
454 LogError("Security model is conflict");
455 ThrowMsg(Exceptions::NotAllowed, "Security model is conflict");
456 } else if (isSecurityModelV1) {
457 data.securityModelVersion =
458 WrtDB::ConfigParserData::SecurityModelVersion::SECURITY_MODEL_V1;
459 } else if (isSecurityModelV2) {
460 data.securityModelVersion =
461 WrtDB::ConfigParserData::SecurityModelVersion::SECURITY_MODEL_V2;
463 data.securityModelVersion =
464 WrtDB::ConfigParserData::SecurityModelVersion::SECURITY_MODEL_V1;
467 m_installContext.job->UpdateProgress(
468 InstallerContext::INSTALL_WIDGET_CONFIG2,
469 "Finished process security model");
472 void TaskWidgetConfig::StepCheckMinVersionInfo()
474 if (!isMinVersionCompatible(
475 m_installContext.widgetConfig.webAppType.appType,
476 m_installContext.widgetConfig.minVersion))
479 "Platform version lower than required -> cancelling installation");
480 ThrowMsg(Exceptions::NotAllowed,
481 "Platform version does not meet requirements");
484 m_installContext.job->UpdateProgress(
485 InstallerContext::INSTALL_WIDGET_CONFIG2,
486 "Check MinVersion Finished");
489 void TaskWidgetConfig::StepVerifyFeatures()
491 using namespace WrtDB;
492 ConfigParserData &data = m_installContext.widgetConfig.configInfo;
493 ConfigParserData::FeaturesList list = data.featuresList;
494 ConfigParserData::FeaturesList newList;
496 //in case of tests, this variable is unused
497 std::string featureInfo;
500 // check feature vender for permission
501 // WAC, TIZEN WebApp cannot use other feature
503 if (!isFeatureAllowed(m_installContext.widgetConfig.webAppType.appType,
506 LogInfo("This application type not allowed to use this feature");
508 Exceptions::WidgetConfigFileInvalid,
510 m_installContext.widgetConfig.webAppType.getApptypeToString()
512 "] cannot be allowed to use [" <<
513 DPL::ToUTF8String(it->name) + "] feature");
516 featureInfo += DPL::ToUTF8String(it->name);
517 featureInfo += DPL::ToUTF8String(BR);
520 if (!data.accessInfoSet.empty()) {
521 featureInfo += WINDGET_INSTALL_NETWORK_ACCESS;
522 featureInfo += DPL::ToUTF8String(BR);
524 data.featuresList = newList;
525 if (!featureInfo.empty()) {
526 m_popupData.addWidgetInfo(DPL::FromUTF8String(featureInfo));
529 m_installContext.job->UpdateProgress(
530 InstallerContext::INSTALL_WIDGET_CONFIG2,
531 "Widget Config step2 Finished");
534 void TaskWidgetConfig::StepVerifyLivebox()
536 using namespace WrtDB;
537 ConfigParserData &data = m_installContext.widgetConfig.configInfo;
538 ConfigParserData::LiveboxList liveBoxList = data.m_livebox;
540 if (liveBoxList.size() <= 0) {
544 FOREACH (it, liveBoxList) {
547 if ((**it).m_type.empty()) {
548 boxType = web_provider_livebox_get_default_type();
550 boxType = DPL::ToUTF8String((**it).m_type);
553 LogInfo("livebox type: " << boxType);
555 ConfigParserData::LiveboxInfo::BoxSizeList boxSizeList =
556 (**it).m_boxInfo.m_boxSize;
557 char** boxSize = static_cast<char**>(
558 malloc(sizeof(char*)* boxSizeList.size()));
561 FOREACH (m, boxSizeList) {
562 boxSize[boxSizeCnt++] = strdup(DPL::ToUTF8String((*m).m_size).c_str());
565 bool chkSize = web_provider_plugin_check_supported_size(
566 boxType.c_str(), boxSize, boxSizeCnt);
568 for(int i = 0; i < boxSizeCnt; i++) {
574 LogError("Invalid boxSize");
575 ThrowMsg(Exceptions::WidgetConfigFileInvalid, "Invalid boxSize");
580 bool TaskWidgetConfig::isFeatureAllowed(WrtDB::AppType appType,
581 DPL::String featureName)
583 using namespace WrtDB;
584 LogInfo("AppType = [" <<
585 WidgetType(appType).getApptypeToString() << "]");
586 LogInfo("FetureName = [" << featureName << "]");
588 AppType featureType = APP_TYPE_UNKNOWN;
589 std::string featureStr = DPL::ToUTF8String(featureName);
590 const char* feature = featureStr.c_str();
592 // check prefix of feature name
593 if (strstr(feature, PluginsPrefix::TIZENPluginsPrefix) == feature) {
594 // Tizen WebApp feature
595 featureType = APP_TYPE_TIZENWEBAPP;
596 } else if (strstr(feature, PluginsPrefix::WACPluginsPrefix) == feature) {
598 featureType = APP_TYPE_WAC20;
599 } else if (strstr(feature, PluginsPrefix::W3CPluginsPrefix) == feature) {
600 // W3C standard feature
601 // Both WAC and TIZEN WebApp are possible to use W3C plugins
605 // unknown feature will be checked next step
609 if (appType == featureType) {
615 bool TaskWidgetConfig::parseVersionString(const std::string &version,
618 long µVersion) const
620 std::istringstream inputString(version);
621 inputString >> majorVersion;
622 if (inputString.bad() || inputString.fail()) {
623 LogWarning("Invalid minVersion format.");
626 inputString.get(); // skip period
627 inputString >> minorVersion;
628 if (inputString.bad() || inputString.fail()) {
629 LogWarning("Invalid minVersion format");
632 inputString.get(); // skip period
633 if (inputString.bad() || inputString.fail()) {
634 inputString >> microVersion;
640 bool TaskWidgetConfig::isMinVersionCompatible(
641 WrtDB::AppType appType,
642 const DPL::OptionalString &
645 if (widgetVersion.IsNull() || (*widgetVersion).empty()) {
646 if (appType == WrtDB::AppType::APP_TYPE_TIZENWEBAPP) {
649 LogWarning("minVersion attribute is empty. WRT assumes platform "
650 "supports this widget.");
655 //Parse widget version
656 long majorWidget = 0, minorWidget = 0, microWidget = 0;
657 if (!parseVersionString(DPL::ToUTF8String(*widgetVersion), majorWidget,
658 minorWidget, microWidget))
660 LogWarning("Invalid format of widget version string.");
664 //Parse supported version
665 long majorSupported = 0, minorSupported = 0, microSupported = 0;
667 if (appType == WrtDB::AppType::APP_TYPE_TIZENWEBAPP) {
668 version = WrtDB::GlobalConfig::GetTizenVersion();
669 } else if (appType == WrtDB::AppType::APP_TYPE_WAC20) {
670 version = WrtDB::GlobalConfig::GetWACVersion();
672 LogWarning("Invaild AppType");
676 if (!parseVersionString(version,
677 majorSupported, minorSupported, microSupported))
679 LogWarning("Invalid format of platform version string.");
683 if (majorWidget > majorSupported ||
684 (majorWidget == majorSupported && minorWidget > minorSupported) ||
685 (majorWidget == majorSupported && minorWidget == minorSupported
686 && microWidget > microSupported))
688 LogInfo("Platform doesn't support this widget.");
694 bool TaskWidgetConfig::isTizenWebApp() const
697 if (m_installContext.widgetConfig.webAppType.appType
698 == WrtDB::AppType::APP_TYPE_TIZENWEBAPP)
706 bool TaskWidgetConfig::parseConfigurationFileBrowser(
707 WrtDB::ConfigParserData& configInfo,
708 const std::string& _currentPath)
713 parser.Parse(_currentPath, ElementParserPtr(new
717 DPL::FromUTF32String(
720 Catch(ElementParser::Exception::Base)
722 LogError("Invalid widget configuration file!");
728 bool TaskWidgetConfig::parseConfigurationFileWidget(
729 WrtDB::ConfigParserData& configInfo,
730 const std::string& _currentPath)
732 std::string configFilePath;
733 WrtUtilJoinPaths(configFilePath, _currentPath, WRT_WIDGET_CONFIG_FILE_NAME);
734 if (!WrtUtilFileExists(configFilePath))
736 LogError("Archive does not contain configuration file");
740 LogDebug("Configuration file: " << configFilePath);
745 #ifdef SCHEMA_VALIDATION_ENABLED
746 if(!parser.Validate(configFilePath, WRT_WIDGETS_XML_SCHEMA))
748 LogError("Invalid configuration file - schema validation failed");
752 parser.Parse(configFilePath,
753 ElementParserPtr(new RootParser<WidgetParser>(
755 DPL::FromUTF32String(L"widget"))));
758 Catch (ElementParser::Exception::Base)
760 LogError("Invalid configuration file!");
765 bool TaskWidgetConfig::locateAndParseConfigurationFile(
766 const std::string& _currentPath,
767 WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
768 const std::string& baseFolder)
770 using namespace WrtDB;
772 ConfigParserData& configInfo = pWidgetConfigInfo.configInfo;
774 // check if this installation from browser, or not.
775 size_t pos = _currentPath.rfind("/");
776 std::ostringstream infoPath;
777 infoPath << _currentPath.substr(pos + 1);
779 if (infoPath.str() != WRT_WIDGET_CONFIG_FILE_NAME) {
780 if (_currentPath.empty() || baseFolder.empty()) {
783 // in case of general installation using wgt archive
784 if (!parseConfigurationFileWidget(configInfo, _currentPath))
789 // in case of browser installation
790 if (!parseConfigurationFileBrowser(configInfo, _currentPath))
796 if (!fillWidgetConfig(pWidgetConfigInfo, configInfo)) {
802 bool TaskWidgetConfig::fillWidgetConfig(
803 WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
804 WrtDB::ConfigParserData& configInfo)
806 if (!!configInfo.widget_id) {
807 if (!pWidgetConfigInfo.guid) {
808 pWidgetConfigInfo.guid = configInfo.widget_id;
810 if (pWidgetConfigInfo.guid != configInfo.widget_id) {
811 LogError("Invalid archive");
816 if (!!configInfo.tizenAppId) {
817 if (DPL::ToUTF8String(pWidgetConfigInfo.tzAppid).compare(
818 DPL::ToUTF8String(*configInfo.tizenAppId)) < 0)
820 LogError("Invalid archive - Tizen App ID not same error");
824 if (!!configInfo.tizenPkgId) {
825 if (pWidgetConfigInfo.tzPkgid != *configInfo.tizenPkgId) {
826 LogError("Invalid archive - Tizen Pkg ID not same error");
830 if (!!configInfo.version) {
831 if (!pWidgetConfigInfo.version) {
832 pWidgetConfigInfo.version = configInfo.version;
834 if (pWidgetConfigInfo.version != configInfo.version) {
835 LogError("Invalid archive");
840 if (!!configInfo.minVersionRequired) {
841 pWidgetConfigInfo.minVersion = configInfo.minVersionRequired;
842 } else if (!!configInfo.tizenMinVersionRequired) {
843 pWidgetConfigInfo.minVersion = configInfo.tizenMinVersionRequired;
848 void TaskWidgetConfig::processFile(
849 const std::string& path,
850 WrtDB::WidgetRegisterInfo &
853 if (!locateAndParseConfigurationFile(path, widgetConfiguration,
856 LogWarning("Widget archive: Failed while parsing config file");
857 ThrowMsg(Exception::ConfigParseFailed, path);
860 } //namespace WidgetInstall