redo recent batch of patches

epel9
Rex Dieter 8 years ago
parent 9d5bb51f92
commit 26bd01cce3

@ -1,100 +0,0 @@
From d1708e3011969823e67869b8a1c639f15b6fd73a Mon Sep 17 00:00:00 2001
From: Aleix Pol <aleixpol@kde.org>
Date: Mon, 10 Oct 2016 16:30:24 +0200
Subject: [PATCH 1/2] Port to new plasma-framework API
Reduces unnecessary castings.
Ports away the WindowedWidgets runner from KService
REVIEW: 129101
---
applets/systemtray/systemtray.cpp | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/applets/systemtray/systemtray.cpp b/applets/systemtray/systemtray.cpp
index e1cd610..ecc23a4 100644
--- a/applets/systemtray/systemtray.cpp
+++ b/applets/systemtray/systemtray.cpp
@@ -99,19 +99,19 @@ void SystemTray::init()
{
Containment::init();
- for (const auto &info: Plasma::PluginLoader::self()->listAppletInfo(QString())) {
- if (!info.isValid() || info.property(QStringLiteral("X-Plasma-NotificationArea")) != "true") {
+ for (const auto &info: Plasma::PluginLoader::self()->listAppletMetaData(QString())) {
+ if (!info.isValid() || info.value(QStringLiteral("X-Plasma-NotificationArea")) != "true") {
continue;
}
- m_systrayApplets[info.pluginName()] = info;
+ m_systrayApplets[info.pluginId()] = KPluginInfo(info);
- if (info.isPluginEnabledByDefault()) {
- m_defaultPlasmoids += info.pluginName();
+ if (info.isEnabledByDefault()) {
+ m_defaultPlasmoids += info.pluginId();
}
- const QString dbusactivation = info.property(QStringLiteral("X-Plasma-DBusActivationService")).toString();
+ const QString dbusactivation = info.value(QStringLiteral("X-Plasma-DBusActivationService"));
if (!dbusactivation.isEmpty()) {
- qCDebug(SYSTEM_TRAY) << "ST Found DBus-able Applet: " << info.pluginName() << dbusactivation;
- m_dbusActivatableTasks[info.pluginName()] = dbusactivation;
+ qCDebug(SYSTEM_TRAY) << "ST Found DBus-able Applet: " << info.pluginId() << dbusactivation;
+ m_dbusActivatableTasks[info.pluginId()] = dbusactivation;
}
}
}
@@ -119,12 +119,12 @@ void SystemTray::init()
void SystemTray::newTask(const QString &task)
{
foreach (Plasma::Applet *applet, applets()) {
- if (!applet->pluginInfo().isValid()) {
+ if (!applet->pluginMetaData().isValid()) {
continue;
}
//only allow one instance per applet
- if (task == applet->pluginInfo().pluginName()) {
+ if (task == applet->pluginMetaData().pluginId()) {
//Applet::destroy doesn't delete the applet from Containment::applets in the same event
//potentially a dbus activated service being restarted can be added in this time.
if (!applet->destroyed()) {
@@ -156,7 +156,7 @@ void SystemTray::newTask(const QString &task)
void SystemTray::cleanupTask(const QString &task)
{
foreach (Plasma::Applet *applet, applets()) {
- if (!applet->pluginInfo().isValid() || task == applet->pluginInfo().pluginName()) {
+ if (!applet->pluginMetaData().isValid() || task == applet->pluginMetaData().pluginId()) {
//we are *not* cleaning the config here, because since is one
//of those automatically loaded/unloaded by dbus, we want to recycle
//the config the next time it's loaded, in case the user configured something here
@@ -255,11 +255,11 @@ Q_INVOKABLE QString SystemTray::plasmoidCategory(QQuickItem *appletInterface) co
}
Plasma::Applet *applet = appletInterface->property("_plasma_applet").value<Plasma::Applet*>();
- if (!applet || !applet->pluginInfo().isValid()) {
+ if (!applet || !applet->pluginMetaData().isValid()) {
return "UnknownCategory";
}
- const QString cat = applet->pluginInfo().property(QStringLiteral("X-Plasma-NotificationAreaCategory")).toString();
+ const QString cat = applet->pluginMetaData().value(QStringLiteral("X-Plasma-NotificationAreaCategory"));
if (cat.isEmpty()) {
return "UnknownCategory";
@@ -385,11 +385,11 @@ void SystemTray::restorePlasmoids()
foreach (Plasma::Applet *applet, applets()) {
//Here it should always be valid.
//for some reason it not always is.
- if (!applet->pluginInfo().isValid()) {
+ if (!applet->pluginMetaData().isValid()) {
applet->config().parent().deleteGroup();
applet->deleteLater();
} else {
- const QString task = applet->pluginInfo().pluginName();
+ const QString task = applet->pluginMetaData().pluginId();
if (!m_allowedPlasmoids.contains(task)) {
//in those cases we do delete the applet config completely
//as they were explicitly disabled by the user
--
2.7.4

@ -0,0 +1,409 @@
From d1708e3011969823e67869b8a1c639f15b6fd73a Mon Sep 17 00:00:00 2001
From: Aleix Pol <aleixpol@kde.org>
Date: Mon, 10 Oct 2016 16:30:24 +0200
Subject: [PATCH 31/59] Port to new plasma-framework API
Reduces unnecessary castings.
Ports away the WindowedWidgets runner from KService
REVIEW: 129101
---
applets/systemtray/systemtray.cpp | 30 +++++++-------
.../shellprivate/widgetexplorer/widgetexplorer.cpp | 14 +++----
plasma-windowed/plasmawindowedcorona.cpp | 2 +-
runners/windowedwidgets/windowedwidgetsrunner.cpp | 46 ++++++++++------------
runners/windowedwidgets/windowedwidgetsrunner.h | 2 +-
shell/alternativeshelper.cpp | 6 +--
shell/containmentconfigview.cpp | 2 +-
shell/scripting/containment.cpp | 4 +-
shell/scripting/widget.cpp | 2 +-
shell/shellcorona.cpp | 15 +++----
10 files changed, 60 insertions(+), 63 deletions(-)
diff --git a/applets/systemtray/systemtray.cpp b/applets/systemtray/systemtray.cpp
index e1cd610..ecc23a4 100644
--- a/applets/systemtray/systemtray.cpp
+++ b/applets/systemtray/systemtray.cpp
@@ -99,19 +99,19 @@ void SystemTray::init()
{
Containment::init();
- for (const auto &info: Plasma::PluginLoader::self()->listAppletInfo(QString())) {
- if (!info.isValid() || info.property(QStringLiteral("X-Plasma-NotificationArea")) != "true") {
+ for (const auto &info: Plasma::PluginLoader::self()->listAppletMetaData(QString())) {
+ if (!info.isValid() || info.value(QStringLiteral("X-Plasma-NotificationArea")) != "true") {
continue;
}
- m_systrayApplets[info.pluginName()] = info;
+ m_systrayApplets[info.pluginId()] = KPluginInfo(info);
- if (info.isPluginEnabledByDefault()) {
- m_defaultPlasmoids += info.pluginName();
+ if (info.isEnabledByDefault()) {
+ m_defaultPlasmoids += info.pluginId();
}
- const QString dbusactivation = info.property(QStringLiteral("X-Plasma-DBusActivationService")).toString();
+ const QString dbusactivation = info.value(QStringLiteral("X-Plasma-DBusActivationService"));
if (!dbusactivation.isEmpty()) {
- qCDebug(SYSTEM_TRAY) << "ST Found DBus-able Applet: " << info.pluginName() << dbusactivation;
- m_dbusActivatableTasks[info.pluginName()] = dbusactivation;
+ qCDebug(SYSTEM_TRAY) << "ST Found DBus-able Applet: " << info.pluginId() << dbusactivation;
+ m_dbusActivatableTasks[info.pluginId()] = dbusactivation;
}
}
}
@@ -119,12 +119,12 @@ void SystemTray::init()
void SystemTray::newTask(const QString &task)
{
foreach (Plasma::Applet *applet, applets()) {
- if (!applet->pluginInfo().isValid()) {
+ if (!applet->pluginMetaData().isValid()) {
continue;
}
//only allow one instance per applet
- if (task == applet->pluginInfo().pluginName()) {
+ if (task == applet->pluginMetaData().pluginId()) {
//Applet::destroy doesn't delete the applet from Containment::applets in the same event
//potentially a dbus activated service being restarted can be added in this time.
if (!applet->destroyed()) {
@@ -156,7 +156,7 @@ void SystemTray::newTask(const QString &task)
void SystemTray::cleanupTask(const QString &task)
{
foreach (Plasma::Applet *applet, applets()) {
- if (!applet->pluginInfo().isValid() || task == applet->pluginInfo().pluginName()) {
+ if (!applet->pluginMetaData().isValid() || task == applet->pluginMetaData().pluginId()) {
//we are *not* cleaning the config here, because since is one
//of those automatically loaded/unloaded by dbus, we want to recycle
//the config the next time it's loaded, in case the user configured something here
@@ -255,11 +255,11 @@ Q_INVOKABLE QString SystemTray::plasmoidCategory(QQuickItem *appletInterface) co
}
Plasma::Applet *applet = appletInterface->property("_plasma_applet").value<Plasma::Applet*>();
- if (!applet || !applet->pluginInfo().isValid()) {
+ if (!applet || !applet->pluginMetaData().isValid()) {
return "UnknownCategory";
}
- const QString cat = applet->pluginInfo().property(QStringLiteral("X-Plasma-NotificationAreaCategory")).toString();
+ const QString cat = applet->pluginMetaData().value(QStringLiteral("X-Plasma-NotificationAreaCategory"));
if (cat.isEmpty()) {
return "UnknownCategory";
@@ -385,11 +385,11 @@ void SystemTray::restorePlasmoids()
foreach (Plasma::Applet *applet, applets()) {
//Here it should always be valid.
//for some reason it not always is.
- if (!applet->pluginInfo().isValid()) {
+ if (!applet->pluginMetaData().isValid()) {
applet->config().parent().deleteGroup();
applet->deleteLater();
} else {
- const QString task = applet->pluginInfo().pluginName();
+ const QString task = applet->pluginMetaData().pluginId();
if (!m_allowedPlasmoids.contains(task)) {
//in those cases we do delete the applet config completely
//as they were explicitly disabled by the user
diff --git a/components/shellprivate/widgetexplorer/widgetexplorer.cpp b/components/shellprivate/widgetexplorer/widgetexplorer.cpp
index 7274d04..4915ab2 100644
--- a/components/shellprivate/widgetexplorer/widgetexplorer.cpp
+++ b/components/shellprivate/widgetexplorer/widgetexplorer.cpp
@@ -249,14 +249,14 @@ void WidgetExplorerPrivate::addContainment(Containment *containment)
QObject::connect(containment, SIGNAL(appletRemoved(Plasma::Applet*)), q, SLOT(appletRemoved(Plasma::Applet*)));
foreach (Applet *applet, containment->applets()) {
- if (applet->pluginInfo().isValid()) {
+ if (applet->pluginMetaData().isValid()) {
Containment *childContainment = applet->property("containment").value<Containment*>();
if (childContainment) {
addContainment(childContainment);
}
- runningApplets[applet->pluginInfo().pluginName()]++;
+ runningApplets[applet->pluginMetaData().pluginId()]++;
} else {
- qDebug() << "Invalid plugininfo. :(";
+ qDebug() << "Invalid plugin metadata. :(";
}
}
}
@@ -268,10 +268,10 @@ void WidgetExplorerPrivate::containmentDestroyed()
void WidgetExplorerPrivate::appletAdded(Plasma::Applet *applet)
{
- if (!applet->pluginInfo().isValid()) {
+ if (!applet->pluginMetaData().isValid()) {
return;
}
- QString name = applet->pluginInfo().pluginName();
+ QString name = applet->pluginMetaData().pluginId();
runningApplets[name]++;
appletNames.insert(applet, name);
@@ -471,9 +471,9 @@ void WidgetExplorer::uninstall(const QString &pluginName)
const auto &applets = c->applets();
foreach (Applet *applet, applets) {
- const auto &appletInfo = applet->pluginInfo();
+ const auto &appletInfo = applet->pluginMetaData();
- if (appletInfo.isValid() && appletInfo.pluginName() == pluginName) {
+ if (appletInfo.isValid() && appletInfo.pluginId() == pluginName) {
applet->destroy();
}
}
diff --git a/plasma-windowed/plasmawindowedcorona.cpp b/plasma-windowed/plasmawindowedcorona.cpp
index fbacbf8..b68d270 100644
--- a/plasma-windowed/plasmawindowedcorona.cpp
+++ b/plasma-windowed/plasmawindowedcorona.cpp
@@ -51,7 +51,7 @@ void PlasmaWindowedCorona::loadApplet(const QString &applet, const QVariantList
//forbid more instances per applet (todo: activate the correpsponding already loaded applet)
for (Plasma::Applet *a : cont->applets()) {
- if (a->pluginInfo().pluginName() == applet) {
+ if (a->pluginMetaData().pluginId() == applet) {
return;
}
}
diff --git a/runners/windowedwidgets/windowedwidgetsrunner.cpp b/runners/windowedwidgets/windowedwidgetsrunner.cpp
index 5ccbd27..7f093a7 100644
--- a/runners/windowedwidgets/windowedwidgetsrunner.cpp
+++ b/runners/windowedwidgets/windowedwidgetsrunner.cpp
@@ -60,24 +60,22 @@ void WindowedWidgetsRunner::match(Plasma::RunnerContext &context)
QList<Plasma::QueryMatch> matches;
- foreach (const KPluginInfo &info, Plasma::PluginLoader::self()->listAppletInfo(QString())) {
- KService::Ptr service = info.service();
-
- if (((service->name().contains(term, Qt::CaseInsensitive) ||
- service->genericName().contains(term, Qt::CaseInsensitive) ||
- service->comment().contains(term, Qt::CaseInsensitive)) ||
- service->categories().contains(term, Qt::CaseInsensitive) ||
+ foreach (const KPluginMetaData &md, Plasma::PluginLoader::self()->listAppletMetaData(QString())) {
+ if (((md.name().contains(term, Qt::CaseInsensitive) ||
+ md.value(QLatin1String("GenericName")).contains(term, Qt::CaseInsensitive) ||
+ md.description().contains(term, Qt::CaseInsensitive)) ||
+ md.category().contains(term, Qt::CaseInsensitive) ||
term.startsWith(i18nc("Note this is a KRunner keyword", "mobile applications"))) &&
- !info.property(QStringLiteral("NoDisplay")).toBool()) {
+ !md.rawData().value(QStringLiteral("NoDisplay")).toBool()) {
- QVariant val = info.property(QStringLiteral("X-Plasma-StandAloneApp"));
+ QVariant val = md.value(QStringLiteral("X-Plasma-StandAloneApp"));
if (!val.isValid() || !val.toBool()) {
continue;
}
Plasma::QueryMatch match(this);
- setupMatch(service, match);
- if (service->name().compare(term, Qt::CaseInsensitive) == 0) {
+ setupMatch(md, match);
+ if (md.name().compare(term, Qt::CaseInsensitive) == 0) {
match.setType(Plasma::QueryMatch::ExactMatch);
match.setRelevance(1);
} else {
@@ -85,8 +83,6 @@ void WindowedWidgetsRunner::match(Plasma::RunnerContext &context)
match.setRelevance(0.7);
}
matches << match;
-
- qDebug() << service;
}
}
@@ -100,27 +96,27 @@ void WindowedWidgetsRunner::match(Plasma::RunnerContext &context)
void WindowedWidgetsRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match)
{
Q_UNUSED(context);
- KService::Ptr service = KService::serviceByStorageId(match.data().toString());
- if (service) {
- QProcess::startDetached(QStringLiteral("plasmawindowed"), QStringList() << service->property(QStringLiteral("X-KDE-PluginInfo-Name"), QVariant::String).toString());
+ KPluginMetaData md(match.data().toString());
+ if (md.isValid()) {
+ QProcess::startDetached(QStringLiteral("plasmawindowed"), QStringList() << md.pluginId());
}
}
-void WindowedWidgetsRunner::setupMatch(const KService::Ptr &service, Plasma::QueryMatch &match)
+void WindowedWidgetsRunner::setupMatch(const KPluginMetaData &md, Plasma::QueryMatch &match)
{
- const QString name = service->name();
+ const QString name = md.pluginId();
match.setText(name);
- match.setData(service->storageId());
+ match.setData(md.metaDataFileName());
- if (!service->genericName().isEmpty() && service->genericName() != name) {
- match.setSubtext(service->genericName());
- } else if (!service->comment().isEmpty()) {
- match.setSubtext(service->comment());
+ if (!md.name().isEmpty() && md.name() != name) {
+ match.setSubtext(md.name());
+ } else if (!md.description().isEmpty()) {
+ match.setSubtext(md.description());
}
- if (!service->icon().isEmpty()) {
- match.setIconName(service->icon());
+ if (!md.iconName().isEmpty()) {
+ match.setIconName(md.iconName());
}
}
diff --git a/runners/windowedwidgets/windowedwidgetsrunner.h b/runners/windowedwidgets/windowedwidgetsrunner.h
index 2294965..fbc8006 100644
--- a/runners/windowedwidgets/windowedwidgetsrunner.h
+++ b/runners/windowedwidgets/windowedwidgetsrunner.h
@@ -48,7 +48,7 @@ protected Q_SLOTS:
protected:
- void setupMatch(const KService::Ptr &service, Plasma::QueryMatch &action);
+ void setupMatch(const KPluginMetaData &md, Plasma::QueryMatch &action);
};
#endif
diff --git a/shell/alternativeshelper.cpp b/shell/alternativeshelper.cpp
index d0f5dfd..6d76307 100644
--- a/shell/alternativeshelper.cpp
+++ b/shell/alternativeshelper.cpp
@@ -38,12 +38,12 @@ AlternativesHelper::~AlternativesHelper()
QStringList AlternativesHelper::appletProvides() const
{
- return m_applet->pluginInfo().property(QStringLiteral("X-Plasma-Provides")).toStringList();
+ return KPluginMetaData::readStringList(m_applet->pluginMetaData().rawData(), QStringLiteral("X-Plasma-Provides"));
}
QString AlternativesHelper::currentPlugin() const
{
- return m_applet->pluginInfo().pluginName();
+ return m_applet->pluginMetaData().pluginId();
}
QQuickItem *AlternativesHelper::applet() const
@@ -53,7 +53,7 @@ QQuickItem *AlternativesHelper::applet() const
void AlternativesHelper::loadAlternative(const QString &plugin)
{
- if (plugin == m_applet->pluginInfo().pluginName() || m_applet->isContainment()) {
+ if (plugin == m_applet->pluginMetaData().pluginId() || m_applet->isContainment()) {
return;
}
diff --git a/shell/containmentconfigview.cpp b/shell/containmentconfigview.cpp
index cec067e..4c9d146 100644
--- a/shell/containmentconfigview.cpp
+++ b/shell/containmentconfigview.cpp
@@ -104,7 +104,7 @@ QAbstractItemModel *ContainmentConfigView::currentContainmentActionsModel()
QString ContainmentConfigView::containmentPlugin() const
{
- return m_containment->pluginInfo().pluginName();
+ return m_containment->pluginMetaData().pluginId();
}
void ContainmentConfigView::setContainmentPlugin(const QString &plugin)
diff --git a/shell/scripting/containment.cpp b/shell/scripting/containment.cpp
index 6040e62..96e2009 100644
--- a/shell/scripting/containment.cpp
+++ b/shell/scripting/containment.cpp
@@ -248,7 +248,7 @@ QScriptValue Containment::widgets(QScriptContext *context, QScriptEngine *engine
int count = 0;
foreach (Plasma::Applet *widget, c->d->containment.data()->applets()) {
- if (widgetType.isEmpty() || widget->pluginInfo().pluginName() == widgetType) {
+ if (widgetType.isEmpty() || widget->pluginMetaData().pluginId() == widgetType) {
widgets.setProperty(count, env->wrap(widget));
++count;
}
@@ -273,7 +273,7 @@ QString Containment::type() const
return QString();
}
- return d->containment.data()->pluginInfo().pluginName();
+ return d->containment.data()->pluginMetaData().pluginId();
}
void Containment::remove()
diff --git a/shell/scripting/widget.cpp b/shell/scripting/widget.cpp
index a651c2a..b58822b 100644
--- a/shell/scripting/widget.cpp
+++ b/shell/scripting/widget.cpp
@@ -65,7 +65,7 @@ uint Widget::id() const
QString Widget::type() const
{
if (d->applet) {
- return d->applet.data()->pluginInfo().pluginName();
+ return d->applet.data()->pluginMetaData().pluginId();
}
return QString();
diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp
index 152ffeb..2c3e734 100644
--- a/shell/shellcorona.cpp
+++ b/shell/shellcorona.cpp
@@ -406,7 +406,7 @@ QByteArray ShellCorona::dumpCurrentLayoutJS() const
|| cont->location() == Plasma::Types::BottomEdge
|| cont->location() == Plasma::Types::LeftEdge
|| cont->location() == Plasma::Types::RightEdge) &&
- cont->pluginInfo().pluginName() != QStringLiteral("org.kde.plasma.private.systemtray");
+ cont->pluginMetaData().pluginId() != QStringLiteral("org.kde.plasma.private.systemtray");
};
auto isDesktop = [] (Plasma::Containment *cont) {
@@ -486,7 +486,7 @@ QByteArray ShellCorona::dumpCurrentLayoutJS() const
KConfigGroup appletConfig = applet->config();
- appletJson.insert("plugin", applet->pluginInfo().pluginName());
+ appletJson.insert("plugin", applet->pluginMetaData().pluginId());
appletJson.insert("config", dumpconfigGroupJS(appletConfig));
appletsJsonArray << appletJson;
@@ -553,7 +553,7 @@ QByteArray ShellCorona::dumpCurrentLayoutJS() const
QJsonObject appletJson;
appletJson.insert("title", applet->title());
- appletJson.insert("plugin", applet->pluginInfo().pluginName());
+ appletJson.insert("plugin", applet->pluginMetaData().pluginId());
appletJson.insert("geometry.x", geometry.x() / gridUnit);
appletJson.insert("geometry.y", geometry.y() / gridUnit);
@@ -1230,11 +1230,11 @@ void ShellCorona::handleContainmentAdded(Plasma::Containment *c)
void ShellCorona::executeSetupPlasmoidScript(Plasma::Containment *containment, Plasma::Applet *applet)
{
- if (!applet->pluginInfo().isValid() || !containment->pluginInfo().isValid()) {
+ if (!applet->pluginMetaData().isValid() || !containment->pluginMetaData().isValid()) {
return;
}
- const QString scriptFile = m_lookAndFeelPackage.filePath("plasmoidsetupscripts", applet->pluginInfo().pluginName() + ".js");
+ const QString scriptFile = m_lookAndFeelPackage.filePath("plasmoidsetupscripts", applet->pluginMetaData().pluginId() + ".js");
if (scriptFile.isEmpty()) {
return;
@@ -1533,7 +1533,7 @@ Plasma::Containment *ShellCorona::setContainmentTypeForScreen(int screen, const
//if creation failed or invalid plugin, give up
if (!newContainment) {
return oldContainment;
- } else if (!newContainment->pluginInfo().isValid()) {
+ } else if (!newContainment->pluginMetaData().isValid()) {
newContainment->deleteLater();
return oldContainment;
}
@@ -1966,7 +1966,8 @@ void ShellCorona::activateLauncherMenu()
for (auto it = m_panelViews.constBegin(), end = m_panelViews.constEnd(); it != end; ++it) {
const auto applets = it.key()->applets();
for (auto applet : applets) {
- if (applet->pluginInfo().property("X-Plasma-Provides").toStringList().contains(QStringLiteral("org.kde.plasma.launchermenu"))) {
+ const auto provides = KPluginMetaData::readStringList(applet->pluginMetaData().rawData(), QStringLiteral("X-Plasma-Provides"));
+ if (provides.contains(QLatin1String("org.kde.plasma.launchermenu"))) {
if (!applet->globalShortcut().isEmpty()) {
emit applet->activated();
return;
--
2.7.4

@ -1,7 +1,7 @@
From 749f60b89f4a166833fb64a5b593a801f63f9615 Mon Sep 17 00:00:00 2001
From: Lindsay Roberts <m@lindsayr.com>
Date: Mon, 10 Oct 2016 19:55:49 +0300
Subject: [PATCH 2/2] Systray: Move all icon resolution to dataengine
Subject: [PATCH 33/59] Systray: Move all icon resolution to dataengine
Summary:
Changes triggered by investigation into a long-running high CPU usage bug with system tray animations. The systray itself had icon name to icon resolution code, which was being triggered (twice) for every icon, every time any icon in the systray was updated. This code was spinning up a KIconLoader on each of these instances, and throwing it directly away. Each one triggered a large quantity of memory allocations and disk scans.
@ -24,9 +24,48 @@ Tags: #plasma
Differential Revision: https://phabricator.kde.org/D2986
---
applets/systemtray/systemtray.cpp | 52 ---------------------------------------
1 file changed, 52 deletions(-)
.../package/contents/ui/ConfigEntries.qml | 2 +-
.../contents/ui/items/StatusNotifierItem.qml | 4 +-
applets/systemtray/systemtray.cpp | 52 ----------------------
applets/systemtray/systemtray.h | 6 ---
.../statusnotifieritemsource.cpp | 9 +++-
5 files changed, 10 insertions(+), 63 deletions(-)
diff --git a/applets/systemtray/package/contents/ui/ConfigEntries.qml b/applets/systemtray/package/contents/ui/ConfigEntries.qml
index ca8b058..aefac23 100644
--- a/applets/systemtray/package/contents/ui/ConfigEntries.qml
+++ b/applets/systemtray/package/contents/ui/ConfigEntries.qml
@@ -75,7 +75,7 @@ QtLayouts.GridLayout {
"index": i,
"taskId": item.Id,
"name": item.Title,
- "iconName": plasmoid.nativeInterface.resolveIcon(item.IconName, item.IconThemePath),
+ "iconName": item.IconName,
"icon": item.Icon
});
}
diff --git a/applets/systemtray/package/contents/ui/items/StatusNotifierItem.qml b/applets/systemtray/package/contents/ui/items/StatusNotifierItem.qml
index 115e1fb..889b8b5 100644
--- a/applets/systemtray/package/contents/ui/items/StatusNotifierItem.qml
+++ b/applets/systemtray/package/contents/ui/items/StatusNotifierItem.qml
@@ -28,7 +28,7 @@ AbstractItem {
text: Title
mainText: ToolTipTitle != "" ? ToolTipTitle : Title
subText: ToolTipSubTitle
- icon: ToolTipIcon != "" ? ToolTipIcon : plasmoid.nativeInterface.resolveIcon(IconName != "" ? IconName : Icon, IconThemePath)
+ icon: ToolTipIcon != "" ? ToolTipIcon : Icon ? Icon : IconName
textFormat: Text.AutoText
category: Category
@@ -48,7 +48,7 @@ AbstractItem {
PlasmaCore.IconItem {
id: iconItem
- source: plasmoid.nativeInterface.resolveIcon(IconName != "" ? IconName : Icon, IconThemePath)
+ source: Icon ? Icon : IconName
width: Math.min(parent.width, parent.height)
height: width
active: taskIcon.containsMouse
diff --git a/applets/systemtray/systemtray.cpp b/applets/systemtray/systemtray.cpp
index ecc23a4..3234dd1 100644
--- a/applets/systemtray/systemtray.cpp
@ -102,6 +141,49 @@ index ecc23a4..3234dd1 100644
void SystemTray::showPlasmoidMenu(QQuickItem *appletInterface, int x, int y)
{
if (!appletInterface) {
diff --git a/applets/systemtray/systemtray.h b/applets/systemtray/systemtray.h
index 953d81b..0a93fe2 100644
--- a/applets/systemtray/systemtray.h
+++ b/applets/systemtray/systemtray.h
@@ -60,12 +60,6 @@ public:
//Invokable utilities
/**
- * returns either a simple icon name or a custom path if the app is
- * using a custom theme
- */
- Q_INVOKABLE QVariant resolveIcon(const QVariant &variant, const QString &iconThemePath);
-
- /**
* Given an AppletInterface pointer, shows a proper context menu for it
*/
Q_INVOKABLE void showPlasmoidMenu(QQuickItem *appletInterface, int x, int y);
diff --git a/dataengines/statusnotifieritem/statusnotifieritemsource.cpp b/dataengines/statusnotifieritem/statusnotifieritemsource.cpp
index 2df5e79..d835d50 100644
--- a/dataengines/statusnotifieritem/statusnotifieritemsource.cpp
+++ b/dataengines/statusnotifieritem/statusnotifieritemsource.cpp
@@ -240,14 +240,19 @@ void StatusNotifierItemSource::refreshCallback(QDBusPendingCallWatcher *call)
if (!m_customIconLoader) {
m_customIconLoader = new KIconLoader(QString(), QStringList(), this);
}
+ // FIXME: If last part of path is not "icons", this won't work!
+ QString appName;
+ auto tokens = path.splitRef('/', QString::SkipEmptyParts);
+ if (tokens.length() >= 3 && tokens.takeLast() == QLatin1String("icons"))
+ appName = tokens.takeLast().toString();
//icons may be either in the root directory of the passed path or in a appdir format
//i.e hicolor/32x32/iconname.png
- m_customIconLoader->reconfigure(QString(), QStringList(path));
+ m_customIconLoader->reconfigure(appName, QStringList(path));
//add app dir requires an app name, though this is completely unused in this context
- m_customIconLoader->addAppDir(QStringLiteral("unused"), path);
+ m_customIconLoader->addAppDir(appName.size() ? appName : QStringLiteral("unused"), path);
}
setData(QStringLiteral("IconThemePath"), path);
--
2.7.4

@ -55,8 +55,8 @@ Patch52: plasma-workspace-5.6.4-installdbgsymbols.patch
## upstream Patches (master branch)
# systray-related fixes
Patch21: 0001-Port-to-new-plasma-framework-API.patch
Patch22: 0002-Systray-Move-all-icon-resolution-to-dataengine.patch
Patch31: 0031-Port-to-new-plasma-framework-API.patch
Patch33: 0033-Systray-Move-all-icon-resolution-to-dataengine.patch
# udev
BuildRequires: zlib-devel
@ -429,9 +429,8 @@ BuildArch: noarch
## upstream patches
## not strictly needed atm, we care more about patch22 -- rex
#patch21 -p1 -b .0001
%patch22 -p1 -b .0002
#patch31 -p1 -b .0031
%patch33 -p1 -b .0033
%if 0%{?fedora} > 23
# dnf debuginfo-install

Loading…
Cancel
Save