Commit 4fc03b71 authored by David Redondo's avatar David Redondo 🏎
Browse files

Port usages of deprecated KPluginInfo to KPluginMetadata

For the interactive console this is done in !158
parent cc26bdb3
......@@ -141,18 +141,18 @@ void WidgetExplorerPrivate::initFilters()
QSet<QString> existingCategories = itemModel.categories();
//foreach (const QString &category, Plasma::Applet::listCategories(application)) {
QStringList cats;
const QList<KPluginInfo> list = PluginLoader::self()->listAppletInfo(QString());
const QList<KPluginMetaData> list = PluginLoader::self()->listAppletMetaData(QString());
for (auto& info : list) {
if (!info.isValid()) {
for (auto& plugin : list) {
if (!plugin.isValid()) {
continue;
}
if (info.property(QStringLiteral("NoDisplay")).toBool() || info.category() == QLatin1String("Containments") ||
info.category().isEmpty()) {
if (plugin.rawData().value("NoDisplay").toBool() || plugin.category() == QLatin1String("Containments") ||
plugin.category().isEmpty()) {
// we don't want to show the hidden category
continue;
}
const QString c = info.category();
const QString c = plugin.category();
if (-1 == cats.indexOf(c)) {
cats << c;
}
......
......@@ -29,8 +29,7 @@
#include <QQuickWindow>
#include <QWindow>
#include <kaboutdata.h>
#include <kaboutapplicationdialog.h>
#include <KAboutPluginDialog>
#include <klocalizedstring.h>
#include <Plasma/Corona>
......@@ -55,13 +54,13 @@ CurrentContainmentActionsModel::CurrentContainmentActionsModel(Plasma::Containme
QStandardItem *item = new QStandardItem();
item->setData(i.key(), ActionRole);
item->setData(i.value()->pluginInfo().pluginName(), PluginNameRole);
item->setData(i.value()->metadata().pluginId(), PluginNameRole);
m_plugins[i.key()] = Plasma::PluginLoader::self()->loadContainmentActions(m_containment, i.value()->pluginInfo().pluginName());
m_plugins[i.key()] = Plasma::PluginLoader::self()->loadContainmentActions(m_containment, i.value()->metadata().pluginId());
m_plugins[i.key()]->setContainment(m_containment);
KConfigGroup cfg(&m_baseCfg, i.key());
m_plugins[i.key()]->restore(cfg);
item->setData(m_plugins[i.key()]->pluginInfo().property(QStringLiteral("X-Plasma-HasConfigurationInterface")).toBool(), HasConfigurationInterfaceRole);
item->setData(m_plugins[i.key()]->metadata().rawData().value(QStringLiteral("X-Plasma-HasConfigurationInterface")).toBool(), HasConfigurationInterfaceRole);
appendRow(item);
}
......@@ -128,7 +127,7 @@ bool CurrentContainmentActionsModel::append(const QString &action, const QString
//empty config: the new one will ne in default state
KConfigGroup tempConfig(&m_tempConfigParent, "test");
m_plugins[action]->restore(tempConfig);
item->setData(m_plugins[action]->pluginInfo().property(QStringLiteral("X-Plasma-HasConfigurationInterface")).toBool(), HasConfigurationInterfaceRole);
item->setData(m_plugins[action]->metadata().rawData().value(QStringLiteral("X-Plasma-HasConfigurationInterface")).toBool(), HasConfigurationInterfaceRole);
m_removedTriggers.removeAll(action);
appendRow(item);
......@@ -166,7 +165,7 @@ void CurrentContainmentActionsModel::update(int row, const QString &action, cons
//empty config: the new one will ne in default state
KConfigGroup tempConfig(&m_tempConfigParent, "test");
m_plugins[action]->restore(tempConfig);
setData(idx, m_plugins[action]->pluginInfo().property(QStringLiteral("X-Plasma-HasConfigurationInterface")).toBool(), HasConfigurationInterfaceRole);
setData(idx, m_plugins[action]->metadata().rawData().value(QStringLiteral("X-Plasma-HasConfigurationInterface")).toBool(), HasConfigurationInterfaceRole);
}
emit configurationChanged();
......@@ -242,21 +241,10 @@ void CurrentContainmentActionsModel::showAbout(int row, QQuickItem *ctx)
return;
}
KPluginInfo info = m_plugins[action]->pluginInfo();
KPluginMetaData info = m_plugins[action]->metadata();
KAboutData aboutData(info.name(),
ki18n(info.name().toUtf8()).toString(),
info.version(),
ki18n(info.comment().toUtf8()).toString(),
KAboutLicense::byKeyword(info.license()).key(),
QString(),
QString(), info.website(),
info.email());
aboutData.addAuthor(ki18n(info.author().toUtf8()).toString(), QString(), info.email());
KAboutApplicationDialog *aboutDialog = new KAboutApplicationDialog(aboutData, qobject_cast<QWidget*>(parent()));
aboutDialog->setWindowIcon(QIcon::fromTheme(info.icon()));
auto aboutDialog = new KAboutPluginDialog(info, qobject_cast<QWidget*>(parent()));
aboutDialog->setWindowIcon(QIcon::fromTheme(info.iconName()));
aboutDialog->setAttribute(Qt::WA_DeleteOnClose);
if (ctx && ctx->window()) {
......@@ -282,7 +270,7 @@ void CurrentContainmentActionsModel::save()
KConfigGroup cfg(&m_baseCfg, i.key());
i.value()->save(cfg);
m_containment->setContainmentActions(i.key(), i.value()->pluginInfo().pluginName());
m_containment->setContainmentActions(i.key(), i.value()->metadata().pluginId());
}
}
......
......@@ -191,10 +191,10 @@ QStringList AppInterface::knownWidgetTypes() const
{
if (m_knownWidgets.isEmpty()) {
QStringList widgets;
KPluginInfo::List infoLs = Plasma::PluginLoader::self()->listAppletInfo(QString());
const QList<KPluginMetaData> plugins = Plasma::PluginLoader::self()->listAppletMetaData(QString());
foreach (const KPluginInfo &info, infoLs) {
widgets.append(info.pluginName());
for (const auto &plugin : plugins) {
widgets.append(plugin.pluginId());
}
const_cast<AppInterface *>(this)->m_knownWidgets = widgets;
......
......@@ -235,7 +235,7 @@ QString Applet::version() const
return QString();
}
return app->pluginInfo().version();
return app->pluginMetaData().version();
}
void Applet::setLocked(bool locked)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment