[users] Move Job creation from the widget to the ViewStep

- Having the widget do creation ties the step heavily to that UI;
   start moving towards a state where we have a Config object (not
   here yet; it still queries the UI part) that moves data around
   between UI and ViewStep.
This commit is contained in:
Adriaan de Groot 2020-02-17 15:56:41 +01:00
parent 2471e74aab
commit dbba0c9b03
2 changed files with 15 additions and 11 deletions

View File

@ -217,19 +217,10 @@ UsersPage::createJobs( const QStringList& defaultGroupsList )
defaultGroupsList ); defaultGroupsList );
list.append( Calamares::job_ptr( j ) ); list.append( Calamares::job_ptr( j ) );
j = new SetPasswordJob( ui->textBoxUsername->text(), ui->textBoxUserPassword->text() );
list.append( Calamares::job_ptr( j ) );
if ( m_writeRootPassword ) if ( m_writeRootPassword )
{ {
gs->insert( "reuseRootPassword", ui->checkBoxReusePassword->isChecked() ); gs->insert( "reuseRootPassword", ui->checkBoxReusePassword->isChecked() );
} }
j = new SetPasswordJob( "root", getRootPassword() );
list.append( Calamares::job_ptr( j ) );
j = new SetHostNameJob( getHostname(), SetHostNameJob::Action::EtcHostname | SetHostNameJob::Action::EtcHosts );
list.append( Calamares::job_ptr( j ) );
gs->insert( "hostname", ui->textBoxHostname->text() ); gs->insert( "hostname", ui->textBoxHostname->text() );
if ( ui->checkBoxAutoLogin->isChecked() ) if ( ui->checkBoxAutoLogin->isChecked() )
{ {

View File

@ -20,9 +20,10 @@
#include "UsersViewStep.h" #include "UsersViewStep.h"
#include "SetHostNameJob.h"
#include "SetPasswordJob.h"
#include "UsersPage.h" #include "UsersPage.h"
// #include "utils/CalamaresUtils.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/Variant.h" #include "utils/Variant.h"
@ -109,8 +110,20 @@ void
UsersViewStep::onLeave() UsersViewStep::onLeave()
{ {
m_jobs.clear(); m_jobs.clear();
m_jobs.append( m_widget->createJobs( m_defaultGroups ) ); m_jobs.append( m_widget->createJobs( m_defaultGroups ) );
Calamares::Job* j;
auto userPW = m_widget->getUserPassword();
j = new SetPasswordJob( userPW.first, userPW.second );
m_jobs.append( Calamares::job_ptr( j ) );
j = new SetPasswordJob( "root", m_widget->getRootPassword() );
m_jobs.append( Calamares::job_ptr( j ) );
j = new SetHostNameJob( m_widget->getHostname(),
SetHostNameJob::Action::EtcHostname | SetHostNameJob::Action::EtcHosts );
m_jobs.append( Calamares::job_ptr( j ) );
} }