Commit a86a8970 authored by Anthony Léonard's avatar Anthony Léonard

Display registered name in CallWidget

If the current account is registered on the name service,
we now display the name on the welcome page instead of
the full RingID.

The QRCode still contains the RingID.

Change-Id: Ie44521c83cd2162eacc6ede03f23492b8a1cce12
Tuleap: #1418
parent 1680f70c
......@@ -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());
}
}
}
......
......@@ -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);
};
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