+void TaskManifestFile::setMetadata(UiApplication &uiApp)
+{
+ WrtDB::ConfigParserData::MetadataList metadataList =
+ m_context.widgetConfig.configInfo.metadataList;
+
+ if (metadataList.empty()) {
+ LogInfo("Web application doesn't contain metadata");
+ return;
+ }
+ FOREACH(it, metadataList) {
+ MetadataType metadataType(it->key, it->value);
+ uiApp.addMetadata(metadataType);
+ }
+}
+
+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(Exceptions::ManifestInvalid, "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 appid = m_context.widgetConfig.tzAppid;
+
+ if (ConfigInfo->m_liveboxId != L"") {
+ size_t found = ConfigInfo->m_liveboxId.find_last_of(L".");
+ if (found != std::string::npos) {
+ if (0 == ConfigInfo->m_liveboxId.compare(0, found, appid)) {
+ liveBox.setLiveboxId(ConfigInfo->m_liveboxId);
+ } else {
+ DPL::String liveboxId =
+ appid + DPL::String(L".") + ConfigInfo->m_liveboxId;
+ liveBox.setLiveboxId(liveboxId);
+ }
+ } else {
+ DPL::String liveboxId =
+ appid + DPL::String(L".") + ConfigInfo->m_liveboxId;
+ liveBox.setLiveboxId(liveboxId);
+ }
+ }
+
+ if (ConfigInfo->m_primary != L"") {
+ liveBox.setPrimary(ConfigInfo->m_primary);
+ }
+
+ 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;
+ }
+ }
+
+ if (ConfigInfo->m_boxInfo.m_boxMouseEvent == L"true") {
+ std::string boxType;
+ if (ConfigInfo->m_type == L"") {
+ // in case of default livebox
+ boxType = web_provider_livebox_get_default_type();
+ } else {
+ boxType = DPL::ToUTF8String(ConfigInfo->m_type);
+ }
+
+ int box_scrollable =
+ web_provider_plugin_get_box_scrollable(boxType.c_str());
+
+ if (box_scrollable) {
+ box.boxMouseEvent = L"true";
+ } else {
+ box.boxMouseEvent = L"false";
+ }
+ } else {
+ box.boxMouseEvent = L"false";
+ }
+
+ if (ConfigInfo->m_boxInfo.m_boxTouchEffect == L"true") {
+ box.boxTouchEffect = L"true";
+ } else {
+ box.boxTouchEffect= L"false";
+ }
+
+ 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())
+ {
+ if ((0 == ConfigInfo->m_boxInfo.m_pdSrc.compare(0, 4, L"http"))
+ || (0 == ConfigInfo->m_boxInfo.m_pdSrc.compare(0, 5, L"https")))
+ {
+ box.pdSrc = ConfigInfo->m_boxInfo.m_pdSrc;
+ } else {
+ 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);
+ }
+}
+
+void TaskManifestFile::setAccount(Manifest& manifest)
+{
+ WrtDB::ConfigParserData::AccountProvider account =
+ m_context.widgetConfig.configInfo.accountProvider;
+
+ AccountProviderType provider;
+
+ if (account.m_iconSet.empty()) {
+ LogInfo("Widget doesn't contain Account");
+ return;
+ }
+ if (account.m_multiAccountSupport) {
+ provider.multiAccount = L"ture";
+ } else {
+ provider.multiAccount = L"false";
+ }
+ provider.appid = m_context.widgetConfig.tzAppid;
+
+ FOREACH(it, account.m_iconSet) {
+ std::pair<DPL::String, DPL::String> icon;
+
+ if (it->first == ConfigParserData::IconSectionType::DefaultIcon) {
+ icon.first = L"account";
+ } else if (it->first == ConfigParserData::IconSectionType::SmallIcon) {
+ icon.first = L"account-small";
+ }
+ icon.second = it->second;
+
+ provider.icon.push_back(icon);
+ }
+
+ FOREACH(it, account.m_displayNameSet) {
+ provider.name.push_back(LabelType(it->second, it->first));
+ }
+
+ FOREACH(it, account.m_capabilityList) {
+ provider.capability.push_back(*it);
+ }
+
+ Account accountInfo;
+ accountInfo.addAccountProvider(provider);
+ manifest.addAccount(accountInfo);
+}
+
+void TaskManifestFile::setPrivilege(Manifest& manifest)
+{
+ WrtDB::ConfigParserData::PrivilegeList privileges =
+ m_context.widgetConfig.configInfo.privilegeList;
+
+ PrivilegeType privilege;
+
+ FOREACH(it, privileges)
+ {
+ privilege.addPrivilegeName(it->name);
+ }
+
+ manifest.addPrivileges(privilege);
+}
+