diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-12-14 14:41:40 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-12-14 14:41:40 -0600 |
commit | 37d282b7a12c884f8441317c89ee3703bd29210c (patch) | |
tree | e288e136e747295458ce1cf205704d7346ec34d3 /ui/qt5/useraccountwidget.cc | |
parent | a4dccc7bc996a62a2887bcf904ddabab9c684b00 (diff) | |
download | horizon-37d282b7a12c884f8441317c89ee3703bd29210c.tar.gz horizon-37d282b7a12c884f8441317c89ee3703bd29210c.tar.bz2 horizon-37d282b7a12c884f8441317c89ee3703bd29210c.tar.xz horizon-37d282b7a12c884f8441317c89ee3703bd29210c.zip |
Qt UI: Skip empty components of GECOS name when creating username
Diffstat (limited to 'ui/qt5/useraccountwidget.cc')
-rw-r--r-- | ui/qt5/useraccountwidget.cc | 4 |
1 files changed, 3 insertions, 1 deletions
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(); }); |