Debian Codegraph @

data/org.freedesktop.portal.FileChooser.xml

raw
1 <?xml version="1.0"?>
2 <!--
3 Copyright (C) 2015 Red Hat, Inc.
4
5 SPDX-License-Identifier: LGPL-2.1-or-later
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library. If not, see <http://www.gnu.org/licenses/>.
19
20 Author: Alexander Larsson <[email protected]>
21 -->
22
23 <node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
24 <!--
25 org.freedesktop.portal.FileChooser:
26 @short_description: File chooser portal
27
28 The FileChooser portal allows sandboxed applications to ask
29 the user for access to files outside the sandbox. The portal
30 backend will present the user with a file chooser dialog.
31
32 The selected files will be made accessible to the application
33 (which may involve adding it to the :ref:`Documents
34 portal<org.freedesktop.portal.Documents>`).
35
36 Files added to the :ref:`Documents
37 portal<org.freedesktop.portal.Documents>` by this portal stay
38 accessible across sessions.
39
40 This documentation describes version 4 of this interface.
41 -->
42 <interface name="org.freedesktop.portal.FileChooser">
43 <!--
44 OpenFile:
45 @parent_window: Identifier for the application window, see :doc:`window-identifiers`
46 @title: Title for the file chooser dialog
47 @options: Vardict with optional further information
48 @handle: Object path for the :ref:`org.freedesktop.portal.Request` object representing this call
49
50 Asks to open one or more files.
51
52 Supported keys in the @options vardict include:
53
54 * ``handle_token`` (``s``)
55
56 A string that will be used as the last element of the @handle. Must be a valid
57 object path element. See the :ref:`org.freedesktop.portal.Request` documentation for
58 more information about the @handle.
59
60 * ``accept_label`` (``s``)
61
62 Label for the accept button. Mnemonic underlines are allowed.
63
64 * ``modal`` (``b``)
65
66 Whether the dialog should be modal. Default is true.
67
68 * ``multiple`` (``b``)
69
70 Whether multiple files can be selected or not. Default is single-selection.
71
72 * ``directory`` (``b``)
73
74 Whether to select for folders instead of files. Default is to select files.
75
76 This option was added in version 3.
77
78 * ``filters`` (``a(sa(us))``)
79
80 List of serialized file filters.
81
82 Each item in the array specifies a single filter to offer to the user.
83
84 The first string is a user-visible name for the filter. The ``a(us)``
85 specifies a list of filter strings, which can be either a glob-style
86 pattern (indicated by 0) or a MIME type (indicated by 1) which allows
87 wildcards for the subtype. Patterns are case-sensitive.
88
89 To match different capitalizations of, e.g. ``'*.ico'``, use a pattern
90 like: ``'*.[iI][cC][oO]'``.
91
92 Example: ``[('Images', [(0, '*.ico'), (1, 'image/png')]), ('Text', [(0, '*.txt')]), (1, 'audio/*')])]``
93
94 Note that filters are purely there to aid the user in making a useful
95 selection. The portal may still allow the user to select files that
96 don't match any filter criteria, and applications must be prepared to
97 handle that.
98
99 * ``current_filter`` (``(sa(us))``)
100
101 Request that this filter be set by default at dialog creation. If
102 the filters list is nonempty, it should match a filter in the
103 list to set the default filter from the list. Alternatively, it
104 may be specified when the list is empty to apply the filter
105 unconditionally.
106
107 * ``choices`` (``a(ssa(ss)s)``)
108
109 List of serialized combo boxes to add to the file chooser.
110
111 For each element, the first string is an ID that will be returned
112 with the response, the second string is a user-visible label. The
113 ``a(ss)`` is the list of choices, each being an ID and a
114 user-visible label. The final string is the initial selection,
115 or "", to let the portal decide which choice will be initially selected.
116 None of the strings, except for the initial selection, should be empty.
117
118 As a special case, passing an empty array for the list of choices
119 indicates a boolean choice that is typically displayed as a check
120 button, using "true" and "false" as the choices.
121
122 Example: ``[('encoding', 'Encoding', [('utf8', 'Unicode (UTF-8)'), ('latin15', 'Western')], 'latin15'), ('reencode', 'Reencode', [], 'false')]``
123
124 * ``current_folder`` (``ay``)
125
126 Suggested folder from which the files should be opened.
127
128 The byte array contains a path in the same encoding as the file
129 system, and it's expected to be terminated by a nul byte.
130
131 If the path points to a location in the document storage, it will be
132 replaced with the path to the location on the host.
133
134 The portal implementation is free to ignore this option.
135
136
137 The following results get returned via the :ref:`org.freedesktop.portal.Request::Response` signal:
138
139 * ``uris`` (``as``)
140
141 An array of strings containing the uris of the selected files. All URIs
142 have the ``file://`` scheme.
143
144 * ``choices`` (``a(ss)``)
145
146 An array of pairs of strings, the first string being the ID of a
147 combobox that was passed into this call, the second string being
148 the selected option.
149
150 Example: ``[('encoding', 'utf8'), ('reencode', 'true')]``
151
152 * ``current_filter`` (``(sa(us))``)
153
154 The filter that was selected. This may match a filter in the
155 filter list or another filter that was applied unconditionally.
156 -->
157 <method name="OpenFile">
158 <arg type="s" name="parent_window" direction="in"/>
159 <arg type="s" name="title" direction="in"/>
160 <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QVariantMap"/>
161 <arg type="a{sv}" name="options" direction="in"/>
162 <arg type="o" name="handle" direction="out"/>
163 </method>
164 <!--
165 SaveFile:
166 @parent_window: Identifier for the application window, see :doc:`window-identifiers`
167 @title: Title for the file chooser dialog
168 @options: Vardict with optional further information
169 @handle: Object path for the :ref:`org.freedesktop.portal.Request` object representing this call
170
171 Asks for a location to save a file.
172
173 Supported keys in the @options vardict include:
174
175 * ``handle_token`` (``s``)
176
177 A string that will be used as the last element of the @handle. Must be a valid
178 object path element. See the :ref:`org.freedesktop.portal.Request` documentation for
179 more information about the @handle.
180
181 * ``accept_label`` (``s``)
182
183 Label for the accept button. Mnemonic underlines are allowed.
184
185 * ``modal`` (``b``)
186
187 Whether the dialog should be modal. Default is yes.
188
189 * ``filters`` (``a(sa(us))``)
190
191 List of serialized file filters.
192
193 See org.freedesktop.portal.FileChooser.OpenFile() for details.
194
195 * ``current_filter`` (``(sa(us))``)
196
197 Request that this filter be set by default at dialog creation.
198
199 See org.freedesktop.portal.FileChooser.OpenFile() for details.
200
201 * ``choices`` (``a(ssa(ss)s)``)
202
203 List of serialized combo boxes.
204
205 See org.freedesktop.portal.FileChooser.OpenFile() for details.
206
207 * ``current_name`` (``s``)
208
209 Suggested name of the file.
210
211 * ``current_folder`` (``ay``)
212
213 Suggested folder in which the file should be saved. The byte array
214 contains a path in the same encoding as the file system, and it's
215 expected to be terminated by a nul byte.
216
217 If the path points to a location in the document storage, it will be
218 replaced with the path to the location on the host.
219
220 The portal implementation is free to ignore this option.
221
222 * ``current_file`` (``ay``)
223
224 The current file (when saving an existing file), in the same encoding as the file
225 system. The byte array is expected to be terminated by a nul byte.
226
227
228 The following results get returned via the :ref:`org.freedesktop.portal.Request::Response` signal:
229
230 * ``uris`` (``as``)
231
232 An array of strings containing the uri of the selected file. It has
233 exactly one element. All URIs have the ``file://`` scheme.
234
235 * ``choices`` (``a(ss)``)
236
237 An array of pairs of strings, corresponding to the passed-in choices.
238
239 See org.freedesktop.portal.FileChooser.OpenFile() for details.
240
241 * ``current_filter`` (``(sa(us))``)
242
243 The filter that was selected.
244
245 See org.freedesktop.portal.FileChooser.OpenFile() for details.
246 -->
247 <method name="SaveFile">
248 <arg type="s" name="parent_window" direction="in"/>
249 <arg type="s" name="title" direction="in"/>
250 <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QVariantMap"/>
251 <arg type="a{sv}" name="options" direction="in"/>
252 <arg type="o" name="handle" direction="out"/>
253 </method>
254 <!--
255 SaveFiles:
256 @parent_window: Identifier for the application window, see :doc:`window-identifiers`
257 @title: Title for the file chooser dialog
258 @options: Vardict with optional further information
259 @handle: Object path for the :ref:`org.freedesktop.portal.Request` object representing this call
260
261 Asks for a folder as a location to save one or more files. The
262 names of the files will be used as-is and appended to the
263 selected folder's path in the list of returned files. If the
264 selected folder already contains a file with one of the given
265 names, the portal may prompt or take some other action to
266 construct a unique file name and return that instead.
267
268 Supported keys in the @options vardict include:
269
270 * ``handle_token`` (``s``)
271
272 A string that will be used as the last element of the
273 @handle. Must be a valid object path element. See the
274 :ref:`org.freedesktop.portal.Request` documentation for more
275 information about the @handle.
276
277 * ``accept_label`` (``s``)
278
279 Label for the accept button. Mnemonic underlines are allowed.
280
281 * ``modal`` (``b``)
282
283 Whether the dialog should be modal. Default is yes.
284
285 * ``choices`` (``a(ssa(ss)s)``)
286
287 List of serialized combo boxes.
288
289 See org.freedesktop.portal.FileChooser.OpenFile() for details.
290
291 * ``current_folder`` (``ay``)
292
293 Suggested folder in which the files should be saved. The byte array
294 contains a path in the same encoding as the file system, and it's
295 expected to be terminated by a nul byte.
296
297 If the path points to a location in the document storage, it will be
298 replaced with the path to the location on the host.
299
300 The portal implementation is free to ignore this option.
301
302 * ``files`` (``aay``)
303
304 An array of file names, using the same encoding as the file system,
305 to be saved. Each byte array is expected to be terminated by a nul
306
307
308 The following results get returned via the
309 :ref:`org.freedesktop.portal.Request::Response` signal:
310
311 * ``uris`` (``as``)
312
313 An array of strings containing the uri corresponding to
314 each file given by @options, in the same order. Note that
315 the file names may have changed, for example if a file
316 with the same name in the selected folder already exists.
317
318 All URIs have the ``file://`` scheme.
319
320 * ``choices`` (``a(ss)``)
321
322 An array of pairs of strings, corresponding to the passed-in choices.
323
324 See org.freedesktop.portal.FileChooser.OpenFile() for details.
325 -->
326 <method name="SaveFiles">
327 <arg type="s" name="parent_window" direction="in"/>
328 <arg type="s" name="title" direction="in"/>
329 <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QVariantMap"/>
330 <arg type="a{sv}" name="options" direction="in"/>
331 <arg type="o" name="handle" direction="out"/>
332 </method>
333 <property name="version" type="u" access="read"/>
334 </interface>
335 </node>