summaryrefslogtreecommitdiffstats
path: root/src/libs/kdtools
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/kdtools')
-rw-r--r--src/libs/kdtools/kdupdaterupdatesinfo.cpp21
-rw-r--r--src/libs/kdtools/kdupdaterupdatesinfodata_p.h3
2 files changed, 17 insertions, 7 deletions
diff --git a/src/libs/kdtools/kdupdaterupdatesinfo.cpp b/src/libs/kdtools/kdupdaterupdatesinfo.cpp
index b46d96943..ffc907923 100644
--- a/src/libs/kdtools/kdupdaterupdatesinfo.cpp
+++ b/src/libs/kdtools/kdupdaterupdatesinfo.cpp
@@ -140,14 +140,10 @@ bool UpdatesInfoData::parsePackageUpdateElement(const QDomElement &updateE)
info.data.insert(QLatin1String("inheritVersionFrom"),
childE.attribute(QLatin1String("inheritVersionFrom")));
info.data[childE.tagName()] = childE.text();
+ } else if (childE.tagName() == QLatin1String("DisplayName")) {
+ processLocalizedTag(childE, info.data);
} else if (childE.tagName() == QLatin1String("Description")) {
- QString languageAttribute = childE.attribute(QLatin1String("xml:lang")).toLower();
- 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();
+ processLocalizedTag(childE, info.data);
} else if (childE.tagName() == QLatin1String("UpdateFile")) {
info.data[QLatin1String("CompressedSize")] = childE.attribute(QLatin1String("CompressedSize"));
info.data[QLatin1String("UncompressedSize")] = childE.attribute(QLatin1String("UncompressedSize"));
@@ -173,6 +169,17 @@ bool UpdatesInfoData::parsePackageUpdateElement(const QDomElement &updateE)
return true;
}
+void UpdatesInfoData::processLocalizedTag(const QDomElement &childE, QHash<QString, QVariant> &info) const
+{
+ QString languageAttribute = childE.attribute(QLatin1String("xml:lang")).toLower();
+ if (!info.contains(childE.tagName()) && (languageAttribute.isEmpty()))
+ info[childE.tagName()] = childE.text();
+
+ // overwrite default if we have a language specific description
+ if (QLocale().name().startsWith(languageAttribute, Qt::CaseInsensitive))
+ info[childE.tagName()] = childE.text();
+}
+
//
// UpdatesInfo
diff --git a/src/libs/kdtools/kdupdaterupdatesinfodata_p.h b/src/libs/kdtools/kdupdaterupdatesinfodata_p.h
index 19e44fa10..786c96f1c 100644
--- a/src/libs/kdtools/kdupdaterupdatesinfodata_p.h
+++ b/src/libs/kdtools/kdupdaterupdatesinfodata_p.h
@@ -62,6 +62,9 @@ public:
bool parsePackageUpdateElement(const QDomElement &updateE);
void setInvalidContentError(const QString &detail);
+
+private:
+ void processLocalizedTag(const QDomElement &childE, QHash<QString, QVariant> &info) const;
};
} // namespace KDUpdater