KStartupInfo

Search for usage in LXR

#include <kstartupinfo.h>

Inheritance diagram for KStartupInfo:

Public Types

enum  { CleanOnCantDetect = 1 << 0, DisableKWinModule = 1 << 1, AnnounceSilenceChanges = 1 << 2 }
 
enum  startup_t { NoMatch, Match, CantDetect }
 

Signals

void gotNewStartup (const KStartupInfoId &id, const KStartupInfoData &data)
 
void gotRemoveStartup (const KStartupInfoId &id, const KStartupInfoData &data)
 
void gotStartupChange (const KStartupInfoId &id, const KStartupInfoData &data)
 

Public Member Functions

 KStartupInfo (bool clean_on_cantdetect, QObject *parent=nullptr)
 
 KStartupInfo (int flags, QObject *parent=nullptr)
 
startup_t checkStartup (WId w)
 
startup_t checkStartup (WId w, KStartupInfoData &data)
 
startup_t checkStartup (WId w, KStartupInfoId &id)
 
startup_t checkStartup (WId w, KStartupInfoId &id, KStartupInfoData &data)
 
void setTimeout (unsigned int secs)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
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 ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
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 QRegExp &regExp, 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
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
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_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 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
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
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 setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Static Public Member Functions

static void appStarted ()
 
static void appStarted (const QByteArray &startup_id)
 
static QByteArray createNewStartupId ()
 
static QByteArray createNewStartupIdForTimestamp (quint32 timestamp)
 
static KStartupInfoId currentStartupIdEnv ()
 
static void resetStartupEnv ()
 
static bool sendChange (const KStartupInfoId &id, const KStartupInfoData &data)
 
static bool sendChangeX (Display *dpy, const KStartupInfoId &id, const KStartupInfoData &data)
 
static bool sendChangeXcb (xcb_connection_t *conn, int screen, const KStartupInfoId &id, const KStartupInfoData &data)
 
static bool sendFinish (const KStartupInfoId &id)
 
static bool sendFinish (const KStartupInfoId &id, const KStartupInfoData &data)
 
static bool sendFinishX (Display *dpy, const KStartupInfoId &id)
 
static bool sendFinishX (Display *dpy, const KStartupInfoId &id, const KStartupInfoData &data)
 
static bool sendFinishXcb (xcb_connection_t *conn, int screen, const KStartupInfoId &id)
 
static bool sendFinishXcb (xcb_connection_t *conn, int screen, const KStartupInfoId &id, const KStartupInfoData &data)
 
static bool sendStartup (const KStartupInfoId &id, const KStartupInfoData &data)
 
static bool sendStartupX (Display *dpy, const KStartupInfoId &id, const KStartupInfoData &data)
 
static bool sendStartupXcb (xcb_connection_t *conn, int screen, const KStartupInfoId &id, const KStartupInfoData &data)
 
static void setNewStartupId (QWidget *window, const QByteArray &startup_id)
 
static void setNewStartupId (QWindow *window, const QByteArray &startup_id)
 
static void setStartupId (const QByteArray &startup_id)
 
static void setWindowStartupId (WId window, const QByteArray &id)
 
static void silenceStartup (bool silence)
 
static QByteArray startupId ()
 
static QByteArray windowStartupId (WId w)
 
- 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)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Protected Member Functions

void customEvent (QEvent *e_P) override
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
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)
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Public Attributes inherited from QObject
typedef QObjectList
 

Detailed Description

Class for manipulating the application startup notification.

This class can be used to send information about started application, change the information and receive this information. For detailed description, see kdelibs/kdecore/README.kstartupinfo.

You usually don't need to use this class for sending the notification information, as KDE libraries should do this when an application is started (e.g. KRun class).

For receiving the startup notification info, create an instance and connect to its slots. It will automatically detect started applications and when they are ready.

See also
KStartupInfoId
KStartupInfoData
Author
Lubos Lunak l.lun[email protected][email protected][email protected]de.or[email protected]g

Definition at line 51 of file kstartupinfo.h.

Member Enumeration Documentation

◆ startup_t

  • NoMatch - the window doesn't match any existing startup notification
  • Match - the window matches an existing startup notification
  • CantDetect - unable to detect if the window matches any existing startup notification

Definition at line 356 of file kstartupinfo.h.

Constructor & Destructor Documentation

◆ KStartupInfo() [1/2]

KStartupInfo::KStartupInfo ( int  flags,
QObject parent = nullptr 
)
explicit

Creates an instance that will receive the startup notifications.

