API Documentation

Documentation for developing SailfishOS applications

Autostart Class

(Sailfish::Mdm::Autostart)

The Autostart class controls auto-starting of applications. More...

Header: #include <mdm-autostart.h>

Public Types

enum Result { Success, InternalError, InvalidDesktopFile, AlreadyAutostarted }

Public Functions

Autostart(QObject *parent = Q_NULLPTR)
virtual ~Autostart()
Result add(const QString &desktopFilePath)
QStringList query(Autostart::Result &result)
Result remove(const QString &desktopFilePath)

Detailed Description

The Autostart class controls auto-starting of applications.

Applications can be added to or removed from the list of applications that are auto-started when the system starts.

To use this class, clients must add the following to their qmake project:

 CONFIG += link_pkgconfig
 PKGCONFIG += sailfishmdm

and then #include <mdm-autostart.h>.

Example of usage:

 #include <mdm-autostart.h>

 void example()
 {
     Sailfish::Mdm::Autostart autostart;
     autostart.add("/usr/share/applications/your-favourite-app.desktop");
 }

Member Type Documentation

enum Autostart::Result

Describes the result of an add() or remove() action.

ConstantValueDescription
Sailfish::Mdm::Autostart::Success0The action succeeded.
Sailfish::Mdm::Autostart::InternalError1An internal API error was encountered.
Sailfish::Mdm::Autostart::InvalidDesktopFile2The specified desktop file is not valid.
Sailfish::Mdm::Autostart::AlreadyAutostarted3add() was called for an application that has already been added.

Member Function Documentation

Autostart::Autostart(QObject *parent = Q_NULLPTR)

Default constructs an instance of Autostart.

[virtual] Autostart::~Autostart()

Destroys the instance of Autostart. The destructor is virtual.

Result Autostart::add(const QString &desktopFilePath)

Adds a given application to be auto-started at system startup. The desktopFilePath is the path to the desktop file of the application.

QStringList Autostart::query(Autostart::Result &result)

Queries the currently auto-started applications and sets result to the result of the action. Returns a list of the currently auto-started applications' desktop file paths.

Result Autostart::remove(const QString &desktopFilePath)

Removes a given application so it will no longer be auto-started at system startup. The desktopFilePath is the path to the desktop file of the application.

We use cookies to improve your user experience and to help us to develop our services. By continuing to browse the site, you approve of our use of cookies.