Commit 199a575c authored by Anthony Léonard's avatar Anthony Léonard

account: give a default alias when left empty

In the wizard dialog, we now set a default alias if user decides
not to give one. Such an account is referred under a generic
“Ring account” in the settings panel.

Change-Id: If07644cee0246486b5a0418a97abfb1734982639
Tuleap: #1625
parent 2075ba22
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include "utils.h" #include "utils.h"
#include "photoboothdialog.h" #include "photoboothdialog.h"
const QString DEFAULT_RING_ACCT_ALIAS = QObject::tr("Ring account", "Default alias for new Ring account");
WizardDialog::WizardDialog(WizardMode wizardMode, Account* toBeMigrated, QWidget* parent) : WizardDialog::WizardDialog(WizardMode wizardMode, Account* toBeMigrated, QWidget* parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::WizardDialog), ui(new Ui::WizardDialog),
...@@ -113,7 +115,8 @@ WizardDialog::accept() ...@@ -113,7 +115,8 @@ WizardDialog::accept()
Utils::CreateStartupLink(); Utils::CreateStartupLink();
if (account_ == nullptr) { if (account_ == nullptr) {
account_ = AccountModel::instance().add(ui->usernameEdit->text(), Account::Protocol::RING); QString accountAlias = (ui->usernameEdit->text().isEmpty())? DEFAULT_RING_ACCT_ALIAS : ui->usernameEdit->text();
account_ = AccountModel::instance().add(accountAlias, Account::Protocol::RING);
if (not ui->fullNameEdit->text().isEmpty()) { if (not ui->fullNameEdit->text().isEmpty()) {
account_->setDisplayName(ui->fullNameEdit->text()); account_->setDisplayName(ui->fullNameEdit->text());
profile->person()->setFormattedName(ui->fullNameEdit->text()); profile->person()->setFormattedName(ui->fullNameEdit->text());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment