FileChooserPortal Class

(Sailfish::XDP::FileChooserPortal)

Backend interface of the FileChooser Portal More...

Header: #include <FileChooserPortal>

Public Types

enum PickerResponse { Accepted, Cancelled, Other }

Properties

Public Functions

FileChooserPortal(QObject *parent)

Public Slots

void OpenFile(const QDBusObjectPath &handle, const QString &app_id, const QString &parent_window, const QString &title, const QVariantMap &options, const QDBusMessage &message)
void SaveFile(const QDBusObjectPath &handle, const QString &app_id, const QString &parent_window, const QString &title, const QVariantMap &options, const QDBusMessage &message)
void SaveFiles(const QDBusObjectPath &handle, const QString &app_id, const QString &parent_window, const QString &title, const QVariantMap &options, const QDBusMessage &message)
void handlePickerError()
void handlePickerResponse(const int &code, const QVariantList &result)
void setupPickerResponse()
uint version() const
void waitForPickerResponse()

Detailed Description

Backend interface of the FileChooser Portal

See XDG Desktop Portal Backend Specification for details.

Member Type Documentation

enum FileChooserPortal::PickerResponse

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

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

Property Documentation

version : const uint

This property contains the backend implementation version.

Access functions:

uint version() const

Member Function Documentation

FileChooserPortal::FileChooserPortal(QObject *parent)

Default constructs an instance of FileChooserPortal.

[slot] void FileChooserPortal::OpenFile(const QDBusObjectPath &handle, const QString &app_id, const QString &parent_window, const QString &title, const QVariantMap &options, const QDBusMessage &message)

Presents a file selection popup to the user. If title is given, it will be the title of the dialog window. See the XDG Desktop Portal Backend Specification for the meaning of handle, app_id, parent_window. See the XDG Desktop Portal Specification for possible options. message is used to send the reply

[slot] void FileChooserPortal::SaveFile(const QDBusObjectPath &handle, const QString &app_id, const QString &parent_window, const QString &title, const QVariantMap &options, const QDBusMessage &message)

Presents a file selection popup to the user. If title is given, it will be the title of the dialog window. See the XDG Desktop Portal Backend Specification for the meaning of handle, app_id, parent_window. See the XDG Desktop Portal Specification for possible options. message is used to send the reply

Warning: This currently does nothing.

[slot] void FileChooserPortal::SaveFiles(const QDBusObjectPath &handle, const QString &app_id, const QString &parent_window, const QString &title, const QVariantMap &options, const QDBusMessage &message)

Presents a file selection popup to the user. If title is given, it will be the title of the dialog window. See the XDG Desktop Portal Backend Specification for the meaning of handle, app_id, parent_window. See the XDG Desktop Portal Specification for possible options. message is used to send the reply

Warning: This currently does nothing.

[slot] void FileChooserPortal::handlePickerError()

Receives the results from the picker Dialog.

[slot] void FileChooserPortal::handlePickerResponse(const int &code, const QVariantList &result)

Receives the results from the picker Dialog. code corresponds to the dialog response options, result ia an array of string variants listing the selected file(s) or directories.

Note: result is a QVariantList mainly because the Nemo.DBus plugin prefers to marshal most things as Variants. If you use the results in a DBus reply, make sure to transform it into e.g. a simple QStringList before sending.

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

[slot] void FileChooserPortal::setupPickerResponse()

After the GUI has been launched, listens for the pickerDone signal, and calls FileChooserPortal::handlePickerResponse with the response.

See also handlePickerResponse.

[slot] void FileChooserPortal::waitForPickerResponse()

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.