From dbba0c9b039b1c06895411b09b4cf97c75be6b47 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 17 Feb 2020 15:56:41 +0100 Subject: [PATCH] [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. --- src/modules/users/UsersPage.cpp | 9 --------- src/modules/users/UsersViewStep.cpp | 17 +++++++++++++++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/modules/users/UsersPage.cpp b/src/modules/users/UsersPage.cpp index f2b9187af..21f472a40 100644 --- a/src/modules/users/UsersPage.cpp +++ b/src/modules/users/UsersPage.cpp @@ -217,19 +217,10 @@ UsersPage::createJobs( const QStringList& defaultGroupsList ) defaultGroupsList ); list.append( Calamares::job_ptr( j ) ); - j = new SetPasswordJob( ui->textBoxUsername->text(), ui->textBoxUserPassword->text() ); - list.append( Calamares::job_ptr( j ) ); - if ( m_writeRootPassword ) { 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() ); if ( ui->checkBoxAutoLogin->isChecked() ) { diff --git a/src/modules/users/UsersViewStep.cpp b/src/modules/users/UsersViewStep.cpp index 0f42d1476..363328495 100644 --- a/src/modules/users/UsersViewStep.cpp +++ b/src/modules/users/UsersViewStep.cpp @@ -20,9 +20,10 @@ #include "UsersViewStep.h" +#include "SetHostNameJob.h" +#include "SetPasswordJob.h" #include "UsersPage.h" -// #include "utils/CalamaresUtils.h" #include "utils/Logger.h" #include "utils/Variant.h" @@ -109,8 +110,20 @@ void UsersViewStep::onLeave() { m_jobs.clear(); - 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 ) ); }