API Documentation
Documentation for developing SailfishOS applicationsAutostart 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.
Constant | Value | Description |
---|---|---|
Sailfish::Mdm::Autostart::Success | 0 | The action succeeded. |
Sailfish::Mdm::Autostart::InternalError | 1 | An internal API error was encountered. |
Sailfish::Mdm::Autostart::InvalidDesktopFile | 2 | The specified desktop file is not valid. |
Sailfish::Mdm::Autostart::AlreadyAutostarted | 3 | add() 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.