The various flags passed may be

  • CleanOnCantDetect - when a new unknown window appears, all startup notifications for applications that are not compliant with the startup protocol are removed
  • DisableKWinModule - KWinModule, which is normally used to detect new windows, is disabled. With this flag, checkStartup() must be called in order to check newly mapped windows.
  • AnnounceSilenceChanges - normally, startup notifications are "removed" when they're silenced, and "recreated" when they're resumed. With this flag, the change is normally announced with gotStartupChange().
Parameters
flagsOR-ed combination of flags
parentthe parent of this QObject (can be nullptr for no parent)

Definition at line 215 of file kstartupinfo.cpp.

◆ KStartupInfo() [2/2]

KStartupInfo::KStartupInfo ( bool  clean_on_cantdetect,
QObject parent = nullptr 
)
explicit

Creates an instance that will receive the startup notifications.

Parameters
clean_on_cantdetectif true, and a new unknown window appears, removes all notification for applications that are not compliant with the app startup protocol
parentthe parent of this QObject (can be nullptr for no parent)
Deprecated:
since 5.0

Definition at line 223 of file kstartupinfo.cpp.

Member Function Documentation

◆ appStarted() [1/2]

void KStartupInfo::appStarted ( )
static

Manual notification that the application has started.

If you do not map a (toplevel) window, then startup notification will not disappear for the application until a timeout. You can use this as an alternative method in this case.

Definition at line 688 of file kstartupinfo.cpp.

◆ appStarted() [2/2]

void KStartupInfo::appStarted ( const QByteArray startup_id)
static

Sends explicit notification that the startup notification with id startup_id should end.

Definition at line 702 of file kstartupinfo.cpp.

◆ checkStartup() [1/4]

KStartupInfo::startup_t KStartupInfo::checkStartup ( WId  w)

Checks if the given windows matches any existing startup notification.

Parameters
wthe window id to check
Returns
the result of the operation

Definition at line 823 of file kstartupinfo.cpp.

◆ checkStartup() [2/4]

KStartupInfo::startup_t KStartupInfo::checkStartup ( WId  w,
KStartupInfoData data 
)

Checks if the given windows matches any existing startup notification, and if yes, returns the notification data in data.

Parameters
wthe window id to check
dataif found, the data of the startup notification will be written here
Returns
the result of the operation

Definition at line 818 of file kstartupinfo.cpp.

◆ checkStartup() [3/4]

KStartupInfo::startup_t KStartupInfo::checkStartup ( WId  w,
KStartupInfoId id 
)

Checks if the given windows matches any existing startup notification, and if yes, returns the identification in id.

Parameters
wthe window id to check
idif found, the id of the startup notification will be written here
Returns
the result of the operation

Definition at line 813 of file kstartupinfo.cpp.

◆ checkStartup() [4/4]

KStartupInfo::startup_t KStartupInfo::checkStartup ( WId  w,
KStartupInfoId id,
KStartupInfoData data 
)

Checks if the given windows matches any existing startup notification, and if yes, returns the identification in id and notification data in data.

Parameters
wthe window id to check
idif found, the id of the startup notification will be written here
dataif found, the data of the startup notification will be written here
Returns
the result of the operation

Definition at line 808 of file kstartupinfo.cpp.

◆ createNewStartupId()

QByteArray KStartupInfo::createNewStartupId ( )
static

Creates and returns new startup id.

The id includes properly setup user timestamp.

On the X11 platform the current timestamp will be fetched from the X-Server. If the caller has an adaquat timestamp (e.g. from a QMouseEvent) it should prefer using createNewStartupIdForTimestamp to not trigger a roundtrip to the X-Server

See also
createNewStartupIdForTimestamp

Definition at line 1059 of file kstartupinfo.cpp.

◆ createNewStartupIdForTimestamp()

QByteArray KStartupInfo::createNewStartupIdForTimestamp ( quint32  timestamp)
static

Creates and returns new startup id with timestamp as user timestamp part.

Parameters
timestampThe timestamp for the startup id.
See also
createNewStartupId
Since
5.5

Definition at line 1070 of file kstartupinfo.cpp.

◆ currentStartupIdEnv()

KStartupInfoId KStartupInfo::currentStartupIdEnv ( )
static

Returns the current startup notification identification for the current startup notification environment variable.

Note that QApplication constructor unsets the variable and you have to use QX11Info::nextStartupId() .

Returns
the current startup notification identification
Deprecated:
since 5.104, use QX11Info::nextStartupId().

Definition at line 1146 of file kstartupinfo.cpp.

◆ gotNewStartup

void KStartupInfo::gotNewStartup ( const KStartupInfoId id,
const KStartupInfoData data 
)
signal

Emitted when a new startup notification is created (i.e. a new application is being started).

Parameters
idthe notification identification
datathe notification data

◆ gotRemoveStartup

