Commit 433ed838 authored by Adriaan de Groot's avatar Adriaan de Groot

[netinstall] Inherit criticalness in groups

- Groups inherit slightly differently: if a subgroup **explicitly**
  configures criticalness, use that. It would be weird, but possibly,
  to have a non-critical subgroup of a critical group.
parent 83a89c14
......@@ -22,6 +22,7 @@
#include "utils/Logger.h"
#include "utils/Variant.h"
/** @brief Should a package be selected, given its parent's state? */
static Qt::CheckState
parentCheckState( PackageTreeItem* parent )
{
......@@ -36,6 +37,20 @@ parentCheckState( PackageTreeItem* parent )
}
}
/** @brief Should a subgroup be marked critical?
*
* If set explicitly, then use that, otherwise use the parent's critical-ness.
*/
static bool
parentCriticality( const QVariantMap& groupData, PackageTreeItem* parent )
{
if ( groupData.contains( "critical" ) )
{
return CalamaresUtils::getBool( groupData, "critical", false );
}
return parent ? parent->isCritical() : false;
}
PackageTreeItem::PackageTreeItem( const QString& packageName, PackageTreeItem* parent )
: m_parentItem( parent )
, m_packageName( packageName )
......@@ -54,7 +69,7 @@ PackageTreeItem::PackageTreeItem( const QVariantMap& groupData, PackageTreeItem*
, m_preScript( CalamaresUtils::getString( groupData, "pre-install" ) )
, m_postScript( CalamaresUtils::getString( groupData, "post-install" ) )
, m_isGroup( true )
, m_isCritical( CalamaresUtils::getBool( groupData, "critical", false ) )
, m_isCritical( parentCriticality( groupData, parent ) )
, m_isHidden( CalamaresUtils::getBool( groupData, "hidden", false ) )
, m_showReadOnly( CalamaresUtils::getBool( groupData, "immutable", false ) )
, m_startExpanded( CalamaresUtils::getBool( groupData, "expanded", false ) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment