summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiels Weber <niels.2.weber@nokia.com>2012-03-28 16:28:14 +0200
committerNiels Weber <niels.2.weber@nokia.com>2012-03-28 17:50:20 +0200
commit7dac5b486560e0f01f786693c53d5755e9740fd4 (patch)
tree6c9836a8c9682eeb92e5d0c10e168af4e2efe9e6
parent2b5c1055e49f5c3598f218f99e447895848b6637 (diff)
Load only the description with the correct lang attribute.
If there is none, fall back to the untranslated one, if that can be found. Change-Id: I589b67e314c2039fe40e88c1370afd4eff89b0d5 Reviewed-by: Karsten Heimrich <karsten.heimrich@nokia.com>
-rw-r--r--src/libs/kdtools/kdupdaterupdatesinfo.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libs/kdtools/kdupdaterupdatesinfo.cpp b/src/libs/kdtools/kdupdaterupdatesinfo.cpp
index 98a71c1ba..202e30457 100644
--- a/src/libs/kdtools/kdupdaterupdatesinfo.cpp
+++ b/src/libs/kdtools/kdupdaterupdatesinfo.cpp
@@ -27,6 +27,7 @@
#include <QtXml/QDomElement>
#include <QFile>
#include <QSharedData>
+#include <QLocale>
using namespace KDUpdater;
@@ -174,6 +175,17 @@ bool UpdatesInfo::UpdatesInfoData::parsePackageUpdateElement(const QDomElement &
} else if (childE.tagName() == QLatin1String("Version")) {
info.data.insert(QLatin1String("inheritVersionFrom"), childE.attribute(QLatin1String("inheritVersionFrom")));
info.data[childE.tagName()] = childE.text();
+ } else if (childE.tagName() == QLatin1String("Description")) {
+
+ QString languageAttribute = childE.attribute(QLatin1String("xml:lang"));
+
+ if (!info.data.contains(QLatin1String("Description")) && (languageAttribute.isEmpty()))
+ info.data[childE.tagName()] = childE.text();
+
+ // overwrite default if we have a language specific description
+ if (languageAttribute == QLocale().name().toLower())
+ info.data[childE.tagName()] = childE.text();
+
} else {
info.data[childE.tagName()] = childE.text();
}