1. 25 Jul, 2020 1 commit
  2. 23 Jul, 2020 1 commit
  3. 14 Jul, 2020 1 commit
    • Michael Weghorn's avatar
      FileChooser: Return selected filter · 8922d260
      Michael Weghorn authored
      This implements handling the 'current_filter' return
      value which returns the filter that was selected in the
      file chooser and was added to 'xdg-desktop-portal'
      and thus the FileChooser API in commit [1].
      
      Keep a mapping between the user-visible names
      (for name filters) or MIME types (for MIME type
      filters) to the actual filters in order to retrieve
      the actual filter to return after running the file dialog.
      
      Since multiple name filters can use the same filter string,
      those aren't necessarily unique, so use the user-visible
      names rather than just the filter string to avoid
      potential name clashes and be able to retrieve the correct
      filter again in the end.
      
      Mapping back to an actual filter does not necessarily
      work in all cases, e.g. if a manual filter string was
      entered in the file widget. No 'current_filter' is
      returned in that case.
      
      This commit moves the extraction of the filters to a
      separate method to avoid code duplication.
      
      Handling 'current_filter' is e.g. needed to make gtk's
      'gtk_file_chooser_get_filter' function work for the portal
      use case. The filter returned by 'gtk_file_chooser_get_filter'
      (not just the file extension) is used e.g. by Firefox and
      Thunderbird to determine what file format to save a file in,
      s. Mozilla bug [2] and gtk issue [3] for more details.
      
      This way, this commit makes that scenario work for the
      KF5 native file chooser as well (with 'GTK_USE_PORTAL=1'
      set and 'xdg-desktop-portal-kde' in use).
      
      Note: For the case of a gtk program, like the Firefox use case,
      this depends on the gtk commits [4] and and [5] in addition
      to xdg-desktop-portal commit [1] to actually work as expected.
      
      [1] https://github.com/flatpak/xdg-desktop-portal/commit/35fca7fae881bdaba1bebccf7775eba84407a488
      [2] https://bugzilla.mozilla.org/show_bug.cgi?id=1517074
      [3] https://gitlab.gnome.org/GNOME/gtk/-/issues/1820
      [4] https://gitlab.gnome.org/GNOME/gtk/-/commit/baddc90c26f65a0867aa6b4073e1a6b689d87136
      [5] https://gitlab.gnome.org/GNOME/gtk/-/commit/d59b28d5f4e2c4ff4cb51df0a39d94c7df7fee96
      8922d260
  4. 04 Jun, 2020 1 commit
    • Michael Weghorn's avatar
      FileChooser: Handle 'options' - 'choices' · 67344e9f
      Michael Weghorn authored
      This impelements handling for the 'choices' in the 'options'
      vardict of the FileChooser portal, which is described in the
      spec [1] as:
      
      > choices a(ssa(ss)s)
      >
      >     List of serialized combo boxes to add to the file chooser.
      >
      >     For each element, the first string is an ID that will be returned
      >     with the response, te second string is a user-visible label. The
      >     a(ss) is the list of choices, each being a is an ID and a
      >     user-visible label. The final string is the initial selection, or
      >     "", to let the portal decide which choice will be initially
      >     selected. None of the strings, except for the initial selection,
      >     should be empty.
      >
      >     As a special case, passing an empty array for the list of choices
      >     indicates a boolean choice that is typically displayed as a check
      >     button, using "true" and "false" as the choices.
      >
      >     Example: [('encoding', 'Encoding', [('utf8', 'Unicode (UTF-8)'),
      >             ('latin15', 'Western')], 'latin15'), ('reencode',
      >                 'Reencode', [], 'false')]
      
      The corresponding types are added for marshalling/unmarshalling to/from
      the QDBusArgument.
      
      Note that the implementation uses the term "Option" for a top-level
      element in the list passed by the 'choices' key while "Choice" refers
      to an element in the "list of choices" for a single element/option.
      
      For every option, a checkbox (for boolean options) or combobox is
      created and all of them are inserted into the layout of a widget that
      is then set as the custom widget of the a custom widget that is then
      added to the file dialog using 'KFileWidget::KFilesetCustomWidget'.
      
      [1] https://flatpak.github.io/xdg-desktop-portal/portal-docs.html#gdbus-org.freedesktop.portal.FileChooser
      67344e9f
  5. 02 Jun, 2020 1 commit
    • Michael Weghorn's avatar
      FileChooser portal: Handle 'current_filter' · 5b9b8f19
      Michael Weghorn authored
      From FileChooser portal documentation [1]:
      
      > current_filter (sa(us))
      >
      >     Request that this filter be set by default at dialog creation. If
      >     the filters list is nonempty, it should match a filter in the list
      >     to set the default filter from the list. Alternatively, it may be
      >     specified when the list is empty to apply the filter
      >     unconditionally.
      
      The implemented approach adds the filter specified by current_filter
      regardless of whether the passed filters list is empty or not.
      
      Since KFileWidget always seems to select the first filter in the
      list it was passed and there seems to be no way to explicitly select
      a different one, this makes sure the the filter specified by
      'current_filter' is the first one in the corresponding list.
      
      [1] https://flatpak.github.io/xdg-desktop-portal/portal-docs.html#gdbus-org.freedesktop.impl.portal.FileChooser
      5b9b8f19
  6. 28 Apr, 2020 1 commit
  7. 26 Mar, 2020 1 commit
  8. 26 Feb, 2020 1 commit
  9. 01 Mar, 2019 1 commit
  10. 24 Feb, 2019 1 commit
  11. 23 Feb, 2019 1 commit
  12. 09 Jan, 2019 1 commit
  13. 25 Dec, 2018 1 commit
  14. 23 Dec, 2018 1 commit
  15. 13 Dec, 2018 1 commit
  16. 27 Nov, 2018 1 commit
  17. 19 Sep, 2018 1 commit
  18. 29 Jun, 2018 1 commit
  19. 05 Apr, 2018 1 commit
    • Jan Grulich's avatar
      Add screen cast portal · 76811d65
      Jan Grulich authored
      Summary:
      Add support for screen casting, using pipewire for creating streams. Screen data
      is supplied by KWin which sends us GBM fd using Remote Access interface from KWayland.
      
      Note that this is meant for sandboxed and also not sandboxed applications as plan for Pipewire is that
      if application talks directly to Pipewire, not calling xdg-desktop-portal (the middle man), then Pipewire
      will still call backend implementation internally, in our case xdg-desktop-portal-kde to get screen cast stream.
      
      Depends on D1231 and D1230
      
      Reviewers: graesslin, Kanedias, romangg, davidedmundson
      
      Reviewed By: Kanedias
      
      Subscribers: #plasma
      
      Maniphest Tasks: T7785
      
      Differential Revision: https://phabricator.kde.org/D10965
      76811d65
  20. 12 Jun, 2017 1 commit
    • David Edmundson's avatar
      Massively simplify the class DesktopPortal · 45843db8
      David Edmundson authored
      Summary:
      Only one QObject can be registered on a DBus path...but that object can
      have
      multiple adaptors, which is how it's structured anyway.
      
      It's considerably easier than doing everything manually through a
      QDBusVirtualObject
      
      Test Plan:
      Checked all ifaces registered in qdbusviewer
      Manually ran AddNotification, debug appeared in xdg-desktop-portal and a
      notification appeared
      
      Reviewers: #plasma, jgrulich
      
      Reviewed By: jgrulich
      
      Subscribers: apol, plasma-devel
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D6145
      45843db8
  21. 12 May, 2017 1 commit
  22. 27 Apr, 2017 1 commit
  23. 15 Dec, 2016 1 commit
  24. 18 Nov, 2016 2 commits
  25. 14 Jul, 2016 1 commit
  26. 13 Jul, 2016 2 commits