KAutostart

Search for usage in LXR

#include <KAutostart>

Inheritance diagram for KAutostart:

Public Types

enum  Condition { NoConditions = 0x0, CheckCommand = 0x1, CheckCondition = 0x2, CheckAll = 0xff }
 
typedef QFlags< ConditionConditions
 
enum  StartPhase { BaseDesktop = 0, DesktopServices = 1, Applications = 2 }
 

Public Member Functions

 KAutostart (const QString &entryName=QString(), QObject *parent=nullptr)
 
void addToAllowedEnvironments (const QString &environment)
 
void addToExcludedEnvironments (const QString &environment)
 
QStringList allowedEnvironments () const
 
bool autostarts (const QString &environment=QString(), Conditions check=NoConditions) const
 
bool checkAllowedEnvironment (const QString &environment) const
 
QString command () const
 
QString commandToCheck () const
 
QStringList excludedEnvironments () const
 
void removeFromAllowedEnvironments (const QString &environment)
 
void removeFromExcludedEnvironments (const QString &environment)
 
void setAllowedEnvironments (const QStringList &environments)
 
void setAutostarts (bool autostart)
 
void setCommand (const QString &command)
 
void setCommandToCheck (const QString &exec)
 
void setExcludedEnvironments (const QStringList &environments)
 
void setStartPhase (StartPhase phase)
 
void setVisibleName (const QString &entryName)
 
QString startAfter () const
 
StartPhase startPhase () const
 
QString visibleName () const
 
- 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 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
 
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 (QObject *object)
 
