#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/wrt-dao-ro/config_parser_data.h>
#include <dpl/log/log.h>
#include <dpl/file_input.h>
#include <dpl/errno_string.h>
#include <dpl/localization/LanguageTagsProvider.h>
#define DEFAULT_ICON_NAME "icon.png"
+#define DEFAULT_PREVIEW_NAME "preview.png"
using namespace WrtDB;
namespace {
typedef std::map<DPL::String, DPL::String> LanguageTagMap;
-const char* const ST_TRUE = "true";
-const char* const ST_NODISPLAY = "nodisplay";
+const char* const STR_TRUE = "true";
+const char* const STR_FALSE = "false";
+const char* const STR_NODISPLAY = "nodisplay";
LanguageTagMap getLanguageTagMap()
{
m_context(inCont),
writer(NULL)
{
- if (false == m_context.existingWidgetInfo.isExist) {
+ if (m_context.isUpdateMode) {
+ // for widget update.
+ AddStep(&TaskManifestFile::stepBackupIconFiles);
AddStep(&TaskManifestFile::stepCopyIconFiles);
+ AddStep(&TaskManifestFile::stepCopyLiveboxFiles);
AddStep(&TaskManifestFile::stepCreateExecFile);
AddStep(&TaskManifestFile::stepGenerateManifest);
- AddStep(&TaskManifestFile::stepParseManifest);
- AddStep(&TaskManifestFile::stepFinalize);
- AddAbortStep(&TaskManifestFile::stepAbortParseManifest);
+ AddAbortStep(&TaskManifestFile::stepAbortIconFiles);
} else {
- // 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);
}
}
std::string exec = m_context.locations->getExecFile();
std::string clientExeStr = GlobalConfig::GetWrtClientExec();
- LogInfo("link -s " << clientExeStr << " " << exec);
+#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(), exec.c_str()) != 0)
+ if (symlink(clientExeStr.c_str(), controlExec.c_str()) != 0)
{
int error = errno;
- if(error)
+ 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) << "]");
+ }
+ }
+ }
+#else
+ //default widget
+ LogDebug("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) << "]");
+ }
+#endif
m_context.job->UpdateProgress(
InstallerContext::INSTALL_CREATE_EXECFILE,
"Widget execfile creation Finished");
WrtDB::WidgetRegisterInfo::LocalizedIconList & icons =
m_context.widgetConfig.localizationData.icons;
- //reversed: last <icon> has highest priority to be copied if it has given
- // locale (TODO: why was that working that way?)
- for (WrtDB::WidgetRegisterInfo::LocalizedIconList::const_reverse_iterator
- icon = icons.rbegin();
- icon != icons.rend();
+ for (WrtDB::WidgetRegisterInfo::LocalizedIconList::const_iterator
+ icon = icons.begin();
+ icon != icons.end();
++icon)
{
+ DPL::String src = icon->src;
FOREACH(locale, icon->availableLocales)
{
- DPL::String src = icon->src;
- LogDebug("Icon for locale: " << *locale << "is : " << src);
+ LogDebug("Icon for locale: " << *locale << "is: " << src);
if (std::find(generatedLocales.begin(), generatedLocales.end(),
- *locale) != generatedLocales.end())
+ *locale) != generatedLocales.end())
{
+ if (icon->src == L"icon.jpg") {
+ generatedLocales.push_back(*locale);
+ } else if (icon->src == L"icon.gif") {
+ generatedLocales.push_back(*locale);
+ } else if (icon->src == L"icon.png") {
+ generatedLocales.push_back(*locale);
+ } else if (icon->src == L"icon.ico") {
+ generatedLocales.push_back(*locale);
+ } else if (icon->src == L"icon.svg") {
+ generatedLocales.push_back(*locale);
+ }
LogDebug("Skipping - has that locale");
continue;
} else {
"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) {
+ ConfigParserData::LiveboxInfo::BoxSizeList boxSizeList =
+ (**boxIt).m_boxInfo.m_boxSize;
+ FOREACH (sizeIt, boxSizeList) {
+ std::string preview = DPL::ToUTF8String((*sizeIt).m_preview);
+ if (preview.empty()) {
+ continue;
+ }
+ sourceFile << m_context.locations->getSourceDir() << "/";
+ sourceFile << preview;
+ targetFile << m_context.locations->getSharedDataDir() << "/";
+ targetFile << (**boxIt).m_liveboxId << ".";
+ targetFile << DPL::ToUTF8String((*sizeIt).m_size) << "." << DEFAULT_PREVIEW_NAME;
+
+ DynamicBoxFileCopy(sourceFile.str(), targetFile.str());
+
+ // 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;
+ }
+ sourceFile << m_context.locations->getSourceDir() << "/";
+ sourceFile << icon;
+ targetFile << m_context.locations->getSharedDataDir() << "/";
+ targetFile << (**boxIt).m_liveboxId << "." << DEFAULT_ICON_NAME;
+
+ DynamicBoxFileCopy(sourceFile.str(), targetFile.str());
+
+ // clear stream objects
+ sourceFile.str("");
+ targetFile.str("");
+ }
+ m_context.job->UpdateProgress(
+ InstallerContext::INSTALL_COPY_LIVEBOX_FILES,
+ "Livebox files copy Finished");
+}
+
+void TaskManifestFile::DynamicBoxFileCopy(const std::string& sourceFile,
+ const std::string& targetFile)
+{
+ Try
+ {
+ DPL::FileInput input(sourceFile);
+ DPL::FileOutput output(targetFile);
+ DPL::Copy(&input, &output);
+ }
+ Catch(DPL::Exception)
+ {
+ LogError("Copying Dynamic Box File Failed. " << sourceFile
+ << " to " << targetFile);
+ ReThrowMsg(Exceptions::DynamicBoxFailed, "Dynamic Box File Copy Failed.");
+ }
+}
+
void TaskManifestFile::stepBackupIconFiles()
{
LogDebug("Backup Icon Files");
- backup_dir << m_context.locations->getPackageInstallationDir();
- backup_dir << "/" << "backup" << "/";
+ backup_dir << m_context.locations->getBackupDir() << "/";
backupIconFiles();
}
}
-void TaskManifestFile::stepUpdateFinalize()
-{
- commitManifest();
- LogDebug("Finished Update Desktopfile");
-}
-
DPL::String TaskManifestFile::getIconTargetFilename(
const DPL::String& languageTag) const
{
return filename.str();
}
-void TaskManifestFile::stepFinalize()
-{
- commitManifest();
- LogInfo("Finished ManifestFile step");
-}
-
void TaskManifestFile::saveLocalizedKey(std::ofstream &file,
const DPL::String& key,
const DPL::String& languageTag)
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_get_appinfo(appid, &ai);
- if (ai) {
- ail_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");
+ LogDebug("Backup Icon Files");
std::ostringstream b_icon_dir;
b_icon_dir << backup_dir.str() << "icons";
writeManifest(manifest_file);
- m_context.job->UpdateProgress(
- InstallerContext::INSTALL_CREATE_MANIFEST,
- "Widget Manifest Creation Finished");
-}
-
-void TaskManifestFile::stepParseManifest()
-{
- int code = pkgmgr_parser_parse_manifest_for_installation(
- DPL::ToUTF8String(manifest_file).c_str(), NULL);
-
- if (code != 0) {
- LogError("Manifest parser error: " << code);
- ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
+ std::ostringstream destFile;
+ 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
}
- // 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");
- LogDebug("Manifest parsed");
-}
-
-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(Exceptions::ManifestInvalid, "Parser returncode: " << code);
- }
+ destFile << DPL::ToUTF8String(manifest_name);
+ commit_manifest = destFile.str();
+ LogDebug("Commiting manifest file : " << commit_manifest);
- // TODO : It will be removed. AIL update is temporary code request by pkgmgr
- // team.
- updateAilInfo();
+ commitManifest();
m_context.job->UpdateProgress(
InstallerContext::INSTALL_CREATE_MANIFEST,
- "Widget Manifest Parsing Finished");
- LogDebug("Manifest parsed");
+ "Widget Manifest Creation Finished");
}
void TaskManifestFile::commitManifest()
{
- LogDebug("Commiting manifest file : " << manifest_file);
- std::ostringstream destFile;
- destFile << "/opt/share/packages" << "/"; //TODO constant with path
- destFile << DPL::ToUTF8String(manifest_name);
- LogInfo("cp " << manifest_file << " " << destFile.str());
+ if (!(m_context.mode.rootPath == InstallMode::RootPath::RO &&
+ m_context.mode.installTime == InstallMode::InstallTime::PRELOAD
+ && m_context.mode.extension == InstallMode::ExtensionType::DIR)) {
+ LogDebug("cp " << manifest_file << " " << commit_manifest);
- DPL::FileInput input(DPL::ToUTF8String(manifest_file));
- DPL::FileOutput output(destFile.str());
- DPL::Copy(&input, &output);
- LogDebug("Manifest writen to: " << destFile.str());
+ DPL::FileInput input(DPL::ToUTF8String(manifest_file));
+ DPL::FileOutput output(commit_manifest);
+ DPL::Copy(&input, &output);
+ LogDebug("Manifest writen to: " << commit_manifest);
- //removing temp file
- unlink((DPL::ToUTF8String(manifest_file)).c_str());
- manifest_file = DPL::FromUTF8String(destFile.str().c_str());
+ //removing temp file
+ unlink((DPL::ToUTF8String(manifest_file)).c_str());
+ manifest_file = DPL::FromUTF8String(commit_manifest);
+ }
}
void TaskManifestFile::writeManifest(const DPL::String & path)
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
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)
{
manifest.setPackage(m_context.widgetConfig.tzPkgid);
DPL::String name = (!!m_context.widgetConfig.configInfo.authorName ?
*m_context.widgetConfig.configInfo.authorName : L"");
manifest.addAuthor(Author(email, href, L"", name));
+
+ if (!m_context.callerPkgId.empty()) {
+ manifest.setStoreClientId(m_context.callerPkgId);
+ }
}
void TaskManifestFile::setWidgetOtherInfo(UiApplication & uiApp)
{
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)) {
+ if (!strcmp(DPL::ToUTF8String(it->m_name).c_str(), STR_NODISPLAY)) {
+ if (!strcmp(DPL::ToUTF8String(it->m_value).c_str(), STR_TRUE)) {
uiApp.setNodisplay(true);
uiApp.setTaskmanage(false);
} else {
//that were in desktop file
}
-void TaskManifestFile::setAppServiceInfo(UiApplication & uiApp)
+void TaskManifestFile::setAppControlsInfo(UiApplication & uiApp)
{
- WrtDB::ConfigParserData::ServiceInfoList appServiceList =
- m_context.widgetConfig.configInfo.appServiceList;
+ WrtDB::ConfigParserData::AppControlInfoList appControlList =
+ m_context.widgetConfig.configInfo.appControlList;
- if (appServiceList.empty()) {
- LogInfo("Widget doesn't contain application service");
+ if (appControlList.empty()) {
+ LogDebug("Widget doesn't contain app control");
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);
+ // x-tizen-svc=http://tizen.org/appcontrol/operation/pick|NULL|image;
+ FOREACH(it, appControlList) {
+ setAppControlInfo(uiApp, *it);
}
}
-void TaskManifestFile::setAppControlInfo(UiApplication & uiApp)
+void TaskManifestFile::setAppControlInfo(UiApplication & uiApp,
+ const WrtDB::ConfigParserData::AppControlInfo & service)
{
- WrtDB::ConfigParserData::AppControlInfoList appControlList =
- m_context.widgetConfig.configInfo.appControlList;
-
- if (appControlList.empty()) {
- LogInfo("Widget doesn't contain app control");
- return;
- }
-
// 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);
- }
+ 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)
m_context.widgetConfig.configInfo.categoryList;
if (categoryList.empty()) {
- LogInfo("Widget doesn't contain application category");
+ LogDebug("Widget doesn't contain application category");
return;
}
FOREACH(it, categoryList) {
}
}
-void TaskManifestFile::stepAbortParseManifest()
+void TaskManifestFile::setMetadata(UiApplication &uiApp)
{
- LogError("[Parse Manifest] Abroting....");
-
- int code = pkgmgr_parser_parse_manifest_for_uninstallation(
- DPL::ToUTF8String(manifest_file).c_str(), NULL);
+ WrtDB::ConfigParserData::MetadataList metadataList =
+ m_context.widgetConfig.configInfo.metadataList;
- if (0 != code) {
- LogWarning("Manifest parser error: " << code);
- ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
+ if (metadataList.empty()) {
+ LogDebug("Web application doesn't contain metadata");
+ return;
}
- int ret = unlink(DPL::ToUTF8String(manifest_file).c_str());
- if (0 != ret) {
- LogWarning("No manifest file found: " << manifest_file);
+ FOREACH(it, metadataList) {
+ MetadataType metadataType(it->key, it->value);
+ uiApp.addMetadata(metadataType);
}
}
void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
{
FOREACH(it, m_context.widgetConfig.configInfo.m_livebox) {
- LogInfo("setLiveBoxInfo");
+ LogDebug("setLiveBoxInfo");
LiveBoxInfo liveBox;
DPL::Optional<WrtDB::ConfigParserData::LiveboxInfo> ConfigInfo = *it;
DPL::String appid = m_context.widgetConfig.tzAppid;
liveBox.setUpdatePeriod(ConfigInfo->m_updatePeriod);
}
- if (ConfigInfo->m_label != L"") {
- liveBox.setLabel(ConfigInfo->m_label);
+ std::list<std::pair<DPL::String, DPL::String> > boxLabelList;
+ if (!ConfigInfo->m_label.empty()) {
+ FOREACH(im, ConfigInfo->m_label) {
+ std::pair<DPL::String, DPL::String> boxSize;
+ Locale i = (*im).first;
+ // translate en -> en_US etc
+ DPL::OptionalString tag = getLangTag(i);
+ if (tag.IsNull()) {
+ tag = i;
+ }
+ boxSize.first = (*tag);
+ boxSize.second = (*im).second;
+ boxLabelList.push_back(boxSize);
+ }
+ liveBox.setLabel(boxLabelList);
}
- 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() ||
ConfigInfo->m_boxInfo.m_boxSize.empty())
{
- LogInfo("Widget doesn't contain box");
+ LogDebug("Widget doesn't contain box");
return;
} else {
BoxInfoType box;
}
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 = ConfigInfo->m_boxInfo.m_boxTouchEffect;
+ 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;
+ ConfigParserData::LiveboxInfo::BoxSizeList boxSizeList =
+ ConfigInfo->m_boxInfo.m_boxSize;
+ FOREACH(it, boxSizeList) {
+ if (!(*it).m_preview.empty()) {
+ (*it).m_preview =
+ DPL::FromUTF8String(m_context.locations->getSharedDataDir()) +
+ DPL::String(L"/") +
+ ConfigInfo->m_liveboxId + DPL::String(L".") +
+ (*it).m_size + DPL::String(L".preview.png");
}
- box.boxSize.push_back(boxSize);
+ box.boxSize.push_back((*it));
}
if (!ConfigInfo->m_boxInfo.m_pdSrc.empty()
AccountProviderType provider;
if (account.m_iconSet.empty()) {
- LogInfo("Widget doesn't contain Account");
+ LogDebug("Widget doesn't contain Account");
return;
}
if (account.m_multiAccountSupport) {
- provider.multiAccount = L"ture";
+ provider.multiAccount = L"true";
} else {
provider.multiAccount = L"false";
}
manifest.addPrivileges(privilege);
}
+void TaskManifestFile::StartStep()
+{
+
+}
+
+void TaskManifestFile::EndStep()
+{
+
+}
} //namespace WidgetInstall
} //namespace Jobs