summaryrefslogtreecommitdiffstats
path: root/src/plugins/platformthemes/flatpak
Commit message (Collapse)AuthorAgeFilesLines
* Make sure we open native dialogs when opening folders inside sandboxJan Grulich2018-06-151-4/+4
| | | | | | | | | We have to take obsoleted QFileDialog::DirectoryOnly file mode option into account, because it is actually used, even internally in Qt when using static QFileDialog::getExistingDirectory() method. Change-Id: I6cdd35ae4724a1d889a0fb1c3555dc3ca4f3bf4d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Keep native file dialog updated with current optionsJan Grulich2018-06-061-4/+12
| | | | | | | | | | | | | | When doing calls on native file dialog, we might end up calling an implementation which will cause crash in case we don't have all options loaded in the native file dialog. Imagine scenario when you want to save a file, it sets acceptMode() to QFileDialogOptions::AcceptSave, which is set to our flatpak file dialog, but not passed through to the native one loaded inside. Then method calls like selectFile() might crash, like in case of Gtk3 dialog, because its implementation asks for acceptMode, but it's not set yet and thus we end up with crash. Change-Id: I7a4239cb8b46ff6b08e2cfc1dd6abb9d9600aef8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Open native file dialog inside sandbox when opening directoriesJan Grulich2018-05-243-8/+56
| | | | | | | | | | | | | | | | | | Flatpak FileChooser portal doesn't support opening and exporting directories to the sandbox as it's not technically possible. Files are simply exported through document-portal, but directories are a different story. We have to, in case we want to open a directory, use native file dialog provided by platform theme we have loaded into flatpak platform theme. Applications which need to open directories to be able to work, like IDEs, music players, will have enabled access ho host's filesystem anyway so it's fine to open a file dialog inside sandbox. [ChangeLog][Linux] QFileDialog will use the native dialogs provided by the platform theme instead of trying to use Flatpak portal to select directories. Change-Id: I0716193bb9878aa621b8ca88506f87c72f690887 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix filter parsing in flatpak FileChooser portalJan Grulich2018-05-151-1/+1
| | | | | | | | | | | Filters are usually in format (Name (*.foo *.bar)), but valid filter is also (Name ( *.bar *.foo )), containing additional spaces. When we split content in the brackets divided by spaces, there will be then empty strings which we need to filter out, otherwise the result we send over DBus is not valid. Change-Id: Iaa265189408f47324bc9b269d534bf4c8d7d2cae Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Avoid multiple connections to same response in FileChooser portalJan Grulich2018-04-061-0/+3
| | | | | | | | | | | | When not specified, xdg-desktop-portal keeps using same Request object over and over when returning response, causing multiple connections to same slot on same DBus object. While this is not problem when using FileDialog just once, it is a problem for QML FileDialog which is usually reused. For this purpose x-d-p provides handle_token option where you can specify token to be used when creating Request objects. Change-Id: Ie6569700c48e05fcefa4d5c22c921410f87ea7ae Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFlatpakTheme: Cleanup the codeAlexander Akulich2018-03-141-73/+15
| | | | | | | | | | | There is no codepath that can result in d->baseTheme being nullptr. Remove the checks and get rid unneeded and sometimes dangerous fallbacks (createPlatformMenuBar(), showPlatformMenuBar() and three more methods could overflow the stack because of infinity recursion). Change-Id: Ib03adadf56c169286de42671e2da506502df7aea Reviewed-by: Jan Grulich <jgrulich@redhat.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix missing override warningAllan Sandfeld Jensen2018-02-141-1/+1
| | | | | | Change-Id: Ib0616b203f3cf2934b7a0fd18b95111423001bab Reviewed-by: Jan Grulich <jgrulich@redhat.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix opening of flatpak FileChooser portalJan Grulich2018-02-022-55/+61
| | | | | | | | | | | | | My assumption before was that show() method calls exec(), but it seems to be vice-versa and so QML applications using QFileDialog were not able to open dialogs as they use visible property, which in turn calls show() method. I made the show() method to call new openPortal() method where I moved the actuall DBus call from exec() method. The exec() method now internally calls show(), at least this is my assumption and it seems to behave like that from my testing. Change-Id: I27a5b0198e9ff1a9ea031f9ae45b57ceae99c6ae Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix support for flatpak FileChooser portalJan Grulich2018-01-081-2/+2
| | | | | | | | Properly parse filters. First captured substring in QRegularExpression is at index 1, with index 0 you access the full captured string. Change-Id: I68b6e314171536a08c606e5acd0f7211c1c3c254 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix support for flatpak FileChooser portalJan Grulich2017-12-191-1/+1
| | | | | | | | | FileChooser portal expects filter property in a(sa(us)) format but by default, using enum, we will end up with a(sa(is)), thus we have to specify format for the enum. Change-Id: I7de971197a0c77d6dca092edda7d428d90394574 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add support for FileChooser flatpak portalJan Grulich2017-12-167-0/+881
Adds support for FileChooser Flatpak portal. To support them we just do specific DBus calls, which are then caught and forwarded by xdg-desktop- portal daemon/service. This is needed for Qt applications running in sandbox. [ChangeLog][Platform Specific Changes][Linux] Added support for flatpak portals. Flatpak is a software utility for software deployment and package management. It provides a sandbox environment in which users can run applications in isolation from the rest of the system. To communicate with the system flatpak uses portals, which are designed to be a bridge between sandboxed applications and desktop/system running on user's computer. Flatpak runs this service (called xdg-desktop-portal) automatically. It exports the portals via DBus and they are visible by default to all applications running under Flatpak. Change-Id: I4de1402434ba7cbcc805eab51c30f84f8ba0c5c5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>