qobject_cast (const 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 bool isServiceRegistered (const QString &entryName)
 
static bool isStartConditionMet (const QString &condition)
 
- 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 *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
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, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- 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

KAutostart provides a programmatic means to control the state of autostart services on a per-user basis.

This is useful for applications that wish to offer a configurable means to allow the application to be autostarted.

By using this class you future-proof your applications against potential future or platform-specific changes to the autostart mechanism(s).

Typical usage might look like:

KAutostart autostart; // without an entryName arg, gets name from KAboutData
autostart.setAutostarts(true); // will now start up when the user logs in
// set the value in our configuration settings to reflect whether or not
// we will actually start up on log in
config.setAutoStart(autostart.autoStarts());

Definition at line 41 of file kautostart.h.

Member Typedef Documentation

Stores a combination of Condition values.

Definition at line 98 of file kautostart.h.

Member Enumeration Documentation

Flags for each of the conditions that may affect whether or not a service actually autostarted on login.

See also
Conditions
Enumerator
NoConditions 

no conditions set

CheckCommand 

an executable that is checked for existence by name

CheckCondition 

autostart condition will be checked too (KDE-specific)

Since
4.3
CheckAll 

all necessary conditions will be checked

Since
4.3

Definition at line 75 of file kautostart.h.

Enumerates the various autostart phases that occur during start-up.

Enumerator
BaseDesktop 

the essential desktop services such as panels and window managers

DesktopServices 

services that should be available before most interactive applications start but that aren't part of the base desktop.

This would include things such as clipboard managers and mouse gesture tools.

Applications 

everything else that doesn't belong in the above two categories, including most system tray applications, system monitors and interactive applications

Definition at line 103 of file kautostart.h.

Constructor & Destructor Documentation

KAutostart::KAutostart ( const QString entryName = QString(),
QObject parent = nullptr 
)
explicit

Creates a new KAutostart object that represents the autostart service "entryName".

If the service already exists in the system then the values associated with that service, such as the executable command, will be loaded as well.

Note that unless this service is explicitly set to autostart, simply creating a KAutostart object will not result in the service being autostarted on next log in.

If no such service is already registered and the command to be executed on startup is not the same as entryName, then you will want to set the associated command with setExec(const QString&)

See also
setExec
Parameters
entryNamethe name used to identify the service. If none is provided then it uses the name registered with KAboutData.
parentQObject
Since
5.61 we are allowed to specify an absolute path to the service description and it will still work.

Definition at line 59 of file kautostart.cpp.

Member Function Documentation

void KAutostart::addToAllowedEnvironments ( const QString environment)

Adds an environment to the list of environments this service may start in.

See also
setAllowedEnvironments(), removeFromAllowedEnvironments()

Definition at line 281 of file kautostart.cpp.

void KAutostart::addToExcludedEnvironments ( const QString environment)

Adds an environment to the list of environments this service may not be autostarted in.

See also
removeFromExcludedEnvironments()

Definition at line 321 of file kautostart.cpp.

QStringList KAutostart::allowedEnvironments ( ) const

Returns the list of environments (e.g.

"KDE") this service is allowed to start in. Use checkAllowedEnvironment() or autostarts() for actual checks.

This does not take other autostart conditions into account. If any environment is added to the allowed environments list, then only those environments will be allowed to autoload the service. It is not allowed to specify both allowed and excluded environments at the same time.

See also
setAllowedEnvironments()

Definition at line 266 of file kautostart.cpp.

bool KAutostart::autostarts ( const QString environment = QString(),
Conditions  check = NoConditions 
) const

Returns whether or not the service represented by entryName in the autostart system is set to autostart at login or not.

Parameters
environmentif provided the check will be performed as if being loaded in that environment
checkautostart conditions to check for (see commandToCheck())
See also
setAutostarts()

Definition at line 101 of file kautostart.cpp.

bool KAutostart::checkAllowedEnvironment ( const QString environment) const

Checks whether autostart is allowed in the given environment, depending on allowedEnvironments() and excludedEnvironments().

Since
4.3

Definition at line 151 of file kautostart.cpp.

QString KAutostart::command ( ) const

Returns the associated command for this autostart service.

See also
setCommand()

Definition at line 166 of file kautostart.cpp.

QString KAutostart::commandToCheck ( ) const

Returns the executable to check for when attempting to autostart this service.

If the executable is not found in the user's environment, it will not autostart.

See also
setCommandToCheck()

Definition at line 202 of file kautostart.cpp.

QStringList KAutostart::excludedEnvironments ( ) const

Returns the list of environments this service is explicitly not allowed to start in.

Use checkAllowedEnvironment() or autostarts() for actual checks.

This does not take other autostart conditions such as into account. It is not allowed to specify both allowed and excluded environments at the same time.

See also
setExcludedEnvironments()

Definition at line 306 of file kautostart.cpp.

bool KAutostart::isServiceRegistered ( const QString entryName)
static

Checks whether or not a service by the given name entryName is registered with the autostart system.

Does not check whether or not it is set to actually autostart or not.

Parameters
entryNamethe name of the service to check for

Definition at line 196 of file kautostart.cpp.

bool KAutostart::isStartConditionMet ( const QString condition)
static

Checks that a given autostart configuration condition is met.

Parameters
conditionconfig in the format "rcfile:group:entry:default"
Since
5.69

Definition at line 129 of file kautostart.cpp.

void KAutostart::removeFromAllowedEnvironments ( const QString environment)

Removes an environment to the list of environments this service may start in.

See also
addToAllowedEnvironments()

Definition at line 293 of file kautostart.cpp.

void KAutostart::removeFromExcludedEnvironments ( const QString environment)

Removes an environment to the list of environments this service may not be autostarted in.

See also
addToExcludedEnvironments()

Definition at line 333 of file kautostart.cpp.

void KAutostart::setAllowedEnvironments ( const QStringList environments)

Sets the environments this service is allowed to start in.

See also
allowedEnvironments(), addToAllowedEnvironments()

Definition at line 271 of file kautostart.cpp.

void KAutostart::setAutostarts ( bool  autostart)

Sets the given exec to start automatically at login.

Parameters
autostartwill register with the autostart facility when true and deregister when false
See also
autostarts()

Definition at line 90 of file kautostart.cpp.

void KAutostart::setCommand ( const QString command)

Set the associated command for this autostart service.

See also
command()

Definition at line 171 of file kautostart.cpp.

void KAutostart::setCommandToCheck ( const QString exec)

Sets the executable to check for the existence of when autostarting this service.

See also
commandToCheck()

Definition at line 207 of file kautostart.cpp.

void KAutostart::setExcludedEnvironments ( const QStringList environments)

Sets the environments this service is not allowed to start in.

See also
excludedEnvironments(), addToExcludedEnvironments()

Definition at line 311 of file kautostart.cpp.

void KAutostart::setStartPhase ( KAutostart::StartPhase  phase)

Sets the service (by name) this service should be started after.

Note that this is KDE specific and may not work in other environments.

See also
StartPhase, startPhase()

Definition at line 243 of file kautostart.cpp.

void KAutostart::setVisibleName ( const QString entryName)

Sets the user-visible name for this autostart service.

See also
visibleName()

Definition at line 186 of file kautostart.cpp.

QString KAutostart::startAfter ( ) const

Returns the name of another service that should be autostarted before this one (if that service would be autostarted).

Since
4.3

Definition at line 346 of file kautostart.cpp.

KAutostart::StartPhase KAutostart::startPhase ( ) const

Returns the autostart phase this service is started in.

Note that this is KDE specific and may not work in other environments.

See also
StartPhase, setStartPhase()

Definition at line 238 of file kautostart.cpp.

QString KAutostart::visibleName ( ) const

Returns the user-visible name this autostart service is registered as.

See also
setVisibleName(), setEntryName()

Definition at line 181 of file kautostart.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Jun 20 2021 22:47:36 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.