[packagechooserq] Apply renaming also to distro-visible code

- The distro-visible key is renamed *pkgc* to *packageChoice*
- Read *packageChoice* only if there are no items to use
This commit is contained in:
Adriaan de Groot 2021-09-03 21:15:57 +02:00
parent 8b703ba6a3
commit 8a49fde016
3 changed files with 27 additions and 18 deletions

View File

@ -204,7 +204,6 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
PackageChooserMode::Required );
m_method = PackageChooserMethodNames().find( CalamaresUtils::getString( configurationMap, "method" ),
PackageChooserMethod::Legacy );
setPackageChoice( CalamaresUtils::getString( configurationMap, "pkgc" ) );
if ( m_method == PackageChooserMethod::Legacy )
{
@ -233,7 +232,6 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
if ( configurationMap.contains( "items" ) )
{
fillModel( m_model, configurationMap.value( "items" ).toList() );
}
QString default_item_id = CalamaresUtils::getString( configurationMap, "default" );
if ( !default_item_id.isEmpty() )
@ -250,4 +248,9 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
}
}
}
}
else
{
setPackageChoice( CalamaresUtils::getString( configurationMap, "packageChoice" ) );
}
}

View File

@ -45,6 +45,12 @@ method: legacy
#
# id: ""
# The *pkgc* is used for setting the default selection in the QML view
pkgc: libreoffice
# The *packageChoice* value is used for setting the default selection
# in the QML view; this should match one of the keys used in the QML
# module for package names.
#
# (e.g. the sample QML uses "no_office_suite", "minimal_install" and
# "libreoffice" as possible choices).
#
packageChoice: libreoffice

View File

@ -84,8 +84,8 @@ Item {
print("L not used")
}
else {
config.pkgc = "libreoffice"
print( config.pkgc )
config.packageChoice = "libreoffice"
print( config.packageChoice )
}
}
}
@ -152,7 +152,7 @@ Item {
}
else {
print("No Office Suite")
config.pkgc = "no_office_suite"
config.packageChoice = "no_office_suite"
}
}
}
@ -220,7 +220,7 @@ Item {
}
else {
print("minimal")
config.pkgc = "minimal_install"
config.packageChoice = "minimal_install"
}
}
}