KActivities::Info

Search for usage in LXR

KActivities::Info Class Reference

#include <info.h>

Inheritance diagram for KActivities::Info:

Public Types

enum  Availability { Nothing = 0 , BasicInfo = 1 , Everything = 2 }
 
enum  State {
  Invalid = 0 , Unknown = 1 , Running = 2 , Starting = 3 ,
  Stopped = 4 , Stopping = 5
}
 

Properties

QString description
 
QString icon
 
QString id
 
bool isCurrent
 
QString name
 
Info::State state
 
- Properties inherited from QObject
 objectName
 

Signals

void added ()
 
void descriptionChanged (const QString &description)
 
void iconChanged (const QString &icon)
 
void infoChanged ()
 
void isCurrentChanged (bool current)
 
void nameChanged (const QString &name)
 
void removed ()
 
void started ()
 
void stateChanged (KActivities::Info::State state)
 
void stopped ()
 

Public Member Functions

 Info (const QString &activity, QObject *parent=nullptr)
 
Availability availability () const
 
QString description () const
 
QString icon () const
 
QString id () const
 
bool isCurrent () const
 
bool isValid () const
 
QString name () const
 
State state () const
 
QString uri () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo () const const
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

This class provides info about an activity.

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

This class is not thread-safe.

See also
Consumer for info about activities

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.

Since
4.5

Definition at line 58 of file info.h.

Member Enumeration Documentation

◆ Availability

Specifies which parts of this class are functional.

Enumerator
Nothing 

No activity info provided (isValid is false)

BasicInfo 

Basic info is provided.

Everything 

Everything is available.

Definition at line 81 of file info.h.

◆ State

State of the activity.

Enumerator
Invalid 

This activity does not exist.

Unknown 

Information is not yet retrieved from the service.

Running 

Activity is running.

Starting 

Activity is begin started.

Stopped 

Activity is stopped.

Stopping 

Activity is begin started.

Definition at line 90 of file info.h.

Property Documentation

◆ description

QString KActivities::Info::description
read

Definition at line 64 of file info.h.

◆ icon

QString KActivities::Info::icon
read

Definition at line 65 of file info.h.

◆ id

QString KActivities::Info::id
read

Definition at line 62 of file info.h.

◆ isCurrent

bool KActivities::Info::isCurrent
read

Definition at line 66 of file info.h.

◆ name

QString KActivities::Info::name
read

Definition at line 63 of file info.h.

◆ state

Info::State KActivities::Info::state
read

Definition at line 67 of file info.h.

Constructor & Destructor Documentation

◆ Info()

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

Definition at line 88 of file info.cpp.

◆ ~Info()

KActivities::Info::~Info ( )
override

Definition at line 119 of file info.cpp.

Member Function Documentation

◆ added

void KActivities::Info::added ( )
signal

Emitted when the activity is added.

◆ availability()

Info::Availability KActivities::Info::availability ( ) const
Returns
what info is provided by this instance of Info

Definition at line 174 of file info.cpp.

◆ description()

QString KActivities::Info::description ( ) const
Returns
the description of the activity

◆ descriptionChanged

void KActivities::Info::descriptionChanged ( const QString & description)
signal

Emitted when the description is changed.

◆ icon()

QString KActivities::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.

◆ iconChanged

void KActivities::Info::iconChanged ( const QString & icon)
signal

Emitted when the icon was changed.

◆ id()

QString KActivities::Info::id ( ) const
Returns
the id of the activity

Definition at line 135 of file info.cpp.

◆ infoChanged

void KActivities::Info::infoChanged ( )
signal

Links the specified resource to the activity.

Parameters
resourceUriresource URI
Note
This method is asynchronous. It will return before the resource is actually linked to the activity. Unlinks the specified resource from the activity
Parameters
resourceUriresource URI
Note
This method is asynchronous. It will return before the resource is actually unlinked from the activity.
Returns
whether a resource is linked to this activity
Note
This QFuture is not thread-based, you can not call synchronous methods like waitForFinished, cancel, pause on it.
Since
5.0 Emitted when the activity's name, icon or some custom property is changed

◆ isCurrent()

bool KActivities::Info::isCurrent ( ) const
Returns
whether this activity is the current one

Definition at line 140 of file info.cpp.

◆ isCurrentChanged

void KActivities::Info::isCurrentChanged ( bool current)
signal

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

◆ isValid()

bool KActivities::Info::isValid ( ) const
Returns
true if the activity represented by this object exists and is valid

Definition at line 124 of file info.cpp.

◆ name()

QString KActivities::Info::name ( ) const
Returns
the name of the activity

◆ nameChanged

void KActivities::Info::nameChanged ( const QString & name)
signal

Emitted when the name is changed.

◆ removed

void KActivities::Info::removed ( )
signal

Emitted when the activity is removed.

◆ started

void KActivities::Info::started ( )
signal

Emitted when the activity is started.

◆ state()

Info::State KActivities::Info::state ( ) const
Returns
the state of the activity

Definition at line 145 of file info.cpp.

◆ stateChanged

void KActivities::Info::stateChanged ( KActivities::Info::State state)
signal

Emitted when the activity changes state.

Parameters
statenew state of the activity

◆ stopped

void KActivities::Info::stopped ( )
signal

Emitted when the activity is stopped.

◆ uri()

QString KActivities::Info::uri ( ) const
Returns
the URI of this activity. The same URI is used by activities KIO worker.

Definition at line 130 of file info.cpp.


The documentation for this class was generated from the following files:
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.