Commit aa538604 authored by Marco Martin's avatar Marco Martin

use the new Package::fileUrl to load from resources

Summary: QUrl::fromLocalFile can't be used when packages are qrc

Test Plan: plasashell loads correctly with packages from qrc

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9176
parent da91a522
......@@ -99,7 +99,7 @@ View::View(QWindow *)
package.setPath(packageName);
}
m_qmlObj->setSource(QUrl::fromLocalFile(package.filePath("runcommandmainscript")));
m_qmlObj->setSource(package.fileUrl("runcommandmainscript"));
m_qmlObj->engine()->rootContext()->setContextProperty(QStringLiteral("runnerWindow"), this);
m_qmlObj->completeInitialization();
......
......@@ -73,7 +73,7 @@ ContainmentConfigView::~ContainmentConfigView()
void ContainmentConfigView::init()
{
setSource(QUrl::fromLocalFile(m_containment->corona()->kPackage().filePath("containmentconfigurationui")));
setSource(m_containment->corona()->kPackage().fileUrl("containmentconfigurationui"));
}
PlasmaQuick::ConfigModel *ContainmentConfigView::containmentActionConfigModel()
......
......@@ -50,7 +50,7 @@ DesktopView::DesktopView(Plasma::Corona *corona, QScreen *targetScreen)
setTitle(corona->kPackage().metadata().name());
setIcon(QIcon::fromTheme(corona->kPackage().metadata().iconName()));
rootContext()->setContextProperty(QStringLiteral("desktop"), this);
setSource(QUrl::fromLocalFile(corona->kPackage().filePath("views", QStringLiteral("Desktop.qml"))));
setSource(corona->kPackage().fileUrl("views", QStringLiteral("Desktop.qml")));
connect(this, &QWindow::screenChanged, this, &DesktopView::adaptToScreen);
......@@ -295,7 +295,7 @@ void DesktopView::screenGeometryChanged()
void DesktopView::coronaPackageChanged(const KPackage::Package &package)
{
setContainment(0);
setSource(QUrl::fromLocalFile(package.filePath("views", QStringLiteral("Desktop.qml"))));
setSource(package.fileUrl("views", QStringLiteral("Desktop.qml")));
}
void DesktopView::setupWaylandIntegration()
......
......@@ -31,7 +31,7 @@
Osd::Osd(KSharedConfig::Ptr config, ShellCorona *corona)
: QObject(corona)
, m_osdPath(corona->lookAndFeelPackage().filePath("osdmainscript"))
, m_osdUrl(corona->lookAndFeelPackage().fileUrl("osdmainscript"))
, m_config(config)
{
QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/kde/osdService"), this, QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllSignals);
......@@ -162,7 +162,7 @@ bool Osd::init()
return true;
}
if (m_osdPath.isEmpty()) {
if (m_osdUrl.isEmpty()) {
return false;
}
......@@ -170,10 +170,10 @@ bool Osd::init()
m_osdObject = new KDeclarative::QmlObject(this);
}
m_osdObject->setSource(QUrl::fromLocalFile(m_osdPath));
m_osdObject->setSource(m_osdUrl);
if (m_osdObject->status() != QQmlComponent::Ready) {
qWarning() << "Failed to load OSD QML file" << m_osdPath;
qWarning() << "Failed to load OSD QML file" << m_osdUrl;
return false;
}
......
......@@ -21,6 +21,7 @@
#include <QObject>
#include <QString>
#include <QUrl>
#include <KSharedConfig>
......@@ -68,7 +69,7 @@ private:
void showProgress(const QString &icon, const int percent, const QString &additionalText = QString());
void showOsd();
QString m_osdPath;
QUrl m_osdUrl;
KDeclarative::QmlObject *m_osdObject = nullptr;
QTimer *m_osdTimer = nullptr;
int m_timeout = 0;
......
......@@ -83,7 +83,7 @@ PanelConfigView::~PanelConfigView()
void PanelConfigView::init()
{
setSource(QUrl::fromLocalFile(m_containment->corona()->kPackage().filePath("panelconfigurationui")));
setSource(m_containment->corona()->kPackage().fileUrl("panelconfigurationui"));
syncGeometry();
syncLocation();
}
......
......@@ -105,7 +105,7 @@ PanelView::PanelView(ShellCorona *corona, QScreen *targetScreen, QWindow *parent
qmlRegisterType<QScreen>();
rootContext()->setContextProperty(QStringLiteral("panel"), this);
setSource(QUrl::fromLocalFile(m_corona->kPackage().filePath("views", QStringLiteral("Panel.qml"))));
setSource(m_corona->kPackage().fileUrl("views", QStringLiteral("Panel.qml")));
}
PanelView::~PanelView()
......
......@@ -810,14 +810,14 @@ void ShellCorona::screenInvariants() const
void ShellCorona::showAlternativesForApplet(Plasma::Applet *applet)
{
const QString alternativesQML = package().filePath("appletalternativesui");
const QUrl alternativesQML = kPackage().fileUrl("appletalternativesui");
if (alternativesQML.isEmpty()) {
return;
}
KDeclarative::QmlObject *qmlObj = new KDeclarative::QmlObject(this);
qmlObj->setInitializationDelayed(true);
qmlObj->setSource(QUrl::fromLocalFile(alternativesQML));
qmlObj->setSource(alternativesQML);
AlternativesHelper *helper = new AlternativesHelper(applet, qmlObj);
qmlObj->rootContext()->setContextProperty(QStringLiteral("alternativesHelper"), helper);
......@@ -1409,14 +1409,14 @@ void ShellCorona::loadInteractiveConsole()
}
if (!m_interactiveConsole) {
const QString consoleQML = package().filePath("interactiveconsole");
const QUrl consoleQML = kPackage().fileUrl("interactiveconsole");
if (consoleQML.isEmpty()) {
return;
}
m_interactiveConsole = new KDeclarative::QmlObject(this);
m_interactiveConsole->setInitializationDelayed(true);
m_interactiveConsole->setSource(QUrl::fromLocalFile(consoleQML));
m_interactiveConsole->setSource(consoleQML);
QObject *engine = new WorkspaceScripting::ScriptEngine(this, m_interactiveConsole);
m_interactiveConsole->rootContext()->setContextProperty(QStringLiteral("scriptEngine"), engine);
......
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