kdelibs/0004-Bugfix-Plasma-PackageMetadata-read-Match-the-behavio.patch

60 lines
2.9 KiB
Diff
Raw Normal View History

From abaa32625edfd814320028200831cfedd4a4f9df Mon Sep 17 00:00:00 2001
Message-Id: <abaa32625edfd814320028200831cfedd4a4f9df.1313973932.git.kevin.kofler@chello.at>
From: Kevin Kofler <kevin.kofler@chello.at>
Date: Mon, 22 Aug 2011 01:53:57 +0200
Subject: [PATCH] Bugfix: Plasma::PackageMetadata::read: Match the behavior of
KService.
Also delete the duplicate entries in PackageMetadata::write.
---
plasma/packagemetadata.cpp | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/plasma/packagemetadata.cpp b/plasma/packagemetadata.cpp
index 59163b2..c9ff446 100644
--- a/plasma/packagemetadata.cpp
+++ b/plasma/packagemetadata.cpp
@@ -94,7 +94,9 @@ void PackageMetadata::write(const QString &filename) const
config.writeEntry("Icon", d->icon);
config.writeEntry("Comment", d->description);
config.writeEntry("Keywords", d->keywords);
+ config.deleteEntry("X-KDE-Keywords");
config.writeEntry("X-KDE-ServiceTypes", d->serviceType);
+ config.deleteEntry("ServiceTypes");
config.writeEntry("X-KDE-PluginInfo-Name", d->pluginName);
config.writeEntry("X-KDE-PluginInfo-Author", d->author);
config.writeEntry("X-KDE-PluginInfo-Email", d->email);
@@ -120,8 +122,27 @@ void PackageMetadata::read(const QString &filename)
d->name = config.readEntry("Name", d->name);
d->icon = config.readEntry("Icon", d->icon);
d->description = config.readEntry("Comment", d->description);
- d->keywords = config.readEntry("Keywords", d->keywords);
- d->serviceType = config.readEntry("X-KDE-ServiceTypes", d->serviceType);
+ bool hasKeywords = config.hasKey("Keywords");
+ bool hasXKdeKeywords = config.hasKey("X-KDE-Keywords");
+ if (hasKeywords && hasXKdeKeywords) {
+ d->keywords = config.readEntry("Keywords", d->keywords);
+ d->keywords.append(config.readEntry("X-KDE-Keywords", d->keywords));
+ } else if (hasKeywords) {
+ d->keywords = config.readEntry("Keywords", d->keywords);
+ } else if (hasXKdeKeywords) {
+ d->keywords = config.readEntry("X-KDE-Keywords", d->keywords);
+ }
+ bool hasServiceTypes = config.hasKey("ServiceTypes");
+ bool hasXKdeServiceTypes = config.hasKey("X-KDE-ServiceTypes");
+ if (hasServiceTypes && hasXKdeServiceTypes) {
+ d->serviceType = config.readEntry("ServiceTypes", d->serviceType);
+ d->serviceType.append(',');
+ d->serviceType.append(config.readEntry("X-KDE-ServiceTypes", d->serviceType));
+ } else if (hasServiceTypes) {
+ d->serviceType = config.readEntry("ServiceTypes", d->serviceType);
+ } else if (hasXKdeServiceTypes) {
+ d->serviceType = config.readEntry("X-KDE-ServiceTypes", d->serviceType);
+ }
d->pluginName = config.readEntry("X-KDE-PluginInfo-Name", d->pluginName);
d->author = config.readEntry("X-KDE-PluginInfo-Author", d->author);
d->email = config.readEntry("X-KDE-PluginInfo-Email", d->email);
--
1.7.4.4