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
28 #include <dpl/errno_string.h>
29 #include <dpl/foreach.h>
30 #include <dpl/localization/w3c_file_localization.h>
31 #include <dpl/singleton_impl.h>
32 #include <dpl/utils/mime_type_utils.h>
33 #include <dpl/utils/wrt_global_settings.h>
34 #include <dpl/utils/wrt_utility.h>
35 #include <dpl/wrt-dao-ro/global_config.h>
36 #include <dpl/wrt-dao-rw/feature_dao.h>
38 #include <libiriwrapper.h>
39 #include <parser_runner.h>
40 #include <root_parser.h>
42 #include <widget_install/job_widget_install.h>
43 #include <widget_install/task_widget_config.h>
44 #include <widget_install/widget_install_context.h>
45 #include <widget_install/widget_install_errors.h>
46 #include <widget_parser.h>
47 #include <wrt_error.h>
50 namespace { // anonymous
51 const DPL::String BR = DPL::FromUTF8String("<br>");
52 const std::string WIDGET_NOT_COMPATIBLE = "This widget is "
53 "not compatible with WRT.<br><br>";
54 const std::string QUESTION = "Do you want to install it anyway?";
56 const char *const DEFAULT_LANGUAGE = "default";
58 const char *const WRT_WIDGET_CONFIG_FILE_NAME = "config.xml";
60 const std::string WINDGET_INSTALL_NETWORK_ACCESS = "network access";
65 namespace WidgetInstall {
66 void InstallerTaskWidgetPopupData::PopupData::addWidgetInfo(
67 const DPL::String &info)
72 TaskWidgetConfig::TaskWidgetConfig(InstallerContext& installContext) :
73 DPL::TaskDecl<TaskWidgetConfig>(this),
74 WidgetInstallPopup(installContext),
75 m_installContext(installContext)
78 AddStep(&TaskWidgetConfig::StepProcessConfigurationFile);
79 AddStep(&TaskWidgetConfig::ReadLocaleFolders);
80 AddStep(&TaskWidgetConfig::ProcessLocalizedStartFiles);
81 AddStep(&TaskWidgetConfig::ProcessBackgroundPageFile);
82 AddStep(&TaskWidgetConfig::ProcessLocalizedIcons);
83 AddStep(&TaskWidgetConfig::StepVerifyFeatures);
85 if (!GlobalSettings::TestModeEnabled() && !m_installContext.m_quiet) {
86 AddStep(&TaskWidgetConfig::StepCancelWidgetInstallationAfterVerifyFeatures);
87 AddStep(&TaskWidgetConfig::StepShowWidgetInfo);
88 AddStep(&TaskWidgetConfig::StepCancelWidgetInstallation);
89 AddStep(&TaskWidgetConfig::StepCheckMinVersionInfo);
90 AddStep(&TaskWidgetConfig::StepCancelWidgetInstallationAfterMinVersion);
91 AddStep(&TaskWidgetConfig::StepDeletePopupWin);
95 void TaskWidgetConfig::StepProcessConfigurationFile()
99 std::string path = m_installContext.locations->getConfigurationDir();
100 LogInfo("path: " << path);
102 processFile(path, m_installContext.widgetConfig);
104 Catch(Exception::ConfigParseFailed)
106 LogError("Parsing failed.");
107 ReThrow(Exceptions::WidgetConfigFileInvalid);
111 // To get widget type for distribute WAC, TIZEN WebApp
112 setApplicationType();
114 Catch(Exception::ConfigParseFailed)
116 LogError("Config.xml has more than one namespace");
117 ReThrow(Exceptions::WidgetConfigFileInvalid);
120 m_installContext.job->UpdateProgress(
121 InstallerContext::INSTALL_WIDGET_CONFIG1,
122 "Parse elements of configuration file and save them");
125 void TaskWidgetConfig::ReadLocaleFolders()
127 LogDebug("Reading locale");
128 //Adding default locale
129 m_localeFolders.insert(L"");
131 std::string localePath = m_installContext.locations->getConfigurationDir() + "/locales";
132 DIR* localeDir = opendir(localePath.c_str());
134 LogDebug("No /locales directory in the widget package.");
138 struct dirent* dirent;
139 struct stat statStruct;
142 if ((dirent = readdir(localeDir))) {
143 DPL::String dirName = DPL::FromUTF8String(dirent->d_name);
144 std::string absoluteDirName = localePath + "/";
145 absoluteDirName += dirent->d_name;
147 if (stat(absoluteDirName.c_str(), &statStruct) != 0) {
148 LogError("stat() failed with " << DPL::GetErrnoString());
152 if (S_ISDIR(statStruct.st_mode)) {
153 //Yes, we ignore current, parent & hidden directories
154 if (dirName[0] != L'.') {
155 LogDebug("Adding locale directory \"" << dirName << "\"");
156 m_localeFolders.insert(dirName);
164 LogError("readdir() failed with " << DPL::GetErrnoString());
167 if (-1 == TEMP_FAILURE_RETRY(closedir(localeDir))) {
168 LogError("Failed to close dir: " << localePath << " with error: "
169 << DPL::GetErrnoString());
173 void TaskWidgetConfig::ProcessLocalizedStartFiles()
175 typedef DPL::String S;
177 m_installContext.widgetConfig.configInfo.startFile,
178 m_installContext.widgetConfig.configInfo.
179 startFileContentType,
180 m_installContext.widgetConfig.configInfo.startFileEncoding,
182 ProcessStartFile(S(L"index.htm"), S(L"text/html"));
183 ProcessStartFile(S(L"index.html"), S(L"text/html"));
184 ProcessStartFile(S(L"index.svg"), S(L"image/svg+xml"));
185 ProcessStartFile(S(L"index.xhtml"), S(L"application/xhtml+xml"));
186 ProcessStartFile(S(L"index.xht"), S(L"application/xhtml+xml"));
187 // TODO: (l.wrzosek) we need better check if in current locales widget is valid.
188 FOREACH(it, m_installContext.widgetConfig.localizationData.startFiles) {
189 if (it->propertiesForLocales.size() > 0) {
193 ThrowMsg(Exceptions::WidgetConfigFileInvalid,
194 L"The Widget has no valid start file");
197 void TaskWidgetConfig::ProcessStartFile(const DPL::OptionalString& path,
198 const DPL::OptionalString& type,
199 const DPL::OptionalString& encoding,
200 bool typeForcedInConfig)
202 using namespace WrtDB;
205 WidgetRegisterInfo::LocalizedStartFile startFileData;
206 startFileData.path = *path;
208 FOREACH(i, m_localeFolders) {
209 DPL::String pathPrefix = *i;
210 if (!pathPrefix.empty()) {
211 pathPrefix = L"locales/" + pathPrefix + L"/";
214 DPL::String relativePath = pathPrefix + *path;
215 DPL::String absolutePath = DPL::FromUTF8String(
216 m_installContext.locations->getConfigurationDir()) + L"/" + relativePath;
218 // get property data from packaged app
219 if (WrtUtilFileExists(DPL::ToUTF8String(absolutePath))) {
220 WidgetRegisterInfo::StartFileProperties startFileProperties;
222 startFileProperties.type = *type;
224 startFileProperties.type =
225 MimeTypeUtils::identifyFileMimeType(absolutePath);
228 //proceed only if MIME type is supported
229 if (MimeTypeUtils::isMimeTypeSupportedForStartFile(
230 startFileProperties.type))
233 startFileProperties.encoding = *encoding;
235 MimeTypeUtils::MimeAttributes attributes =
236 MimeTypeUtils::getMimeAttributes(
237 startFileProperties.type);
238 if (attributes.count(L"charset") > 0) {
239 startFileProperties.encoding =
240 attributes[L"charset"];
242 startFileProperties.encoding = L"UTF-8";
246 startFileData.propertiesForLocales[*i] =
250 //(there seems to be no similar requirement in .6,
251 //so let's throw only when mime type is
252 // provided explcitly in config.xml)
253 if (typeForcedInConfig) {
254 ThrowMsg(Exceptions::WidgetConfigFileInvalid,
255 "Unsupported MIME type for start file.");
259 // set property data for hosted start url
260 // Hosted start url only support TIZEN WebApp
261 if (m_installContext.widgetConfig.webAppType ==
262 APP_TYPE_TIZENWEBAPP)
264 const char *startPath =
265 DPL::ToUTF8String(startFileData.path).c_str();
266 if (strstr(startPath, "http") == startPath) {
267 WidgetRegisterInfo::StartFileProperties
270 startFileProperties.type = *type;
273 startFileProperties.encoding = *encoding;
275 startFileData.propertiesForLocales[*i] =
282 m_installContext.widgetConfig.localizationData.startFiles.push_back(
287 void TaskWidgetConfig::ProcessBackgroundPageFile()
289 if (!!m_installContext.widgetConfig.configInfo.backgroundPage) {
290 // check whether file exists
291 DPL::String backgroundPagePath = DPL::FromUTF8String(
292 m_installContext.locations->getConfigurationDir()) + L"/" +
293 *m_installContext.widgetConfig.configInfo.backgroundPage;
294 //if no then cancel installation
295 if (!WrtUtilFileExists(DPL::ToUTF8String(backgroundPagePath))) {
296 ThrowMsg(Exceptions::WidgetConfigFileInvalid,
297 L"Given background page file not found in archive");
302 void TaskWidgetConfig::ProcessLocalizedIcons()
304 using namespace WrtDB;
305 ProcessIcon(ConfigParserData::Icon(L"icon.svg"));
306 ProcessIcon(ConfigParserData::Icon(L"icon.ico"));
307 ProcessIcon(ConfigParserData::Icon(L"icon.png"));
308 ProcessIcon(ConfigParserData::Icon(L"icon.gif"));
309 ProcessIcon(ConfigParserData::Icon(L"icon.jpg"));
311 FOREACH(i, m_installContext.widgetConfig.configInfo.iconsList)
317 void TaskWidgetConfig::ProcessIcon(const WrtDB::ConfigParserData::Icon& icon)
320 bool isAnyIconValid = false;
321 //In case a default filename is passed as custom filename in config.xml, we
322 //need to keep a set of already processed filenames to avoid icon duplication
325 using namespace WrtDB;
327 if (m_processedIconSet.count(icon.src) > 0) {
330 m_processedIconSet.insert(icon.src);
332 LocaleSet localesAvailableForIcon;
334 FOREACH(i, m_localeFolders)
336 DPL::String pathPrefix = *i;
337 if (!pathPrefix.empty()) {
338 pathPrefix = L"locales/" + pathPrefix + L"/";
341 DPL::String relativePath = pathPrefix + icon.src;
342 DPL::String absolutePath = DPL::FromUTF8String(
343 m_installContext.locations->getConfigurationDir()) + L"/" + relativePath;
345 if (WrtUtilFileExists(DPL::ToUTF8String(absolutePath))) {
346 DPL::String type = MimeTypeUtils::identifyFileMimeType(absolutePath);
348 if (MimeTypeUtils::isMimeTypeSupportedForIcon(type)) {
349 isAnyIconValid = true;
350 localesAvailableForIcon.insert(*i);
351 LogInfo("Icon absolutePath :" << absolutePath <<
352 ", assigned locale :" << *i << ", type: " << type);
359 WidgetRegisterInfo::LocalizedIcon localizedIcon(icon,
360 localesAvailableForIcon);
361 m_installContext.widgetConfig.localizationData.icons.push_back(
366 void TaskWidgetConfig::StepCancelWidgetInstallationAfterVerifyFeatures()
368 LogDebug("StepCancelWidgetInstallationAfterVerifyFeatures");
369 if (InfoPopupButton::WRT_POPUP_BUTTON_CANCEL == m_installCancel) {
370 m_installCancel = WRT_POPUP_BUTTON;
372 ThrowMsg(Exceptions::WidgetConfigFileInvalid, "Widget not allowed");
376 void TaskWidgetConfig::StepCancelWidgetInstallation()
378 if (InfoPopupButton::WRT_POPUP_BUTTON_CANCEL == m_installCancel) {
379 m_installCancel = WRT_POPUP_BUTTON;
381 ThrowMsg(Exceptions::NotAllowed, "Widget not allowed");
385 void TaskWidgetConfig::StepCancelWidgetInstallationAfterMinVersion()
387 if (InfoPopupButton::WRT_POPUP_BUTTON_CANCEL == m_installCancel) {
388 m_installCancel = WRT_POPUP_BUTTON;
390 ThrowMsg(Exceptions::NotAllowed, "WRT version incompatible.");
394 void TaskWidgetConfig::createInstallPopup(PopupType type, const std::string &label)
396 m_installContext.job->Pause();
400 bool ret = createPopup();
403 loadPopup( type, label);
408 void TaskWidgetConfig::StepDeletePopupWin()
413 void TaskWidgetConfig::StepShowWidgetInfo()
415 if (!m_popupData.widgetInfo.empty()) {
416 std::string label = DPL::ToUTF8String(m_popupData.widgetInfo);
417 createInstallPopup(PopupType::WIDGET_FEATURE_INFO, label);
418 m_installContext.job->UpdateProgress(
419 InstallerContext::INSTALL_WIDGET_CONFIG2,
420 "Show Widget Info Finished");
424 void TaskWidgetConfig::StepCheckMinVersionInfo()
426 if (!isMinVersionCompatible(
427 m_installContext.widgetConfig.webAppType.appType,
428 m_installContext.widgetConfig.minVersion)) {
429 std::string label = WIDGET_NOT_COMPATIBLE + QUESTION;
430 createInstallPopup(PopupType::WIDGET_MIN_VERSION, label);
433 m_installContext.job->UpdateProgress(
434 InstallerContext::INSTALL_WIDGET_CONFIG2,
435 "Check MinVersion Finished");
438 void TaskWidgetConfig::StepVerifyFeatures()
440 using namespace WrtDB;
441 ConfigParserData &data = m_installContext.widgetConfig.configInfo;
442 ConfigParserData::FeaturesList list = data.featuresList;
443 ConfigParserData::FeaturesList newList;
445 //in case of tests, this variable is unused
446 std::string featureInfo;
449 // check feature vender for permission
450 // WAC, TIZEN WebApp cannot use other feature
452 if (!isFeatureAllowed(m_installContext.widgetConfig.webAppType.appType,
455 LogInfo("This application type not allowed to use this feature");
457 Exceptions::WidgetConfigFileInvalid,
459 m_installContext.widgetConfig.webAppType.getApptypeToString() <<
460 "] cannot be allowed to use [" <<
461 DPL::ToUTF8String(it->name) + "] feature");
463 if (!WrtDB::FeatureDAOReadOnly::isFeatureInstalled(
464 DPL::ToUTF8String(it->name))) {
465 LogWarning("Feature not found. Checking if required :[" <<
466 DPL::ToUTF8String(it->name) << "]");
470 * WL-3210 The WRT MUST inform the user if a widget cannot be
471 * installed because one or more required features are not
474 std::ostringstream os;
475 os << "Widget cannot be installed, required feature is missing:["
476 << DPL::ToUTF8String(it->name) << "]";
477 if (!GlobalSettings::TestModeEnabled() && !isTizenWebApp()) {
478 std::string label = os.str();
479 createInstallPopup(PopupType::WIDGET_WRONG_FEATURE_INFO, label);
481 ThrowMsg(Exceptions::WidgetConfigFileInvalid, os.str());
485 featureInfo += DPL::ToUTF8String(it->name);
486 featureInfo += DPL::ToUTF8String(BR);
489 if(!data.accessInfoSet.empty()) {
490 featureInfo += WINDGET_INSTALL_NETWORK_ACCESS;
491 featureInfo += DPL::ToUTF8String(BR);
493 data.featuresList = newList;
494 if (!featureInfo.empty()) {
495 m_popupData.addWidgetInfo(DPL::FromUTF8String(featureInfo));
498 m_installContext.job->UpdateProgress(
499 InstallerContext::INSTALL_WIDGET_CONFIG2,
500 "Widget Config step2 Finished");
503 void TaskWidgetConfig::setApplicationType()
505 using namespace WrtDB;
506 WidgetRegisterInfo* widgetInfo = &(m_installContext.widgetConfig);
507 ConfigParserData* configInfo = &(widgetInfo->configInfo);
509 FOREACH(iterator, configInfo->nameSpaces) {
510 LogInfo("namespace = [" << *iterator << "]");
511 AppType currentAppType = APP_TYPE_UNKNOWN;
513 if (*iterator == ConfigurationNamespace::W3CWidgetNamespaceName) {
517 ConfigurationNamespace::WacWidgetNamespaceNameForLinkElement ||
519 ConfigurationNamespace::WacWidgetNamespaceName)
521 currentAppType = APP_TYPE_WAC20;
522 } else if (*iterator == ConfigurationNamespace::TizenWebAppNamespaceName) {
523 currentAppType = APP_TYPE_TIZENWEBAPP;
526 if (widgetInfo->webAppType == APP_TYPE_UNKNOWN) {
527 widgetInfo->webAppType = currentAppType;
528 } else if (widgetInfo->webAppType == currentAppType) {
531 ThrowMsg(Exceptions::WidgetConfigFileInvalid,
532 "Config.xml has more than one namespace");
536 // If there is no define, type set to WAC 2.0
537 if (widgetInfo->webAppType == APP_TYPE_UNKNOWN) {
538 widgetInfo->webAppType = APP_TYPE_WAC20;
541 LogInfo("type = [" << widgetInfo->webAppType.getApptypeToString() << "]");
544 bool TaskWidgetConfig::isFeatureAllowed(WrtDB::AppType appType,
545 DPL::String featureName)
547 using namespace WrtDB;
548 LogInfo("AppType = [" <<
549 WidgetType(appType).getApptypeToString() << "]");
550 LogInfo("FetureName = [" << featureName << "]");
552 AppType featureType = APP_TYPE_UNKNOWN;
553 const char* feature = DPL::ToUTF8String(featureName).c_str();
554 // check prefix of feature name
555 if (strstr(feature, PluginsPrefix::TIZENPluginsPrefix) == feature) {
556 // Tizen WebApp feature
557 featureType = APP_TYPE_TIZENWEBAPP;
558 } else if (strstr(feature, PluginsPrefix::WACPluginsPrefix) == feature) {
560 featureType = APP_TYPE_WAC20;
561 } else if (strstr(feature, PluginsPrefix::W3CPluginsPrefix) == feature) {
562 // W3C standard feature
563 // Both WAC and TIZEN WebApp are possible to use W3C plugins
567 // unknown feature will be checked next step
571 if (appType == featureType) {
577 bool TaskWidgetConfig::parseVersionString(const std::string &version,
578 long &majorVersion, long &minorVersion, long µVersion) const
580 std::istringstream inputString(version);
581 inputString >> majorVersion;
582 if (inputString.bad() || inputString.fail()) {
583 LogWarning("Invalid minVersion format.");
586 inputString.get(); // skip period
587 inputString >> minorVersion;
588 if (inputString.bad() || inputString.fail()) {
589 LogWarning("Invalid minVersion format");
592 inputString.get(); // skip period
593 if (inputString.bad() || inputString.fail()) {
594 inputString >> microVersion;
600 bool TaskWidgetConfig::isMinVersionCompatible(WrtDB::AppType appType,
601 const DPL::OptionalString &widgetVersion) const
603 if (widgetVersion.IsNull() || (*widgetVersion).empty())
605 LogWarning("minVersion attribute is empty. WRT assumes platform "
606 "supports this widget.");
610 //Parse widget version
611 long majorWidget = 0, minorWidget = 0, microWidget = 0;
612 if (!parseVersionString(DPL::ToUTF8String(*widgetVersion), majorWidget,
613 minorWidget, microWidget)) {
614 LogWarning("Invalid format of widget version string.");
618 //Parse supported version
619 long majorSupported = 0, minorSupported = 0, microSupported = 0;
621 if (appType == WrtDB::AppType::APP_TYPE_TIZENWEBAPP) {
622 version = WrtDB::GlobalConfig::GetTizenVersion();
623 } else if (appType == WrtDB::AppType::APP_TYPE_WAC20) {
624 version = WrtDB::GlobalConfig::GetWACVersion();
626 LogWarning("Invaild AppType");
630 if (!parseVersionString(version,
631 majorSupported, minorSupported, microSupported)) {
632 LogWarning("Invalid format of WAC version string.");
636 if (majorWidget > majorSupported ||
637 minorWidget > minorSupported ||
638 microWidget > microSupported) {
639 LogInfo("Platform doesn't support this widget.");
645 bool TaskWidgetConfig::isTizenWebApp() const
648 if (m_installContext.widgetConfig.webAppType.appType
649 == WrtDB::AppType::APP_TYPE_TIZENWEBAPP)
655 bool TaskWidgetConfig::parseConfigurationFileBrowser(WrtDB::ConfigParserData& configInfo,
656 const std::string& _currentPath, int* pErrCode)
661 parser.Parse(_currentPath, ElementParserPtr(new
665 DPL::FromUTF32String(
668 Catch(ElementParser::Exception::Base)
670 LogError("Invalid widget configuration file!");
671 *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
677 bool TaskWidgetConfig::parseConfigurationFileWidget(WrtDB::ConfigParserData& configInfo,
678 const std::string& _currentPath, int* pErrCode)
682 //TODO: rewrite this madness
683 std::string cfgAbsPath;
685 struct dirent* ptr = NULL;
687 dir = opendir(_currentPath.c_str());
689 *pErrCode = WRT_ERR_UNKNOWN;
692 bool has_config_xml = false;
694 while ((ptr = readdir(dir)) != NULL) { //Find configuration file, based on its name
695 if (ptr->d_type == DT_REG) {
696 if (!strcmp(ptr->d_name, WRT_WIDGET_CONFIG_FILE_NAME)) {
697 std::string dName(ptr->d_name);
698 WrtUtilJoinPaths(cfgAbsPath, _currentPath, dName);
700 //Parse widget configuration file
701 LogDebug("Found config: " << cfgAbsPath);
705 parser.Parse(cfgAbsPath, ElementParserPtr(new
714 Catch(ElementParser::Exception::Base)
716 LogError("Invalid widget configuration file!");
717 // _rethrown_exception.Dump();
718 *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
719 if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
720 LogError("Failed to close dir: " << _currentPath << " with error: "
721 << DPL::GetErrnoString());
726 has_config_xml = true;
731 if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
732 LogError("Failed to close dir: " << _currentPath << " with error: "
733 << DPL::GetErrnoString());
736 //We must have config.xml so leaveing if we doesn't
737 if (!has_config_xml) {
738 LogError("Invalid archive");
739 *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
745 bool TaskWidgetConfig::locateAndParseConfigurationFile(
746 const std::string& _currentPath,
747 WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
748 const std::string& baseFolder,
751 using namespace WrtDB;
757 ConfigParserData& configInfo = pWidgetConfigInfo.configInfo;
759 // check if this installation from browser, or not.
760 size_t pos = _currentPath.rfind("/");
761 std::ostringstream infoPath;
762 infoPath << _currentPath.substr(pos+1);
764 if (infoPath.str() != WRT_WIDGET_CONFIG_FILE_NAME) {
765 if (_currentPath.empty() || baseFolder.empty()) {
766 *pErrCode = WRT_ERR_INVALID_ARG;
769 // in case of general installation using wgt archive
770 if(!parseConfigurationFileWidget(configInfo, _currentPath, pErrCode))
775 // in case of browser installation
776 if(!parseConfigurationFileBrowser(configInfo, _currentPath, pErrCode))
782 if(!fillWidgetConfig(pWidgetConfigInfo, configInfo))
784 *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
790 bool TaskWidgetConfig::fillWidgetConfig(WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
791 WrtDB::ConfigParserData& configInfo)
793 if (!!configInfo.widget_id) {
794 if (!pWidgetConfigInfo.guid) {
795 pWidgetConfigInfo.guid = configInfo.widget_id;
797 if (pWidgetConfigInfo.guid != configInfo.widget_id) {
798 LogError("Invalid archive");
803 if (!!configInfo.tizenId) {
804 if (!pWidgetConfigInfo.pkgname) {
805 pWidgetConfigInfo.pkgname = configInfo.tizenId;
807 if (pWidgetConfigInfo.pkgname != configInfo.tizenId) {
808 LogError("Invalid archive - Tizen ID not same error");
813 if (!!configInfo.version) {
814 if (!pWidgetConfigInfo.version) {
815 pWidgetConfigInfo.version = configInfo.version;
817 if (pWidgetConfigInfo.version != configInfo.version) {
818 LogError("Invalid archive");
823 if (!!configInfo.minVersionRequired) {
824 pWidgetConfigInfo.minVersion = configInfo.minVersionRequired;
825 } else if (!!configInfo.tizenMinVersionRequired) {
826 pWidgetConfigInfo.minVersion = configInfo.tizenMinVersionRequired;
831 void TaskWidgetConfig::processFile(const std::string& path,
832 WrtDB::WidgetRegisterInfo &widgetConfiguration)
836 if (!locateAndParseConfigurationFile(path, widgetConfiguration,
837 DEFAULT_LANGUAGE, &pErrCode)) {
838 LogWarning("Widget archive: Failed while parsing config file");
839 ThrowMsg(Exception::ConfigParseFailed, path);
843 } //namespace WidgetInstall