Use methods in KF5-activities to switch to previous/next activity

Summary:
Since the release of KDE Frameworks 5.68.0 we can now
use the methods exposed in KActivities::Controller to trigger a
switch to the previous or next activity from ShellCorona.

Reviewers: ngraham, ivan, apol

Reviewed By: ngraham, apol

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D28083
parent dbdb78b4
......@@ -2024,31 +2024,12 @@ int ShellCorona::screenForContainment(const Plasma::Containment *containment) co
void ShellCorona::nextActivity()
{
const QStringList list = m_activityController->activities(KActivities::Info::Running);
if (list.isEmpty()) {
return;
}
const int start = list.indexOf(m_activityController->currentActivity());
const int i = (start + 1) % list.size();
m_activityController->setCurrentActivity(list.at(i));
m_activityController->nextActivity();
}
void ShellCorona::previousActivity()
{
const QStringList list = m_activityController->activities(KActivities::Info::Running);
if (list.isEmpty()) {
return;
}
const int start = list.indexOf(m_activityController->currentActivity());
int i = start - 1;
if(i < 0) {
i = list.size() - 1;
}
m_activityController->setCurrentActivity(list.at(i));
m_activityController->previousActivity();
}
void ShellCorona::stopCurrentActivity()
......
Markdown is supported
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