diff --git a/src/modules/usersq/UsersQmlViewStep.cpp b/src/modules/usersq/UsersQmlViewStep.cpp index bb5fbd9a6..963383c10 100644 --- a/src/modules/usersq/UsersQmlViewStep.cpp +++ b/src/modules/usersq/UsersQmlViewStep.cpp @@ -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 ); diff --git a/src/modules/usersq/UsersQmlViewStep.h b/src/modules/usersq/UsersQmlViewStep.h index c40b35f47..463698199 100644 --- a/src/modules/usersq/UsersQmlViewStep.h +++ b/src/modules/usersq/UsersQmlViewStep.h @@ -22,7 +22,6 @@ #define USERSQMLVIEWSTEP_H #include -//#include "SetHostNameJob.h" #include #include @@ -61,10 +60,7 @@ public: private: Config *m_config; - QList< Calamares::job_ptr > m_jobs; - - QStringList m_defaultGroups; - //SetHostNameJob::Actions m_actions; + Calamares::JobList m_jobs; }; CALAMARES_PLUGIN_FACTORY_DECLARATION( UsersQmlViewStepFactory ) diff --git a/src/modules/usersq/usersq.qml b/src/modules/usersq/usersq.qml index 42bb6321d..64cbea85e 100644 --- a/src/modules/usersq/usersq.qml +++ b/src/modules/usersq/usersq.qml @@ -75,7 +75,7 @@ Kirigami.ScrollablePage { radius: 2 opacity: 0.9 //border.color: _userNameField.text === "" ? Kirigami.Theme.backgroundColor : ( config.fullNameReady ? Kirigami.Theme.backgroundColor : Kirigami.Theme.negativeTextColor) - border.color: _userNameField.text === "" ? "#FBFBFB" : ( config.fullNameReady ? "#FBFBFB" : Kirigami.Theme.negativeTextColor) + border.color: _userNameField.text === "" ? "#FBFBFB" : ( config.fullNameChanged ? "#FBFBFB" : Kirigami.Theme.negativeTextColor) } } } @@ -97,14 +97,14 @@ Kirigami.ScrollablePage { width: parent.width placeholderText: qsTr("Login Name") //text: config.userName - onTextEdited: config.loginNameChanged(text) + onTextEdited: config.loginNameStatusChanged(text) background: Rectangle { color: "#FBFBFB" // Kirigami.Theme.backgroundColor opacity: 0.9 //border.color: _userLoginField.text === "" ? Kirigami.Theme.backgroundColor : ( config.userNameReady ? Kirigami.Theme.backgroundColor : Kirigami.Theme.negativeTextColor) - border.color: _userLoginField.text === "" ? "#FBFBFB" : ( config.userNameReady ? "#FBFBFB" : Kirigami.Theme.negativeTextColor) + border.color: _userLoginField.text === "" ? "#FBFBFB" : ( config.loginNameStatusChanged ? "#FBFBFB" : Kirigami.Theme.negativeTextColor) } } @@ -135,13 +135,13 @@ Kirigami.ScrollablePage { width: parent.width placeholderText: qsTr("Computer Name") text: config.hostName - onTextEdited: config.hostNameChanged(text) + onTextEdited: config.hostNameStatusChanged(text) background: Rectangle { color: "#FBFBFB" // Kirigami.Theme.backgroundColor opacity: 0.9 - //border.color: _hostName.text === "" ? Kirigami.Theme.backgroundColor : ( config.hostNameReady ? Kirigami.Theme.backgroundColor : Kirigami.Theme.negativeTextColor) - border.color: _hostName.text === "" ? "#FBFBFB" : ( config.hostNameReady ? "#FBFBFB" : Kirigami.Theme.negativeTextColor) + //border.color: _hostName.text === "" ? Kirigami.Theme.backgroundColor : ( config.hostNameStatusChanged ? Kirigami.Theme.backgroundColor : Kirigami.Theme.negativeTextColor) + border.color: _hostName.text === "" ? "#FBFBFB" : ( config.hostNameStatusChanged ? "#FBFBFB" : Kirigami.Theme.negativeTextColor) } } @@ -178,14 +178,14 @@ Kirigami.ScrollablePage { echoMode: TextInput.Password passwordMaskDelay: 300 inputMethodHints: Qt.ImhNoAutoUppercase - onTextChanged: config.userPasswordChanged(text, _verificationPasswordField.text) + onTextChanged: config.userPasswordStatusChanged(text, _verificationPasswordField.text) background: Rectangle { color: "#FBFBFB" // Kirigami.Theme.backgroundColor opacity: 0.9 //border.color: _passwordField.text === "" ? Kirigami.Theme.backgroundColor : ( config.passwordReady ? Kirigami.Theme.backgroundColor : Kirigami.Theme.negativeTextColor) - border.color: _passwordField.text === "" ? "#FBFBFB" : ( config.passwordReady ? "#FBFBFB" : Kirigami.Theme.negativeTextColor) + border.color: _passwordField.text === "" ? "#FBFBFB" : ( config.userPasswordStatusChanged ? "#FBFBFB" : Kirigami.Theme.negativeTextColor) } } @@ -204,7 +204,7 @@ Kirigami.ScrollablePage { color: "#FBFBFB" //Kirigami.Theme.backgroundColor opacity: 0.9 //border.color: _verificationpasswordField.text === "" ? Kirigami.Theme.backgroundColor : ( config.passwordReady ? Kirigami.Theme.backgroundColor : Kirigami.Theme.negativeTextColor) - border.color: _verificationpasswordField.text === "" ? "#FBFBFB" : ( config.passwordReady ? "#FBFBFB" : Kirigami.Theme.negativeTextColor) + border.color: _verificationPasswordField.text === "" ? "#FBFBFB" : ( config.userPasswordSecondaryChanged ? "#FBFBFB" : Kirigami.Theme.negativeTextColor) } } }