From 74c19fc02d6f3cdf9693dcc35efc75b837a6e3e9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 25 Sep 2017 16:22:03 +0200 Subject: [PATCH] Finished: make notification optional FIXES #811 --- src/modules/finished/FinishedViewStep.cpp | 7 ++++++- src/modules/finished/FinishedViewStep.h | 1 + src/modules/finished/finished.conf | 13 +++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/modules/finished/FinishedViewStep.cpp b/src/modules/finished/FinishedViewStep.cpp index a4cc5c734..883314ace 100644 --- a/src/modules/finished/FinishedViewStep.cpp +++ b/src/modules/finished/FinishedViewStep.cpp @@ -34,6 +34,7 @@ FinishedViewStep::FinishedViewStep( QObject* parent ) : Calamares::ViewStep( parent ) , m_widget( new FinishedPage() ) , installFailed( false ) + , m_notifyOnFinished( false ) { auto jq = Calamares::JobQueue::instance(); connect( jq, &Calamares::JobQueue::failed, @@ -139,7 +140,8 @@ FinishedViewStep::onActivate() { m_widget->setUpRestart(); - sendNotification(); + if ( m_notifyOnFinished ) + sendNotification(); } @@ -179,6 +181,9 @@ FinishedViewStep::setConfigurationMap( const QVariantMap& configurationMap ) m_widget->setRestartNowCommand( "systemctl -i reboot" ); } } + if ( configurationMap.contains( "notifyOnFinished" ) && + configurationMap.value( "notifyOnFinished" ).type() == QVariant::Bool ) + m_notifyOnFinished = configurationMap.value( "notifyOnFinished" ).toBool(); } CALAMARES_PLUGIN_FACTORY_DEFINITION( FinishedViewStepFactory, registerPlugin(); ) diff --git a/src/modules/finished/FinishedViewStep.h b/src/modules/finished/FinishedViewStep.h index 6a11dc8a3..f13da9fb8 100644 --- a/src/modules/finished/FinishedViewStep.h +++ b/src/modules/finished/FinishedViewStep.h @@ -68,6 +68,7 @@ private: void sendNotification(); bool installFailed; + bool m_notifyOnFinished; }; CALAMARES_PLUGIN_FACTORY_DECLARATION( FinishedViewStepFactory ) diff --git a/src/modules/finished/finished.conf b/src/modules/finished/finished.conf index f93acb587..6bd8bb2d6 100644 --- a/src/modules/finished/finished.conf +++ b/src/modules/finished/finished.conf @@ -1,4 +1,17 @@ +Configuration for the "finished" page, which is usually shown only at +the end of the installation (successful or not). --- +# The finished page can hold a "restart system now" checkbox. +# If this is false, no checkbox is show and the system is not restarted +# when Calamares exits. restartNowEnabled: true +# Initial state of the checkbox "restart now". restartNowChecked: false +# If the checkbox is shown, and the checkbox is checked, then when +# Calamares exits from the finished-page it will run this command. restartNowCommand: "systemctl -i reboot" + +# When the last page is (successfully) reached, send a DBus notification +# to the desktop that the installation is done. This works only if the +# user as whom Calamares is run, can reach the regular desktop session bus. +notifyOnFinished: false