Backend interface of the FileChooser Portal More...
Header: | #include <FileChooserPortal> |
enum | PickerResponse { Accepted, Cancelled, Other } |
FileChooserPortal(QObject *parent) |
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() |
Backend interface of the FileChooser Portal
See XDG Desktop Portal Backend Specification for details.
Possible return values of a dialog interaction. The values correspond to the response poperties of the calls in this class.
Constant | Value | Description |
---|---|---|
Sailfish::XDP::FileChooserPortal::Accepted | 0 | The dialog has been accepted |
Sailfish::XDP::FileChooserPortal::Cancelled | 1 | The dialog has been cancelled |
Sailfish::XDP::FileChooserPortal::Other | 2 | Something else has happened (e.g. a timeout) |
This property contains the backend implementation version.
Access functions:
uint | version() const |
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.