From f7e07926f1b3d8b35ade68dc9416802f03a6ca67 Mon Sep 17 00:00:00 2001 From: Isa Nanic <isa.nanic@savoirfairelinux.com> Date: Mon, 29 Oct 2018 10:52:05 -0400 Subject: [PATCH] ux: modify second id displayed in AccountListModel Change-Id: Ie7a50eff8ef855c48485556544e0be50a252c7ce Reviewed-by: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> --- accountitemdelegate.cpp | 3 ++- accountlistmodel.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/accountitemdelegate.cpp b/accountitemdelegate.cpp index 2620697..ce8d965 100644 --- a/accountitemdelegate.cpp +++ b/accountitemdelegate.cpp @@ -112,7 +112,8 @@ AccountItemDelegate::paint(QPainter* painter, painter->drawText(rectTexts, Qt::AlignVCenter | Qt::AlignLeft, nameStr); } - // Display the ID under the name + // Display the secondary ID under the name + QString idStr = index.data(static_cast<int>(AccountListModel::Role::Username)).value<QString>(); if (idStr != name.toString()) { font.setItalic(false); diff --git a/accountlistmodel.cpp b/accountlistmodel.cpp index 0297d43..a418e7b 100644 --- a/accountlistmodel.cpp +++ b/accountlistmodel.cpp @@ -62,7 +62,7 @@ QVariant AccountListModel::data(const QModelIndex &index, int role) const case Qt::DisplayRole: return QVariant(QString::fromStdString(accountInfo.profileInfo.alias)); case Role::Username: - return QVariant(QString::fromStdString(accountInfo.profileInfo.uri)); + return QVariant(QString::fromStdString(Utils::secondBestNameForAccount(accountInfo))); case Role::Type: return QVariant(Utils::toUnderlyingValue<lrc::api::profile::Type>(accountInfo.profileInfo.type)); case Role::Status: -- GitLab