[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [plasma-workspace] /: Revert "Revert "Port to new plasma-framework API""
From: David Edmundson <kde () davidedmundson ! co ! uk>
Date: 2016-11-17 10:32:32
Message-ID: E1c7Jzc-0006gh-4g () code ! kde ! org
[Download RAW message or body]
Git commit dbb7f8aecfb34923c4cb891e6455739b40694815 by David Edmundson.
Committed on 17/11/2016 at 10:26.
Pushed by davidedmundson into branch 'master'.
Revert "Revert "Port to new plasma-framework API""
This commit was wrong in 5.8, but fine in master where we can
raise the dependency
This reverts commit 9e457e8c639f1db0b42a22036d61673aeac6a60f.
M +15 -15 applets/systemtray/systemtray.cpp
M +7 -7 components/shellprivate/widgetexplorer/widgetexplorer.cpp
M +1 -1 plasma-windowed/plasmawindowedcorona.cpp
M +22 -26 runners/windowedwidgets/windowedwidgetsrunner.cpp
M +1 -1 runners/windowedwidgets/windowedwidgetsrunner.h
M +3 -3 shell/alternativeshelper.cpp
M +1 -1 shell/containmentconfigview.cpp
M +2 -2 shell/scripting/containment.cpp
M +1 -1 shell/scripting/widget.cpp
M +8 -7 shell/shellcorona.cpp
http://commits.kde.org/plasma-workspace/dbb7f8aecfb34923c4cb891e6455739b40694815
diff --git a/applets/systemtray/systemtray.cpp b/applets/systemtray/systemtray.cpp
index b4211d7..af82a00 100644
--- a/applets/systemtray/systemtray.cpp
+++ b/applets/systemtray/systemtray.cpp
@@ -73,19 +73,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; }
}
}
@@ -93,12 +93,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()) {
@@ -130,7 +130,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 @@ -203,11 +203,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";
@@ -338,11 +338,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 848aa47..74fa2b0 \
100644
--- a/components/shellprivate/widgetexplorer/widgetexplorer.cpp
+++ b/components/shellprivate/widgetexplorer/widgetexplorer.cpp
@@ -277,14 +277,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. :(";
}
}
}
@@ -296,10 +296,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);
@@ -495,9 +495,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 f86159a..706b1bb 100644
--- a/runners/windowedwidgets/windowedwidgetsrunner.cpp
+++ b/runners/windowedwidgets/windowedwidgetsrunner.cpp
@@ -60,28 +60,26 @@ 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->isValid()) {
+ foreach (const KPluginMetaData &md, \
Plasma::PluginLoader::self()->listAppletMetaData(QString())) { + if \
(!md.isValid()) { continue;
}
- 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) ||
+ 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 {
@@ -89,8 +87,6 @@ void WindowedWidgetsRunner::match(Plasma::RunnerContext &context)
match.setRelevance(0.7);
}
matches << match;
-
- qDebug() << service;
}
}
@@ -104,27 +100,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 833cfb0..269ae2b 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 17f1ab5..0422bc3 100644
--- a/shell/shellcorona.cpp
+++ b/shell/shellcorona.cpp
@@ -391,7 +391,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) {
@@ -478,7 +478,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;
@@ -545,7 +545,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);
@@ -1254,11 +1254,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;
@@ -1557,7 +1557,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;
}
@@ -1992,7 +1992,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;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic