KActivities 5.109.0
|
Contextual information can be, from the user's point of view, divided into three aspects - "who am I?", "where am I?" (what are my surroundings?) and "what am I doing?". More...
#include <consumer.h>
Public Types | |
enum | ServiceStatus { NotRunning , Unknown , Running } |
Different states of the activities service. More... | |
Properties | |
QStringList | activities |
QString | currentActivity |
QStringList | runningActivities |
ServiceStatus | serviceStatus |
Signals | |
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. | |
Public Member Functions | |
Consumer (QObject *parent=nullptr) | |
QStringList | activities () const |
QStringList | activities (Info::State state) const |
QString | currentActivity () const |
QStringList | runningActivities () const |
ServiceStatus | serviceStatus () |
Contextual information can be, from the user's point of view, divided into three aspects - "who am I?", "where am I?" (what are my surroundings?) and "what am I doing?".
Activities deal with the last one - "what am I doing?". The current activity refers to what the user is doing at the moment, while the other activities represent things that he/she was doing before, and probably will be doing again.
Activity is an abstract concept whose meaning can differ from one user to another. Typical examples of activities are "developing a KDE project", "studying the 19th century art", "composing music", "lazing on a Sunday afternoon" etc.
Consumer provides read-only information about activities.
Before relying on the values retrieved by the class, make sure that the serviceStatus is set to Running. Otherwise, you can get invalid data either because the service is not functioning properly (or at all) or because the class did not have enough time to synchronize the data with it.
For example, if this is the only existing instance of the Consumer class, the listActivities method will return an empty list.
Instances of the Consumer class should be long-lived. For example, members of the classes that use them, and you should listen for the changes in the provided properties.
QStringList KActivities::Consumer::activities | ( | ) | const |
QStringList KActivities::Consumer::activities | ( | Info::State | state | ) | const |
state | state of the activity |
|
signal |
This signal is emitted when the activity list changes.
activities | list of activities |
|
signal |
This signal is emitted when a new activity is added.
id | id of the new activity |
|
signal |
This signal is emitted when an activity has been removed.
id | id of the removed activity |
QString KActivities::Consumer::currentActivity | ( | ) | const |
|
signal |
This signal is emitted when the current activity is changed.
id | id of the new current activity |
QStringList KActivities::Consumer::runningActivities | ( | ) | const |
|
signal |
This signal is emitted when the list of running activities changes.
runningActivities | list of running activities |
ServiceStatus KActivities::Consumer::serviceStatus | ( | ) |
|
signal |
This signal is emitted when the activity service goes online or offline, or when the class manages to synchronize the data with the service.
status | new status of the service |