From 5bd54084cf41bcd6f1b7fb5e4da0ebc7b3a9e4ba Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 19 Jun 2017 11:00:18 +0100 Subject: [PATCH] Make --test mode run without spawning kactivitymanagerd Summary: This allows us to run the plasma-tests repo on your system without it destroying all your real activities. Even though one run tests in a nested dbus sessions, kactivities will still load and meddle with your real database at the same time as the real daemon is. That gets messy and broken. It also allows us to remove a hack in the plasma-tests script. Test Plan: Ran normal plasma, everything is the same. Ran plasma-tests everything there now works properly Reviewers: #plasma, hein Reviewed By: #plasma, hein Subscribers: apol, plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D6133 --- shell/main.cpp | 4 +++- shell/shellcorona.cpp | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/shell/main.cpp b/shell/main.cpp index ec117f3bf..953ba5402 100644 --- a/shell/main.cpp +++ b/shell/main.cpp @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) ShellManager::s_fixedShell = cliOptions.value(shellPluginOption); - if (!cliOptions.isSet(noRespawnOption)) { + if (!cliOptions.isSet(noRespawnOption) && !cliOptions.isSet(testOption)) { KCrash::setFlags(KCrash::AutoRestart); } @@ -135,6 +135,8 @@ int main(int argc, char *argv[]) QDir(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)).removeRecursively(); ShellManager::s_testModeLayout = layoutUrl.toLocalFile(); + qApp->setProperty("org.kde.KActivities.core.disableAutostart", true); + QObject::connect(ShellManager::instance(), &ShellManager::shellChanged, ShellManager::instance(), [layoutUrl]() { diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp index d947b2e3c..cfa949531 100644 --- a/shell/shellcorona.cpp +++ b/shell/shellcorona.cpp @@ -316,9 +316,7 @@ void ShellCorona::setShell(const QString &shell) connect(m_activityController, &KActivities::Controller::serviceStatusChanged, this, &ShellCorona::load, Qt::UniqueConnection); - if (m_activityController->serviceStatus() == KActivities::Controller::Running) { - load(); - } + load(); } @@ -640,7 +638,8 @@ QString ShellCorona::shell() const void ShellCorona::load() { if (m_shell.isEmpty() || - m_activityController->serviceStatus() != KActivities::Controller::Running) { + (m_activityController->serviceStatus() != KActivities::Controller::Running && + !qApp->property("org.kde.KActivities.core.disableAutostart").toBool())) { return; }