[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
This commit is contained in:
parent
db15022686
commit
eb81b3f162
@ -504,9 +504,11 @@ void AppletQuickItem::init()
|
|||||||
|
|
||||||
d->qmlObject->setSource(QUrl::fromLocalFile(d->applet->kPackage().filePath("mainscript")));
|
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;
|
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()) {
|
foreach (QQmlError error, d->qmlObject->mainComponent()->errors()) {
|
||||||
reason += error.toString() + '\n';
|
reason += error.toString() + '\n';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user