API Documentation
Documentation for developing SailfishOS applicationsApplications Class
(Sailfish::Mdm::Applications)The Applications class provides information on installed applications and packages. More...
Header: | #include <mdm-applications.h> |
Public Functions
Applications(QObject *parent = 0) | |
virtual | ~Applications() |
QList<ApplicationEntry> | getInstalledApplications() |
QList<PackageEntry> | getInstalledPackages() |
ApplicationOperation * | installPackage(const QString &package, const QString &version = QString()) |
ApplicationOperation * | removePackage(const QString &package, bool autoremove) |
Detailed Description
The Applications class provides information on installed applications and packages.
To use this class, clients must add the following to their qmake project:
CONFIG += link_pkgconfig PKGCONFIG += sailfishmdm
and then #include <mdm-applications.h>
.
Example of usage:
#include <mdm-applications.h> void printApplications() { QList<Sailfish::Mdm::ApplicationEntry> apps = Sailfish::Mdm::Applications().getInstalledApplications(); foreach (const Sailfish::Mdm::ApplicationEntry &entry, apps) { Sailfish::Mdm::PackageEntry package = entry.package(); qInfo() << "Application name:" << entry.name(); qInfo() << "From package:" << (package.name().isEmpty() ? QStringLiteral("(none)") : QString("%1-%2").arg(package.name()).arg(package.version())); qInfo() << QStringLiteral("--------"); } }
Member Function Documentation
Applications::Applications(QObject *parent = 0)
Default constructs an instance of Applications.
[virtual]
Applications::~Applications()
Destroys the instance of Applications. The destructor is virtual.
QList<ApplicationEntry> Applications::getInstalledApplications()
Returns the list of entries of the applications installed on the device.
QList<PackageEntry> Applications::getInstalledPackages()
Returns the list of entries of the packages installed on the device.
ApplicationOperation *Applications::installPackage(const QString &package, const QString &version = QString())
Installs the given package with the given version from the system's RPM repositories.
See also ApplicationOperation::finished, ApplicationOperation::failed, and ApplicationOperation::succeeded.
ApplicationOperation *Applications::removePackage(const QString &package, bool autoremove)
Removes an installed RPM package.
If autoremove is true, this suggests to remove dependencies that were pulled in by the package and not used by other components.
See also ApplicationOperation::finished, ApplicationOperation::failed, and ApplicationOperation::succeeded.