on xenial help sign in
Add button colors and i18n for power off dialog. Fixes: 1354506
d3ba6f8Ying-Chun Liu
qml/Components/Dialogs.qml+21−25
@@ -18,15 +18,18 @@ import QtQuick 2.0
18
18
19import Unity.Application 0.1
19import Unity.Application 0.1
20import Unity.Session 0.1
20import Unity.Session 0.1
21−import Ubuntu.Components 0.1
21+import Ubuntu.Components 1.1
22import Ubuntu.Components.Popups 0.1
22import Ubuntu.Components.Popups 0.1
23
23
24Item {
24Item {
25 id: root
25 id: root
26
26
27 function onPowerKeyPressed() {
27 function onPowerKeyPressed() {
28+ // FIXME: event.isAutoRepeat is always false on Nexus 4.
29+ // So we use powerKeyTimer.running to avoid the PowerOff key repeat
30+ // https://launchpad.net/bugs/1349416
28 if (!powerKeyTimer.running) {
31 if (!powerKeyTimer.running) {
29− powerKeyTimer.start();
32+ powerKeyTimer.restart();
30 }
33 }
31 }
34 }
32
35
@@ -64,17 +67,17 @@ Item {
64 id: logoutDialog
67 id: logoutDialog
65 Dialog {
68 Dialog {
66 id: dialogueLogout
69 id: dialogueLogout
67− title: "Logout"
70+ title: i18n.tr("Log out")
68− text: "Are you sure that you want to logout?"
71+ text: i18n.tr("Are you sure you want to log out?")
69 Button {
72 Button {
70− text: "Cancel"
73+ text: i18n.tr("No")
71 onClicked: {
74 onClicked: {
72 PopupUtils.close(dialogueLogout);
75 PopupUtils.close(dialogueLogout);
73 d.dialogShown = false;
76 d.dialogShown = false;
74 }
77 }
75 }
78 }
76 Button {
79 Button {
77− text: "Yes"
80+ text: i18n.tr("Yes")
78 onClicked: {
81 onClicked: {
79 DBusUnitySessionService.Logout();
82 DBusUnitySessionService.Logout();
80 PopupUtils.close(dialogueLogout);
83 PopupUtils.close(dialogueLogout);
@@ -88,17 +91,17 @@ Item {
88 id: shutdownDialog
91 id: shutdownDialog
89 Dialog {
92 Dialog {
90 id: dialogueShutdown
93 id: dialogueShutdown
91− title: "Shutdown"
94+ title: i18n.tr("Shut down")
92− text: "Are you sure that you want to shutdown?"
95+ text: i18n.tr("Are you sure you want to shut down?")
93 Button {
96 Button {
94− text: "Cancel"
97+ text: i18n.tr("No")
95 onClicked: {
98 onClicked: {
96 PopupUtils.close(dialogueShutdown);
99 PopupUtils.close(dialogueShutdown);
97 d.dialogShown = false;
100 d.dialogShown = false;
98 }
101 }
99 }
102 }
100 Button {
103 Button {
101− text: "Yes"
104+ text: i18n.tr("Yes")
102 onClicked: {
105 onClicked: {
103 dBusUnitySessionServiceConnection.closeAllApps();
106 dBusUnitySessionServiceConnection.closeAllApps();
104 DBusUnitySessionService.Shutdown();
107 DBusUnitySessionService.Shutdown();
@@ -113,17 +116,17 @@ Item {
113 id: rebootDialog
116 id: rebootDialog
114 Dialog {
117 Dialog {
115 id: dialogueReboot
118 id: dialogueReboot
116− title: "Reboot"
119+ title: i18n.tr("Reboot")
117− text: "Are you sure that you want to reboot?"
120+ text: i18n.tr("Are you sure you want to reboot?")
118 Button {
121 Button {
119− text: "Cancel"
122+ text: i18n.tr("No")
120 onClicked: {
123 onClicked: {
121 PopupUtils.close(dialogueReboot)
124 PopupUtils.close(dialogueReboot)
122 d.dialogShown = false;
125 d.dialogShown = false;
123 }
126 }
124 }
127 }
125 Button {
128 Button {
126− text: "Yes"
129+ text: i18n.tr("Yes")
127 onClicked: {
130 onClicked: {
128 dBusUnitySessionServiceConnection.closeAllApps();
131 dBusUnitySessionServiceConnection.closeAllApps();
129 DBusUnitySessionService.Reboot();
132 DBusUnitySessionService.Reboot();
@@ -138,8 +141,8 @@ Item {
138 id: powerDialog
141 id: powerDialog
139 Dialog {
142 Dialog {
140 id: dialoguePower
143 id: dialoguePower
141− title: "Power"
144+ title: i18n.tr("Power")
142− text: i18n.tr("Are you sure you would like to turn power off?")
145+ text: i18n.tr("Are you sure you would like\nto power off?")
143 Button {
146 Button {
144 text: i18n.tr("Power off")
147 text: i18n.tr("Power off")
145 onClicked: {
148 onClicked: {
@@ -148,15 +151,7 @@ Item {
148 d.dialogShown = false;
151 d.dialogShown = false;
149 root.powerOffClicked();
152 root.powerOffClicked();
150 }
153 }
151− }
154+ color: UbuntuColors.red
152− Button {
153− text: i18n.tr("Restart")
154− onClicked: {
155− dBusUnitySessionServiceConnection.closeAllApps();
156− DBusUnitySessionService.Reboot();
157− PopupUtils.close(dialoguePower);
158− d.dialogShown = false;
159− }
160 }
155 }
161 Button {
156 Button {
162 text: i18n.tr("Cancel")
157 text: i18n.tr("Cancel")
@@ -164,6 +159,7 @@ Item {
164 PopupUtils.close(dialoguePower);
159 PopupUtils.close(dialoguePower);
165 d.dialogShown = false;
160 d.dialogShown = false;
166 }
161 }
162+ color: UbuntuColors.coolGrey
167 }
163 }
168 }
164 }
169 }
165 }