From aa004503c592851472ef153e4122df82dc23be62 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 6 Mar 2021 13:38:02 +0100 Subject: [PATCH] [finished] Expand Config object's repertoire of notification-API --- src/modules/finished/Config.cpp | 5 +++-- src/modules/finished/Config.h | 15 +++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/modules/finished/Config.cpp b/src/modules/finished/Config.cpp index bf156303d..03616d05a 100644 --- a/src/modules/finished/Config.cpp +++ b/src/modules/finished/Config.cpp @@ -121,10 +121,11 @@ Config::doRestart() void -Config::doNotify( bool hasFailed ) +Config::doNotify( bool hasFailed, bool sendAnyway ) { - if ( !notifyOnFinished() ) + if ( !sendAnyway ) { + cDebug() << "Notification failed?" << hasFailed << "not sent."; return; } diff --git a/src/modules/finished/Config.h b/src/modules/finished/Config.h index cf1d8eb73..b4f93fd91 100644 --- a/src/modules/finished/Config.h +++ b/src/modules/finished/Config.h @@ -76,14 +76,21 @@ public Q_SLOTS: */ void doRestart(); - /** @brief Send DBus notification, if desired. - * - * This takes notifyOnFinished() into account. + /** @brief Send DBus notification * * At the end of installation (when the FinishedViewStep is activated), * send a desktop notification via DBus that the install is done. + * + * - The two-argument form sends success or failure, and can be + * forced to send by setting @p sendAnyway to @c true. + * - The one-argument form sends success or failure and takes + * the notifyOnFinished() configuration into account. + * - The no-argument form checks if a failure was signalled previously + * and uses that to decide if it was a failure. + * */ - void doNotify( bool hasFailed ); + void doNotify( bool hasFailed, bool sendAnyway ); + void doNotify( bool hasFailed ) { doNotify( hasFailed, notifyOnFinished() ); } void doNotify() { doNotify( hasFailed() ); } /** @brief Tell the config the install failed