ux: add name registration to settings

Change-Id: I7ea11b56984b4aad989d145bb92328cb676c85b4
diff --git a/settingswidget.cpp b/settingswidget.cpp
index c6e12f8..c81dd15 100644
--- a/settingswidget.cpp
+++ b/settingswidget.cpp
@@ -247,8 +247,6 @@
     ui->currentRegisteredID->setText(QString::fromStdString(LRCInstance::getCurrentAccountInfo().registeredName));
     ui->currentRingID->setText(QString::fromStdString(LRCInstance::getCurrentAccountInfo().profileInfo.uri));
 
-    ui->currentRegisteredID->setReadOnly(true);
-
 // if no registered name is found for account
     if (LRCInstance::getCurrentAccountInfo().registeredName.empty()) {
         ui->currentRegisteredID->setReadOnly(false);
@@ -367,8 +365,7 @@
     QRegularExpression regExp(" ");
     if (regName.size() > 2 && !regName.contains(regExp)) {
         return true;
-    }
-    else {
+    } else {
         return false;
     }
 }
@@ -444,7 +441,6 @@
         ui->regNameButton->setEnabled(true);
 
         connect(ui->regNameButton, &QPushButton::clicked, this, &SettingsWidget::regNameRegisteredSlot);
-
         break;
 
     case RegName::SEARCHING:
@@ -455,11 +451,12 @@
         connect(gif, SIGNAL(frameChanged(int)), this, SLOT(setButtonIconSlot(int)));
         gif->start();
         ui->regNameButton->setEnabled(false);
-
         break;
     }
 }
-void SettingsWidget::setButtonIconSlot(int frame)
+
+void
+SettingsWidget::setButtonIconSlot(int frame)
 {
     Q_UNUSED(frame);
     ui->regNameButton->setIcon(QIcon(gif->currentPixmap()));
@@ -471,10 +468,13 @@
     if (!regNameBtn_) { return; }
 
     RegNameDialog regNameDialog(registeredName_, this);
-    if (regNameDialog.exec() == QDialog::Accepted) { // if user confirms regName choice
+    if (regNameDialog.exec() == QDialog::Accepted) {
         ui->currentRegisteredID->setReadOnly(true);
-    }
-    else {
+        ui->currentRegisteredID->setText(registeredName_);
+
+        lrc::api::account::ConfProperties_t accountProperties = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
+        LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), accountProperties);
+    } else {
         ui->currentRegisteredID->setText("");
         registeredName_ = "";
     }
@@ -695,7 +695,7 @@
         this, &SettingsWidget::updateAndShowDevicesSlot);
 
     // account settings setters {
-    connect(ui->accountEnableCheckBox, &QAbstractButton::clicked, this, &SettingsWidget::setAccEnableSlot);
+    connect(ui->accountEnableCheckBox, &QCheckBox::clicked, this, &SettingsWidget::setAccEnableSlot);
 
     connect(ui->displayNameLineEdit, &QLineEdit::textChanged, [this](const QString& displayName) {
         LRCInstance::setCurrAccDisplayName(displayName.toStdString());
@@ -965,4 +965,4 @@
 SettingsWidget::stopVideo()
 {
     Video::PreviewManager::instance().stopPreview();
-}
\ No newline at end of file
+}