AccessPortal Class

(Sailfish::XDP::AccessPortal)

Backend interface of the Access Portal More...

Header: #include <AccessPortal>

Public Types

enum DialogResponse { Accepted, Cancelled, Other }

Public Functions

AccessPortal(QObject *parent)

Public Slots

uint AccessDialog(const QDBusObjectPath &handle, const QString &app_id, const QString &parent_window, const QString &title, const QString &subtitle, const QString &body, const QVariantMap &options, QVariantMap &results)
void handleDialogError()
void handleDialogResponse(const int &code)
void setupDialogResponse()
void waitForDialogResponse()

Detailed Description

Backend interface of the Access Portal

See XDG Desktop Portal Backend Specification for details.

Member Type Documentation

enum AccessPortal::DialogResponse

Possible return values of a dialog interaction. The values correspond to the response poperties of the calls in this class.

ConstantValueDescription
Sailfish::XDP::AccessPortal::Accepted0The dialog has been accepted
Sailfish::XDP::AccessPortal::Cancelled1The dialog has been cancelled
Sailfish::XDP::AccessPortal::Other2Something else has happened (e.g. a timeout)

Member Function Documentation

AccessPortal::AccessPortal(QObject *parent)

Default constructs an instance of AccessPortal.

[slot] uint AccessPortal::AccessDialog(const QDBusObjectPath &handle, const QString &app_id, const QString &parent_window, const QString &title, const QString &subtitle, const QString &body, const QVariantMap &options, QVariantMap &results)

Presents the user with a prompt they can accept or deny, and several other options.

title, subtitle, and body can be used to configure the dialog appearance.

See the XDG Desktop Portal Specification for possible values of options. See the XDG Desktop Portal Backend Specification for the meaning of handle, app_id, parent_window, results.

Warning: The implementation of triggering the UI is incomplete. It serves as proof-of-concept only. Specifically, some options like modal, or choices are not handled.

[slot] void AccessPortal::handleDialogError()

Receives the results from the Dialog.

[slot] void AccessPortal::handleDialogResponse(const int &code)

Receives the results from the Dialog. code corresponds to the dialog response options.

See also Sailfish::XDP::AccessPortal::DialogResponse and [nemo-qml-plugin-dbus]{Nemo QML Plugin DBus}.

[slot] void AccessPortal::setupDialogResponse()

After the GUI has been launched, listens for the dialog's Done signal, and calls AccessPortal::handleDialogResponse with the response.

See also handleDialogResponse.

[slot] void AccessPortal::waitForDialogResponse()

Since launching the GUI via D-Bus is asynchronous (or rather, returns immediately), we have to wait for a Done signal to arrive from the application.