Changeset View
Changeset View
Standalone View
Standalone View
src/service/Activities.cpp
Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Line(s) | 115 | if (state == Activities::Running) { | |||
---|---|---|---|---|---|
116 | atLeastOneRunning = true; | 116 | atLeastOneRunning = true; | ||
117 | } | 117 | } | ||
118 | } | 118 | } | ||
119 | 119 | | |||
120 | // Is this our first start? | 120 | // Is this our first start? | ||
121 | if (activities.isEmpty()) { | 121 | if (activities.isEmpty()) { | ||
122 | // We need to add this only after the service has been properly started | 122 | // We need to add this only after the service has been properly started | ||
123 | KConfigGroup cg(KSharedConfig::openConfig("kdeglobals"), "Activities"); | 123 | KConfigGroup cg(KSharedConfig::openConfig("kdeglobals"), "Activities"); | ||
124 | const QString name = cg.readEntry("defaultActivityName", i18n("Default")); | 124 | //NOTE: config key still singular for retrocompatibility | ||
125 | const QStringList names = cg.readEntry("defaultActivityName", QStringList{i18n("Default")}); | ||||
ivan: `QStringList{i18n("Default")}` should be enough | |||||
125 | 126 | | |||
127 | for (const auto &name : names) { | ||||
ivan: `const auto&` - IMO, no need to specify the type explicitly here | |||||
126 | QMetaObject::invokeMethod( | 128 | QMetaObject::invokeMethod( | ||
127 | q, | 129 | q, | ||
128 | "AddActivity", | 130 | "AddActivity", | ||
129 | Qt::QueuedConnection, | 131 | Qt::QueuedConnection, | ||
130 | Q_ARG(QString, name)); | 132 | Q_ARG(QString, name)); | ||
133 | } | ||||
131 | 134 | | |||
132 | } else if (!atLeastOneRunning) { | 135 | } else if (!atLeastOneRunning) { | ||
133 | // If we have no running activities, but we have activities, | 136 | // If we have no running activities, but we have activities, | ||
134 | // we are in a problem. This should not happen unless the | 137 | // we are in a problem. This should not happen unless the | ||
135 | // configuration file is in a big problem and told us there | 138 | // configuration file is in a big problem and told us there | ||
136 | // are no running activities, and enlists all of them as stopped. | 139 | // are no running activities, and enlists all of them as stopped. | ||
137 | // In that case, we will pretend all of them are running | 140 | // In that case, we will pretend all of them are running | ||
138 | qWarning() << "The config file enlisted all activities as stopped"; | 141 | qWarning() << "The config file enlisted all activities as stopped"; | ||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Line(s) | 218 | { | |||
222 | } | 225 | } | ||
223 | 226 | | |||
224 | // Saves the activity info to the config | 227 | // Saves the activity info to the config | ||
225 | 228 | | |||
226 | activities[activity] = Invalid; | 229 | activities[activity] = Invalid; | ||
227 | activitiesCount = activities.size(); | 230 | activitiesCount = activities.size(); | ||
228 | } | 231 | } | ||
229 | 232 | | |||
230 | setActivityState(activity, Running); | 233 | setActivityState(activity, Running); | ||
We'll end up toggling between activities on startup. davidedmundson: We'll end up toggling between activities on startup.
Can we avoid this? | |||||
ivan: What do you mean by 'toggling' here? | |||||
If the default is "activityA, activityB" I don't want clients (plasmashell) to start loading the layout for activityA and then start loading activityB. davidedmundson: If the default is "activityA, activityB" I don't want clients (plasmashell) to start loading… | |||||
when i tested it it didn't seem to switch to the latest created one without an explicit setCurrentActivity? mart: when i tested it it didn't seem to switch to the latest created one without an explicit… | |||||
@davidedmundson Haven't looked at that part of Plasma for some time, but I see no reason why it would do that since creating a new activity does not make it current. ivan: @davidedmundson Haven't looked at that part of Plasma for some time, but I see no reason why it… | |||||
setActivityState(activity, Running); mart: setActivityState(activity, Running);
makes it running but *not* current, right?
| |||||
davidedmundson: yeah, my bad.
Ignore my comment. | |||||
231 | 234 | | |||
232 | q->SetActivityName(activity, name); | 235 | q->SetActivityName(activity, name); | ||
233 | 236 | | |||
234 | emit q->ActivityAdded(activity); | 237 | emit q->ActivityAdded(activity); | ||
235 | 238 | | |||
236 | scheduleConfigSync(); | 239 | scheduleConfigSync(); | ||
237 | 240 | | |||
238 | if (activitiesCount == 1) { | 241 | if (activitiesCount == 1) { | ||
▲ Show 20 Lines • Show All 358 Lines • Show Last 20 Lines |
QStringList{i18n("Default")} should be enough