Debian Codegraph @

src/imports/Components/Popups/1.3/DefaultSheet.qml

raw
1 /*
2 * Copyright 2012 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 import QtQuick 2.4
18 import Lomiri.Components 1.3
19
20 /*!
21 \qmltype DefaultSheet
22 \deprecated
23 \inherits SheetBase
24 \inqmlmodule Lomiri.Components.Popups 1.0
25 \ingroup lomiri-popups
26 \brief The Default Sheet allows an application to insert a content view over the focused view
27 without disrupting the navigation pattern (tabs state or drill-down path are maintained. When
28 the sheet is dismissed the user continues the journey from the point (s)he left it).
29 The Default Sheet can be closed using either a "close" button (top left) or a "done" button
30 (top right). The sheet cannot be dismissed any other way.
31 Use the \l doneButton property to configure whether the "close" or the "done" button
32 is used.
33
34 Example:
35 \qml
36 import Lomiri.Components 1.3
37 import Lomiri.Components.Popups 1.3
38
39 Item {
40 Component {
41 id: defaultSheet
42 DefaultSheet {
43 id: sheet
44 title: "Default sheet with done button"
45 doneButton: true
46 Label {
47 anchors.fill: parent
48 text: "A default sheet with a done button."
49 wrapMode: Text.WordWrap
50 }
51 onDoneClicked: PopupUtils.close(sheet)
52 }
53 }
54 Button {
55 anchors.centerIn: parent
56 text: "default"
57 width: units.gu(16)
58 onClicked: PopupUtils.open(defaultSheet)
59 }
60 }
61 \endqml
62
63 \b{Sheets are deprecated. Consider using \l Dialog, \l Popover or \l PageStack instead.}
64 */
65 SheetBase {
66 id: sheet
67
68 /*!
69 If set, a "done" button is visible in the top right of the sheet's header, if unset
70 a "cancel" button is available in the top left of the sheet's header.
71 */
72 property bool doneButton: false
73
74 /*!
75 This handler is called when the close button is clicked.
76 */
77 signal closeClicked
78
79 /*!
80 This handler is called when the done button is clicked.
81 */
82 signal doneClicked
83
84 __leftButton: Button {
85 text: i18n.dtr("lomiri-ui-toolkit", "Close")
86 visible: !doneButton
87 /*! \internal */
88 onClicked: {
89 sheet.closeClicked();
90 sheet.hide();
91 }
92 }
93
94 __rightButton: Button {
95 text: i18n.dtr("lomiri-ui-toolkit", "Done")
96 color: LomiriColors.orange
97 visible: doneButton
98 /*! \internal */
99 onClicked: {
100 sheet.doneClicked();
101 sheet.hide();
102 }
103 }
104 }