namespace {
typedef std::map<DPL::String, DPL::String> LanguageTagMap;
+const char* const ST_TRUE = "true";
+const char* const ST_NODISPLAY = "nodisplay";
+
LanguageTagMap getLanguageTagMap()
{
LanguageTagMap map;
AddStep(&TaskManifestFile::stepGenerateManifest);
AddStep(&TaskManifestFile::stepParseManifest);
AddStep(&TaskManifestFile::stepFinalize);
+
+ AddAbortStep(&TaskManifestFile::stepAbortParseManifest);
} else {
// for widget update.
AddStep(&TaskManifestFile::stepBackupIconFiles);
targetFile << GlobalConfig::GetUserWidgetDesktopIconPath() << "/";
targetFile << getIconTargetFilename(*locale);
- if (m_context.locations->browserRequest())
- {
+
+ if (m_context.widgetConfig.packagingType ==
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP) {
m_context.locations->setIconTargetFilenameForLocale(targetFile.str());
}
if (AIL_ERROR_NO_DATA == ret) {
if (ail_desktop_add(pkgname) < 0) {
- LogDebug("Failed to add ail desktop : " << pkgname);
+ LogWarning("Failed to add ail desktop : " << pkgname);
}
} else if (AIL_ERROR_OK == ret) {
if (ail_desktop_update(pkgname) < 0) {
- LogDebug("Failed to update ail desktop : " << pkgname);
+ LogWarning("Failed to update ail desktop : " << pkgname);
}
}
}
setWidgetManifest(manifest);
setWidgetOtherInfo(uiApp);
setAppServiceInfo(uiApp);
+ setAppCategory(uiApp);
+ setLiveBoxInfo(manifest);
manifest.addUiApplication(uiApp);
manifest.generate(path);
void TaskManifestFile::setWidgetOtherInfo(UiApplication & uiApp)
{
- uiApp.setNodisplay(false);
+ FOREACH(it, m_context.widgetConfig.configInfo.settingsList)
+ {
+ if(!strcmp(DPL::ToUTF8String(it->m_name).c_str(), ST_NODISPLAY)) {
+ if(!strcmp(DPL::ToUTF8String(it->m_value).c_str(), ST_TRUE)) {
+ uiApp.setNodisplay(true);
+ }
+ else {
+ uiApp.setNodisplay(false);
+ }
+ }
+ }
//TODO
//There is no "X-TIZEN-PackageType=wgt"
//There is no X-TIZEN-PackageID in manifest "X-TIZEN-PackageID=" << DPL::ToUTF8String(*widgetID).c_str()
// x-tizen-svc=http://tizen.org/appcontrol/operation/pick|NULL|image;
FOREACH(it, appServiceList) {
- ApplicationService appService;
+ AppControl appControl;
if (!it->m_operation.empty()) {
- appService.addOperation(it->m_operation); //TODO: encapsulation?
+ appControl.addOperation(it->m_operation); //TODO: encapsulation?
}
if (!it->m_scheme.empty()) {
- appService.addUri(it->m_scheme);
+ appControl.addUri(it->m_scheme);
}
if (!it->m_mime.empty()) {
- appService.addMime(it->m_mime);
+ appControl.addMime(it->m_mime);
}
- uiApp.addApplicationService(appService);
+ uiApp.addAppControl(appControl);
+ }
+}
+
+void TaskManifestFile::setAppCategory(UiApplication &uiApp)
+{
+ WrtDB::ConfigParserData::CategoryList categoryList =
+ m_context.widgetConfig.configInfo.categoryList;
+
+ if (categoryList.empty()) {
+ LogInfo("Widget doesn't contain application category");
+ return;
+ }
+ FOREACH(it, categoryList) {
+ if (!(*it).empty()) {
+ uiApp.addAppCategory(*it);
+ }
+ }
+}
+
+void TaskManifestFile::stepAbortParseManifest()
+{
+ LogError("[Parse Manifest] Abroting....");
+
+ int code = pkgmgr_parser_parse_manifest_for_uninstallation(
+ DPL::ToUTF8String(manifest_file).c_str(), NULL);
+
+ if (0 != code)
+ {
+ LogWarning("Manifest parser error: " << code);
+ ThrowMsg(ManifestParsingError, "Parser returncode: " << code);
+ }
+ int ret = unlink(DPL::ToUTF8String(manifest_file).c_str());
+ if (0 != ret)
+ {
+ LogWarning("No manifest file found: " << manifest_file);
}
}
+void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
+{
+ FOREACH(it, m_context.widgetConfig.configInfo.m_livebox) {
+ LogInfo("setLiveBoxInfo");
+ LiveBoxInfo liveBox;
+ DPL::Optional<WrtDB::ConfigParserData::LiveboxInfo> ConfigInfo = *it;
+ DPL::String pkgname = *m_context.widgetConfig.pkgname;
+ size_t found;
+
+ if(ConfigInfo->m_liveboxId != L"") {
+ found = ConfigInfo->m_liveboxId.find_first_of(L".");
+ if(found != std::string::npos) {
+ if(0 == ConfigInfo->m_liveboxId.compare(0, found, pkgname))
+ liveBox.setLiveboxId(ConfigInfo->m_liveboxId);
+ else {
+ DPL::String liveboxId =
+ pkgname+DPL::String(L".")+ConfigInfo->m_liveboxId;
+ liveBox.setLiveboxId(liveboxId);
+ }
+ } else {
+ DPL::String liveboxId =
+ pkgname+DPL::String(L".")+ConfigInfo->m_liveboxId;
+ liveBox.setLiveboxId(liveboxId);
+ }
+ }
+
+ if(ConfigInfo->m_primary != L"")
+ liveBox.setPrimary(ConfigInfo->m_primary);
+
+ if(ConfigInfo->m_autoLaunch == L"true")
+ liveBox.setAutoLaunch(pkgname);
+
+ if(ConfigInfo->m_updatePeriod != L"")
+ liveBox.setUpdatePeriod(ConfigInfo->m_updatePeriod);
+
+ if(ConfigInfo->m_label != L"")
+ liveBox.setLabel(ConfigInfo->m_label);
+
+ DPL::String defaultLocale
+ = DPL::FromUTF8String(m_context.locations->getPackageInstallationDir())
+ + DPL::String(L"/res/wgt/");
+
+ if(ConfigInfo->m_icon!=L"") {
+ liveBox.setIcon(defaultLocale+ConfigInfo->m_icon);
+ }
+
+ if (ConfigInfo->m_boxInfo.m_boxSrc.empty() || ConfigInfo->m_boxInfo.m_boxSize.empty()) {
+ LogInfo("Widget doesn't contain box");
+ return;
+ } else {
+ BoxInfoType box;
+ if (!ConfigInfo->m_boxInfo.m_boxSrc.empty()) {
+ if((0 == ConfigInfo->m_boxInfo.m_boxSrc.compare(0, 4, L"http"))
+ || (0 == ConfigInfo->m_boxInfo.m_boxSrc.compare(0, 5, L"https")))
+ box.boxSrc = ConfigInfo->m_boxInfo.m_boxSrc;
+ else
+ box.boxSrc = defaultLocale + ConfigInfo->m_boxInfo.m_boxSrc;
+ }
+
+ std::list<std::pair<DPL::String,DPL::String>> BoxSizeList
+ = ConfigInfo->m_boxInfo.m_boxSize;
+ FOREACH(im, BoxSizeList) {
+ std::pair<DPL::String, DPL::String> boxSize = *im;
+ if(!boxSize.second.empty())
+ boxSize.second = defaultLocale + boxSize.second;
+ box.boxSize.push_back(boxSize);
+ }
+
+ if (!ConfigInfo->m_boxInfo.m_pdSrc.empty()
+ && !ConfigInfo->m_boxInfo.m_pdWidth.empty()
+ && !ConfigInfo->m_boxInfo.m_pdHeight.empty()) {
+ box.pdSrc = defaultLocale + ConfigInfo->m_boxInfo.m_pdSrc;
+ box.pdWidth = ConfigInfo->m_boxInfo.m_pdWidth;
+ box.pdHeight = ConfigInfo->m_boxInfo.m_pdHeight;
+ }
+
+ liveBox.setBox(box);
+ }
+
+ manifest.addLivebox(liveBox);
+ }
+
+}
+
} //namespace WidgetInstall
} //namespace Jobs