[finished] Allow positive and negative notifications at end.
This commit is contained in:
parent
ec4b6752d6
commit
5af614daf7
@ -94,25 +94,41 @@ Config::doRestart()
|
||||
|
||||
|
||||
void
|
||||
Config::doNotify()
|
||||
Config::doNotify( bool hasFailed )
|
||||
{
|
||||
QDBusInterface notify(
|
||||
"org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications" );
|
||||
if ( notify.isValid() )
|
||||
{
|
||||
cDebug() << "Sending notification of completion. Failed?" << hasFailed;
|
||||
|
||||
QString title;
|
||||
QString message;
|
||||
if ( hasFailed )
|
||||
{
|
||||
title = Calamares::Settings::instance()->isSetupMode() ? tr( "Setup Failed" ) : tr( "Installation Failed" );
|
||||
message = Calamares::Settings::instance()->isSetupMode()
|
||||
? tr( "The setup of %1 did not complete successfully." )
|
||||
: tr( "The installation of %1 did not complete successfully." );
|
||||
}
|
||||
else
|
||||
{
|
||||
title = Calamares::Settings::instance()->isSetupMode() ? tr( "Setup Complete" )
|
||||
: tr( "Installation Complete" );
|
||||
message = Calamares::Settings::instance()->isSetupMode() ? tr( "The setup of %1 is complete." )
|
||||
: tr( "The installation of %1 is complete." );
|
||||
}
|
||||
|
||||
const auto* branding = Calamares::Branding::instance();
|
||||
QDBusReply< uint > r = notify.call(
|
||||
"Notify",
|
||||
QString( "Calamares" ),
|
||||
QVariant( 0U ),
|
||||
QString( "calamares" ),
|
||||
Calamares::Settings::instance()->isSetupMode() ? tr( "Setup Complete" ) : tr( "Installation Complete" ),
|
||||
Calamares::Settings::instance()->isSetupMode()
|
||||
? tr( "The setup of %1 is complete." ).arg( branding->versionedName() )
|
||||
: tr( "The installation of %1 is complete." ).arg( branding->versionedName() ),
|
||||
QStringList(),
|
||||
QVariantMap(),
|
||||
QVariant( 0 ) );
|
||||
QDBusReply< uint > r = notify.call( "Notify",
|
||||
QString( "Calamares" ),
|
||||
QVariant( 0U ),
|
||||
QString( "calamares" ),
|
||||
title,
|
||||
message.arg( branding->versionedName() ),
|
||||
QStringList(),
|
||||
QVariantMap(),
|
||||
QVariant( 0 ) );
|
||||
if ( !r.isValid() )
|
||||
{
|
||||
cWarning() << "Could not call org.freedesktop.Notifications.Notify at end of installation." << r.error();
|
||||
|
@ -62,10 +62,8 @@ public slots:
|
||||
*
|
||||
* At the end of installation (when the FinishedViewStep is activated),
|
||||
* send a desktop notification via DBus that the install is done.
|
||||
* If the installation failed, don't call this method because
|
||||
* the notification is a positive one.
|
||||
*/
|
||||
void doNotify();
|
||||
void doNotify( bool hasFailed = false );
|
||||
|
||||
signals:
|
||||
void restartModeChanged( RestartMode m );
|
||||
|
Loading…
Reference in New Issue
Block a user