From ba9a8a16ab49e739428f263cf61234158b7e59bd Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Tue, 11 Oct 2016 15:22:41 +0200 Subject: [PATCH] Fix loading plasmoids by absolute path We were not looking into the plugin directory when figuring out the applet path. Fixes configmodeltest REVIEW: 129143 --- src/plasma/private/applet_p.cpp | 5 ++++- src/plasmaquick/configmodel.cpp | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plasma/private/applet_p.cpp b/src/plasma/private/applet_p.cpp index 624e4fe46..bfb6d2502 100644 --- a/src/plasma/private/applet_p.cpp +++ b/src/plasma/private/applet_p.cpp @@ -29,7 +29,9 @@ #include #include #include +#include #include +#include #include #include @@ -113,7 +115,7 @@ AppletPrivate::~AppletPrivate() delete modificationsTimer; } -void AppletPrivate::init(const QString &packagePath, const QVariantList &args) +void AppletPrivate::init(const QString &_packagePath, const QVariantList &args) { // WARNING: do not access config() OR globalConfig() in this method! // that requires a Corona, which is not available at this point @@ -145,6 +147,7 @@ void AppletPrivate::init(const QString &packagePath, const QVariantList &args) return; } + const QString packagePath = _packagePath.isEmpty() && !appletDescription.metaDataFileName().isEmpty() ? QFileInfo(appletDescription.metaDataFileName()).dir().path() : _packagePath; QString path = appletDescription.rawData().value(QStringLiteral("X-Plasma-RootPath")).toString(); if (path.isEmpty()) { path = packagePath.isEmpty() ? appletDescription.pluginId() : packagePath; diff --git a/src/plasmaquick/configmodel.cpp b/src/plasmaquick/configmodel.cpp index 975854ad3..03beac7b8 100644 --- a/src/plasmaquick/configmodel.cpp +++ b/src/plasmaquick/configmodel.cpp @@ -199,7 +199,9 @@ QVariant ConfigModel::data(const QModelIndex &index, int role) const const QString source = d->categories.at(index.row())->source(); // Quick check if source is an absolute path or not if (d->appletInterface && !source.isEmpty() && !(source.startsWith('/') && source.endsWith(QLatin1String("qml")))) { - return QUrl::fromLocalFile(d->appletInterface.data()->package().filePath("ui", source)); + if(!d->appletInterface.data()->kPackage().isValid()) + qWarning() << "wrong applet" << d->appletInterface.data()->pluginMetaData().name(); + return QUrl::fromLocalFile(d->appletInterface.data()->kPackage().filePath("ui", source)); } else { return source; }