*/
//SYSTEM INCLUDES
+#include <unistd.h>
#include <string>
#include <dpl/assert.h>
#include <dirent.h>
#include <widget_install/job_widget_install.h>
#include <widget_install/widget_install_errors.h>
#include <widget_install/widget_install_context.h>
+#include <web_provider_livebox_info.h>
+#include <web_provider_plugin_info.h>
#include <dpl/wrt-dao-ro/global_config.h>
#include <dpl/log/log.h>
#include <dpl/file_input.h>
TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
DPL::TaskDecl<TaskManifestFile>(this),
- m_context(inCont)
+ m_context(inCont),
+ writer(NULL)
{
- if (false == m_context.existingWidgetInfo.isExist) {
- AddStep(&TaskManifestFile::stepCopyIconFiles);
- AddStep(&TaskManifestFile::stepCreateExecFile);
- AddStep(&TaskManifestFile::stepGenerateManifest);
- AddStep(&TaskManifestFile::stepParseManifest);
- AddStep(&TaskManifestFile::stepFinalize);
-
- AddAbortStep(&TaskManifestFile::stepAbortParseManifest);
- } else {
+ if (m_context.isUpdateMode) {
// for widget update.
AddStep(&TaskManifestFile::stepBackupIconFiles);
AddStep(&TaskManifestFile::stepCopyIconFiles);
+ AddStep(&TaskManifestFile::stepCopyLiveboxFiles);
+ AddStep(&TaskManifestFile::stepCreateExecFile);
AddStep(&TaskManifestFile::stepGenerateManifest);
AddStep(&TaskManifestFile::stepParseUpgradedManifest);
AddStep(&TaskManifestFile::stepUpdateFinalize);
AddAbortStep(&TaskManifestFile::stepAbortIconFiles);
+ } else {
+ AddStep(&TaskManifestFile::stepCopyIconFiles);
+ AddStep(&TaskManifestFile::stepCopyLiveboxFiles);
+ AddStep(&TaskManifestFile::stepCreateExecFile);
+ AddStep(&TaskManifestFile::stepGenerateManifest);
+ AddStep(&TaskManifestFile::stepParseManifest);
+ AddStep(&TaskManifestFile::stepFinalize);
+
+ AddAbortStep(&TaskManifestFile::stepAbortParseManifest);
}
}
std::string exec = m_context.locations->getExecFile();
std::string clientExeStr = GlobalConfig::GetWrtClientExec();
- LogInfo("link -s " << clientExeStr << " " << exec);
- symlink(clientExeStr.c_str(), exec.c_str());
+#ifdef MULTIPROCESS_SERVICE_SUPPORT
+ //default widget
+ std::stringstream postfix;
+ postfix << AppControlPrefix::PROCESS_PREFIX << 0;
+ std::string controlExec = exec;
+ controlExec.append(postfix.str());
+
+ errno = 0;
+ if (symlink(clientExeStr.c_str(), controlExec.c_str()) != 0)
+ {
+ int error = errno;
+ if (error)
+ LogPedantic("Failed to make a symbolic name for a file "
+ << "[" << DPL::GetErrnoString(error) << "]");
+ ThrowMsg(Exceptions::FileOperationFailed,
+ "Symbolic link creating is not done.");
+ }
+
+ // app-control widgets
+ unsigned int indexMax = 0;
+ FOREACH(it, m_context.widgetConfig.configInfo.appControlList) {
+ if (it->m_index > indexMax) {
+ indexMax = it->m_index;
+ }
+ }
+ for (std::size_t i = 1; i <= indexMax; ++i) {
+ std::stringstream postfix;
+ postfix << AppControlPrefix::PROCESS_PREFIX << i;
+ std::string controlExec = exec;
+ controlExec.append(postfix.str());
+ errno = 0;
+ if (symlink(clientExeStr.c_str(), controlExec.c_str()) != 0) {
+ int error = errno;
+ if (error) {
+ LogPedantic("Failed to make a symbolic name for a file "
+ << "[" << DPL::GetErrnoString(error) << "]");
+ }
+ ThrowMsg(Exceptions::FileOperationFailed,
+ "Symbolic link creating is not done.");
+ }
+ }
+#else
+ //default widget
+ LogInfo("link -s " << clientExeStr << " " << exec);
+ errno = 0;
+ if (symlink(clientExeStr.c_str(), exec.c_str()) != 0)
+ {
+ int error = errno;
+ if (error)
+ LogPedantic("Failed to make a symbolic name for a file "
+ << "[" << DPL::GetErrnoString(error) << "]");
+ ThrowMsg(Exceptions::FileOperationFailed,
+ "Symbolic link creating is not done.");
+ }
+#endif
m_context.job->UpdateProgress(
- InstallerContext::INSTALL_CREATE_EXECFILE,
- "Widget execfile creation Finished");
+ InstallerContext::INSTALL_CREATE_EXECFILE,
+ "Widget execfile creation Finished");
}
void TaskManifestFile::stepCopyIconFiles()
for (WrtDB::WidgetRegisterInfo::LocalizedIconList::const_reverse_iterator
icon = icons.rbegin();
icon != icons.rend();
- icon++)
+ ++icon)
{
FOREACH(locale, icon->availableLocales)
{
"Widget iconfile copy Finished");
}
+void TaskManifestFile::stepCopyLiveboxFiles()
+{
+ LogDebug("Copy Livebox Files");
+
+ using namespace WrtDB;
+ ConfigParserData &data = m_context.widgetConfig.configInfo;
+ ConfigParserData::LiveboxList liveBoxList = data.m_livebox;
+
+ if (liveBoxList.size() <= 0) {
+ return;
+ }
+
+ std::ostringstream sourceFile;
+ std::ostringstream targetFile;
+
+ FOREACH (boxIt, liveBoxList) {
+ boxSizeType boxSizeList = (**boxIt).m_boxInfo.m_boxSize;
+ FOREACH (sizeIt, boxSizeList) {
+ std::string preview = DPL::ToUTF8String((*sizeIt).second);
+ if (preview.empty()) {
+ continue;
+ }
+ // copy preview image to shared directory
+ sourceFile << m_context.locations->getSourceDir() << "/";
+ sourceFile << preview;
+ targetFile << m_context.locations->getSharedDataDir() << "/";
+ targetFile << (**boxIt).m_liveboxId << ".";
+ targetFile << DPL::ToUTF8String((*sizeIt).first) << ".preview.png";
+
+ DPL::FileInput input(sourceFile.str());
+ DPL::FileOutput output(targetFile.str());
+ DPL::Copy(&input, &output);
+
+ // clear stream objects
+ sourceFile.str("");
+ targetFile.str("");
+ }
+ // check this livebox has icon element
+ std::string icon = DPL::ToUTF8String((**boxIt).m_icon);
+ if (icon.empty()) {
+ continue;
+ }
+ // copy icon to shared directory
+ sourceFile << m_context.locations->getSourceDir() << "/";
+ sourceFile << icon;
+ targetFile << m_context.locations->getSharedDataDir() << "/";
+ targetFile << (**boxIt).m_liveboxId << ".icon.png";
+
+ DPL::FileInput input(sourceFile.str());
+ DPL::FileOutput output(targetFile.str());
+ DPL::Copy(&input, &output);
+
+ // clear stream objects
+ sourceFile.str("");
+ targetFile.str("");
+ }
+
+ m_context.job->UpdateProgress(
+ InstallerContext::INSTALL_COPY_LIVEBOX_FILES,
+ "Livebox files copy Finished");
+}
+
void TaskManifestFile::stepBackupIconFiles()
{
LogDebug("Backup Icon Files");
- backup_dir << m_context.locations->getPackageInstallationDir();
- backup_dir << "/" << "backup" << "/";
+ backup_dir << m_context.locations->getBackupDir() << "/";
backupIconFiles();
file << "=";
}
-void TaskManifestFile::updateAilInfo()
-{
- // Update ail for desktop
- std::string cfgAppid =
- DPL::ToUTF8String(m_context.widgetConfig.tzAppid);
- const char* appid = cfgAppid.c_str();
-
- LogDebug("Update ail desktop : " << appid);
- ail_appinfo_h ai = NULL;
- ail_error_e ret;
-
- ret = ail_package_get_appinfo(appid, &ai);
- if (ai) {
- ail_package_destroy_appinfo(ai);
- }
-
- if (AIL_ERROR_NO_DATA == ret) {
- if (ail_desktop_add(appid) < 0) {
- LogWarning("Failed to add ail desktop : " << appid);
- }
- } else if (AIL_ERROR_OK == ret) {
- if (ail_desktop_update(appid) < 0) {
- LogWarning("Failed to update ail desktop : " << appid);
- }
- }
-}
-
void TaskManifestFile::backupIconFiles()
{
LogInfo("Backup Icon Files");
DIR* dir = opendir(path);
if (!dir) {
LogError("icon directory doesn't exist");
- ThrowMsg(Exceptions::InternalError, path);
+ ThrowMsg(Exceptions::FileOperationFailed, path);
}
- struct dirent* d_ent;
- do {
- if ((d_ent = readdir(dir))) {
- if (strcmp(d_ent->d_name, ".") == 0 ||
- strcmp(d_ent->d_name, "..") == 0)
- {
- continue;
- }
- std::string file_name = d_ent->d_name;
- list.push_back(file_name);
+ struct dirent entry;
+ struct dirent *result;
+ int return_code;
+ errno = 0;
+ for (return_code = readdir_r(dir, &entry, &result);
+ result != NULL && return_code == 0;
+ return_code = readdir_r(dir, &entry, &result))
+ {
+ if (strcmp(entry.d_name, ".") == 0 ||
+ strcmp(entry.d_name, "..") == 0)
+ {
+ continue;
}
- } while (d_ent);
+ std::string file_name = entry.d_name;
+ list.push_back(file_name);
+ }
+
+ if (return_code != 0 || errno != 0) {
+ LogError("readdir_r() failed with " << DPL::GetErrnoString());
+ }
+
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
LogError("Failed to close dir: " << path << " with error: "
<< DPL::GetErrnoString());
if (code != 0) {
LogError("Manifest parser error: " << code);
- ThrowMsg(ManifestParsingError, "Parser returncode: " << code);
+ ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
}
- // TODO : It will be removed. AIL update is temporary code request by pkgmgr
- // team.
- updateAilInfo();
-
m_context.job->UpdateProgress(
InstallerContext::INSTALL_CREATE_MANIFEST,
"Widget Manifest Parsing Finished");
void TaskManifestFile::stepParseUpgradedManifest()
{
- int code = pkgmgr_parser_parse_manifest_for_upgrade(
- DPL::ToUTF8String(manifest_file).c_str(), NULL);
-
- if (code != 0) {
- LogError("Manifest parser error: " << code);
- ThrowMsg(ManifestParsingError, "Parser returncode: " << code);
- }
+ if (m_context.widgetConfig.packagingType !=
+ PKG_TYPE_HYBRID_WEB_APP)
+ {
+ int code = pkgmgr_parser_parse_manifest_for_upgrade(
+ DPL::ToUTF8String(manifest_file).c_str(), NULL);
- // TODO : It will be removed. AIL update is temporary code request by pkgmgr
- // team.
- updateAilInfo();
+ if (code != 0) {
+ LogError("Manifest parser error: " << code);
+ ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
+ }
- m_context.job->UpdateProgress(
- InstallerContext::INSTALL_CREATE_MANIFEST,
- "Widget Manifest Parsing Finished");
- LogDebug("Manifest parsed");
+ m_context.job->UpdateProgress(
+ InstallerContext::INSTALL_CREATE_MANIFEST,
+ "Widget Manifest Parsing Finished");
+ LogDebug("Manifest parsed");
+ }
}
void TaskManifestFile::commitManifest()
LogDebug("Commiting manifest file : " << manifest_file);
std::ostringstream destFile;
- destFile << "/opt/share/packages" << "/"; //TODO constant with path
+ if (m_context.mode.rootPath == InstallMode::RootPath::RO) {
+ destFile << "/usr/share/packages" << "/"; //TODO constant with path
+ } else {
+ destFile << "/opt/share/packages" << "/"; //TODO constant with path
+ }
destFile << DPL::ToUTF8String(manifest_name);
LogInfo("cp " << manifest_file << " " << destFile.str());
Manifest manifest;
UiApplication uiApp;
+#ifdef MULTIPROCESS_SERVICE_SUPPORT
+ //default widget content
+ std::stringstream postfix;
+ // index 0 is reserved
+ postfix << AppControlPrefix::PROCESS_PREFIX << 0;
+ setWidgetExecPath(uiApp, postfix.str());
+ setWidgetName(manifest, uiApp);
+ setWidgetIds(manifest, uiApp);
+ setWidgetIcons(uiApp);
+ setWidgetDescription(manifest);
+ setWidgetManifest(manifest);
+ setWidgetOtherInfo(uiApp);
+ setAppCategory(uiApp);
+ setMetadata(uiApp);
+ setLiveBoxInfo(manifest);
+ setAccount(manifest);
+ setPrivilege(manifest);
+ manifest.addUiApplication(uiApp);
+
+ //app-control content
+ ConfigParserData::AppControlInfoList appControlList =
+ m_context.widgetConfig.configInfo.appControlList;
+ FOREACH(it, appControlList) {
+ UiApplication uiApp;
+
+ uiApp.setTaskmanage(true);
+ uiApp.setNodisplay(true);
+#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
+ uiApp.setTaskmanage(ConfigParserData::AppControlInfo::Disposition::INLINE != it->m_disposition);
+ uiApp.setMultiple(ConfigParserData::AppControlInfo::Disposition::INLINE == it->m_disposition);
+#endif
+ std::stringstream postfix;
+ postfix << AppControlPrefix::PROCESS_PREFIX << it->m_index;
+ setWidgetExecPath(uiApp, postfix.str());
+ setWidgetName(manifest, uiApp);
+ setWidgetIds(manifest, uiApp);
+ setWidgetIcons(uiApp);
+ setAppControlInfo(uiApp, *it);
+ setAppCategory(uiApp);
+ setMetadata(uiApp);
+ manifest.addUiApplication(uiApp);
+ }
+#else
+ //default widget content
setWidgetExecPath(uiApp);
setWidgetName(manifest, uiApp);
+ setWidgetIds(manifest, uiApp);
setWidgetIcons(uiApp);
+ setWidgetDescription(manifest);
setWidgetManifest(manifest);
setWidgetOtherInfo(uiApp);
- setAppServiceInfo(uiApp);
- setAppControlInfo(uiApp);
+ setAppControlsInfo(uiApp);
setAppCategory(uiApp);
+ setMetadata(uiApp);
setLiveBoxInfo(manifest);
+ setAccount(manifest);
+ setPrivilege(manifest);
manifest.addUiApplication(uiApp);
+#endif
+
manifest.generate(path);
LogDebug("Manifest file serialized");
}
-void TaskManifestFile::setWidgetExecPath(UiApplication & uiApp)
+void TaskManifestFile::setWidgetExecPath(UiApplication & uiApp,
+ const std::string &postfix)
{
- uiApp.setExec(DPL::FromASCIIString(m_context.locations->getExecFile()));
+ std::string exec = m_context.locations->getExecFile();
+ if (!postfix.empty()) {
+ exec.append(postfix);
+ }
+ LogDebug("exec = " << exec);
+ uiApp.setExec(DPL::FromASCIIString(exec));
}
-void TaskManifestFile::setWidgetName(Manifest & manifest, UiApplication & uiApp)
+void TaskManifestFile::setWidgetName(Manifest & manifest,
+ UiApplication & uiApp)
{
bool defaultNameSaved = false;
name,
defaultNameSaved);
}
+}
+
+void TaskManifestFile::setWidgetIds(Manifest & manifest,
+ UiApplication & uiApp,
+ const std::string &postfix)
+{
//appid
TizenAppId appid = m_context.widgetConfig.tzAppid;
+ if (!postfix.empty()) {
+ appid = DPL::FromUTF8String(DPL::ToUTF8String(appid).append(postfix));
+ }
uiApp.setAppid(appid);
//extraid
for (WrtDB::WidgetRegisterInfo::LocalizedIconList::const_reverse_iterator
icon = icons.rbegin();
icon != icons.rend();
- icon++)
+ ++icon)
{
FOREACH(locale, icon->availableLocales)
{
} else {
uiApp.addIcon(IconType(iconText));
}
+ std::ostringstream iconPath;
+ iconPath << GlobalConfig::GetUserWidgetDesktopIconPath() << "/";
+ iconPath << getIconTargetFilename(locale);
+ m_context.job->SendProgressIconPath(iconPath.str());
+}
+
+void TaskManifestFile::setWidgetDescription(Manifest & manifest)
+{
+ FOREACH(localizedData, m_context.widgetConfig.configInfo.localizedDataSet)
+ {
+ Locale i = localizedData->first;
+ DPL::OptionalString tag = getLangTag(i); // translate en -> en_US etc
+ if (tag.IsNull()) {
+ tag = i;
+ }
+ DPL::OptionalString description = localizedData->second.description;
+ generateWidgetDescription(manifest, tag, description);
+ }
+}
+
+void TaskManifestFile::generateWidgetDescription(Manifest & manifest,
+ const DPL::OptionalString& tag,
+ DPL::OptionalString description)
+{
+ if (!!description) {
+ if (!!tag) {
+ DPL::String locale =
+ LanguageTagsProvider::BCP47LanguageTagToLocale(*tag);
+ if (!locale.empty()) {
+ manifest.addDescription(DescriptionType(*description, locale));
+ } else {
+ manifest.addDescription(DescriptionType(*description));
+ }
+ } else {
+ manifest.addDescription(DescriptionType(*description));
+ }
+ }
}
void TaskManifestFile::setWidgetManifest(Manifest & manifest)
//that were in desktop file
}
-void TaskManifestFile::setAppServiceInfo(UiApplication & uiApp)
-{
- WrtDB::ConfigParserData::ServiceInfoList appServiceList =
- m_context.widgetConfig.configInfo.appServiceList;
-
- if (appServiceList.empty()) {
- LogInfo("Widget doesn't contain application service");
- return;
- }
-
- // x-tizen-svc=http://tizen.org/appcontrol/operation/pick|NULL|image;
- FOREACH(it, appServiceList) {
- AppControl appControl;
- if (!it->m_operation.empty()) {
- appControl.addOperation(it->m_operation); //TODO: encapsulation?
- }
- if (!it->m_scheme.empty()) {
- appControl.addUri(it->m_scheme);
- }
- if (!it->m_mime.empty()) {
- appControl.addMime(it->m_mime);
- }
- uiApp.addAppControl(appControl);
- }
-}
-
-void TaskManifestFile::setAppControlInfo(UiApplication & uiApp)
+void TaskManifestFile::setAppControlsInfo(UiApplication & uiApp)
{
WrtDB::ConfigParserData::AppControlInfoList appControlList =
m_context.widgetConfig.configInfo.appControlList;
return;
}
- // x-tizen-svc=http://tizen.org/appcontrol/operation/pick|NULL|image;
+ // x-tizen-svc=http://tizen.org/appcontrol/operation/pick|NULL|image;
FOREACH(it, appControlList) {
- AppControl appControl;
- if (!it->m_operation.empty()) {
- appControl.addOperation(it->m_operation); //TODO: encapsulation?
- }
- if (!it->m_uriList.empty()) {
- FOREACH(uri, it->m_uriList) {
- appControl.addUri(*uri);
- }
+ setAppControlInfo(uiApp, *it);
+ }
+}
+
+void TaskManifestFile::setAppControlInfo(UiApplication & uiApp,
+ const WrtDB::ConfigParserData::AppControlInfo & service)
+{
+ // x-tizen-svc=http://tizen.org/appcontrol/operation/pick|NULL|image;
+ AppControl appControl;
+ if (!service.m_operation.empty()) {
+ appControl.addOperation(service.m_operation); //TODO: encapsulation?
+ }
+ if (!service.m_uriList.empty()) {
+ FOREACH(uri, service.m_uriList) {
+ appControl.addUri(*uri);
}
- if (!it->m_mimeList.empty()) {
- FOREACH(mime, it->m_mimeList) {
- appControl.addMime(*mime);
- }
+ }
+ if (!service.m_mimeList.empty()) {
+ FOREACH(mime, service.m_mimeList) {
+ appControl.addMime(*mime);
}
- uiApp.addAppControl(appControl);
}
+ uiApp.addAppControl(appControl);
}
void TaskManifestFile::setAppCategory(UiApplication &uiApp)
}
}
+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....");
if (0 != code) {
LogWarning("Manifest parser error: " << code);
- ThrowMsg(ManifestParsingError, "Parser returncode: " << code);
+ ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
}
int ret = unlink(DPL::ToUTF8String(manifest_file).c_str());
if (0 != ret) {
LiveBoxInfo liveBox;
DPL::Optional<WrtDB::ConfigParserData::LiveboxInfo> ConfigInfo = *it;
DPL::String appid = m_context.widgetConfig.tzAppid;
- size_t found;
if (ConfigInfo->m_liveboxId != L"") {
- found = ConfigInfo->m_liveboxId.find_last_of(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);
liveBox.setPrimary(ConfigInfo->m_primary);
}
- if (ConfigInfo->m_autoLaunch == L"true") {
- liveBox.setAutoLaunch(appid);
- }
-
if (ConfigInfo->m_updatePeriod != L"") {
liveBox.setUpdatePeriod(ConfigInfo->m_updatePeriod);
}
liveBox.setLabel(ConfigInfo->m_label);
}
- DPL::String defaultLocale
- = DPL::FromUTF8String(
- m_context.locations->getPackageInstallationDir())
- + DPL::String(L"/res/wgt/");
+ 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);
+ DPL::String icon =
+ DPL::FromUTF8String(m_context.locations->getSharedDataDir()) +
+ DPL::String(L"/") +
+ ConfigInfo->m_liveboxId + DPL::String(L".icon.png");
+ liveBox.setIcon(icon);
}
if (ConfigInfo->m_boxInfo.m_boxSrc.empty() ||
}
if (ConfigInfo->m_boxInfo.m_boxMouseEvent == L"true") {
- box.boxMouseEvent = ConfigInfo->m_boxInfo.m_boxMouseEvent;
+ 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;
+ boxSize.second =
+ DPL::FromUTF8String(m_context.locations->getSharedDataDir()) +
+ DPL::String(L"/") +
+ ConfigInfo->m_liveboxId + DPL::String(L".") +
+ boxSize.first + DPL::String(L".preview.png");
}
box.boxSize.push_back(boxSize);
}
&& !ConfigInfo->m_boxInfo.m_pdWidth.empty()
&& !ConfigInfo->m_boxInfo.m_pdHeight.empty())
{
- box.pdSrc = defaultLocale + ConfigInfo->m_boxInfo.m_pdSrc;
+ 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;
}
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);
+}
+
} //namespace WidgetInstall
} //namespace Jobs