summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleix Pol <[email protected]>2016-12-19 15:42:46 +0100
committerAleix Pol <[email protected]>2016-12-19 15:42:46 +0100
commitf1606eb6ae6aa20ebda4d810c03135f336c05398 (patch)
tree24c80cb305e395884a9ca60b156c306e0142010c
parent26aeaffa0d0a5fe4f3f771ec4c183e6a6b45b14a (diff)
Check on the knsrc file to figure out the name of its resource
-rw-r--r--libdiscover/backends/KNSBackend/KNSBackend.cpp7
-rw-r--r--libdiscover/backends/KNSBackend/custom/discover_ktexteditor_codesnippets_core.knsrc2
2 files changed, 8 insertions, 1 deletions
diff --git a/libdiscover/backends/KNSBackend/KNSBackend.cpp b/libdiscover/backends/KNSBackend/KNSBackend.cpp
index d083613..8c7e32f 100644
--- a/libdiscover/backends/KNSBackend/KNSBackend.cpp
+++ b/libdiscover/backends/KNSBackend/KNSBackend.cpp
@@ -124,6 +124,11 @@ void KNSBackend::setMetaData(const QString& iconName, const QString &knsrc)
const QVector<QPair<FilterType, QString>> filters = { {CategoryFilter, fileName } };
const QSet<QString> potatoe = { QStringLiteral("potatoe") };
+ QString displayName = group.readEntry("Name", QString());
+ if (displayName.isEmpty()) {
+ displayName = fileName.mid(0, fileName.indexOf(QLatin1Char('.')));
+ displayName[0] = displayName[0].toUpper();
+ }
static const QSet<QString> knsrcPlasma = {
QStringLiteral("aurorae.knsrc"), QStringLiteral("icons.knsrc"), QStringLiteral("kfontinst.knsrc"), QStringLiteral("lookandfeel.knsrc"), QStringLiteral("plasma-themes.knsrc"), QStringLiteral("plasmoids.knsrc"),
@@ -132,7 +137,7 @@ void KNSBackend::setMetaData(const QString& iconName, const QString &knsrc)
QStringLiteral("cgcgtk3.knsrc"), QStringLiteral("cgcicon.knsrc"), QStringLiteral("cgctheme.knsrc"), //GTK integration
QStringLiteral("kwinswitcher.knsrc"), QStringLiteral("kwineffect.knsrc"), QStringLiteral("kwinscripts.knsrc") //KWin
};
- auto actualCategory = new Category(fileName.mid(0, fileName.indexOf(QLatin1Char('.'))), QStringLiteral("plasma"), filters, potatoe, {}, QUrl(), true);
+ auto actualCategory = new Category(displayName, QStringLiteral("plasma"), filters, potatoe, {}, QUrl(), true);
const auto topLevelName = knsrcPlasma.contains(fileName)? i18n("Plasma Addons") : i18n("Application Addons");
const QUrl decoration(knsrcPlasma.contains(fileName)? QStringLiteral("https://c2.staticflickr.com/4/3148/3042248532_20bd2e38f4_b.jpg") : QStringLiteral("https://c2.staticflickr.com/8/7067/6847903539_d9324dcd19_o.jpg"));
diff --git a/libdiscover/backends/KNSBackend/custom/discover_ktexteditor_codesnippets_core.knsrc b/libdiscover/backends/KNSBackend/custom/discover_ktexteditor_codesnippets_core.knsrc
index 0c3a458..1adba81 100644
--- a/libdiscover/backends/KNSBackend/custom/discover_ktexteditor_codesnippets_core.knsrc
+++ b/libdiscover/backends/KNSBackend/custom/discover_ktexteditor_codesnippets_core.knsrc
@@ -1,4 +1,6 @@
[KNewStuff3]
+Name=Kate Snippets
+
#ProvidersUrl=http://.../provider.xml
ProvidersUrl=http://download.kde.org/ocs/providers.xml
Categories=KTextEditor Snippet