From 4b3e5cd21178ec075312d5ae42ff8b1cabef3697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C4=8Cuki=C4=87?= Date: Mon, 25 Jul 2016 22:48:13 +0200 Subject: [PATCH] Properly registering existing activities before loading layout.js Reviewers: #plasma, mart, davidedmundson Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D2288 --- shell/shellcorona.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp index b9e1374bd..ccf903df4 100644 --- a/shell/shellcorona.cpp +++ b/shell/shellcorona.cpp @@ -328,7 +328,12 @@ void ShellCorona::load() loadLayout("plasma-" + m_shell + "-appletsrc"); checkActivities(); + if (containments().isEmpty()) { + // Seems like we never really get to this point since loadLayout already + // (virtually) calls loadDefaultLayout if it does not load anything + // from the config file. Maybe if the config file is not empty, + // but still does not have any containments loadDefaultLayout(); processUpdateScripts(); } else { @@ -539,6 +544,14 @@ void ShellCorona::loadDefaultLayout() QString code = file.readAll(); qDebug() << "evaluating startup script:" << script; + // We need to know which activities are here in order for + // the scripting engine to work. activityAdded does not mind + // if we pass it the same activity multiple times + QStringList existingActivities = m_activityController->activities(); + foreach (const QString &id, existingActivities) { + activityAdded(id); + } + WorkspaceScripting::ScriptEngine scriptEngine(this); connect(&scriptEngine, &WorkspaceScripting::ScriptEngine::printError, this,