@ -33,30 +33,13 @@
CALAMARES_PLUGIN_FACTORY_DEFINITION ( UsersQmlViewStepFactory , registerPlugin < UsersQmlViewStep > ( ) ; )
/*static const NamedEnumTable< SetHostNameJob::Action >&
hostnameActions ( )
{
using Action = SetHostNameJob : : Action ;
// *INDENT-OFF*
// clang-format off
static const NamedEnumTable < Action > names {
{ QStringLiteral ( " none " ) , Action : : None } ,
{ QStringLiteral ( " etcfile " ) , Action : : EtcHostname } ,
{ QStringLiteral ( " hostnamed " ) , Action : : SystemdHostname }
} ;
// clang-format on
// *INDENT-ON*
return names ;
} */
UsersQmlViewStep : : UsersQmlViewStep ( QObject * parent )
: Calamares : : QmlViewStep ( parent )
, m_config ( new Config ( this ) )
{
connect ( m_config , & Config : : readyChanged , this , & UsersQmlViewStep : : nextStatusChanged ) ;
emit nextStatusChanged ( true ) ;
//connect( m_config, &Config::checkReady, this, &UsersQmlViewStep::nextStatusChanged );
}
QString
@ -68,8 +51,8 @@ UsersQmlViewStep::prettyName() const
bool
UsersQmlViewStep : : isNextEnabled ( ) const
{
//return m_config->isReady();
return true ;
return m_config - > isReady ( ) ;
//return true;
}
@ -105,94 +88,22 @@ void
UsersQmlViewStep : : onActivate ( )
{
//m_config->onActivate();
//QmlViewStep::onActivate();
}
void
UsersQmlViewStep : : onLeave ( )
{
m_jobs . clear ( ) ;
//m_jobs.append( m_config->createJobs( m_defaultGroups ) );
m_jobs = m_config - > createJobs ( ) ;
m_config - > finalizeGlobalStorage ( ) ;
}
void
UsersQmlViewStep : : setConfigurationMap ( const QVariantMap & configurationMap )
{
using CalamaresUtils : : getBool ;
if ( configurationMap . contains ( " defaultGroups " )
& & configurationMap . value ( " defaultGroups " ) . type ( ) = = QVariant : : List )
{
m_defaultGroups = configurationMap . value ( " defaultGroups " ) . toStringList ( ) ;
}
else
{
cWarning ( ) < < " Using fallback groups. Please check defaultGroups in users.conf " ;
m_defaultGroups = QStringList { " lp " , " video " , " network " , " storage " , " wheel " , " audio " } ;
}
if ( configurationMap . contains ( " autologinGroup " )
& & configurationMap . value ( " autologinGroup " ) . type ( ) = = QVariant : : String )
{
Calamares : : JobQueue : : instance ( ) - > globalStorage ( ) - > insert (
" autologinGroup " , configurationMap . value ( " autologinGroup " ) . toString ( ) ) ;
}
if ( configurationMap . contains ( " sudoersGroup " )
& & configurationMap . value ( " sudoersGroup " ) . type ( ) = = QVariant : : String )
{
Calamares : : JobQueue : : instance ( ) - > globalStorage ( ) - > insert ( " sudoersGroup " ,
configurationMap . value ( " sudoersGroup " ) . toString ( ) ) ;
}
bool setRootPassword = getBool ( configurationMap , " setRootPassword " , true ) ;
Calamares : : JobQueue : : instance ( ) - > globalStorage ( ) - > insert ( " setRootPassword " , setRootPassword ) ;
//m_config->writeRootPassword( setRootPassword );
//m_config->setAutologinGroup( getBool( configurationMap, "doAutologin", false ) );
//m_config->setReusePasswordDefault( getBool( configurationMap, "doReusePassword", false ) );
if ( configurationMap . contains ( " passwordRequirements " )
& & configurationMap . value ( " passwordRequirements " ) . type ( ) = = QVariant : : Map )
{
auto pr_checks ( configurationMap . value ( " passwordRequirements " ) . toMap ( ) ) ;
for ( decltype ( pr_checks ) : : const_iterator i = pr_checks . constBegin ( ) ; i ! = pr_checks . constEnd ( ) ; + + i )
{
//m_config->passwordChecks( i.key(), i.value() );
}
}
//m_config->setPasswordCheckboxVisible( getBool( configurationMap, "allowWeakPasswords", false ) );
//m_config->setValidatePasswordDefault( !getBool( configurationMap, "allowWeakPasswordsDefault", false ) );
QString shell ( QLatin1String ( " /bin/bash " ) ) ; // as if it's not set at all
if ( configurationMap . contains ( " userShell " ) )
{
shell = CalamaresUtils : : getString ( configurationMap , " userShell " ) ;
}
// Now it might be explicitly set to empty, which is ok
Calamares : : JobQueue : : instance ( ) - > globalStorage ( ) - > insert ( " userShell " , shell ) ;
/*using Action = SetHostNameJob::Action;
QString hostnameActionString = CalamaresUtils : : getString ( configurationMap , " setHostname " ) ;
if ( hostnameActionString . isEmpty ( ) )
{
hostnameActionString = QStringLiteral ( " EtcFile " ) ;
}
bool ok = false ;
auto hostnameAction = hostnameActions ( ) . find ( hostnameActionString , ok ) ;
if ( ! ok )
{
hostnameAction = Action : : EtcHostname ;
}
Action hostsfileAction = getBool ( configurationMap , " writeHostsFile " , true ) ? Action : : WriteEtcHosts : Action : : None ;
m_actions = hostsfileAction | hostnameAction ; */
m_config - > setConfigurationMap ( configurationMap ) ;
Calamares : : QmlViewStep : : setConfigurationMap ( configurationMap ) ; // call parent implementation last
setContextProperty ( " Users " , m_config ) ;