From 165ee47c0833091f0425efd10f7acc3a237edfed Mon Sep 17 00:00:00 2001 From: Kamil Nowac Date: Fri, 5 Jul 2013 09:51:40 +0200 Subject: [PATCH] Default icon is not loading in correct order [Issue#] LINUXWRT-621 [Problem] Wrong prioritizing of icons. [Cause] N/A [Solution] Icons extensions are now checked [Verification] 1. Build wrt-installer repo 2. Build wrt-extra repo with tests 2. Install widget bo.wgt widget from wrt-extra's ta_FAFYMEGELU_bo test Widget should install without problems and icon.png should be displayed in menu. Change-Id: I7cc7f4e552c3221b284832cc422be132a805edc8 --- src/jobs/widget_install/task_manifest_file.cpp | 25 +++++++++++++++++-------- src/jobs/widget_install/task_widget_config.cpp | 9 ++++----- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/jobs/widget_install/task_manifest_file.cpp b/src/jobs/widget_install/task_manifest_file.cpp index b4eb7db..a94bf6a 100755 --- a/src/jobs/widget_install/task_manifest_file.cpp +++ b/src/jobs/widget_install/task_manifest_file.cpp @@ -210,21 +210,30 @@ void TaskManifestFile::stepCopyIconFiles() WrtDB::WidgetRegisterInfo::LocalizedIconList & icons = m_context.widgetConfig.localizationData.icons; - //reversed: last 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 { diff --git a/src/jobs/widget_install/task_widget_config.cpp b/src/jobs/widget_install/task_widget_config.cpp index 2be933c..758535d 100644 --- a/src/jobs/widget_install/task_widget_config.cpp +++ b/src/jobs/widget_install/task_widget_config.cpp @@ -296,16 +296,15 @@ void TaskWidgetConfig::ProcessBackgroundPageFile() void TaskWidgetConfig::ProcessLocalizedIcons() { using namespace WrtDB; + FOREACH(i, m_installContext.widgetConfig.configInfo.iconsList) + { + ProcessIcon(*i); + } ProcessIcon(ConfigParserData::Icon(L"icon.svg")); ProcessIcon(ConfigParserData::Icon(L"icon.ico")); ProcessIcon(ConfigParserData::Icon(L"icon.png")); ProcessIcon(ConfigParserData::Icon(L"icon.gif")); ProcessIcon(ConfigParserData::Icon(L"icon.jpg")); - - FOREACH(i, m_installContext.widgetConfig.configInfo.iconsList) - { - ProcessIcon(*i); - } } void TaskWidgetConfig::ProcessIcon(const WrtDB::ConfigParserData::Icon& icon) -- 2.7.4