[users] Move GlobalStorage wrangling to config

- the whole fill-GS method is a bit weird, since you might want
  to reflect that "live" in GS instead.
main
Adriaan de Groot 4 years ago
parent 5db4195b7e
commit eb44d0c6be

@ -647,3 +647,15 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
}
std::sort( m_passwordChecks.begin(), m_passwordChecks.end() );
}
void
Config::finalizeGlobalStorage() const
{
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
if ( writeRootPassword() )
{
gs->insert( "reuseRootPassword", reuseUserPasswordForRoot() );
}
gs->insert( "password", CalamaresUtils::obscure( userPassword() ) );
}

@ -116,6 +116,13 @@ public:
void setConfigurationMap( const QVariantMap& );
/** @brief Fill Global Storage with some settings
*
* This should be called when moving on from the view step,
* and copies some things to GS that otherwise would not.
*/
void finalizeGlobalStorage() const;
/** @brief Full path to the user's shell executable
*
* Typically this will be /bin/bash, but it can be set from

@ -209,23 +209,6 @@ UsersPage::isReady() const
return readyFields;
}
void
UsersPage::fillGlobalStorage() const
{
if ( !isReady() )
{
return;
}
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
if ( m_config->writeRootPassword() )
{
gs->insert( "reuseRootPassword", ui->checkBoxReusePassword->isChecked() );
}
gs->insert( "password", CalamaresUtils::obscure( ui->textBoxUserPassword->text() ) );
}
void
UsersPage::onActivate()

@ -44,8 +44,6 @@ public:
bool isReady() const;
void fillGlobalStorage() const;
void onActivate();
protected slots:

@ -143,7 +143,7 @@ UsersViewStep::onLeave()
j = new SetHostNameJob( m_config->hostName(), m_config->hostNameActions() );
m_jobs.append( Calamares::job_ptr( j ) );
m_widget->fillGlobalStorage();
m_config->finalizeGlobalStorage();
}

Loading…
Cancel
Save