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 ) FinishedViewStep::FinishedViewStep( QObject* parent )
: Calamares::ViewStep( parent ) : Calamares::ViewStep( parent )
, m_widget( new FinishedPage() ) , m_widget( new FinishedPage() )
, installFailed( false )
{ {
cDebug() << "FinishedViewStep()"; cDebug() << "FinishedViewStep()";
connect( Calamares::JobQueue::instance(), &Calamares::JobQueue::failed, auto jq = Calamares::JobQueue::instance();
connect( jq, &Calamares::JobQueue::failed,
m_widget, &FinishedPage::onInstallationFailed ); m_widget, &FinishedPage::onInstallationFailed );
connect( jq, &Calamares::JobQueue::failed,
this, &FinishedViewStep::onInstallationFailed );
emit nextStatusChanged( true ); emit nextStatusChanged( true );
} }
@ -107,6 +111,11 @@ FinishedViewStep::isAtEnd() const
void void
FinishedViewStep::sendNotification() 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" ); QDBusInterface notify( "org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications" );
if ( notify.isValid() ) if ( notify.isValid() )
{ {
@ -145,6 +154,13 @@ FinishedViewStep::jobs() const
return QList< Calamares::job_ptr >(); return QList< Calamares::job_ptr >();
} }
void
FinishedViewStep::onInstallationFailed( const QString& message, const QString& details )
{
Q_UNUSED(message);
Q_UNUSED(details);
installFailed = true;
}
void void
FinishedViewStep::setConfigurationMap( const QVariantMap& configurationMap ) FinishedViewStep::setConfigurationMap( const QVariantMap& configurationMap )

View File

@ -55,6 +55,9 @@ public:
void setConfigurationMap( const QVariantMap& configurationMap ) override; void setConfigurationMap( const QVariantMap& configurationMap ) override;
public slots:
void onInstallationFailed( const QString& message, const QString& details );
private: private:
FinishedPage* m_widget; FinishedPage* m_widget;
@ -63,6 +66,8 @@ private:
* send a desktop notification via DBus that the install is done. * send a desktop notification via DBus that the install is done.
*/ */
void sendNotification(); void sendNotification();
bool installFailed;
}; };
CALAMARES_PLUGIN_FACTORY_DECLARATION( FinishedViewStepFactory ) CALAMARES_PLUGIN_FACTORY_DECLARATION( FinishedViewStepFactory )