diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -39,7 +39,6 @@ dialogstatetest fallbackpackagetest packagestructuretest - packageurlinterceptortest pluginloadertest framesvgtest iconitemtest diff --git a/autotests/packageurlinterceptortest.h b/autotests/packageurlinterceptortest.h deleted file mode 100644 --- a/autotests/packageurlinterceptortest.h +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************** -* Copyright 2013 Sebastian Kügler * -* * -* This library is free software; you can redistribute it and/or * -* modify it under the terms of the GNU Library General Public * -* License as published by the Free Software Foundation; either * -* version 2 of the License, or (at your option) any later version. * -* * -* This library is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * -* Library General Public License for more details. * -* * -* You should have received a copy of the GNU Library General Public License * -* along with this library; see the file COPYING.LIB. If not, write to * -* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * -* Boston, MA 02110-1301, USA. * -*******************************************************************************/ - -#ifndef PACKAGEURLINTERCEPTORTEST_H -#define PACKAGEURLINTERCEPTORTEST_H - -#include - -class PackageUrlInterceptorTest : public QObject -{ - Q_OBJECT -public: - PackageUrlInterceptorTest() {} - -private Q_SLOTS: - void loadAccessManager(); -}; - -#endif diff --git a/autotests/packageurlinterceptortest.cpp b/autotests/packageurlinterceptortest.cpp deleted file mode 100644 --- a/autotests/packageurlinterceptortest.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/****************************************************************************** -* Copyright 2013 Sebastian Kügler * -* * -* This library is free software; you can redistribute it and/or * -* modify it under the terms of the GNU Library General Public * -* License as published by the Free Software Foundation; either * -* version 2 of the License, or (at your option) any later version. * -* * -* This library is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * -* Library General Public License for more details. * -* * -* You should have received a copy of the GNU Library General Public License * -* along with this library; see the file COPYING.LIB. If not, write to * -* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * -* Boston, MA 02110-1301, USA. * -*******************************************************************************/ - -#include "packageurlinterceptortest.h" - -#include - -#include -#include - -QTEST_MAIN(PackageUrlInterceptorTest) - -void PackageUrlInterceptorTest::loadAccessManager() -{ - const Plasma::Package &pkg = Plasma::Package(); - //TODO: tests on path resolution -} - -#include "moc_packageurlinterceptortest.cpp" - diff --git a/src/plasma/package.h b/src/plasma/package.h --- a/src/plasma/package.h +++ b/src/plasma/package.h @@ -98,6 +98,12 @@ * Copy constructore * @since 4.6 */ + PLASMA_DEPRECATED Package(const KPackage::Package &other); + + /** + * Copy constructore + * @since 4.6 + */ PLASMA_DEPRECATED Package(const Package &other); ~Package(); diff --git a/src/plasma/package.cpp b/src/plasma/package.cpp --- a/src/plasma/package.cpp +++ b/src/plasma/package.cpp @@ -84,6 +84,13 @@ PackageStructureWrapper::s_packagesMap[d->internalPackage] = this; } +Package::Package(const KPackage::Package &other) + : d(new Plasma::PackagePrivate()) +{ + d->internalPackage = new KPackage::Package(other); + PackageStructureWrapper::s_packagesMap[d->internalPackage] = this; +} + Package::~Package() { PackageStructureWrapper::s_packagesMap.remove(d->internalPackage); diff --git a/src/plasma/pluginloader.h b/src/plasma/pluginloader.h --- a/src/plasma/pluginloader.h +++ b/src/plasma/pluginloader.h @@ -202,15 +202,33 @@ * Returns a list of all known applets associated with a certain mimetype. * * @return list of applets + * + * @deprecated use listAppletMetaDataForMimeType instead + **/ + PLASMA_DEPRECATED KPluginInfo::List listAppletInfoForMimeType(const QString &mimetype); + + /** + * Returns a list of all known applets associated with a certain mimetype. + * + * @return list of applets + **/ + QList listAppletMetaDataForMimeType(const QString &mimetype); + + /** + * Returns a list of all known applets associated with a certain URL. + * + * @return list of applets + * + * @deprecated use listAppletMetaDataForUrl instead **/ - KPluginInfo::List listAppletInfoForMimeType(const QString &mimetype); + PLASMA_DEPRECATED KPluginInfo::List listAppletInfoForUrl(const QUrl &url); /** * Returns a list of all known applets associated with a certain URL. * * @return list of applets **/ - KPluginInfo::List listAppletInfoForUrl(const QUrl &url); + QList listAppletMetaDataForUrl(const QUrl &url); /** * Returns a list of all the categories used by installed applets. diff --git a/src/plasma/pluginloader.cpp b/src/plasma/pluginloader.cpp --- a/src/plasma/pluginloader.cpp +++ b/src/plasma/pluginloader.cpp @@ -534,16 +534,21 @@ return list; } -KPluginInfo::List PluginLoader::listAppletInfoForMimeType(const QString &mimeType) +QList PluginLoader::listAppletMetaDataForMimeType(const QString &mimeType) { auto filter = [&mimeType](const KPluginMetaData &md) -> bool { return KPluginMetaData::readStringList(md.rawData(), QStringLiteral("X-Plasma-DropMimeTypes")).contains(mimeType); }; - return KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter).toVector()); + return KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter); } -KPluginInfo::List PluginLoader::listAppletInfoForUrl(const QUrl &url) +KPluginInfo::List PluginLoader::listAppletInfoForMimeType(const QString &mimeType) +{ + return KPluginInfo::fromMetaData(listAppletMetaDataForMimeType(mimeType).toVector()); +} + +QList PluginLoader::listAppletMetaDataForUrl(const QUrl &url) { QString parentApp; QCoreApplication *app = QCoreApplication::instance(); @@ -556,9 +561,9 @@ const QString pa = md.value(QStringLiteral("X-KDE-ParentApp")); return (pa.isEmpty() || pa == parentApp) && !KPluginMetaData::readStringList(md.rawData(), QStringLiteral("X-Plasma-DropUrlPatterns")).isEmpty(); }; - QList allApplets = KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter); + const QList allApplets = KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Applet"), QString(), filter); - KPluginInfo::List filtered; + QList filtered; foreach (const KPluginMetaData &md, allApplets) { QStringList urlPatterns = KPluginMetaData::readStringList(md.rawData(), QStringLiteral("X-Plasma-DropUrlPatterns")); foreach (const QString &glob, urlPatterns) { @@ -568,14 +573,19 @@ #ifndef NDEBUG // qCDebug(LOG_PLASMA) << md.name() << "matches" << glob << url; #endif - filtered << KPluginInfo::fromMetaData(md); + filtered << md; } } } return filtered; } +KPluginInfo::List PluginLoader::listAppletInfoForUrl(const QUrl &url) +{ + return KPluginInfo::fromMetaData(listAppletMetaDataForUrl(url).toVector()); +} + QStringList PluginLoader::listAppletCategories(const QString &parentApp, bool visibleOnly) { KConfigGroup group(KSharedConfig::openConfig(), "General"); diff --git a/src/plasmaquick/appletquickitem.h b/src/plasmaquick/appletquickitem.h --- a/src/plasmaquick/appletquickitem.h +++ b/src/plasmaquick/appletquickitem.h @@ -102,11 +102,11 @@ //Make the constructor lighter and delay the actual instantiation of the qml in the applet virtual void init(); - Plasma::Package appletPackage() const; - void setAppletPackage(const Plasma::Package &package); + PLASMA_DEPRECATED Plasma::Package appletPackage() const; + PLASMA_DEPRECATED void setAppletPackage(const Plasma::Package &package); - Plasma::Package coronaPackage() const; - void setCoronaPackage(const Plasma::Package &package); + PLASMA_DEPRECATED Plasma::Package coronaPackage() const; + PLASMA_DEPRECATED void setCoronaPackage(const Plasma::Package &package); QQuickItem *compactRepresentationItem(); QQuickItem *fullRepresentationItem(); diff --git a/src/plasmaquick/appletquickitem.cpp b/src/plasmaquick/appletquickitem.cpp --- a/src/plasmaquick/appletquickitem.cpp +++ b/src/plasmaquick/appletquickitem.cpp @@ -36,6 +36,7 @@ #include #include +#include namespace PlasmaQuick { @@ -63,7 +64,7 @@ qmlObject = new KDeclarative::QmlObjectSharedEngine(q); if (!qmlObject->engine()->urlInterceptor()) { - PackageUrlInterceptor *interceptor = new PackageUrlInterceptor(qmlObject->engine(), Plasma::Package()); + PackageUrlInterceptor *interceptor = new PackageUrlInterceptor(qmlObject->engine(), KPackage::Package()); qmlObject->engine()->setUrlInterceptor(interceptor); } } @@ -405,14 +406,14 @@ d->init(); if (d->applet) { - d->appletPackage = d->applet->package(); + d->appletPackage = d->applet->kPackage(); if (d->applet->containment()) { if (d->applet->containment()->corona()) { - d->coronaPackage = d->applet->containment()->corona()->package(); + d->coronaPackage = d->applet->containment()->corona()->kPackage(); } - d->containmentPackage = d->applet->containment()->package(); + d->containmentPackage = d->applet->containment()->kPackage(); } if (d->applet->pluginMetaData().isValid()) { @@ -494,7 +495,7 @@ //are using an old version of the api in which every applet had one engine //so initialize a private url interceptor if (d->applet->kPackage().isValid() && !qobject_cast(d->qmlObject)) { - PackageUrlInterceptor *interceptor = new PackageUrlInterceptor(engine, d->applet->package()); + PackageUrlInterceptor *interceptor = new PackageUrlInterceptor(engine, d->applet->kPackage()); interceptor->addAllowedPath(d->coronaPackage.path()); engine->setUrlInterceptor(interceptor); } @@ -598,22 +599,22 @@ Plasma::Package AppletQuickItem::appletPackage() const { - return d->appletPackage; + return Plasma::Package(d->appletPackage); } void AppletQuickItem::setAppletPackage(const Plasma::Package &package) { - d->appletPackage = package; + d->appletPackage = package.kPackage(); } Plasma::Package AppletQuickItem::coronaPackage() const { - return d->coronaPackage; + return Plasma::Package(d->coronaPackage); } void AppletQuickItem::setCoronaPackage(const Plasma::Package &package) { - d->coronaPackage = package; + d->coronaPackage = package.kPackage(); } int AppletQuickItem::switchWidth() const diff --git a/src/plasmaquick/configview.cpp b/src/plasmaquick/configview.cpp --- a/src/plasmaquick/configview.cpp +++ b/src/plasmaquick/configview.cpp @@ -123,8 +123,9 @@ return; } - if (corona->kPackage().isValid()) { - PackageUrlInterceptor *interceptor = new PackageUrlInterceptor(q->engine(), corona->package()); + const auto pkg = corona->kPackage(); + if (pkg.isValid()) { + PackageUrlInterceptor *interceptor = new PackageUrlInterceptor(q->engine(), pkg); interceptor->addAllowedPath(applet.data()->kPackage().path()); q->engine()->setUrlInterceptor(interceptor); } diff --git a/src/plasmaquick/containmentview.cpp b/src/plasmaquick/containmentview.cpp --- a/src/plasmaquick/containmentview.cpp +++ b/src/plasmaquick/containmentview.cpp @@ -206,9 +206,9 @@ this, &ContainmentView::screenGeometryChanged); if (corona->kPackage().isValid()) { - KPluginInfo info = corona->package().metadata(); + const auto info = corona->kPackage().metadata(); if (info.isValid()) { - setTranslationDomain("plasma_shell_" + info.pluginName()); + setTranslationDomain("plasma_shell_" + info.pluginId()); } else { qWarning() << "Invalid corona package metadata"; } diff --git a/src/plasmaquick/packageurlinterceptor.h b/src/plasmaquick/packageurlinterceptor.h --- a/src/plasmaquick/packageurlinterceptor.h +++ b/src/plasmaquick/packageurlinterceptor.h @@ -24,7 +24,7 @@ #include -#include +#include // // W A R N I N G @@ -48,7 +48,7 @@ class PLASMAQUICK_EXPORT PackageUrlInterceptor: public QQmlAbstractUrlInterceptor { public: - PackageUrlInterceptor(QQmlEngine *engine, const Plasma::Package &p); + PackageUrlInterceptor(QQmlEngine *engine, const KPackage::Package &p); virtual ~PackageUrlInterceptor(); void addAllowedPath(const QString &path); diff --git a/src/plasmaquick/packageurlinterceptor.cpp b/src/plasmaquick/packageurlinterceptor.cpp --- a/src/plasmaquick/packageurlinterceptor.cpp +++ b/src/plasmaquick/packageurlinterceptor.cpp @@ -26,33 +26,35 @@ #include #include +#include +#include #include namespace PlasmaQuick { class PackageUrlInterceptorPrivate { public: - PackageUrlInterceptorPrivate(QQmlEngine *engine, const Plasma::Package &p) + PackageUrlInterceptorPrivate(QQmlEngine *engine, const KPackage::Package &p) : package(p), engine(engine) { } - Plasma::Package package; + KPackage::Package package; QStringList allowedPaths; QQmlEngine *engine; //FIXME: those are going to be stuffed here and stay.. // they should probably be removed when the last applet of that type is removed - static QHash s_packages; + static QHash s_packages; }; -QHash PackageUrlInterceptorPrivate::s_packages = QHash(); +QHash PackageUrlInterceptorPrivate::s_packages = QHash(); -PackageUrlInterceptor::PackageUrlInterceptor(QQmlEngine *engine, const Plasma::Package &p) +PackageUrlInterceptor::PackageUrlInterceptor(QQmlEngine *engine, const KPackage::Package &p) : QQmlAbstractUrlInterceptor(), d(new PackageUrlInterceptorPrivate(engine, p)) { @@ -83,7 +85,7 @@ { //qDebug() << "Intercepted URL:" << path << type; QString pkgRoot; - Plasma::Package package; + KPackage::Package package; if (d->package.isValid()) { package = d->package; } else { @@ -94,7 +96,7 @@ if (PackageUrlInterceptorPrivate::s_packages.contains(pkgName)) { package = PackageUrlInterceptorPrivate::s_packages.value(pkgName); } else { - package = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/Applet")); + package = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/Applet")).kPackage(); package.setPath(pkgName); PackageUrlInterceptorPrivate::s_packages[pkgName] = package; } diff --git a/src/plasmaquick/private/appletquickitem_p.h b/src/plasmaquick/private/appletquickitem_p.h --- a/src/plasmaquick/private/appletquickitem_p.h +++ b/src/plasmaquick/private/appletquickitem_p.h @@ -21,8 +21,9 @@ #define APPLETQUICKITEM_P_H #include -#include +#include #include +#include // // W A R N I N G @@ -35,6 +36,7 @@ // We mean it. // + namespace Plasma { class Applet; @@ -99,9 +101,9 @@ Plasma::Applet *applet; KDeclarative::QmlObject *qmlObject; - Plasma::Package appletPackage; - Plasma::Package coronaPackage; - Plasma::Package containmentPackage; + KPackage::Package appletPackage; + KPackage::Package coronaPackage; + KPackage::Package containmentPackage; bool expanded : 1; bool activationTogglesExpanded : 1; diff --git a/src/plasmaquick/view.cpp b/src/plasmaquick/view.cpp --- a/src/plasmaquick/view.cpp +++ b/src/plasmaquick/view.cpp @@ -188,14 +188,15 @@ QObject::connect(screen(), &QScreen::geometryChanged, this, &View::screenGeometryChanged); - if (corona->kPackage().isValid()) { - PackageUrlInterceptor *interceptor = new PackageUrlInterceptor(engine(), corona->package()); + const auto pkg = corona->kPackage(); + if (pkg.isValid()) { + PackageUrlInterceptor *interceptor = new PackageUrlInterceptor(engine(), pkg); engine()->setUrlInterceptor(interceptor); KDeclarative::KDeclarative kdeclarative; kdeclarative.setDeclarativeEngine(engine()); //binds things like kconfig and icons - kdeclarative.setTranslationDomain("plasma_shell_" + corona->kPackage().metadata().pluginId()); + kdeclarative.setTranslationDomain("plasma_shell_" + pkg.metadata().pluginId()); kdeclarative.setupBindings(); } else { qWarning() << "Invalid home screen package"; diff --git a/src/scriptengines/qml/plasmoid/containmentinterface.cpp b/src/scriptengines/qml/plasmoid/containmentinterface.cpp --- a/src/scriptengines/qml/plasmoid/containmentinterface.cpp +++ b/src/scriptengines/qml/plasmoid/containmentinterface.cpp @@ -494,19 +494,19 @@ } else { QStringList formats = mimeData->formats(); - QHash seenPlugins; + QHash seenPlugins; QHash pluginFormats; foreach (const QString &format, formats) { - KPluginInfo::List plugins = Plasma::PluginLoader::self()->listAppletInfoForMimeType(format); + const auto plugins = Plasma::PluginLoader::self()->listAppletMetaDataForMimeType(format); - foreach (const KPluginInfo &plugin, plugins) { - if (seenPlugins.contains(plugin.pluginName())) { + foreach (const auto &plugin, plugins) { + if (seenPlugins.contains(plugin.pluginId())) { continue; } - seenPlugins.insert(plugin.pluginName(), plugin); - pluginFormats.insert(plugin.pluginName(), format); + seenPlugins.insert(plugin.pluginId(), plugin); + pluginFormats.insert(plugin.pluginId(), format); } } //qDebug() << "Mimetype ..." << formats << seenPlugins.keys() << pluginFormats.values(); @@ -530,25 +530,25 @@ } QList extraActions; QHash actionsToPlugins; - foreach (const KPluginInfo &info, seenPlugins) { + foreach (const auto &info, seenPlugins) { QAction *action; - if (!info.icon().isEmpty()) { - action = new QAction(QIcon::fromTheme(info.icon()), info.name(), nullptr); + if (!info.iconName().isEmpty()) { + action = new QAction(QIcon::fromTheme(info.iconName()), info.name(), nullptr); } else { action = new QAction(info.name(), nullptr); } extraActions << action; if (choices) { choices->addAction(action); } - action->setData(info.pluginName()); + action->setData(info.pluginId()); connect(action, &QAction::triggered, this, [this, x, y, mimeData, action]() { const QString selectedPlugin = action->data().toString(); Plasma::Applet *applet = createApplet(selectedPlugin, QVariantList(), QRect(x, y, -1, -1)); setAppletArgs(applet, selectedPlugin, mimeData->data(selectedPlugin)); }); - actionsToPlugins.insert(action, info.pluginName()); + actionsToPlugins.insert(action, info.pluginId()); } //if the menu was created by ourselves, delete it @@ -595,7 +595,7 @@ clearDataForMimeJob(job); return; } - KPluginInfo::List appletList = Plasma::PluginLoader::self()->listAppletInfoForUrl(tjob->url()); + QList appletList = Plasma::PluginLoader::self()->listAppletMetaDataForUrl(tjob->url()); if (mimetype.isEmpty() && appletList.isEmpty()) { clearDataForMimeJob(job); qDebug() << "No applets found matching the url (" << tjob->url() << ") or the mimetype (" << mimetype << ")"; @@ -624,17 +624,17 @@ qDebug() << "Creating menu for:" << mimetype << posi; - appletList << Plasma::PluginLoader::self()->listAppletInfoForMimeType(mimetype); + appletList << Plasma::PluginLoader::self()->listAppletMetaDataForMimeType(mimetype); - KPluginInfo::List wallpaperList; + QList wallpaperList; if (m_containment->containmentType() != Plasma::Types::PanelContainment && m_containment->containmentType() != Plasma::Types::CustomPanelContainment) { if (m_wallpaperInterface && m_wallpaperInterface->supportsMimetype(mimetype)) { - wallpaperList << m_wallpaperInterface->package().metadata(); + wallpaperList << m_wallpaperInterface->kPackage().metadata(); } else { - wallpaperList = WallpaperInterface::listWallpaperInfoForMimetype(mimetype); + wallpaperList = WallpaperInterface::listWallpaperMetadataForMimetype(mimetype); } } @@ -701,21 +701,19 @@ action->setSeparator(true); dropActions << action; } - foreach (const KPluginInfo &info, appletList) { - qDebug() << info.name(); + foreach (const auto &info, appletList) { QAction *action; - if (!info.icon().isEmpty()) { - action = new QAction(QIcon::fromTheme(info.icon()), info.name(), nullptr); + if (!info.iconName().isEmpty()) { + action = new QAction(QIcon::fromTheme(info.iconName()), info.name(), nullptr); } else { action = new QAction(info.name(), nullptr); } if (choices) { choices->addAction(action); } dropActions << action; - action->setData(info.pluginName()); - qDebug() << info.pluginName(); + action->setData(info.pluginId()); const QUrl url = tjob->url(); connect(action, &QAction::triggered, this, [this, action, posi, mimetype, url]() { Plasma::Applet *applet = createApplet(action->data().toString(), QVariantList(), QRect(posi, QSize(-1,-1))); @@ -746,24 +744,24 @@ dropActions << action; } - QMap sorted; - foreach (const KPluginInfo &info, appletList) { + QMap sorted; + foreach (const auto &info, appletList) { sorted.insert(info.name(), info); } - foreach (const KPluginInfo &info, wallpaperList) { + foreach (const KPluginMetaData &info, wallpaperList) { QAction *action; - if (!info.icon().isEmpty()) { - action = new QAction(QIcon::fromTheme(info.icon()), info.name(), nullptr); + if (!info.iconName().isEmpty()) { + action = new QAction(QIcon::fromTheme(info.iconName()), info.name(), nullptr); } else { action = new QAction(info.name(), nullptr); } if (choices) { choices->addAction(action); } dropActions << action; - actionsToWallpapers.insert(action, info.pluginName()); + actionsToWallpapers.insert(action, info.pluginId()); const QUrl url = tjob->url(); connect(action, &QAction::triggered, this, [this, action, url]() { //set wallpapery stuff diff --git a/src/scriptengines/qml/plasmoid/wallpaperinterface.h b/src/scriptengines/qml/plasmoid/wallpaperinterface.h --- a/src/scriptengines/qml/plasmoid/wallpaperinterface.h +++ b/src/scriptengines/qml/plasmoid/wallpaperinterface.h @@ -23,7 +23,7 @@ #include #include -#include +#include class KConfigLoader; class KActionCollection; @@ -56,15 +56,15 @@ ~WallpaperInterface(); /** - * Returns a list of all known wallpapers that can accept the given mimetype - * @param mimetype the mimetype to search for - * @param formFactor the format of the wallpaper being search for (e.g. desktop) - * @return list of wallpapers - */ - static KPluginInfo::List listWallpaperInfoForMimetype(const QString &mimetype, + * Returns a list of all known wallpapers that can accept the given mimetype + * @param mimetype the mimetype to search for + * @param formFactor the format of the wallpaper being search for (e.g. desktop) + * @return list of wallpapers + */ + static QList listWallpaperMetadataForMimetype(const QString &mimetype, const QString &formFactor = QString()); - Plasma::Package package() const; + KPackage::Package kPackage() const; QString pluginName() const; @@ -100,7 +100,7 @@ QString m_wallpaperPlugin; ContainmentInterface *m_containmentInterface; KDeclarative::QmlObject *m_qmlObject; - Plasma::Package m_pkg; + KPackage::Package m_pkg; KDeclarative::ConfigPropertyMap *m_configuration; KConfigLoader *m_configLoader; KActionCollection *m_actions; diff --git a/src/scriptengines/qml/plasmoid/wallpaperinterface.cpp b/src/scriptengines/qml/plasmoid/wallpaperinterface.cpp --- a/src/scriptengines/qml/plasmoid/wallpaperinterface.cpp +++ b/src/scriptengines/qml/plasmoid/wallpaperinterface.cpp @@ -68,19 +68,19 @@ } } -KPluginInfo::List WallpaperInterface::listWallpaperInfoForMimetype(const QString &mimetype, const QString &formFactor) +QList WallpaperInterface::listWallpaperMetadataForMimetype(const QString &mimetype, const QString &formFactor) { auto filter = [&mimetype, &formFactor](const KPluginMetaData &md) -> bool { if (!formFactor.isEmpty() && !md.value(QStringLiteral("X-Plasma-FormFactors")).contains(formFactor)) { return false; } return KPluginMetaData::readStringList(md.rawData(), QStringLiteral("X-Plasma-DropMimeTypes")).contains(mimetype); }; - return KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Wallpaper"), QString(), filter).toVector()); + return KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/Wallpaper"), QString(), filter); } -Plasma::Package WallpaperInterface::package() const +KPackage::Package WallpaperInterface::kPackage() const { return m_pkg; } @@ -133,7 +133,7 @@ } m_actions->clear(); - m_pkg = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/Wallpaper")); + m_pkg = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/Wallpaper")).kPackage(); m_pkg.setPath(m_wallpaperPlugin); if (!m_pkg.isValid()) { qWarning() << "Error loading the wallpaper, no valid package loaded"; @@ -151,11 +151,11 @@ m_qmlObject->rootContext()->setContextProperty(QStringLiteral("wallpaper"), this); m_qmlObject->setSource(QUrl::fromLocalFile(m_pkg.filePath("mainscript"))); - const QString rootPath = m_pkg.metadata().property(QStringLiteral("X-Plasma-RootPath")).toString(); + const QString rootPath = m_pkg.metadata().value(QStringLiteral("X-Plasma-RootPath")); if (!rootPath.isEmpty()) { m_qmlObject->setTranslationDomain(QLatin1String("plasma_wallpaper_") + rootPath); } else { - m_qmlObject->setTranslationDomain(QLatin1String("plasma_wallpaper_") + m_pkg.metadata().pluginName()); + m_qmlObject->setTranslationDomain(QLatin1String("plasma_wallpaper_") + m_pkg.metadata().pluginId()); } //initialize with our size to avoid as much resize events as possible @@ -199,7 +199,7 @@ bool WallpaperInterface::supportsMimetype(const QString &mimetype) const { - return KPluginMetaData::readStringList(m_pkg.kPackage().metadata().rawData(), "X-Plasma-DropMimeTypes").contains(mimetype); + return KPluginMetaData::readStringList(m_pkg.metadata().rawData(), "X-Plasma-DropMimeTypes").contains(mimetype); } void WallpaperInterface::setUrl(const QUrl &url)