Skip to content
Snippets Groups Projects
Commit a86a8970 authored by Anthony Léonard's avatar Anthony Léonard
Browse files

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
Branches
Tags
No related merge requests found
...@@ -332,18 +332,23 @@ CallWidget::findRingAccount(QModelIndex idx1, QModelIndex idx2, QVector<int> vec ...@@ -332,18 +332,23 @@ CallWidget::findRingAccount(QModelIndex idx1, QModelIndex idx2, QVector<int> vec
auto idx = AccountModel::instance().index(i, 0); auto idx = AccountModel::instance().index(i, 0);
auto protocol = idx.data(static_cast<int>(Account::Role::Proto)); auto protocol = idx.data(static_cast<int>(Account::Role::Proto));
if (static_cast<Account::Protocol>(protocol.toUInt()) == Account::Protocol::RING) { 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)); auto username = idx.data(static_cast<int>(Account::Role::Username));
if (registeredName.isEmpty()) {
ui->ringIdLabel->setText(username.toString()); ui->ringIdLabel->setText(username.toString());
setupQRCode(); } else
ui->ringIdLabel->setText(registeredName);
setupQRCode(username.toString());
return; return;
} }
} }
ui->ringIdLabel->setText(tr("NO RING ACCOUNT FOUND")); 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 0, //Let the version be decided by libqrencode
QR_ECLEVEL_L, // Lowest level of error correction QR_ECLEVEL_L, // Lowest level of error correction
QR_MODE_8, // 8-bit data mode QR_MODE_8, // 8-bit data mode
...@@ -396,9 +401,9 @@ CallWidget::findRingAccount() ...@@ -396,9 +401,9 @@ CallWidget::findRingAccount()
dlg.exec(); dlg.exec();
} }
if (ui->ringIdLabel->text().isEmpty()) { if (ui->ringIdLabel->text().isEmpty()) {
auto username = account->username(); auto registeredName = account->registeredName();
ui->ringIdLabel->setText(username); ui->ringIdLabel->setText((registeredName.isEmpty())?account->username():registeredName);
setupQRCode(); setupQRCode(account->username());
} }
} }
} }
......
...@@ -126,7 +126,7 @@ private: ...@@ -126,7 +126,7 @@ private:
void setupSmartListMenu(); void setupSmartListMenu();
void slidePage(QWidget* widget, bool toRight = false); void slidePage(QWidget* widget, bool toRight = false);
void callStateToView(Call* value); void callStateToView(Call* value);
void setupQRCode(); void setupQRCode(QString ringID);
void searchContactLineEditEntry(const URI &uri); void searchContactLineEditEntry(const URI &uri);
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment