on xenial help sign in
Session indicator convergence Fixes: #1538591

Approved by: Michael Terry

commite72267458e9c3b570a0e416619db5546e2334c60 authorMichael Terry <michael.terry@canonical.com> dateWed 23 Mar 2016, 09:53 (11 years ago) parentfd5249af30d6f0
8 files changed+48−59
debian/changelog+6 debian/control+2−1 plugins/Unity/Indicators/indicatorsmanager.cpp+3−5 plugins/Unity/Session/dbusunitysessionservice.cpp+4−1 qml/Components/Dialogs.qml+6−47 qml/Greeter/Greeter.qml+6 qml/Panel/IndicatorItemRow.qml+5−2 qml/Panel/Indicators/MenuItemFactory.qml+16−3
debian/changelog+6
@@ -1,3 +1,9 @@
1+unity8 (8.12+16.04.20160310.4-0ubuntu1) UNRELEASED; urgency=medium
2+
3+ *
4+
5+ -- Michael Terry <mterry@ubuntu.com> Mon, 14 Mar 2016 11:27:53 -0400
6+
17unity8 (8.11+16.04.20160318.1-0ubuntu1) xenial; urgency=medium
28
39 [ CI Train Bot ]
debian/control+2−1
@@ -112,7 +112,8 @@ Depends: dmz-cursor-theme,
112112 unity8-private | unity-launcher-impl,
113113 ${misc:Depends},
114114 ${shlibs:Depends},
115−Recommends: unity-scope-click,
115+Recommends: indicator-session,
116+ unity-scope-click,
116117 unity-scope-mediascanner2,
117118Breaks: indicator-network (<< 0.5.1+14.10.20141014),
118119 ubuntu-touch-session (<< 0.107),
plugins/Unity/Indicators/indicatorsmanager.cpp+3−5
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright (C) 2013-2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -12,8 +12,6 @@
1212 *
1313 * You should have received a copy of the GNU General Public License
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Author: Nick Dedekind <nick.dedekind@canonical.com>
1715 */
1816
1917#include "indicatorsmanager.h"
@@ -286,12 +284,12 @@ Indicator::Ptr IndicatorsManager::indicator(const QString& indicator_name)
286284 new_indicator->init(data->m_fileInfo.fileName(), settings);
287285
288286 // convergence:
289− // 1) enable session indicator conditionally, typically when running in a multisession/multiuser environment
287+ // 1) enable session indicator
290288 // 2) on a PC, switch the battery/power indicator to desktop mode,
291289 // can't control brightness for now and phone-on-desktop broken (FIXME)
292290 //
293291 // The rest of the indicators respect their default profile (which is "phone", even on desktop PCs)
294− if ((new_indicator->identifier() == QStringLiteral("indicator-session") && m_platform.isMultiSession())
292+ if ((new_indicator->identifier() == QStringLiteral("indicator-session"))
295293 || (new_indicator->identifier() == QStringLiteral("indicator-power") && m_platform.isPC())) {
296294 new_indicator->setProfile(QStringLiteral("desktop"));
297295 } else {
plugins/Unity/Session/dbusunitysessionservice.cpp+4−1
@@ -336,6 +336,9 @@ void DBusUnitySessionService::PromptLock()
336336
337337void DBusUnitySessionService::Lock()
338338{
339+ // signal u8 to show the lockscreen/greeter
340+ PromptLock();
341+
339342 // lock the session using the org.freedesktop.DisplayManager system DBUS service
340343 const QString sessionPath = QString::fromLocal8Bit(qgetenv("XDG_SESSION_PATH"));
341344 QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.DisplayManager"),
@@ -348,7 +351,7 @@ void DBusUnitySessionService::Lock()
348351 connect(watcher, &QDBusPendingCallWatcher::finished,
349352 this, [this](QDBusPendingCallWatcher* watcher) {
350353
351− QDBusPendingReply<QVariant> reply = *watcher;
354+ QDBusPendingReply<void> reply = *watcher;
352355 watcher->deleteLater();
353356 if (reply.isError()) {
354357 qWarning() << "Lock call failed" << reply.error().message();
qml/Components/Dialogs.qml+6−47
@@ -166,40 +166,6 @@ Item {
166166 }
167167 }
168168
169− Component {
170− id: shutdownDialogComponent
171− ShellDialog {
172− id: shutdownDialog
173− title: i18n.ctr("Title: Reboot/Shut down dialog", "Shut down")
174− text: i18n.tr("Are you sure you want to shut down?")
175− Button {
176− text: i18n.ctr("Button: Reboot the system", "Reboot")
177− onClicked: {
178− root.closeAllApps();
179− unitySessionService.reboot();
180− shutdownDialog.hide();
181− }
182− color: UbuntuColors.lightGrey
183− }
184− Button {
185− text: i18n.ctr("Button: Shut down the system", "Shut down")
186− onClicked: {
187− root.closeAllApps();
188− unitySessionService.shutdown();
189− shutdownDialog.hide();
190− }
191− color: UbuntuColors.red
192− }
193− Button {
194− text: i18n.tr("Cancel")
195− onClicked: {
196− shutdownDialog.hide();
197− }
198− color: UbuntuColors.lightGrey
199− }
200− }
201− }
202−
203169 Component {
204170 id: rebootDialogComponent
205171 ShellDialog {
@@ -273,23 +239,16 @@ Item {
273239
274240 onShutdownRequested: {
275241 // Display a dialog to ask the user to confirm.
276− if (!dialogLoader.active) {
277− dialogLoader.sourceComponent = shutdownDialogComponent;
278− dialogLoader.focus = true;
279− dialogLoader.active = true;
280− }
242+ showPowerDialog();
281243 }
282244
283245 onRebootRequested: {
284246 // Display a dialog to ask the user to confirm.
285− if (!dialogLoader.active) {
286− // display a combined reboot/shutdown dialog, sadly the session indicator calls rather the "Reboot()" method
287− // than shutdown when clicking on the "Shutdown..." menu item
288− // FIXME: when/if session indicator is fixed, put the rebootDialogComponent here
289− dialogLoader.sourceComponent = shutdownDialogComponent;
290− dialogLoader.focus = true;
291− dialogLoader.active = true;
292− }
247+
248+ // display a combined reboot/shutdown dialog, sadly the session indicator calls rather the "Reboot()" method
249+ // than shutdown when clicking on the "Shutdown..." menu item
250+ // FIXME: when/if session indicator is fixed, put the rebootDialogComponent here
251+ showPowerDialog();
293252 }
294253
295254 onLogoutReady: {
qml/Greeter/Greeter.qml+6
@@ -20,6 +20,7 @@ import GSettings 1.0
2020import Ubuntu.Components 1.3
2121import Ubuntu.SystemImage 0.1
2222import Unity.Launcher 0.1
23+import Unity.Session 0.1
2324import "../Components"
2425
2526Showable {
@@ -447,6 +448,11 @@ Showable {
447448 }
448449 }
449450
451+ Connections {
452+ target: DBusUnitySessionService
453+ onLockRequested: root.forceShow()
454+ }
455+
450456 Binding {
451457 target: lightDM.greeter
452458 property: "active"
qml/Panel/IndicatorItemRow.qml+5−2
@@ -15,6 +15,7 @@
1515 */
1616
1717import QtQuick 2.4
18+import QtQuick.Window 2.2
1819import Ubuntu.Components 1.3
1920
2021Item {
@@ -183,7 +184,9 @@ Item {
183184
184185 property int ownIndex: index
185186 property bool overflow: row.width - x > overFlowWidth
186− property bool hidden: !expanded && (overflow || !indicatorVisible)
187+ property bool hidden: !expanded && (overflow || !indicatorVisible || hideSessionIndicator)
188+ // HACK for indicator-session
189+ readonly property bool hideSessionIndicator: identifier == "indicator-session" && Math.min(Screen.width, Screen.height) <= units.gu(60)
187190
188191 height: row.height
189192 expanded: root.expanded
@@ -199,7 +202,7 @@ Item {
199202 NumberAnimation { duration: UbuntuAnimation.SnapDuration; easing: UbuntuAnimation.StandardEasing }
200203 }
201204
202− width: (expanded || indicatorVisible) ? implicitWidth : 0
205+ width: ((expanded || indicatorVisible) && !hideSessionIndicator) ? implicitWidth : 0
203206
204207 Behavior on width {
205208 NumberAnimation { duration: UbuntuAnimation.SnapDuration; easing: UbuntuAnimation.StandardEasing }
qml/Panel/Indicators/MenuItemFactory.qml+16−3
@@ -15,6 +15,7 @@
1515 */
1616
1717import QtQuick 2.4
18+import QtQuick.Window 2.2
1819import Ubuntu.Settings.Menus 0.1 as Menus
1920import Ubuntu.Settings.Components 0.1
2021import QMenuModel 0.1
@@ -22,6 +23,7 @@ import Utils 0.1 as Utils
2223import Ubuntu.Components.ListItems 1.3 as ListItems
2324import Ubuntu.Components 1.3
2425import Unity.Session 0.1
26+import Unity.Platform 1.0
2527
2628Item {
2729 id: menuFactory
@@ -61,9 +63,11 @@ Item {
6163
6264 "com.canonical.indicator.calendar": calendarMenu,
6365 "com.canonical.indicator.location": timezoneMenu,
64−
65− "indicator.user-menu-item": userMenuItem,
66− "indicator.guest-menu-item": userMenuItem
66+ },
67+ "indicator-session": {
68+ "indicator.user-menu-item": Platform.isPC ? userMenuItem : null,
69+ "indicator.guest-menu-item": Platform.isPC ? userMenuItem : null,
70+ "com.canonical.indicator.switch": Math.min(Screen.width, Screen.height) > units.gu(60) ? switchMenu : null // Desktop mode switch
6771 },
6872 "indicator-messages" : {
6973 "com.canonical.indicator.button" : messagesButtonMenu
@@ -981,6 +985,15 @@ Item {
981985 }
982986
983987 function load(modelData, context) {
988+ // tweak indicator-session items
989+ if (context === "indicator-session") {
990+ if ((modelData.action === "indicator.logout" || modelData.action === "indicator.suspend" || modelData.action === "indicator.hibernate" ||
991+ modelData.action === "indicator.reboot")
992+ && !Platform.isPC) {
993+ return null; // logout, suspend and hibernate hidden on devices
994+ }
995+ }
996+
984997 if (modelData.type !== undefined && modelData.type !== "") {
985998 var component = undefined;
986999