Merge lp:~paulliu/unity8/reboot into lp:unity8

Proposed by Ying-Chun Liu
Status: Merged
Approved by: Michael Zanetti
Approved revision: 858
Merged at revision: 1050
Proposed branch: lp:~paulliu/unity8/reboot
Merge into: lp:unity8
Diff against target: 364 lines (+283/-6)
3 files modified
plugins/Unity/Session/dbusunitysessionservice.cpp (+33/-0)
plugins/Unity/Session/dbusunitysessionservice.h (+61/-4)
qml/Shell.qml (+189/-2)
To merge this branch: bzr merge lp:~paulliu/unity8/reboot
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Michael Zanetti (community) Approve
Michał Sawicz Pending
Review via email: mp+221159@code.launchpad.net

Commit message

Add reboot/shutdown

Description of the change

* Are there any related MPs required for this MP to build/function as expected?
No.

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes.

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
No. We need to discuss this in Malta

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~paulliu/unity8/reboot updated
851. By Ying-Chun Liu

merged trunk
* debian/control:
  list qtdeclarative5-ubuntu-ui-toolkit-plugin-gles as an alternative
  choice, since provides are not versionned, should restore installability
  on amd64 and i386
[ Michał Sawicz ]
* Adapt to suru theme.
[ Michael Terry ]
* Fix path in launcher mock after moving our mock icons, to avoid a
  lot of "icon not found" warnings during qmluitests.
