[Release] wrt-installer_0.1.114
[framework/web/wrt-installer.git] / src / jobs / widget_install / task_manifest_file.cpp
index c204226..37d856e 100644 (file)
 #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()
 {
@@ -109,19 +114,16 @@ TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
         // 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);
     }
 }
 
@@ -133,43 +135,56 @@ void TaskManifestFile::stepCreateExecFile()
     std::string exec = m_context.locations->getExecFile();
     std::string clientExeStr = GlobalConfig::GetWrtClientExec();
 
+#ifdef MULTIPROCESS_SERVICE_SUPPORT
     //default widget
-    LogInfo("link -s " << clientExeStr << " " << exec);
+    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)
             LogPedantic("Failed to make a symbolic name for a file "
                     << "[" <<  DPL::GetErrnoString(error) << "]");
-        ThrowMsg(Exceptions::FileOperationFailed,
-                "Symbolic link creating is not done.");
     }
 
-#ifdef MULTIPROCESS_SERVICE_SUPPORT
-    //services
-    std::size_t serviceCount =
-        m_context.widgetConfig.configInfo.appControlList.size();
-    serviceCount += m_context.widgetConfig.configInfo.appServiceList.size();
-    for (std::size_t i = 0; i < serviceCount; ++i) {
+    // 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 << "-__SERVICE_PROCESS__" << i;
-        std::string serviceExec = exec;
-        serviceExec.append(postfix.str());
+        postfix << AppControlPrefix::PROCESS_PREFIX << i;
+        std::string controlExec = exec;
+        controlExec.append(postfix.str());
         errno = 0;
-        if (symlink(clientExeStr.c_str(), serviceExec.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.");
+                    << "[" <<  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");
@@ -191,21 +206,30 @@ void TaskManifestFile::stepCopyIconFiles()
     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 {
@@ -282,12 +306,84 @@ void TaskManifestFile::stepCopyIconFiles()
         "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();
 
@@ -345,12 +441,6 @@ void TaskManifestFile::stepAbortIconFiles()
     }
 }
 
-void TaskManifestFile::stepUpdateFinalize()
-{
-    commitManifest();
-    LogDebug("Finished Update Desktopfile");
-}
-
 DPL::String TaskManifestFile::getIconTargetFilename(
     const DPL::String& languageTag) const
 {
@@ -379,12 +469,6 @@ DPL::String TaskManifestFile::getIconTargetFilename(
     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)
@@ -401,7 +485,7 @@ void TaskManifestFile::saveLocalizedKey(std::ofstream &file,
 
 void TaskManifestFile::backupIconFiles()
 {
-    LogInfo("Backup Icon Files");
+    LogDebug("Backup Icon Files");
 
     std::ostringstream b_icon_dir;
     b_icon_dir << backup_dir.str() << "icons";
@@ -500,66 +584,41 @@ void TaskManifestFile::stepGenerateManifest()
 
     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
     }
 
-    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);
+    destFile << DPL::ToUTF8String(manifest_name);
+    commit_manifest = destFile.str();
+    LogDebug("Commiting manifest file : " << commit_manifest);
 
-    if (code != 0) {
-        LogError("Manifest parser error: " << code);
-        ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
-    }
+    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;
-    if (m_context.job->getInstallerStruct().m_installMode
-            == InstallMode::INSTALL_MODE_PRELOAD)
-    {
-        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());
+    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)
@@ -568,31 +627,29 @@ void TaskManifestFile::writeManifest(const DPL::String & path)
     Manifest manifest;
     UiApplication uiApp;
 
+#ifdef MULTIPROCESS_SERVICE_SUPPORT
     //default widget content
-    setWidgetExecPath(uiApp);
+    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);
-#ifndef MULTIPROCESS_SERVICE_SUPPORT
-    setAppServicesInfo(uiApp);
-    setAppControlsInfo(uiApp);
-#endif
     setAppCategory(uiApp);
+    setMetadata(uiApp);
     setLiveBoxInfo(manifest);
     setAccount(manifest);
     setPrivilege(manifest);
-
     manifest.addUiApplication(uiApp);
-#ifdef MULTIPROCESS_SERVICE_SUPPORT
-    //services AppControl tag
+
+    //app-control content
     ConfigParserData::AppControlInfoList appControlList =
         m_context.widgetConfig.configInfo.appControlList;
-    unsigned count = 0;
-
     FOREACH(it, appControlList) {
-        it->m_index = count;
         UiApplication uiApp;
 
         uiApp.setTaskmanage(true);
@@ -602,49 +659,35 @@ void TaskManifestFile::writeManifest(const DPL::String & path)
         uiApp.setMultiple(ConfigParserData::AppControlInfo::Disposition::INLINE == it->m_disposition);
 #endif
         std::stringstream postfix;
-        postfix << "-__SERVICE_PROCESS__" << count++;
-
+        postfix << AppControlPrefix::PROCESS_PREFIX << it->m_index;
         setWidgetExecPath(uiApp, postfix.str());
         setWidgetName(manifest, uiApp);
-        setWidgetIds(manifest, uiApp, postfix.str());
+        setWidgetIds(manifest, uiApp);
         setWidgetIcons(uiApp);
         setAppControlInfo(uiApp, *it);
         setAppCategory(uiApp);
-        setAccount(manifest);
-        setPrivilege(manifest);
-
+        setMetadata(uiApp);
         manifest.addUiApplication(uiApp);
     }
-    //TODO: AppService tag will be removed
-    //services AppService tag
-    WrtDB::ConfigParserData::ServiceInfoList appServiceList =
-        m_context.widgetConfig.configInfo.appServiceList;
-    FOREACH(it, appServiceList) {
-        it->m_index = count;
-        UiApplication uiApp;
+#else
+    //default widget content
+    setWidgetExecPath(uiApp);
+    setWidgetName(manifest, uiApp);
+    setWidgetIds(manifest, uiApp);
+    setWidgetIcons(uiApp);
+    setWidgetDescription(manifest);
+    setWidgetManifest(manifest);
+    setWidgetOtherInfo(uiApp);
+    setAppControlsInfo(uiApp);
+    setAppCategory(uiApp);
+    setMetadata(uiApp);
+    setLiveBoxInfo(manifest);
+    setAccount(manifest);
+    setPrivilege(manifest);
 
-        uiApp.setTaskmanage(true);
-        uiApp.setNodisplay(true);
-#ifdef MULTIPROCESS_SERVICE_SUPPORT_INLINE
-        uiApp.setTaskmanage(ConfigParserData::ServiceInfo::Disposition::INLINE != it->m_disposition);
-        uiApp.setMultiple(ConfigParserData::ServiceInfo::Disposition::INLINE == it->m_disposition);
+    manifest.addUiApplication(uiApp);
 #endif
 
-        std::stringstream postfix;
-        postfix << "-__SERVICE_PROCESS__" << count++;
-
-        setWidgetExecPath(uiApp, postfix.str());
-        setWidgetName(manifest, uiApp);
-        setWidgetIds(manifest, uiApp, postfix.str());
-        setWidgetIcons(uiApp);
-        setAppServiceInfo(uiApp, *it);
-        setAppCategory(uiApp);
-        setAccount(manifest);
-        setPrivilege(manifest);
-
-        manifest.addUiApplication(uiApp);
-    }
-#endif
     manifest.generate(path);
     LogDebug("Manifest file serialized");
 }
