Commit 6e60c6a3 authored by Marco Martin's avatar Marco Martin
Browse files

allow to have more than one default activity

Summary:
since addActivity in layout.js is the wrong place and extremely fragile,
allow to have more than one default activity with custom names
the config key is unchanged so all is retrocompatible, even
if the key being singular isn't 100% correct now

Test Plan: tried with an empty session, works correctly

Reviewers: #plasma, ivan, bshah

Reviewed By: #plasma, ivan

Subscribers: davidedmundson, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10388
parent ed092b96
......@@ -121,13 +121,16 @@ Activities::Private::Private(Activities *parent)
if (activities.isEmpty()) {
// We need to add this only after the service has been properly started
KConfigGroup cg(KSharedConfig::openConfig("kdeglobals"), "Activities");
const QString name = cg.readEntry("defaultActivityName", i18n("Default"));
QMetaObject::invokeMethod(
q,
"AddActivity",
Qt::QueuedConnection,
Q_ARG(QString, name));
//NOTE: config key still singular for retrocompatibility
const QStringList names = cg.readEntry("defaultActivityName", QStringList{i18n("Default")});
for (const auto &name : names) {
QMetaObject::invokeMethod(
q,
"AddActivity",
Qt::QueuedConnection,
Q_ARG(QString, name));
}
} else if (!atLeastOneRunning) {
// If we have no running activities, but we have activities,
......
Supports Markdown
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