* Fix the testMultiGreeter qmluitest. Incoming method variables are
  apparently read-only in Qt5.3. (LP: #1332488)
[ CI bot ]
* Resync trunk
[ Michał Sawicz ]
* Adapt scope mock to new api and quiet unused variable warnings.
* Fix dynamic overlay height. (LP: #1334879)
* Don't center items in CardVerticalJournal, kind of beats the
  purpose... Also don't bind unnecessarily.
[ Ying-Chun Liu ]
* Fix LP:1330957 Fix some failed test cases. (LP: #1330957)
[ Albert Astals ]
* Don't seem to need this waitForRendering And makes test fail in 5.3
[ Alberto Aguirre ]
* Update Powerd plugin and Shell.qml to accommodate changes in the
  display power state notification.
[ Ying-Chun Liu ]
* Add logout support. Reviewed by: Daniel d'Andrada (LP: #1302213)
[ Michał Sawicz ]
* Make so that fixedArtShapeSize actually fixes artShapeSize.
[ Albert Astals ]
* Add VerticalJournal integration to Dash/scopes/QML (LP: #1326467)
* Make so that fixedArtShapeSize actually fixes artShapeSize.
[ Mirco Müller ]
* Added the frontend-part of sound-hint support for notifications with
  updated QML-tests.
* New rebuild forced
[ Albert Astals ]
* Departments support (LP: #1320847)
[ Pawel Stolowski ]
* Extend the hack for click scope categories with the upcoming 'store'
  category: single-tap on results from the 'store' category should
  activate them, instead of requesting a preview. (LP: #1326292)
[ Albert Astals ]
* Drop the " Preview" suffix from Preview title As requested in
  https://bugs.launchpad.net/unity8/+bug/1316671 (LP: #1316671)
[ Michael Terry ]
* Revert split greeter for now. We will bring it back as an option
  for Desktop, but use a big hammer revert right now to get Touch back
  in shape.
[ CI bot ]
* Fix build problems. Reviewed by: Michael Terry (LP: #1328850)
[ Michał Sawicz ]
* Make lockscreen buttons translatable.
[ Albert Astals ]
* Correctly mark these functions as overrides
* Remove connections to non existant signal
* Better test name
* Improvements for headerless categories LVPWH: No section name -> no
  header LVPWH: New hasSectionHeader context property for delegates
  GSV: Add topMargin if no hasSectionHeader (LP: #1326415)
* Make tryVerticalJournal, tryHorizontalJournal and tryOrganicGrid
  work again
[ Michael Zanetti ]
* Don't crash when we get an invalid app from ApplicationManager (LP:
  #1309162)
[ Andrea Cimitan ]
* Workaround for lp1324159 (LP: #1322233, #1324159)
[ CI bot ]
* Resync trunk
[ Florian Boucault ]
* Application startup: changed splash rectangle to be black instead of
  white and added a neat little animation. (LP: #1124265)
[ Michael Terry ]
* Bump version so ubuntu-touch-session can reference this one
[ CI bot ]
* Resync trunk
[ Michał Sawicz ]
* Move env setup past session init in greeter wrapper. (LP: #1325882)
* no change rebuild
* drop dbus-x11 dependency of unity8-greeter, it makes us end up with
  multiple session dbus daemons which breaks many AP tests in the lab
[ Michael Terry ]
* Bump version for Breaks due to unity8-greeter
* In split mode, determine whether the application identifiers in
  AccountsService are click packages or not, so we know the correct
  url prefix to use.
* Start logrotate in the greeter's session.
[ Andrea Cimitan ]
* Passes to make tryCommand -qmljsdebugger=port:3768 to enable
  debug/profiling test apps
* Fixes carousel shadow
[ Michał Sawicz ]
* Use dpkg-architecture, not gcc, to determine the machine triplet.
[ Ying-Chun Liu ]
* Fix ZoomableImage test failure. (LP: #1317254)
[ Albert Astals ]
* We don't need iconutils in this mock
* Don't reserve space for mascot if no mascot is specified (LP:
  #1319343)
* CardHeader is no more, remove stale line in CMakeLists.txt
* GenericScopeViewTest: Wait a bit more Otherwise sometimes we end
  getting up the wrong delegate (maybe one that will be garbage
  collected?) (LP: #1322279)
* Fix crash in organicgridtest
[ Daniel d'Andrada ]
* Remove Shell's underlay background image as it cannot be seen
  anymore Now that the Dash has its own, opaque, background, the
  underlay's background image can no longer be seen. So it's just a
  waste of resources to have it.
[ Michael Terry ]
* Use the same animation when dismissing a greeter slide from the
  launcher as from a normal greeter drag. (LP: #1316513)
[ Michael Zanetti ]
* enhance lockscreen add a retry indication label (e.g. 3 attempts
  left). add an additional label (e.g. phone number for multi sim).
  add a infoPopup (e.g. to display a warning for last retry). add min
  and max limit values. add tests for the above (LP: #1302050)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~paulliu/unity8/reboot updated
852. By Ying-Chun Liu

fix dialog

853. By Ying-Chun Liu

Merge trunk
[ Nick Dedekind ]
* Added support for TransferMenu
[ Michał Sawicz ]
* Initial code for a payment button widget, to handle purchasing apps
  from the click scope.
[ Nick Dedekind ]
* Moved [Message]MenuItemFacotory from Unity.Indicators plugin to qml
  folder.
[ Albert Astals ]
* EasingCurve: Initialize members
* Fix valgrind warning by not emitting reset on model destructor That
  won't be supported until Qt 5.4 More info at https://bugreports.qt-
  project.org/browse/QTBUG-39780 Warning was ==16693== Invalid read of
  size 8 ==16693== at 0x72B19A0: QQmlContext::isValid() const
  (qqmlcontext.cpp:231) ==16693== by 0x736C82B:
  QQmlDelegateModelPrivate::emitChanges() (qqmldelegatemodel.cpp:1412)
  ==16693== by 0x7372AE6: QQmlDelegateModel::_q_modelReset()
  (qqmldelegatemodel.cpp:1463) ==16693== by 0x7397224:
  QQmlDelegateModel::qt_static_metacall(QObject*, QMetaObject::Call,
  int, void**) (moc_qqmldelegatemodel_p.cpp:196) ==16693== by
  0x739769E: QQmlDelegateModel::qt_metacall(QMetaObject::Call, int,
  void**) (moc_qqmldelegatemodel_p.cpp:292) ==16693== by 0x66379CC:
  QMetaObject::activate(QObject*, int, int, void**) (in
  /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==16693== by
  0x65AEEFD: QAbstractItemModel::endResetModel() (in /usr/lib/x86_64-
  linux-gnu/libQt5Core.so.5.3.0) ==16693== by 0x23461EFD:
  FakeIndicatorsModel::unload() (fakeindicatorsmodel.cpp:53) ==16693==
  by 0x23461E13: FakeIndicatorsModel::~FakeIndicatorsModel()
  (fakeindicatorsmodel.cpp:34) ==16693== by 0x2345C073:
  QQmlPrivate::QQmlElement<FakeIndicatorsModel>::~QQmlElement() (in
  /home/tsdgeos_work/phablet/unity8/investigate_test_shell_crash/build
  dir/tests/mocks/Unity/Indicators/libIndicatorsFakeQml.so) ==16693==
  by 0x2345C0A3:
  QQmlPrivate::QQmlElement<FakeIndicatorsModel>::~QQmlElement()
  (qqmlprivate.h:106) ==16693== by 0x663636B:
  QObjectPrivate::deleteChildren() (in /usr/lib/x86_64-linux-
  gnu/libQt5Core.so.5.3.0) ==16693== Address 0x1862d448 is 8 bytes
  inside a block of size 16 free'd ==16693== at 0x4C2C2BC: operator
  delete(void*) (vg_replace_malloc.c:503) ==16693== by 0x72B21B8:
  QQmlContextData::destroy() (qqmlcontext.cpp:647) ==16693== by
  0x7293458: QQmlPrivate::qdeclarativeelement_destructor(QObject*)
  (qqmlengine.cpp:612) ==16693== by 0x6C0CADD:
  QQmlPrivate::QQmlElement<QQuickItem>::~QQmlElement()
  (qqmlprivate.h:105) ==16693== by 0x663636B:
  QObjectPrivate::deleteChildren() (in /usr/lib/x86_64-linux-
  gnu/libQt5Core.so.5.3.0) ==16693== by 0x663F0EB: QObject::~QObject()
  (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==16693== by
  0x6BF64B5: QQuickItem::~QQuickItem() (qquickitem.cpp:2064) ==16693==
  by 0x6C0CAE5: QQmlPrivate::QQmlElement<QQuickItem>::~QQmlElement()
  (qqmlprivate.h:106) ==16693== by 0x663636B:
  QObjectPrivate::deleteChildren() (in /usr/lib/x86_64-linux-
  gnu/libQt5Core.so.5.3.0) ==16693== by 0x663F0EB: QObject::~QObject()
  (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==16693== by
  0x6BF64B5: QQuickItem::~QQuickItem() (qquickitem.cpp:2064) ==16693==
  by 0x6C0CAE5: QQmlPrivate::QQmlElement<QQuickItem>::~QQmlElement()
  (qqmlprivate.h:106) (LP: #1332598)
[ Michael Zanetti ]
* drop launcher item spacing (LP: #1332022)
* change wording in launcher quicklist (LP: #1332035)
[ Alejandro J. Cura ]
* Initial code for a payment button widget, to handle purchasing apps
  from the click scope.
[ Rodney Dawes ]
* Initial code for a payment button widget, to handle purchasing apps
  from the click scope.
[ Renato Araujo Oliveira Filho ]
* Create IndicatorsLight.qml component used to control indicator led.
  A blue led will pulse if the message indicator is blue and screen is
  off.

854. By Ying-Chun Liu

Fix FTBFS

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

I'm not sure if its a good idea to have the exact same interface exported into the shell and on D-Bus. Besides the fact that it looks quite chaotic, it also raises some security concerns here...

Michal, your opinion?

review: Needs Information
Revision history for this message
Michał Sawicz (saviq) wrote :

> I'm not sure if its a good idea to have the exact same interface exported into
> the shell and on D-Bus. Besides the fact that it looks quite chaotic, it also
> raises some security concerns here...

While I agree this is not ideal, the whole API here is rather temporary, until we spend the much needed time for analysis on session handling with accordance to fdo, systemd, logind etc. etc.

And applications can't call this API anyway, so it *should* be fine for now.

lp:~paulliu/unity8/reboot updated
855. By Ying-Chun Liu

Add fade-out effect.

856. By Ying-Chun Liu

Merge trunk

857. By Ying-Chun Liu

Fix bugs.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ying-Chun Liu (paulliu) wrote :

The DBus is not used by the phone. It is for the desktop.
The indicators-session will use that DBus interface to ask the unity8 to shutdown.

lp:~paulliu/unity8/reboot updated
858. By Ying-Chun Liu

Merge trunk
[ Michal Hruby ]
* Fix FTBFS when using latest unity-api.
[ Michał Sawicz ]
* Refactor carousel item activation.
* Refactor ScopeItem into GenericScopeView.
* Add initial support for scope customizations.
* Make rating stars in PreviewReviewDisplay.qml non-interactive. (LP:
  #1337508)
[ Nick Dedekind ]
* Added active call hint A hint is displayed in the indicator panel
  when an call is active on the Telephony Serivce
[ Albert Astals ]
* We need to boostrap height also when we have 1 item ^_^ (LP:
  #1337408)
* Add initial support for scope customizations.
* CardCreator: Give a correct implicitHeight if we only have art The
  hasSubtitle change is really unrelated and not needed here, just
  sneaking it in to not create yet another review. (LP: #1330899)
* Fake Scopes Plugin: Register PreviewModelInterface
[ Michael Zanetti ]
* make the launcher's drag'n'drop indicator more prominent (LP:
  #1332042)
* make launcher items live having them non-live is not really required
  and reveals an issue in combination with UbuntuShape (LP: #1302761)
* Fade out launcher in place instead of moving it to the left on long
  left edge swipes. (LP: #1332096)
* update launcher icon glow as requested by design (LP: #1336725)
* update header in dash to use the new header from the SDK (LP:
  #1335491)
* fix testPreview with larger GRID_UNIT_PX values
* clip the corner of pinned icons in the launcher as per new design
* update launcher background according to latest design (LP: #1336314)
* Update Launcher's home button design according to new spec. (LP:
  #1329331)
[ CI bot ]
* make launcher items live having them non-live is not really required
  and reveals an issue in combination with UbuntuShape (LP: #1302761)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> The DBus is not used by the phone. It is for the desktop.
> The indicators-session will use that DBus interface to ask the unity8 to
> shutdown.

Not sure I understand what you're trying to say with this. But anyways, given its temporary I guess we can land as is... It worked fine in my tests...

 * Did you perform an exploratory manual test run of the code change and any related functionality?

ya

 * Did CI run pass? If not, please explain why.

no. flaky, unrelated tests

review: Approve
Revision history for this message
Michael Zanetti (mzanetti) wrote :

Oh... just saw the description says to NOT approve this branch yet... What's the status with that?

review: Needs Information
Revision history for this message
Ying-Chun Liu (paulliu) wrote :

> Oh... just saw the description says to NOT approve this branch yet... What's
> the status with that?

Sorry. I fix the description.

Thanks.

Revision history for this message
Michael Zanetti (mzanetti) wrote :

ack

review: Approve
lp:~paulliu/unity8/reboot updated
859. By Ying-Chun Liu

Merge trunk.
[ Michał Sawicz ]
* Activate all results in click scope by default. (LP: #1341262)
[ Mirco Müller ]
* Added support for utilization of the ComboButton SDK-element for
  snap-decision notifications with many actions.

860. By Ying-Chun Liu

Merge trunk.

Revision history for this message
Ying-Chun Liu (paulliu) wrote :

I just merge trunk and request a jenkins rebuild to see if it fix.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/Unity/Session/dbusunitysessionservice.cpp'
--- plugins/Unity/Session/dbusunitysessionservice.cpp 2014-05-27 11:44:25 +0000
+++ plugins/Unity/Session/dbusunitysessionservice.cpp 2014-07-16 14:44:35 +0000
@@ -19,6 +19,7 @@
1919
20// Qt20// Qt
21#include <QDBusConnection>21#include <QDBusConnection>
22#include <QDBusInterface>
2223
23DBusUnitySessionService::DBusUnitySessionService() : QObject()24DBusUnitySessionService::DBusUnitySessionService() : QObject()
24{25{
@@ -44,3 +45,35 @@
44{45{
45 Q_EMIT logoutRequested(false);46 Q_EMIT logoutRequested(false);
46}47}
48
49void DBusUnitySessionService::Reboot()
50{
51 QDBusConnection connection = QDBusConnection::systemBus();
52 QDBusInterface iface1 ("org.freedesktop.login1",
53 "/org/freedesktop/login1",
54 "org.freedesktop.login1.Manager",
55 connection);
56
57 iface1.call("Reboot", false);
58}
59
60void DBusUnitySessionService::RequestReboot()
61{
62 Q_EMIT rebootRequested(false);
63}
64
65void DBusUnitySessionService::Shutdown()
66{
67 QDBusConnection connection = QDBusConnection::systemBus();
68 QDBusInterface iface1 ("org.freedesktop.login1",
69 "/org/freedesktop/login1",
70 "org.freedesktop.login1.Manager",
71 connection);
72
73 iface1.call("PowerOff", false);
74}
75
76void DBusUnitySessionService::RequestShutdown()
77{
78 Q_EMIT shutdownRequested(false);
79}
4780
=== modified file 'plugins/Unity/Session/dbusunitysessionservice.h'
--- plugins/Unity/Session/dbusunitysessionservice.h 2014-05-26 15:11:09 +0000
+++ plugins/Unity/Session/dbusunitysessionservice.h 2014-07-16 14:44:35 +0000
@@ -47,6 +47,27 @@
47 void logoutRequested(bool have_inhibitors);47 void logoutRequested(bool have_inhibitors);
4848
49 /**49 /**
50 * rebootRequested signal
51 *
52 * This signal is emitted when some applications request the system to
53 * reboot.
54 * @param have_inhibitors if there are any special running applications
55 * which inhibit the reboot.
56 */
57 void rebootRequested(bool have_inhibitors);
58
59 /**
60 * shutdownRequested signal
61 *
62 * This signal is emitted when some applications request the system to
63 * shutdown.
64 * @param have_inhibitors if there are any special running applications
65 * which inhibit the shutdown.
66 */
67 void shutdownRequested(bool have_inhibitors);
68
69
70 /**
50 * logoutReady signal71 * logoutReady signal
51 *72 *
52 * This signal is emitted when all the apps are closed. And the system73 * This signal is emitted when all the apps are closed. And the system
@@ -61,22 +82,58 @@
61 * This method directly logout the system without user's confirmation.82 * This method directly logout the system without user's confirmation.
62 * Ordinary applications should avoid calling this method. Please call83 * Ordinary applications should avoid calling this method. Please call
63 * RequestLogout() to ask the user to decide logout or not.84 * RequestLogout() to ask the user to decide logout or not.
64 * This method will stop all the running applications and then signal
65 * logoutReady when all the apps stopped.
66 */85 */
67 Q_SCRIPTABLE void Logout();86 Q_SCRIPTABLE void Logout();
6887
69 /**88 /**
89 * Reboot the system.
90 *
91 * This method directly reboot the system without user's confirmation.
92 * Ordinary applications should avoid calling this method. Please call
93 * RequestReboot() to ask the user to decide reboot or not.
94 */
95 Q_SCRIPTABLE void Reboot();
96
97 /**
98 * Shutdown the system.
99 *
100 * This method directly shutdown the system without user's confirmation.
101 * Ordinary applications should avoid calling this method. Please call
102 * RequestShutdown() to ask the user to decide shutdown or not.
103 */
104 Q_SCRIPTABLE void Shutdown();
105
106 /**
70 * Issue a logout request.107 * Issue a logout request.
71 *108 *
72 * This method emit the logoutRequested signal to the shell with a boolean109 * This method emit the logoutRequested signal to the shell with a boolean
73 * which indicates if there's any inhibitors. The shell should receive110 * which indicates if there's any inhibitors. The shell should receive
74 * this signal and display a dialog to ask the user to confirm the logout111 * this signal and display a dialog to ask the user to confirm the logout
75 * action. If confirmed, shell can call Logout() method to kill the apps112 * action. If confirmed, shell can call Logout() method to logout.
76 * and then logout
77 */113 */
78 Q_SCRIPTABLE void RequestLogout();114 Q_SCRIPTABLE void RequestLogout();
79115
116 /**
117 * Issue a reboot request.
118 *
119 * This method emit the rebootRequested signal to the shell with a boolean
120 * which indicates if there's any inhibitors. The shell should receive
121 * this signal and display a dialog to ask the user to confirm the reboot
122 * action. If confirmed, shell can call Reboot() method to reboot
123 */
124 Q_SCRIPTABLE void RequestReboot();
125
126 /**
127 * Issue a shutdown request.
128 *
129 * This method emit the shutdownRequested signal to the shell with a
130 * boolean which indicates if there's any inhibitors.
131 * The shell should receive
132 * this signal and display a dialog to ask the user to confirm the reboot
133 * action. If confirmed, shell can call Shutdown() method to reboot
134 */
135 Q_SCRIPTABLE void RequestShutdown();
136
80};137};
81138
82#endif // DBUSUNITYSESSIONSERVICE_H139#endif // DBUSUNITYSESSIONSERVICE_H
83140
=== modified file 'qml/Shell.qml'
--- qml/Shell.qml 2014-07-09 19:44:14 +0000
+++ qml/Shell.qml 2014-07-16 14:44:35 +0000
@@ -19,6 +19,7 @@
19import GSettings 1.019import GSettings 1.0
20import Unity.Application 0.120import Unity.Application 0.1
21import Ubuntu.Components 0.121import Ubuntu.Components 0.1
22import Ubuntu.Components.Popups 0.1
22import Ubuntu.Gestures 0.123import Ubuntu.Gestures 0.1
23import Unity.Launcher 0.124import Unity.Launcher 0.1
24import LightDM 0.1 as LightDM25import LightDM 0.1 as LightDM
@@ -268,7 +269,128 @@
268 }269 }
269 }270 }
270271
272 property bool dialogShown: false
273
274 Component {
275 id: logoutDialog
276 Dialog {
277 id: dialogueLogout
278 title: "Logout"
279 text: "Are you sure that you want to logout?"
280 Button {
281 text: "Cancel"
282 onClicked: {
283 PopupUtils.close(dialogueLogout);
284 stages.dialogShown = false;
285 }
286 }
287 Button {
288 text: "Yes"
289 onClicked: {
290 DBusUnitySessionService.Logout();
291 PopupUtils.close(dialogueLogout);
292 stages.dialogShown = false;
293 }
294 }
295 }
296 }
297
298 Component {
299 id: shutdownDialog
300 Dialog {
301 id: dialogueShutdown
302 title: "Shutdown"
303 text: "Are you sure that you want to shutdown?"
304 Button {
305 text: "Cancel"
306 onClicked: {
307 PopupUtils.close(dialogueShutdown);
308 stages.dialogShown = false;
309 }
310 }
311 Button {
312 text: "Yes"
313 onClicked: {
314 dBusUnitySessionServiceConnection.closeAllApps();
315 DBusUnitySessionService.Shutdown();
316 PopupUtils.close(dialogueShutdown);
317 stages.dialogShown = false;
318 }
319 }
320 }
321 }
322
323 Component {
324 id: rebootDialog
325 Dialog {
326 id: dialogueReboot
327 title: "Reboot"
328 text: "Are you sure that you want to reboot?"
329 Button {
330 text: "Cancel"
331 onClicked: {
332 PopupUtils.close(dialogueReboot)
333 stages.dialogShown = false;
334 }
335 }
336 Button {
337 text: "Yes"
338 onClicked: {
339 dBusUnitySessionServiceConnection.closeAllApps();
340 DBusUnitySessionService.Reboot();
341 PopupUtils.close(dialogueReboot);
342 stages.dialogShown = false;
343 }
344 }
345 }
346 }
347
348 Component {
349 id: powerDialog
350 Dialog {
351 id: dialoguePower
352 title: "Power"
353 text: i18n.tr("Are you sure you would like to turn power off?")
354 Button {
355 text: i18n.tr("Power off")
356 onClicked: {
357 dBusUnitySessionServiceConnection.closeAllApps();
358 PopupUtils.close(dialoguePower);
359 stages.dialogShown = false;
360 shutdownFadeOutRectangle.enabled = true;
361 shutdownFadeOutRectangle.visible = true;
362 shutdownFadeOut.start();
363 }
364 }
365 Button {
366 text: i18n.tr("Restart")
367 onClicked: {
368 dBusUnitySessionServiceConnection.closeAllApps();
369 DBusUnitySessionService.Reboot();
370 PopupUtils.close(dialoguePower);
371 stages.dialogShown = false;
372 }
373 }
374 Button {
375 text: i18n.tr("Cancel")
376 onClicked: {
377 PopupUtils.close(dialoguePower);
378 stages.dialogShown = false;
379 }
380 }
381 }
382 }
383
384 function showPowerDialog() {
385 if (!stages.dialogShown) {
386 stages.dialogShown = true;
387 PopupUtils.open(powerDialog);
388 }
389 }
390
271 Connections {391 Connections {
392 id: dBusUnitySessionServiceConnection
393 objectName: "dBusUnitySessionServiceConnection"
272 target: DBusUnitySessionService394 target: DBusUnitySessionService
273395
274 function closeAllApps() {396 function closeAllApps() {
@@ -282,8 +404,27 @@
282 }404 }
283405
284 onLogoutRequested: {406 onLogoutRequested: {
285 // TODO: Display a dialog to ask the user to confirm.407 // Display a dialog to ask the user to confirm.
286 DBusUnitySessionService.Logout();408 if (!stages.dialogShown) {
409 stages.dialogShown = true;
410 PopupUtils.open(logoutDialog);
411 }
412 }
413
414 onShutdownRequested: {
415 // Display a dialog to ask the user to confirm.
416 if (!stages.dialogShown) {
417 stages.dialogShown = true;
418 PopupUtils.open(shutdownDialog);
419 }
420 }
421
422 onRebootRequested: {
423 // Display a dialog to ask the user to confirm.
424 if (!stages.dialogShown) {
425 stages.dialogShown = true;
426 PopupUtils.open(rebootDialog);
427 }
287 }428 }
288429
289 onLogoutReady: {430 onLogoutReady: {
@@ -679,4 +820,50 @@
679 target: SessionBroadcast820 target: SessionBroadcast
680 onShowHome: showHome()821 onShowHome: showHome()
681 }822 }
823
824 Keys.onPressed: {
825 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
826 if (!powerKeyTimer.running) {
827 powerKeyTimer.start();
828 }
829 event.accepted = true;
830 }
831 }
832
833 Keys.onReleased: {
834 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
835 powerKeyTimer.stop();
836 event.accepted = true;
837 }
838 }
839
840 Timer {
841 id: powerKeyTimer
842 interval: 2000
843 repeat: false
844 triggeredOnStart: false
845
846 onTriggered: {
847 stages.showPowerDialog();
848 }
849 }
850
851 Rectangle {
852 id: shutdownFadeOutRectangle
853 enabled: false
854 visible: false
855 color: "black"
856 anchors.fill: parent
857 opacity: 0.0
858 NumberAnimation on opacity {
859 id: shutdownFadeOut
860 from: 0.0
861 to: 1.0
862 onStopped: {
863 if (shutdownFadeOutRectangle.enabled && shutdownFadeOutRectangle.visible) {
864 DBusUnitySessionService.Shutdown();
865 }
866 }
867 }
868 }
682}869}

Subscribers

People subscribed via source and target branches