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