forked from SiriusDely/Cascades-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
filepicker.qdoc
67 lines (52 loc) · 2.81 KB
/
filepicker.qdoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/****************************************************************************
**
** Copyright (C) 2012 Research In Motion Limited.
** All rights reserved.
** Contact: Research In Motion Ltd. (http://www.rim.com/company/contact/)
**
** This file is part of the examples of the BB10 Platform.
**
** GNU Free Documentation License
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms
** and conditions contained in a signed written agreement between you
** and Research In Motion Limited.
**
****************************************************************************/
/*!
\page filepicker
\example filepicker
\title File Picker Example
\section1 Description
The File Picker example lets the user configure the properties of a file dialog and open it
to select a file for loading or saving.
\image filepicker-example.png
\section1 Overview
In this example we'll learn how to use the \c FilePicker class of the BB10
framework to select a file from the file system. The \c FilePicker can be configured to
either select a file for loading data or to save them. Additionally you can define the view mode,
the sort order and criterion of the files and a filter based on mime type or extensions.
\section1 The UI
The UI of this sample application consists of a couple of \c DropDown control to configure the
various properties of the \c FilePicker. A 'Show' button let the use open the dialog and a \c Label
at the bottom of the page shows the selected file path.
The \c DropDown controls are filled with \c Option objects that represent the possible values for
a property. The enums are directly set on their 'value' property, so that the 'selectedValue' property
of the \c DropDown can be used later on.
\snippet filepicker/assets/main.qml 0
Whenever the user clicks the 'Show' button, the open() method is invoked on the \c FilePicker object.
\snippet filepicker/assets/main.qml 1
The object itself is created as attached object on the main page. Its properties are bound against the
'selectedValue' properties of the various \c DropDown controls, so whenever the user changes an option,
the \c FilePicker is updated automatically.
\snippet filepicker/assets/main.qml 3
If the user has selected a file in the \c FilePicker, the onFileSelected() signal handler is invoked.
Inside this method we store the first of the selected files in the custom property 'selectedFile'.
\snippet filepicker/assets/main.qml 2
This property is used by the result label to update its 'text' property.
*/