From 37d282b7a12c884f8441317c89ee3703bd29210c Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 14 Dec 2019 14:41:40 -0600 Subject: Qt UI: Skip empty components of GECOS name when creating username --- ui/qt5/horizonwizard.cc | 1 + ui/qt5/useraccountwidget.cc | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/qt5/horizonwizard.cc b/ui/qt5/horizonwizard.cc index ccf6b8f..4364f90 100644 --- a/ui/qt5/horizonwizard.cc +++ b/ui/qt5/horizonwizard.cc @@ -337,6 +337,7 @@ QString HorizonWizard::toHScript() { lines << "pkginstall adelie-base links tmux"; break; case Custom: + lines << "pkginstall adelie-base-posix"; lines << ("pkginstall " + packages.join(" ")); break; } diff --git a/ui/qt5/useraccountwidget.cc b/ui/qt5/useraccountwidget.cc index 85fd71d..9151572 100644 --- a/ui/qt5/useraccountwidget.cc +++ b/ui/qt5/useraccountwidget.cc @@ -101,7 +101,7 @@ UserAccountWidget::UserAccountWidget(QWidget *parent) .normalized(QString::NormalizationForm_KC) /* Casefold */ .toLower(); - QStringList components = result.split(" "); + QStringList components = result.split(" ", QString::SkipEmptyParts); if(components.size() > 1) { result = ""; for(int next = 0; next < components.size() - 1; next++) { @@ -109,6 +109,8 @@ UserAccountWidget::UserAccountWidget(QWidget *parent) } result += components.at(components.size() - 1); } + /* if SkipEmptyParts causes components to be 1, but still has space */ + result.replace(" ", ""); accountName->setText(result.left(32)); emit validityChanged(); }); -- cgit v1.2.3-60-g2f50