[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.
This commit is contained in:
Adriaan de Groot 2020-08-17 15:30:09 +02:00
parent 5db4195b7e
commit eb44d0c6be
5 changed files with 20 additions and 20 deletions

View File

@ -647,3 +647,15 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
} }
std::sort( m_passwordChecks.begin(), m_passwordChecks.end() ); 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() ) );
}

View File

@ -116,6 +116,13 @@ public:
void setConfigurationMap( const QVariantMap& ); 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 /** @brief Full path to the user's shell executable
* *
* Typically this will be /bin/bash, but it can be set from * Typically this will be /bin/bash, but it can be set from

View File

@ -209,23 +209,6 @@ UsersPage::isReady() const
return readyFields; 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 void
UsersPage::onActivate() UsersPage::onActivate()

View File

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

View File

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