summaryrefslogtreecommitdiffstats
path: root/src/libs/kdtools/updatesinfo.cpp
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@theqtcompany.com>2015-08-19 16:39:18 +0200
committerKai Koehne <kai.koehne@theqtcompany.com>2015-08-19 16:39:18 +0200
commitc417d953f743b8a273ea36ff7d7b1dc8b761d518 (patch)
tree4bc08bf733ba04a7846db8289ba7003a961bad82 /src/libs/kdtools/updatesinfo.cpp
parentc53747138d2f48138ee6e12149064344e668634d (diff)
parentd343cd20410ecb2741c85877c8203579dc7c227d (diff)
Merge remote-tracking branch 'origin/2.0'
Conflicts: Changelog dist/config/config.xml dist/packages/org.qtproject.ifw.binaries/meta/package.xml dist/packages/org.qtproject.ifw/meta/package.xml installerfw.pri src/libs/installer/component.cpp src/libs/kdtools/updatesinfo.cpp Change-Id: I0a1b4a464f7d9008b589b54dd7aed0cac71bd666
Diffstat (limited to 'src/libs/kdtools/updatesinfo.cpp')
-rw-r--r--src/libs/kdtools/updatesinfo.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/libs/kdtools/updatesinfo.cpp b/src/libs/kdtools/updatesinfo.cpp
index 44539171b..9b4913f62 100644
--- a/src/libs/kdtools/updatesinfo.cpp
+++ b/src/libs/kdtools/updatesinfo.cpp
@@ -33,10 +33,13 @@
****************************************************************************/
#include "updatesinfo_p.h"
+#include "utils.h"
#include <QDomDocument>
#include <QFile>
#include <QLocale>
+#include <QPair>
+#include <QVector>
#include <QUrl>
using namespace KDUpdater;
@@ -117,6 +120,7 @@ bool UpdatesInfoData::parsePackageUpdateElement(const QDomElement &updateE)
return false;
UpdateInfo info;
+ QMap<QString, QString> localizedDescriptions;
for (int i = 0; i < updateE.childNodes().count(); i++) {
QDomElement childE = updateE.childNodes().at(i).toElement();
if (childE.isNull())
@@ -144,7 +148,10 @@ bool UpdatesInfoData::parsePackageUpdateElement(const QDomElement &updateE)
} else if (childE.tagName() == QLatin1String("DisplayName")) {
processLocalizedTag(childE, info.data);
} else if (childE.tagName() == QLatin1String("Description")) {
- processLocalizedTag(childE, info.data);
+ if (!childE.hasAttribute(QLatin1String("xml:lang")))
+ info.data[QLatin1String("Description")] = childE.text();
+ QString languageAttribute = childE.attribute(QLatin1String("xml:lang"), QLatin1String("en"));
+ localizedDescriptions.insert(languageAttribute.toLower(), childE.text());
} else if (childE.tagName() == QLatin1String("UpdateFile")) {
info.data[QLatin1String("CompressedSize")] = childE.attribute(QLatin1String("CompressedSize"));
info.data[QLatin1String("UncompressedSize")] = childE.attribute(QLatin1String("UncompressedSize"));
@@ -153,6 +160,16 @@ bool UpdatesInfoData::parsePackageUpdateElement(const QDomElement &updateE)
}
}
+ QStringList candidates;
+ foreach (const QString &lang, QLocale().uiLanguages())
+ candidates << QInstaller::localeCandidates(lang.toLower());
+ foreach (const QString &candidate, candidates) {
+ if (localizedDescriptions.contains(candidate)) {
+ info.data[QLatin1String("Description")] = localizedDescriptions.value(candidate);
+ break;
+ }
+ }
+
if (!info.data.contains(QLatin1String("Name"))) {
setInvalidContentError(tr("PackageUpdate element without Name"));
return false;