@@ -819,6 +862,39 @@ void TaskManifestFile::generateWidgetIcon(UiApplication & uiApp,
      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);
@@ -833,14 +909,18 @@ void TaskManifestFile::setWidgetManifest(Manifest & manifest)
     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 {
@@ -857,29 +937,13 @@ void TaskManifestFile::setWidgetOtherInfo(UiApplication & uiApp)
     //that were in desktop file
 }
 
-void TaskManifestFile::setAppServicesInfo(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) {
-        setAppServiceInfo(uiApp, *it);
-     }
- }
-
 void TaskManifestFile::setAppControlsInfo(UiApplication & uiApp)
 {
     WrtDB::ConfigParserData::AppControlInfoList appControlList =
         m_context.widgetConfig.configInfo.appControlList;
 
     if (appControlList.empty()) {
-        LogInfo("Widget doesn't contain app control");
+        LogDebug("Widget doesn't contain app control");
         return;
     }
 
@@ -889,22 +953,6 @@ void TaskManifestFile::setAppControlsInfo(UiApplication & uiApp)
     }
 }
 
-void TaskManifestFile::setAppServiceInfo(UiApplication & uiApp,
-                                         const ConfigParserData::ServiceInfo & service)
-{
-    AppControl appControl;
-    if (!service.m_operation.empty()) {
-        appControl.addOperation(service.m_operation); //TODO: encapsulation?
-    }
-    if (!service.m_scheme.empty()) {
-        appControl.addUri(service.m_scheme);
-    }
-    if (!service.m_mime.empty()) {
-        appControl.addMime(service.m_mime);
-    }
-    uiApp.addAppControl(appControl);
-}
-
 void TaskManifestFile::setAppControlInfo(UiApplication & uiApp,
                                          const WrtDB::ConfigParserData::AppControlInfo & service)
 {
@@ -932,7 +980,7 @@ 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) {
@@ -942,27 +990,25 @@ void TaskManifestFile::setAppCategory(UiApplication &uiApp)
     }
 }
 
-void TaskManifestFile::stepAbortParseManifest()
+void TaskManifestFile::setMetadata(UiApplication &uiApp)
 {
-    LogError("[Parse Manifest] Abroting....");
+    WrtDB::ConfigParserData::MetadataList metadataList =
+        m_context.widgetConfig.configInfo.metadataList;
 
-    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);
+    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;
@@ -992,23 +1038,39 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
             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;
@@ -1024,25 +1086,43 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
             }
 
             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()
@@ -1073,11 +1153,11 @@ void TaskManifestFile::setAccount(Manifest& manifest)
     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";
     }
@@ -1124,5 +1204,14 @@ void TaskManifestFile::setPrivilege(Manifest& manifest)
     manifest.addPrivileges(privilege);
 }
 
+void TaskManifestFile::StartStep()
+{
+
+}
+
+void TaskManifestFile::EndStep()
+{
+
+}
 } //namespace WidgetInstall
 } //namespace Jobs