use the interceptor on views too
relax its rules a bit and alter it to make it work with shell packages too
This commit is contained in:
parent
249c1e1c93
commit
d4b4a9558f
@ -103,10 +103,19 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept
|
||||
const QString &filename = components.join("/");
|
||||
|
||||
//qDebug() << "Returning" << QUrl::fromLocalFile(m_package.filePath(prefixForType(type, filename), filename));
|
||||
return QUrl::fromLocalFile(m_package.filePath(prefixForType(type, filename), filename));
|
||||
|
||||
QUrl ret = QUrl::fromLocalFile(m_package.filePath(prefixForType(type, filename), filename));
|
||||
|
||||
if (ret.path().isEmpty()) {
|
||||
return path;
|
||||
}
|
||||
return ret;
|
||||
|
||||
//forbid to load random absolute paths
|
||||
} else {
|
||||
if (m_package.allowExternalPaths()) {
|
||||
return path;
|
||||
}
|
||||
foreach (const QString &allowed, m_allowedPaths) {
|
||||
//It's a private import
|
||||
if (path.path().contains("org/kde/plasma/private")) {
|
||||
|
@ -24,8 +24,10 @@
|
||||
#include <QQmlContext>
|
||||
#include <QTimer>
|
||||
#include <QScreen>
|
||||
#include <QQmlEngine>
|
||||
|
||||
#include "plasma/pluginloader.h"
|
||||
#include <packageurlinterceptor.h>
|
||||
|
||||
namespace PlasmaQuick
|
||||
{
|
||||
@ -164,7 +166,10 @@ View::View(Plasma::Corona *corona, QWindow *parent)
|
||||
QObject::connect(screen(), &QScreen::geometryChanged,
|
||||
this, &View::screenGeometryChanged);
|
||||
|
||||
if (!corona->package().isValid()) {
|
||||
if (corona->package().isValid()) {
|
||||
PackageUrlInterceptor *interceptor = new PackageUrlInterceptor(engine(), corona->package());
|
||||
engine()->setUrlInterceptor(interceptor);
|
||||
} else {
|
||||
qWarning() << "Invalid home screen package";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user