Unity 8
ModeSwitchWarningDialog.qml
1 /*
2  * Copyright (C) 2015 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 
17 import QtQuick 2.4
18 import QtQuick.Layouts 1.1
19 import Ubuntu.Components 1.3
20 import Ubuntu.Components.ListItems 1.3
21 import Ubuntu.Components.Popups 1.3
22 
23 ShellDialog {
24  id: root
25  objectName: "modeSwitchWarningDialog"
26 
27  property alias model: appRepeater.model
28 
29  signal forceClose();
30 
31  Label {
32  text: i18n.tr("Apps may have unsaved data:")
33  fontSize: "large"
34  color: "#5D5D5D"
35  }
36 
37  Repeater {
38  id: appRepeater
39  RowLayout {
40  spacing: units.gu(2)
41  Image {
42  Layout.preferredHeight: units.gu(2)
43  Layout.preferredWidth: units.gu(2)
44  source: model.icon
45  sourceSize.width: width
46  sourceSize.height: height
47  }
48  Label {
49  Layout.fillWidth: true
50  text: model.name
51  color: "#888888"
52  }
53  }
54  }
55 
56  Label {
57  text: i18n.tr("Re-dock, save your work and close these apps to continue.")
58  wrapMode: Text.WordWrap
59  color: "#888888"
60  }
61 
62  Label {
63  text: i18n.tr("Or force close now (unsaved data will be lost).")
64  wrapMode: Text.WordWrap
65  color: "#888888"
66  }
67 
68  ThinDivider {}
69 
70  RowLayout {
71  Label {
72  objectName: "reconnectLabel"
73  Layout.fillWidth: true
74  property bool clicked: false
75  property string notClickedText: i18n.tr("OK, I will reconnect")
76  property string clickedText: i18n.tr("Reconnect now!")
77  text: clicked ? clickedText : notClickedText
78  color: "#292929"
79 
80  MouseArea {
81  anchors.fill: parent
82  onClicked: parent.clicked = true;
83  }
84  }
85 
86  Button {
87  objectName: "forceCloseButton"
88  text: i18n.tr("Close all")
89  color: UbuntuColors.red
90  onClicked: {
91  root.forceClose();
92  }
93  }
94  }
95 }