#include <libxml_utils.h>
#include <pkgmgr/pkgmgr_parser.h>
#include <dpl/localization/LanguageTagsProvider.h>
-#include <dpl/utils/path.h>
#define DEFAULT_ICON_NAME "icon.png"
#define DEFAULT_PREVIEW_NAME "preview.png"
if (std::find(generatedLocales.begin(), 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 {
generatedLocales.push_back(*locale);
}
- DPL::Utils::Path sourceFile(m_context.locations->getSourceDir());
+ std::ostringstream sourceFile;
+ std::ostringstream targetFile;
+
+ sourceFile << m_context.locations->getSourceDir() << "/";
+
if (!locale->empty()) {
- sourceFile /= "locales";
- sourceFile /= *locale;
+ sourceFile << "locales/" << *locale << "/";
}
- sourceFile /= src;
- DPL::Utils::Path targetFile(GlobalConfig::GetUserWidgetDesktopIconPath());
- targetFile /= getIconTargetFilename(*locale, sourceFile.Extension());
+ sourceFile << src;
+
+ targetFile << GlobalConfig::GetUserWidgetDesktopIconPath() << "/";
+ targetFile << getIconTargetFilename(*locale);
if (m_context.widgetConfig.packagingType ==
WrtDB::PKG_TYPE_HOSTED_WEB_APP)
{
m_context.locations->setIconTargetFilenameForLocale(
- targetFile.Fullpath());
+ targetFile.str());
}
- LogDebug("Copying icon: " << sourceFile << " -> " << targetFile);
+ LogDebug("Copying icon: " << sourceFile.str() <<
+ " -> " << targetFile.str());
- icon_list.push_back(targetFile.Fullpath());
+ icon_list.push_back(targetFile.str());
Try
{
- DPL::FileInput input(sourceFile.Fullpath());
- DPL::FileOutput output(targetFile.Fullpath());
+ DPL::FileInput input(sourceFile.str());
+ DPL::FileOutput output(targetFile.str());
DPL::Copy(&input, &output);
}
}
DPL::String TaskManifestFile::getIconTargetFilename(
- const DPL::String& languageTag, const std::string & ext) const
+ const DPL::String& languageTag) const
{
DPL::OStringStream filename;
TizenAppId appid = m_context.widgetConfig.tzAppid;
}
}
- if(!ext.empty())
- {
- filename << L"." + DPL::FromUTF8String(ext);
- }
+ filename << L".png";
return filename.str();
}
tag = *locale;
}
- generateWidgetIcon(uiApp, tag, *locale, DPL::Utils::Path(icon->src).Extension(), defaultIconSaved);
+ generateWidgetIcon(uiApp, tag, *locale, defaultIconSaved);
}
}
if (!!defaultLocale && !defaultIconSaved) {
generateWidgetIcon(uiApp, DPL::OptionalString::Null,
DPL::String(),
- std::string(),
defaultIconSaved);
}
}
void TaskManifestFile::generateWidgetIcon(UiApplication & uiApp,
const DPL::OptionalString& tag,
const DPL::String& language,
- const std::string & extension,
bool & defaultIconSaved)
{
DPL::String locale;
}
DPL::String iconText;
- iconText += getIconTargetFilename(language, extension);
+ iconText += getIconTargetFilename(language);
if (!locale.empty()) {
uiApp.addIcon(IconType(iconText, locale));
}
std::ostringstream iconPath;
iconPath << GlobalConfig::GetUserWidgetDesktopIconPath() << "/";
- iconPath << getIconTargetFilename(locale, extension);
- m_context.job->SendProgressIconPath(iconPath.str());
+ iconPath << getIconTargetFilename(locale);
+ m_context.job->SendProgressIconPath(iconPath.str());
}
void TaskManifestFile::setWidgetDescription(Manifest & manifest)
DPL::OptionalString description);
void generateWidgetIcon(UiApplication & uiApp,
const DPL::OptionalString& tag,
- const DPL::String& language, const std::string &extension,
+ const DPL::String& language,
bool & defaultIconSaved);
void DynamicBoxFileCopy(const std::string& sourceFile,
const std::string& targetFile);
//for widget update
void backupIconFiles();
void getFileList(const char* path, std::list<std::string> &list);
- DPL::String getIconTargetFilename(const DPL::String& languageTag,
- const std::string & ext) const;
+ DPL::String getIconTargetFilename(const DPL::String& languageTag) const;
static void saveLocalizedKey(std::ofstream &file,
const DPL::String& key,