[Release] wrt-installer_0.1.57
[framework/web/wrt-installer.git] / src / jobs / widget_install / task_manifest_file.cpp
index 0abe0f1..33b1283 100644 (file)
@@ -33,6 +33,8 @@
 #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>
@@ -109,6 +111,7 @@ TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
         // for widget update.
         AddStep(&TaskManifestFile::stepBackupIconFiles);
         AddStep(&TaskManifestFile::stepCopyIconFiles);
+        AddStep(&TaskManifestFile::stepCreateExecFile);
         AddStep(&TaskManifestFile::stepGenerateManifest);
         AddStep(&TaskManifestFile::stepParseUpgradedManifest);
         AddStep(&TaskManifestFile::stepUpdateFinalize);
@@ -305,8 +308,7 @@ void TaskManifestFile::stepBackupIconFiles()
 {
     LogDebug("Backup Icon Files");
 
-    backup_dir << m_context.locations->getPackageInstallationDir();
-    backup_dir << "/" << "backup" << "/";
+    backup_dir << m_context.locations->getBackupDir() << "/";
 
     backupIconFiles();
 
@@ -542,18 +544,22 @@ void TaskManifestFile::stepParseManifest()
 
 void TaskManifestFile::stepParseUpgradedManifest()
 {
-    int code = pkgmgr_parser_parse_manifest_for_upgrade(
-            DPL::ToUTF8String(manifest_file).c_str(), NULL);
+    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);
 
-    if (code != 0) {
-        LogError("Manifest parser error: " << code);
-        ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
-    }
+        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()
@@ -561,9 +567,7 @@ void TaskManifestFile::commitManifest()
     LogDebug("Commiting manifest file : " << manifest_file);
 
     std::ostringstream destFile;
-    if (m_context.job->getInstallerStruct().m_installMode
-            == InstallMode::INSTALL_MODE_PRELOAD)
-    {
+    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
@@ -600,6 +604,7 @@ void TaskManifestFile::writeManifest(const DPL::String & path)
     setWidgetManifest(manifest);
     setWidgetOtherInfo(uiApp);
     setAppCategory(uiApp);
+    setMetadata(uiApp);
     setLiveBoxInfo(manifest);
     setAccount(manifest);
     setPrivilege(manifest);
@@ -625,6 +630,7 @@ void TaskManifestFile::writeManifest(const DPL::String & path)
         setWidgetIcons(uiApp);
         setAppControlInfo(uiApp, *it);
         setAppCategory(uiApp);
+        setMetadata(uiApp);
         manifest.addUiApplication(uiApp);
     }
 #else
@@ -633,10 +639,12 @@ void TaskManifestFile::writeManifest(const DPL::String & path)
     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);
@@ -942,6 +950,21 @@ 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....");
@@ -1024,13 +1047,28 @@ 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";
             }