Pages
API Documentation
On this page

KActivities::Info Class

Info about an activity. More...

  • Header: #include <PlasmaActivities/Info>
  • CMake: find_package(Plasma REQUIRED COMPONENTS Activities)
    target_link_libraries(mytarget PRIVATE Plasma::Activities)
  • Inherits: QObject

List of all members, including inherited members

Public Types

Properties

Public Functions

Signals

Detailed Description

Most methods in it require a semantic backend running to function properly.

This class is not thread-safe.

The API of the class is synchronous, but the most used properties are pre-fetched and cached. This means that, in order to get the least amount of d-bus related locks, you should declare long-lived instances of this class.

Before relying on the values retrieved by the class, make sure that the state is not Info::Unknown. 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 Info class, the name method will return an empty string.

For example, this is wrong (works, but blocks):

void someMethod(const QString & activity) {
    // Do not copy. This approach is not a good one!
    Info info(activity);
    doSomethingWith(info.name());
}

Instances of the Info 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.

Member Type Documentation

enum Info::Availability

Specifies which parts of this class are functional

Constant Value Description
KActivities::Info::Nothing 0 No activity info provided (isValid is false)
KActivities::Info::BasicInfo 1 Basic info is provided
KActivities::Info::Everything 2 Everything is available

Property Documentation

[read-only] description : QString

Access functions:

Notifier signal:

[read-only] icon : QString

Access functions:

  • QString icon() const

Notifier signal:

[read-only] id : QString

Access functions:

  • QString id() const

[read-only] isCurrent : bool

Access functions:

Notifier signal:

[read-only] name : QString

Access functions:

  • QString name() const

Notifier signal:

Member Function Documentation

[explicit] Info::Info(const QString &activity, QObject *parent = nullptr)

[signal] void Info::added()

Emitted when the activity is added

KActivities::Info::Availability Info::availability() const

Returns what info is provided by this instance of Info

QString Info::description() const

Returns the description of the activity

Note: Getter function for property description.

[signal] void Info::descriptionChanged(const QString &description)

Emitted when the description is changed

Note: Notifier signal for property description.

QString Info::icon() const

Returns the icon of the activity. Icon can be a freedesktop.org name or a file path. Or empty if no icon is set.

Note: Getter function for property icon.

[signal] void Info::iconChanged(const QString &icon)

Emitted when the icon was changed

Note: Notifier signal for property icon.

QString Info::id() const

Returns the id of the activity

Note: Getter function for property id.

[signal] void Info::infoChanged()

Emitted when the activity's name, icon or some custom property is changed

bool Info::isCurrent() const

Returns whether this activity is the current one

Note: Getter function for property isCurrent.

[signal] void Info::isCurrentChanged(bool current)

Emitted when the activity becomes the current one, or when it stops being the current one

Note: Notifier signal for property isCurrent.

QString Info::name() const

Returns the name of the activity

Note: Getter function for property name.

[signal] void Info::nameChanged(const QString &name)

Emitted when the name is changed

Note: Notifier signal for property name.

[signal] void Info::removed()

Emitted when the activity is removed

QString Info::uri() const

Returns the URI of this activity. The same URI is used by activities KIO worker.

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.