diff --git a/callwidget.cpp b/callwidget.cpp index ee5a94fe51ced1f2b08395a4196778d6fcd14712..5dfe0d841aa4c9b1d5ac07cadcc8877abd31452b 100644 --- a/callwidget.cpp +++ b/callwidget.cpp @@ -332,18 +332,23 @@ CallWidget::findRingAccount(QModelIndex idx1, QModelIndex idx2, QVector<int> vec auto idx = AccountModel::instance().index(i, 0); auto protocol = idx.data(static_cast<int>(Account::Role::Proto)); if (static_cast<Account::Protocol>(protocol.toUInt()) == Account::Protocol::RING) { + auto account = AccountModel::instance().getAccountByModelIndex(idx); + auto registeredName = account->registeredName(); auto username = idx.data(static_cast<int>(Account::Role::Username)); - ui->ringIdLabel->setText(username.toString()); - setupQRCode(); + if (registeredName.isEmpty()) { + ui->ringIdLabel->setText(username.toString()); + } else + ui->ringIdLabel->setText(registeredName); + setupQRCode(username.toString()); return; } } ui->ringIdLabel->setText(tr("NO RING ACCOUNT FOUND")); } -void CallWidget::setupQRCode() +void CallWidget::setupQRCode(QString ringID) { - auto rcode = QRcode_encodeString(ui->ringIdLabel->text().toStdString().c_str(), + auto rcode = QRcode_encodeString(ringID.toStdString().c_str(), 0, //Let the version be decided by libqrencode QR_ECLEVEL_L, // Lowest level of error correction QR_MODE_8, // 8-bit data mode @@ -396,9 +401,9 @@ CallWidget::findRingAccount() dlg.exec(); } if (ui->ringIdLabel->text().isEmpty()) { - auto username = account->username(); - ui->ringIdLabel->setText(username); - setupQRCode(); + auto registeredName = account->registeredName(); + ui->ringIdLabel->setText((registeredName.isEmpty())?account->username():registeredName); + setupQRCode(account->username()); } } } diff --git a/callwidget.h b/callwidget.h index 274cfd984c63d17fa876f8120aa60b9ac9f1a4e8..2ed1ca097599861aad2e7a6ba661b8443c963d69 100644 --- a/callwidget.h +++ b/callwidget.h @@ -126,7 +126,7 @@ private: void setupSmartListMenu(); void slidePage(QWidget* widget, bool toRight = false); void callStateToView(Call* value); - void setupQRCode(); + void setupQRCode(QString ringID); void searchContactLineEditEntry(const URI &uri); };