Lomiri
Loading...
Searching...
No Matches
ModeSwitchWarningDialog.qml
1/*
2 * Copyright (C) 2015-2017 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU 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 General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.12
18import QtQuick.Layouts 1.1
19import Lomiri.Components 1.3
20import Lomiri.Components.ListItems 1.3
21import Lomiri.Components.Popups 1.3
22
23ShellDialog {
24 id: root
25 objectName: "modeSwitchWarningDialog"
26
27 property alias model: appRepeater.model
28
29 signal forceClose();
30
31 Label {
32 width: parent.width
33 text: i18n.tr("Apps may have unsaved data:")
34 fontSize: "large"
35 color: "#5D5D5D"
36 }
37
38 Repeater {
39 id: appRepeater
40 RowLayout {
41 width: parent.width
42 spacing: units.gu(2)
43 Image {
44 Layout.preferredHeight: units.gu(2)
45 Layout.preferredWidth: units.gu(2)
46 source: model.icon
47 sourceSize.width: width
48 sourceSize.height: height
49 }
50 Label {
51 Layout.fillWidth: true
52 text: model.name
53 color: "#888888"
54 }
55 }
56 }
57
58 Label {
59 width: parent.width
60 text: i18n.ctr("Re-dock means connect the device again to an external screen/mouse/keyboard", "Re-dock, save your work and close these apps to continue.")
61 wrapMode: Text.WordWrap
62 color: "#888888"
63 }
64
65 Label {
66 width: parent.width
67 text: i18n.tr("Or force close now (unsaved data will be lost).")
68 wrapMode: Text.WordWrap
69 color: "#888888"
70 }
71
72 ThinDivider { width: parent.width }
73
74 RowLayout {
75 width: parent.width
76 Label {
77 objectName: "reconnectLabel"
78 Layout.fillWidth: true
79 property bool clicked: false
80 property string notClickedText: i18n.tr("OK, I will reconnect")
81 property string clickedText: i18n.tr("Reconnect now!")
82 text: clicked ? clickedText : notClickedText
83 color: "#292929"
84
85 MouseArea {
86 anchors.fill: parent
87 onClicked: parent.clicked = true;
88 }
89 }
90
91 Button {
92 focus: true
93 objectName: "forceCloseButton"
94 text: i18n.tr("Close all")
95 color: theme.palette.normal.negative
96 onClicked: {
97 root.forceClose();
98 }
99 }
100 }
101}