void KStartupInfo::gotRemoveStartup ( const KStartupInfoId id,
const KStartupInfoData data 
)
signal

Emitted when a startup notification is removed (either because it was detected that the application is ready or because of a timeout).

Parameters
idthe notification identification
datathe notification data

◆ gotStartupChange

void KStartupInfo::gotStartupChange ( const KStartupInfoId id,
const KStartupInfoData data 
)
signal

Emitted when a startup notification changes.

Parameters
idthe notification identification
datathe notification data

◆ resetStartupEnv()

void KStartupInfo::resetStartupEnv ( )
static

Unsets the startup notification environment variable.

Definition at line 1159 of file kstartupinfo.cpp.

◆ sendChange()

bool KStartupInfo::sendChange ( const KStartupInfoId id,
const KStartupInfoData data 
)
static

Sends given notification data about started application with the given startup identification.

This is used for updating the notification info, if no notification for this identification exists, it's ignored.

Parameters
idthe id of the application
datathe application's data
Returns
true if successful, false otherwise
See also
KStartupInfoId
KStartupInfoData

Definition at line 536 of file kstartupinfo.cpp.

◆ sendChangeX()

bool KStartupInfo::sendChangeX ( Display *  dpy,
const KStartupInfoId id,
const KStartupInfoData data 
)
static

Like sendChange , uses dpy instead of qt_x11display() for sending the info.

Parameters
dpythe display of the application.
idthe id of the application
datathe application's data
Returns
true if successful, false otherwise
Deprecated:
since 5.18 use sendChangeXcb

Definition at line 550 of file kstartupinfo.cpp.

◆ sendChangeXcb()

bool KStartupInfo::sendChangeXcb ( xcb_connection_t *  conn,
int  screen,
const KStartupInfoId id,
const KStartupInfoData data 
)
static

Like sendChange , uses conn instead of QX11Info::connection() for sending the info.

Parameters
connthe xcb connection of the application.
screenThe x11 screen the connection belongs to
idthe id of the application
datathe application's data
Returns
true if successful, false otherwise
Since
5.18

Definition at line 569 of file kstartupinfo.cpp.

◆ sendFinish() [1/2]

bool KStartupInfo::sendFinish ( const KStartupInfoId id)
static

Ends startup notification with the given identification.

Parameters
idthe id of the application
Returns
true if successful, false otherwise

Definition at line 588 of file kstartupinfo.cpp.

◆ sendFinish() [2/2]

bool KStartupInfo::sendFinish ( const KStartupInfoId id,
const KStartupInfoData data 
)
static

Ends startup notification with the given identification and the given data (e.g. PIDs of processes for this startup notification that exited).

Parameters
idthe id of the application
datathe application's data
Returns
true if successful, false otherwise

Definition at line 636 of file kstartupinfo.cpp.

◆ sendFinishX() [1/2]

bool KStartupInfo::sendFinishX ( Display *  dpy,
const KStartupInfoId id 
)
static

Like sendFinish , uses dpy instead of qt_x11display() for sending the info.

Parameters
dpythe display of the application.
idthe id of the application
Returns
true if successful, false otherwise
Deprecated:
since 5.18 use sendFinishXcb

Definition at line 600 of file kstartupinfo.cpp.

◆ sendFinishX() [2/2]

bool KStartupInfo::sendFinishX ( Display *  dpy,
const KStartupInfoId id,
const KStartupInfoData data 
)
static

Like sendFinish , uses dpy instead of qt_x11display() for sending the info.

Parameters
dpythe display of the application.
idthe id of the application
datathe application's data
Returns
true if successful, false otherwise
Deprecated:
since 5.18 use sendFinishXcb

Definition at line 650 of file kstartupinfo.cpp.

◆ sendFinishXcb() [1/2]

bool KStartupInfo::sendFinishXcb ( xcb_connection_t *  conn,
int  screen,
const KStartupInfoId id 
)
static

Like sendFinish , uses conn instead of QX11Info::connection() for sending the info.

Parameters
connthe xcb connection of the application.
screenThe x11 screen the connection belongs to
idthe id of the application
Returns
true if successful, false otherwise
Since
5.18

Definition at line 618 of file kstartupinfo.cpp.

◆ sendFinishXcb() [2/2]

bool KStartupInfo::sendFinishXcb ( xcb_connection_t *  conn,
int  screen,
const KStartupInfoId id,
const KStartupInfoData data 
)
static

Like sendFinish , uses conn instead of QX11Info::connection() for sending the info.

Parameters
connthe xcb connection of the application.
screenThe x11 screen the connection belongs to
idthe id of the application
datathe application's data
Returns
true if successful, false otherwise
Since
5.18

Definition at line 669 of file kstartupinfo.cpp.

