Debian Codegraph @

src/imports/Components/Popups/1.3/ComposerSheet.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 \qmltype ComposerSheet
21 \inherits SheetBase
22 \inqmlmodule Lomiri.Components.Popups 1.0
23 \deprecated
24 \ingroup lomiri-popups
25 \brief Much like the \l DefaultSheet the Composer Sheet allows an application to insert a content
26 view over the focused view without disrupting the navigation pattern. However the Composer Sheet
27 is optimised for scenarios in which user content is at risk of corruption, most often (but not
28 solely) when creating or editing content (e.g compose new message).
29 There are two ways to dismiss it: user confirming the manipulation or user cancelling
30 the manipulation, using the "confirm" and "cancel" buttons shown in the right and left side
31 of the composer header.
32
33 Example:
34 \qml
35 import Lomiri.Components 1.3
36 import Lomiri.Components.Popups 1.3
37
38 Item {
39 Component {
40 id: composerSheet
41 ComposerSheet {
42 id: sheet
43 title: "Composer sheet"
44 Label {
45 text: "A composer sheet has cancel and confirm buttons."
46 }
47 onCancelClicked: PopupUtils.close(sheet)
48 onConfirmClicked: PopupUtils.close(sheet)
49 }
50 }
51
52 Button {
53 anchors.centerIn: parent
54 text: "composer"
55 width: units.gu(16)
56 onClicked: PopupUtils.open(composerSheet)
57 }
58 }
59 \endqml
60
61 \b{Sheets are deprecated. Consider using \l Dialog, \l Popover or \l PageStack instead.}
62 */
63
64 SheetBase {
65 id: composer
66
67 /*!
68 The user clicked the "cancel" button.
69 */
70 signal cancelClicked
71
72 /*!
73 The user clicked the "confirm" button.
74 */
75 signal confirmClicked
76
77 __leftButton: Button {
78 text: i18n.dtr("lomiri-ui-toolkit", "Cancel")
79 objectName: "cancelButton"
80 /*! \internal */ // avoid warning when generating documentation
81 onClicked: {
82 composer.cancelClicked();
83 composer.hide();
84 }
85 }
86
87 __rightButton: Button {
88 text: i18n.dtr("lomiri-ui-toolkit", "Confirm")
89 objectName: "confirmButton"
90 color: LomiriColors.orange
91 /*! \internal */ // avoid warning when generating documentation
92 onClicked: {
93 composer.confirmClicked();
94 composer.hide();
95 }
96 }
97 }