KActivities 5.109.0
Properties | Public Member Functions | List of all members
KActivities::Controller

This class provides methods for controlling and managing the activities. More...

#include <controller.h>

Properties

QString currentActivity
 
- Properties inherited from KActivities::Consumer
QStringList activities
 
QString currentActivity
 
QStringList runningActivities
 
ServiceStatus serviceStatus
 

Public Member Functions

 Controller (QObject *parent=nullptr)
 
QFuture< QString > addActivity (const QString &name)
 Adds a new activity.
 
QFuture< void > nextActivity ()
 Switches to the next activity.
 
QFuture< void > previousActivity ()
 Switches to the previous activity.
 
QFuture< void > removeActivity (const QString &id)
 Removes the specified activity.
 
QFuture< void > setActivityDescription (const QString &id, const QString &description)
 Sets the description of the specified activity.
 
QFuture< void > setActivityIcon (const QString &id, const QString &icon)
 Sets the icon of the specified activity.
 
QFuture< void > setActivityName (const QString &id, const QString &name)
 Sets the name of the specified activity.
 
QFuture< bool > setCurrentActivity (const QString &id)
 Sets the current activity.
 
QFuture< void > startActivity (const QString &id)
 Starts the activity.
 
QFuture< void > stopActivity (const QString &id)
 Stops the activity.
 
- Public Member Functions inherited from KActivities::Consumer
 Consumer (QObject *parent=nullptr)
 
QStringList activities () const
 
QStringList activities (Info::State state) const
 
QString currentActivity () const
 
QStringList runningActivities () const
 
ServiceStatus serviceStatus ()
 

Additional Inherited Members

- Public Types inherited from KActivities::Consumer
enum  ServiceStatus { NotRunning , Unknown , Running }
 Different states of the activities service. More...
 
- Signals inherited from KActivities::Consumer
void activitiesChanged (const QStringList &activities)
 This signal is emitted when the activity list changes.
 
void activityAdded (const QString &id)
 This signal is emitted when a new activity is added.
 
void activityRemoved (const QString &id)
 This signal is emitted when an activity has been removed.
 
void currentActivityChanged (const QString &id)
 This signal is emitted when the current activity is changed.
 
void runningActivitiesChanged (const QStringList &runningActivities)
 This signal is emitted when the list of running activities changes.
 
void serviceStatusChanged (Consumer::ServiceStatus status)
 This signal is emitted when the activity service goes online or offline, or when the class manages to synchronize the data with the service.
 

Detailed Description

This class provides methods for controlling and managing the activities.

Note
The QFuture objects returned by these methods are not thread-based, you can not call synchronous methods like waitForFinished, cancel, pause on them. You need either to register watchers to check when those have finished, or to check whether they are ready from time to time manually.
See also
Consumer for info about activities
Since
5.0

Member Function Documentation

◆ addActivity()

QFuture< QString > KActivities::Controller::addActivity ( const QString &  name)

Adds a new activity.

Parameters
namename of the activity
Returns
id of the newly created activity

◆ nextActivity()

QFuture< void > KActivities::Controller::nextActivity ( )

Switches to the next activity.

◆ previousActivity()

QFuture< void > KActivities::Controller::previousActivity ( )

Switches to the previous activity.

◆ removeActivity()

QFuture< void > KActivities::Controller::removeActivity ( const QString &  id)

Removes the specified activity.

Parameters
idid of the activity to delete

◆ setActivityDescription()

QFuture< void > KActivities::Controller::setActivityDescription ( const QString &  id,
const QString &  description 
)

Sets the description of the specified activity.

Parameters
idid of the activity
descriptiondescription to be set

◆ setActivityIcon()

QFuture< void > KActivities::Controller::setActivityIcon ( const QString &  id,
const QString &  icon 
)

Sets the icon of the specified activity.

Parameters
idid of the activity
iconicon to be set - freedesktop.org name or file path

◆ setActivityName()

QFuture< void > KActivities::Controller::setActivityName ( const QString &  id,
const QString &  name 
)

Sets the name of the specified activity.

Parameters
idid of the activity
namename to be set

◆ setCurrentActivity()

QFuture< bool > KActivities::Controller::setCurrentActivity ( const QString &  id)

Sets the current activity.

Parameters
idid of the activity to make current
Returns
true if successful

◆ startActivity()

QFuture< void > KActivities::Controller::startActivity ( const QString &  id)

Starts the activity.

Parameters
idid of the activity to start

◆ stopActivity()

QFuture< void > KActivities::Controller::stopActivity ( const QString &  id)

Stops the activity.

Parameters
idid of the activity to stop