[Release] wrt-installer_0.1.58.2 accepted/tizen_2.1/20130520.093135 submit/tizen_2.1/20130516.045954
authorYunchan Cho <yunchan.cho@samsung.com>
Wed, 15 May 2013 02:25:24 +0000 (11:25 +0900)
committerYunchan Cho <yunchan.cho@samsung.com>
Wed, 15 May 2013 05:37:35 +0000 (14:37 +0900)
Change-Id: I5c0e911781efb340a7861038b74e76b38be45fdc

packaging/wrt-installer.spec
src/jobs/widget_install/task_manifest_file.cpp
src/jobs/widget_install/task_manifest_file.h
src/jobs/widget_install/widget_install_context.h

index 4a9ee5f..23a2f39 100644 (file)
@@ -1,7 +1,7 @@
-#git:framework/web/wrt-installer wrt-installer_0.1.58.1
+#git:framework/web/wrt-installer wrt-installer_0.1.58.2
 Name:       wrt-installer
 Summary:    Installer for tizen Webruntime
-Version:    0.1.58.1
+Version:    0.1.58.2
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index 33b1283..19d2ee4 100644 (file)
@@ -111,6 +111,7 @@ 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);
@@ -119,6 +120,7 @@ TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
         AddAbortStep(&TaskManifestFile::stepAbortIconFiles);
     } else {
         AddStep(&TaskManifestFile::stepCopyIconFiles);
+        AddStep(&TaskManifestFile::stepCopyLiveboxFiles);
         AddStep(&TaskManifestFile::stepCreateExecFile);
         AddStep(&TaskManifestFile::stepGenerateManifest);
         AddStep(&TaskManifestFile::stepParseManifest);
@@ -304,6 +306,68 @@ 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) {
+        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");
@@ -1019,13 +1083,16 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
             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() ||
@@ -1078,7 +1145,11 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
             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);
             }
index d0c93b1..d4f1c90 100644 (file)
@@ -63,6 +63,7 @@ class TaskManifestFile :
     void stepCreateExecFile();
     void stepFinalize();
     void stepCopyIconFiles();
+    void stepCopyLiveboxFiles();
     void stepGenerateManifest();
     void stepParseManifest();
     void stepParseUpgradedManifest();
index a981670..402005a 100644 (file)
@@ -67,6 +67,7 @@ struct InstallerContext
 
         INSTALL_BACKUP_ICONFILE,                         /* For Update */
         INSTALL_COPY_ICONFILE,
+        INSTALL_COPY_LIVEBOX_FILES,
         INSTALL_CREATE_EXECFILE,
         INSTALL_CREATE_MANIFEST,
         INSTALL_CREATE_SHORTCUT,