From 2ed819f37dd44cc6c4a24624f76938347ceb8e95 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 10 Oct 2016 21:30:02 +0200 Subject: [PATCH] Fix loading plasmoids by absolute path We were not looking into the plugin directory when figuring out the applet path when it's load from an absolute path. Fixes configmodeltest REVIEW: 129101 --- 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..9d210c5e6 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,8 +115,9 @@ AppletPrivate::~AppletPrivate() delete modificationsTimer; } -void AppletPrivate::init(const QString &packagePath, const QVariantList &args) +void AppletPrivate::init(const QString &_packagePath, const QVariantList &args) { + const QString packagePath = _packagePath.isEmpty() ? QFileInfo(appletDescription.metaDataFileName()).dir().path() : _packagePath; // WARNING: do not access config() OR globalConfig() in this method! // that requires a Corona, which is not available at this point q->setHasConfigurationInterface(true); 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; }