Suppress success-notification on failure

This commit is contained in:
Adriaan de Groot 2017-08-23 05:25:07 -04:00
parent 2c81fceacb
commit 89c2c8a76e
2 changed files with 22 additions and 1 deletions

View file

@ -33,11 +33,15 @@
FinishedViewStep::FinishedViewStep( QObject* parent )
: Calamares::ViewStep( parent )
, m_widget( new FinishedPage() )
, installFailed( false )
{
cDebug() << "FinishedViewStep()";
connect( Calamares::JobQueue::instance(), &Calamares::JobQueue::failed,
auto jq = Calamares::JobQueue::instance();
connect( jq, &Calamares::JobQueue::failed,
m_widget, &FinishedPage::onInstallationFailed );
connect( jq, &Calamares::JobQueue::failed,
this, &FinishedViewStep::onInstallationFailed );
emit nextStatusChanged( true );
}
@ -107,6 +111,11 @@ FinishedViewStep::isAtEnd() const
void
FinishedViewStep::sendNotification()
{
// If the installation failed, don't send notification popup;
// there's a (modal) dialog popped up with the failure notice.
if (installFailed)
return;
QDBusInterface notify( "org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications" );
if ( notify.isValid() )
{
@ -145,6 +154,13 @@ FinishedViewStep::jobs() const
return QList< Calamares::job_ptr >();
}
void
FinishedViewStep::onInstallationFailed( const QString& message, const QString& details )
{
Q_UNUSED(message);
Q_UNUSED(details);
installFailed = true;
}
void
FinishedViewStep::setConfigurationMap( const QVariantMap& configurationMap )