◆ sendStartup()

bool KStartupInfo::sendStartup ( const KStartupInfoId id,
const KStartupInfoData data 
)
static

Sends given notification data about started application with the given startup identification.

If no notification for this identification exists yet, it is created, otherwise it's updated. Note that the name field in data is required.

Parameters
idthe id of the application
datathe application's data
Returns
true if successful, false otherwise
See also
KStartupInfoId
KStartupInfoData

Definition at line 465 of file kstartupinfo.cpp.

◆ sendStartupX()

bool KStartupInfo::sendStartupX ( Display *  dpy,
const KStartupInfoId id,
const KStartupInfoData data 
)
static

Like sendStartup , uses dpy instead of qt_x11display() for sending the info.

Parameters
dpythe display of the application. Note that the name field in data is required.
idthe id of the application
datathe application's data
Returns
true if successful, false otherwise
Deprecated:
since 5.18 use sendStartupXcb

Definition at line 479 of file kstartupinfo.cpp.

◆ sendStartupXcb()

bool KStartupInfo::sendStartupXcb ( xcb_connection_t *  conn,
int  screen,
const KStartupInfoId id,
const KStartupInfoData data 
)
static

Like sendStartup , uses conn instead of QX11Info::connection() for sending the info.

Parameters
connthe xcb connection of the application. Note that the name field in data is required.
screenThe x11 screen the connection belongs to
idthe id of the application
datathe application's data
Returns
true if successful, false otherwise
Since
5.18

Definition at line 499 of file kstartupinfo.cpp.

◆ setNewStartupId() [1/2]

void KStartupInfo::setNewStartupId ( QWidget window,
const QByteArray startup_id 
)
static

Use this function if the application got a request with startup notification from outside (for example, when KUniqueApplication::newInstance() is called, or e.g. when khelpcenter opens new URL in its window).

The window can be either an already existing and visible window, or a new one, before being shown. Note that this function is usually needed only when a window is reused.

Deprecated:
since 5.62, use setNewStartupId(QWindow *) instead Note: if all you have is a QWidget*, you might need to call setAttribute(Qt::WA_NativeWindow, true); before calling window()->windowHandle().

Definition at line 771 of file kstartupinfo.cpp.

◆ setNewStartupId() [2/2]

void KStartupInfo::setNewStartupId ( QWindow window,
const QByteArray startup_id 
)
static

Use this function if the application got a request with startup notification from outside (for example, when KUniqueApplication::newInstance() is called, or e.g. when khelpcenter opens new URL in its window).

The window can be either an already existing and visible window, or a new one, before being shown. Note that this function is usually needed only when a window is reused.

Definition at line 780 of file kstartupinfo.cpp.

◆ setStartupId()

void KStartupInfo::setStartupId ( const QByteArray startup_id)
static

Sets a new value for the application startup notification window property for newly created toplevel windows.

Parameters
startup_idthe startup notification identifier
See also
KStartupInfo::setNewStartupId

Definition at line 743 of file kstartupinfo.cpp.

◆ setTimeout()

void KStartupInfo::setTimeout ( unsigned int  secs)

Sets the timeout for notifications, after this timeout a notification is removed.

Parameters
secsthe new timeout in seconds

Definition at line 995 of file kstartupinfo.cpp.

◆ setWindowStartupId()

void KStartupInfo::setWindowStartupId ( WId  window,
const QByteArray id 
)
static

Sets the startup notification window property on the given window.

Parameters
windowthe id of the window
idthe startup notification id
Deprecated:
since 5.104

Definition at line 972 of file kstartupinfo.cpp.

◆ silenceStartup()

void KStartupInfo::silenceStartup ( bool  silence)
static

If your application shows temporarily some window during its startup, for example a dialog, and only after closing it shows the main window, startup notification would normally be shown while the dialog is visible.

To temporarily suspend and resume the notification, use this function. Note that this is cumulative, i.e. after suspending twice, you have to resume twice.

Deprecated:
since 5.102, no known users.

Definition at line 717 of file kstartupinfo.cpp.

◆ startupId()

QByteArray KStartupInfo::startupId ( )
static

Returns the startup ID set by setStartupId().

Returns
the startup notification identifier
Warning
This does not give access to the startup ID the app was launched with. Use QX11Info::nextStartupId() to get that.
Deprecated:
since 5.102, use QX11Info::nextStartupId().

Definition at line 731 of file kstartupinfo.cpp.

◆ windowStartupId()

QByteArray KStartupInfo::windowStartupId ( WId  w)
static

Returns startup notification identification of the given window.

Parameters
wthe id of the window
Returns
the startup notification id. Can be null if not found.

Definition at line 951 of file kstartupinfo.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:54:19 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.