Provide sane defaults for restart command, and make it optional.

CAL-372 #close
This commit is contained in:
Teo Mrnjavac 2016-06-09 17:23:40 +02:00
parent 936e7fab7c
commit 326ff5e724

View File

@ -117,13 +117,20 @@ FinishedViewStep::setConfigurationMap( const QVariantMap& configurationMap )
if ( restartNowEnabled ) if ( restartNowEnabled )
{ {
if ( configurationMap.contains( "restartNowChecked" ) && if ( configurationMap.contains( "restartNowChecked" ) &&
configurationMap.value( "restartNowChecked" ).type() == QVariant::Bool && configurationMap.value( "restartNowChecked" ).type() == QVariant::Bool )
configurationMap.contains( "restartNowCommand" ) &&
configurationMap.value( "restartNowCommand" ).type() == QVariant::String )
{ {
m_widget->setRestartNowChecked( configurationMap.value( "restartNowChecked" ).toBool() ); m_widget->setRestartNowChecked( configurationMap.value( "restartNowChecked" ).toBool() );
}
if ( configurationMap.contains( "restartNowCommand" ) &&
configurationMap.value( "restartNowCommand" ).type() == QVariant::String )
{
m_widget->setRestartNowCommand( configurationMap.value( "restartNowCommand" ).toString() ); m_widget->setRestartNowCommand( configurationMap.value( "restartNowCommand" ).toString() );
} }
else
{
m_widget->setRestartNowCommand( "systemctl reboot");
}
} }
} }
} }