PlasmaActivities

controller.h
1/*
2 SPDX-FileCopyrightText: 2010-2016 Ivan Cukic <ivan.cukic(at)kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef ACTIVITIES_CONTROLLER_H
8#define ACTIVITIES_CONTROLLER_H
9
10#include <QFuture>
11#include <QObject>
12#include <QString>
13
14#include "consumer.h"
15
16#include "plasma_activities_export.h"
17
18#include <memory>
19
20namespace KActivities
21{
22class ControllerPrivate;
23
24/**
25 * This class provides methods for controlling and managing
26 * the activities.
27 *
28 * @note The QFuture objects returned by these methods are not thread-based,
29 * you can not call synchronous methods like waitForFinished, cancel, pause on
30 * them. You need either to register watchers to check when those have finished,
31 * or to check whether they are ready from time to time manually.
32 *
33 * @see Consumer for info about activities
34 *
35 * @since 5.0
36 */
37class PLASMA_ACTIVITIES_EXPORT Controller : public Consumer
38{
40
41 Q_PROPERTY(QString currentActivity READ currentActivity WRITE setCurrentActivity)
42
43public:
44 explicit Controller(QObject *parent = nullptr);
45
46 ~Controller() override;
47
48 /**
49 * Sets the name of the specified activity
50 * @param id id of the activity
51 * @param name name to be set
52 */
54
55 /**
56 * Sets the description of the specified activity
57 * @param id id of the activity
58 * @param description description to be set
59 */
60 QFuture<void> setActivityDescription(const QString &id, const QString &description);
61
62 /**
63 * Sets the icon of the specified activity
64 * @param id id of the activity
65 * @param icon icon to be set - freedesktop.org name or file path
66 */
68
69 /**
70 * Sets the current activity
71 * @param id id of the activity to make current
72 * @returns true if successful
73 */
75
76 /**
77 * Adds a new activity
78 * @param name name of the activity
79 * @returns id of the newly created activity
80 */
82
83 /**
84 * Removes the specified activity
85 * @param id id of the activity to delete
86 */
88
89 /**
90 * Stops the activity
91 * @param id id of the activity to stop
92 */
94
95 /**
96 * Starts the activity
97 * @param id id of the activity to start
98 */
100
101 /**
102 * Switches to the previous activity
103 */
105
106 /**
107 * Switches to the next activity
108 */
110
111private:
112 const std::unique_ptr<ControllerPrivate> d;
113};
114
115} // namespace KActivities
116
117#endif // ACTIVITIES_CONTROLLER_H
QFuture< void > startActivity(const QString &id)
Starts the activity.
QFuture< void > setActivityIcon(const QString &id, const QString &icon)
Sets the icon of the specified activity.
QFuture< void > previousActivity()
Switches to the previous activity.
QFuture< bool > setCurrentActivity(const QString &id)
Sets the current activity.
QFuture< void > nextActivity()
Switches to the next activity.
QFuture< void > stopActivity(const QString &id)
Stops the activity.
QFuture< void > setActivityName(const QString &id, const QString &name)
Sets the name of the specified 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< QString > addActivity(const QString &name)
Adds a new activity.
Namespace for everything in libkactivities.
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 28 2025 12:01:06 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.