From eb81b3f1628ec32dcc4042f23c01844e2e677dd9 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Mon, 19 Dec 2016 13:48:52 +0100 Subject: [PATCH] [AppletQuickItem] Support launch error message Now that we can have C++ applet we can make use of setLaunchErrorMessage to communicate a fatal error in the applet initialization. Differential Revision: https://phabricator.kde.org/D3725 --- src/plasmaquick/appletquickitem.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plasmaquick/appletquickitem.cpp b/src/plasmaquick/appletquickitem.cpp index e2fd40ece..e1df7c670 100644 --- a/src/plasmaquick/appletquickitem.cpp +++ b/src/plasmaquick/appletquickitem.cpp @@ -504,9 +504,11 @@ void AppletQuickItem::init() d->qmlObject->setSource(QUrl::fromLocalFile(d->applet->kPackage().filePath("mainscript"))); - if (!engine || !engine->rootContext() || !engine->rootContext()->isValid() || !d->qmlObject->mainComponent() || d->qmlObject->mainComponent()->isError()) { + if (!engine || !engine->rootContext() || !engine->rootContext()->isValid() || !d->qmlObject->mainComponent() || d->qmlObject->mainComponent()->isError() || d->applet->failedToLaunch()) { QString reason; - if (d->applet->kPackage().isValid()) { + if (d->applet->failedToLaunch()) { + reason = d->applet->launchErrorMessage(); + } else if (d->applet->kPackage().isValid()) { foreach (QQmlError error, d->qmlObject->mainComponent()->errors()) { reason += error.toString() + '\n'; }