[libcalamares] Add isEditable() check

This adds support for checking whether a field is editable;
Config objects should reject changes if the field is not
editable. There is an "unlock" setting to override the
check, although this is currently always locked.
This commit is contained in:
Adriaan de Groot 2021-03-12 14:49:46 +01:00
parent 448e478b6d
commit 8b10a9cfc2
4 changed files with 68 additions and 2 deletions

View file

@ -60,5 +60,20 @@ Config::loadPresets( const QVariantMap& configurationMap, const QStringList& rec
= std::make_unique< Presets >( CalamaresUtils::getSubMap( configurationMap, key, bogus ), recognizedKeys );
}
bool
Config::isEditable( const QString& fieldName ) const
{
if ( m_unlocked )
{
return true;
}
if ( d && d->m_presets )
{
return d->m_presets->isEditable( fieldName );
}
return true;
}
} // namespace ModuleSystem
} // namespace Calamares