// for widget update.
AddStep(&TaskManifestFile::stepBackupIconFiles);
AddStep(&TaskManifestFile::stepCopyIconFiles);
+ AddStep(&TaskManifestFile::stepCopyLiveboxFiles);
AddStep(&TaskManifestFile::stepCreateExecFile);
AddStep(&TaskManifestFile::stepGenerateManifest);
AddStep(&TaskManifestFile::stepParseUpgradedManifest);
AddAbortStep(&TaskManifestFile::stepAbortIconFiles);
} else {
AddStep(&TaskManifestFile::stepCopyIconFiles);
+ AddStep(&TaskManifestFile::stepCopyLiveboxFiles);
AddStep(&TaskManifestFile::stepCreateExecFile);
AddStep(&TaskManifestFile::stepGenerateManifest);
AddStep(&TaskManifestFile::stepParseManifest);
"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");
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() ||
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);
}