mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-10 12:03:18 +02:00
wizardview: adapt the added best name and id logic in lrc
Note: if the Displayname/alias is the same as the username, it should be the only line shown Gitlab: #129 Change-Id: I2c3dc8d304bd730a2ae114e4686c9ae899087c6b
This commit is contained in:
parent
173cf2be50
commit
be1419c0a6
11 changed files with 140 additions and 215 deletions
|
@ -63,15 +63,16 @@ AccountListModel::data(const QModelIndex& index, int role) const
|
|||
return QVariant();
|
||||
}
|
||||
|
||||
auto& accountInfo = LRCInstance::accountModel().getAccountInfo(accountList.at(index.row()));
|
||||
auto accountId = accountList.at(index.row());
|
||||
auto& accountInfo = LRCInstance::accountModel().getAccountInfo(accountId);
|
||||
|
||||
// Since we are using image provider right now, image url representation should be unique to
|
||||
// be able to use the image cache, account avatar will only be updated once PictureUid changed
|
||||
switch (role) {
|
||||
case Role::Alias:
|
||||
return QVariant(Utils::bestNameForAccount(accountInfo));
|
||||
return QVariant(LRCInstance::accountModel().bestNameForAccount(accountId));
|
||||
case Role::Username:
|
||||
return QVariant(Utils::secondBestNameForAccount(accountInfo));
|
||||
return QVariant(LRCInstance::accountModel().bestIdForAccount(accountId));
|
||||
case Role::Type:
|
||||
return QVariant(static_cast<int>(accountInfo.profileInfo.type));
|
||||
case Role::Status:
|
||||
|
|
|
@ -185,8 +185,8 @@ CallAdapter::slotShowIncomingCallView(const QString& accountId, const conversati
|
|||
if (currentConvHasCall) {
|
||||
auto currentCall = callModel->getCall(currentConvInfo.callId);
|
||||
if ((currentCall.status == lrc::api::call::Status::CONNECTED
|
||||
|| currentCall.status == lrc::api::call::Status::IN_PROGRESS)
|
||||
&& !accountProperties.autoAnswer) {
|
||||
|| currentCall.status == lrc::api::call::Status::IN_PROGRESS)
|
||||
&& !accountProperties.autoAnswer) {
|
||||
showNotification(accountId, convInfo.uid);
|
||||
return;
|
||||
}
|
||||
|
@ -271,9 +271,8 @@ CallAdapter::getConferencesInfos()
|
|||
data["isLocal"] = true;
|
||||
} else {
|
||||
try {
|
||||
auto& contact = LRCInstance::getCurrentAccountInfo()
|
||||
.contactModel->getContact(participant["uri"]);
|
||||
bestName = Utils::bestNameForContact(contact);
|
||||
bestName = LRCInstance::getCurrentAccountInfo()
|
||||
.contactModel->bestNameForContact(participant["uri"]);
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
|
@ -295,10 +294,8 @@ CallAdapter::showNotification(const QString& accountId, const QString& convUid)
|
|||
auto convInfo = LRCInstance::getConversationFromConvUid(convUid, accountId);
|
||||
if (!accountId.isEmpty() && !convInfo.uid.isEmpty()) {
|
||||
auto& accInfo = LRCInstance::getAccountInfo(accountId);
|
||||
if (!convInfo.participants.isEmpty()) {
|
||||
auto& contact = accInfo.contactModel->getContact(convInfo.participants[0]);
|
||||
from = Utils::bestNameForContact(contact);
|
||||
}
|
||||
if (!convInfo.participants.isEmpty())
|
||||
from = accInfo.contactModel->bestNameForContact(convInfo.participants[0]);
|
||||
}
|
||||
|
||||
auto onClicked = [this, convInfo]() {
|
||||
|
@ -356,7 +353,8 @@ CallAdapter::connectCallModel(const QString& accountId)
|
|||
try {
|
||||
auto& contact = LRCInstance::getCurrentAccountInfo()
|
||||
.contactModel->getContact(participant["uri"]);
|
||||
bestName = Utils::bestNameForContact(contact);
|
||||
bestName = LRCInstance::getCurrentAccountInfo()
|
||||
.contactModel->bestNameForContact(participant["uri"]);
|
||||
if (participant["videoMuted"] == "true")
|
||||
data["avatar"] = contact.profileInfo.avatar;
|
||||
} catch (...) {
|
||||
|
@ -480,6 +478,9 @@ CallAdapter::updateCallOverlay(const lrc::api::conversation::Info& convInfo)
|
|||
bool isAudioMuted = call->audioMuted && (call->status != lrc::api::call::Status::PAUSED);
|
||||
bool isVideoMuted = call->videoMuted && !isPaused && !call->isAudioOnly;
|
||||
bool isRecording = isRecordingThisCall();
|
||||
auto bestName = convInfo.participants.isEmpty()
|
||||
? QString()
|
||||
: accInfo.contactModel->bestNameForContact(convInfo.participants[0]);
|
||||
|
||||
emit updateOverlay(isPaused,
|
||||
isAudioOnly,
|
||||
|
@ -488,8 +489,7 @@ CallAdapter::updateCallOverlay(const lrc::api::conversation::Info& convInfo)
|
|||
isRecording,
|
||||
accInfo.profileInfo.type == lrc::api::profile::Type::SIP,
|
||||
!convInfo.confId.isEmpty(),
|
||||
Utils::bestNameForConversation(convInfo,
|
||||
*LRCInstance::getCurrentConversationModel()));
|
||||
bestName);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -144,7 +144,7 @@ ConversationsAdapter::onNewUnreadInteraction(const QString& accountId,
|
|||
|| convUid != LRCInstance::getCurrentConvUid())) {
|
||||
auto& accInfo = LRCInstance::getAccountInfo(accountId);
|
||||
auto& contact = accInfo.contactModel->getContact(interaction.authorUri);
|
||||
auto from = Utils::bestNameForContact(contact);
|
||||
auto from = accInfo.contactModel->bestNameForContact(interaction.authorUri);
|
||||
auto onClicked = [this, accountId, convUid, uri = interaction.authorUri] {
|
||||
#ifdef Q_OS_WINDOWS
|
||||
emit LRCInstance::instance().notificationClicked();
|
||||
|
|
|
@ -69,63 +69,75 @@ ComboBox {
|
|||
AccountListModel.Status)
|
||||
}
|
||||
|
||||
Text {
|
||||
id: textUserAliasRoot
|
||||
|
||||
ColumnLayout {
|
||||
anchors.left: userImageRoot.right
|
||||
anchors.leftMargin: 16
|
||||
anchors.top: background.top
|
||||
anchors.topMargin: 16
|
||||
|
||||
text: textMetricsUserAliasRoot.elidedText
|
||||
font.pointSize: JamiTheme.textFontSize
|
||||
}
|
||||
height: root.height
|
||||
|
||||
ResponsiveImage {
|
||||
id: arrowDropDown
|
||||
spacing: 0
|
||||
|
||||
anchors.left: textUserAliasRoot.right
|
||||
anchors.verticalCenter: textUserAliasRoot.verticalCenter
|
||||
RowLayout {
|
||||
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
|
||||
Layout.topMargin: textUsernameRoot.visible ? root.height / 2 - implicitHeight : 0
|
||||
|
||||
width: 24
|
||||
height: 24
|
||||
Text {
|
||||
id: textUserAliasRoot
|
||||
|
||||
source: "qrc:/images/icons/round-arrow_drop_down-24px.svg"
|
||||
}
|
||||
Layout.alignment: Qt.AlignLeft
|
||||
|
||||
Text {
|
||||
id: textUsernameRoot
|
||||
text: textMetricsUserAliasRoot.elidedText
|
||||
font.pointSize: JamiTheme.textFontSize
|
||||
|
||||
anchors.left: userImageRoot.right
|
||||
anchors.leftMargin: 16
|
||||
anchors.top: textUserAliasRoot.bottom
|
||||
TextMetrics {
|
||||
id: textMetricsUserAliasRoot
|
||||
|
||||
text: textMetricsUsernameRoot.elidedText
|
||||
font.pointSize: JamiTheme.textFontSize
|
||||
color: JamiTheme.faddedLastInteractionFontColor
|
||||
}
|
||||
font: textUserAliasRoot.font
|
||||
elide: Text.ElideRight
|
||||
elideWidth: root.width - userImageRoot.width - settingsButton.width
|
||||
- arrowDropDown.width - qrCodeGenerateButton.width - 55
|
||||
|
||||
TextMetrics {
|
||||
id: textMetricsUserAliasRoot
|
||||
text: accountListModel.data(accountListModel.index(0,0), AccountListModel.Alias)
|
||||
}
|
||||
}
|
||||
|
||||
font: textUserAliasRoot.font
|
||||
elide: Text.ElideRight
|
||||
elideWidth: root.width - userImageRoot.width - settingsButton.width
|
||||
- arrowDropDown.width - qrCodeGenerateButton.width - 55
|
||||
ResponsiveImage {
|
||||
id: arrowDropDown
|
||||
|
||||
text: accountListModel.data(accountListModel.index(0,0), AccountListModel.Alias)
|
||||
}
|
||||
Layout.alignment: Qt.AlignRight
|
||||
|
||||
TextMetrics {
|
||||
id: textMetricsUsernameRoot
|
||||
width: 24
|
||||
height: 24
|
||||
|
||||
font: textUsernameRoot.font
|
||||
elide: Text.ElideRight
|
||||
elideWidth: root.width - userImageRoot.width - settingsButton.width
|
||||
- qrCodeGenerateButton.width - 55
|
||||
source: "qrc:/images/icons/round-arrow_drop_down-24px.svg"
|
||||
}
|
||||
}
|
||||
|
||||
text: accountListModel.data(accountListModel.index(0,0),
|
||||
AccountListModel.Username)
|
||||
Text {
|
||||
id: textUsernameRoot
|
||||
|
||||
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
|
||||
Layout.bottomMargin: root.height / 2 - implicitHeight
|
||||
|
||||
visible: textMetricsUsernameRoot.text.length
|
||||
|
||||
text: textMetricsUsernameRoot.elidedText
|
||||
font.pointSize: JamiTheme.textFontSize
|
||||
color: JamiTheme.faddedLastInteractionFontColor
|
||||
|
||||
TextMetrics {
|
||||
id: textMetricsUsernameRoot
|
||||
|
||||
font: textUsernameRoot.font
|
||||
elide: Text.ElideRight
|
||||
elideWidth: root.width - userImageRoot.width - settingsButton.width
|
||||
- qrCodeGenerateButton.width - 55
|
||||
|
||||
text: accountListModel.data(accountListModel.index(0,0),
|
||||
AccountListModel.Username)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
|
|
|
@ -49,7 +49,14 @@ Popup {
|
|||
clip: true
|
||||
model: accountListModel
|
||||
implicitHeight: contentHeight
|
||||
delegate: ItemDelegate {
|
||||
delegate: Rectangle {
|
||||
id: delegate
|
||||
|
||||
width: root.width
|
||||
height: accountComboBox.height
|
||||
|
||||
color: JamiTheme.backgroundColor
|
||||
|
||||
AvatarImage {
|
||||
id: userImage
|
||||
|
||||
|
@ -71,68 +78,71 @@ Popup {
|
|||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: textUserAliasPopup
|
||||
|
||||
ColumnLayout {
|
||||
anchors.left: userImage.right
|
||||
anchors.leftMargin: 10
|
||||
anchors.top: itemComboBackground.top
|
||||
anchors.topMargin: 15
|
||||
anchors.leftMargin: 16
|
||||
anchors.top: delegate.top
|
||||
|
||||
text: textMetricsUserAliasPopup.elidedText
|
||||
font.pointSize: JamiTheme.textFontSize
|
||||
}
|
||||
height: delegate.height
|
||||
|
||||
Text {
|
||||
id: textUsernamePopup
|
||||
spacing: 0
|
||||
|
||||
anchors.left: userImage.right
|
||||
anchors.leftMargin: 10
|
||||
anchors.top: textUserAliasPopup.bottom
|
||||
Text {
|
||||
id: textUserAliasPopup
|
||||
|
||||
text: textMetricsUsernamePopup.elidedText
|
||||
font.pointSize: JamiTheme.textFontSize
|
||||
color: JamiTheme.faddedLastInteractionFontColor
|
||||
}
|
||||
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
|
||||
Layout.topMargin: textUsernamePopup.visible ?
|
||||
delegate.height / 2 - implicitHeight : 0
|
||||
|
||||
TextMetrics {
|
||||
id: textMetricsUserAliasPopup
|
||||
elide: Text.ElideRight
|
||||
elideWidth: accountComboBox.width - userImage.width - settingsButton.width - 30
|
||||
text: Alias
|
||||
}
|
||||
text: textMetricsUserAliasPopup.elidedText
|
||||
font.pointSize: JamiTheme.textFontSize
|
||||
|
||||
TextMetrics {
|
||||
id: textMetricsUsernamePopup
|
||||
elide: Text.ElideRight
|
||||
elideWidth: accountComboBox.width - userImage.width - settingsButton.width - 30
|
||||
text: Username
|
||||
}
|
||||
TextMetrics {
|
||||
id: textMetricsUserAliasPopup
|
||||
elide: Text.ElideRight
|
||||
elideWidth: delegate.width - userImage.width - 80
|
||||
text: Alias
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
id: itemComboBackground
|
||||
color: JamiTheme.backgroundColor
|
||||
implicitWidth: accountComboBox.width
|
||||
implicitHeight: accountComboBox.height
|
||||
Text {
|
||||
id: textUsernamePopup
|
||||
|
||||
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
|
||||
Layout.bottomMargin: delegate.height / 2 - implicitHeight
|
||||
|
||||
visible: textMetricsUsernamePopup.text.length
|
||||
|
||||
text: textMetricsUsernamePopup.elidedText
|
||||
font.pointSize: JamiTheme.textFontSize
|
||||
color: JamiTheme.faddedLastInteractionFontColor
|
||||
|
||||
TextMetrics {
|
||||
id: textMetricsUsernamePopup
|
||||
elide: Text.ElideRight
|
||||
elideWidth: delegate.width - userImage.width - 80
|
||||
text: Username
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onPressed: {
|
||||
itemComboBackground.color = JamiTheme.pressColor
|
||||
delegate.color = JamiTheme.pressColor
|
||||
}
|
||||
onReleased: {
|
||||
itemComboBackground.color = JamiTheme.normalButtonColor
|
||||
delegate.color = JamiTheme.normalButtonColor
|
||||
currentIndex = index
|
||||
root.close()
|
||||
AccountAdapter.accountChanged(index)
|
||||
}
|
||||
onEntered: {
|
||||
itemComboBackground.color = JamiTheme.hoverColor
|
||||
delegate.color = JamiTheme.hoverColor
|
||||
}
|
||||
onExited: {
|
||||
itemComboBackground.color = JamiTheme.backgroundColor
|
||||
delegate.color = JamiTheme.backgroundColor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -448,7 +448,7 @@ MessagesAdapter::setConversationProfileData(const lrc::api::conversation::Info&
|
|||
}
|
||||
try {
|
||||
auto& contact = accInfo->contactModel->getContact(contactUri);
|
||||
auto bestName = Utils::bestNameForConversation(convInfo, *convModel);
|
||||
auto bestName = accInfo->contactModel->bestNameForContact(contactUri);
|
||||
setInvitation(contact.profileInfo.type == lrc::api::profile::Type::PENDING
|
||||
|| contact.profileInfo.type == lrc::api::profile::Type::TEMPORARY,
|
||||
bestName,
|
||||
|
|
|
@ -260,7 +260,7 @@ SettingsAdapter::getCurrentAccount_Profile_Info_Type()
|
|||
QString
|
||||
SettingsAdapter::getAccountBestName()
|
||||
{
|
||||
return Utils::bestNameForAccount(LRCInstance::getCurrentAccountInfo());
|
||||
return LRCInstance::accountModel().bestNameForAccount(LRCInstance::getCurrAccId());
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -277,17 +277,13 @@ SmartListModel::getConversationItemData(const conversation::Info& item,
|
|||
// be able to use the image cache, account avatar will only be updated once PictureUid changed
|
||||
switch (role) {
|
||||
case Role::DisplayName: {
|
||||
if (!item.participants.isEmpty()) {
|
||||
auto& contact = contactModel->getContact(item.participants[0]);
|
||||
return QVariant(Utils::bestNameForContact(contact));
|
||||
}
|
||||
if (!item.participants.isEmpty())
|
||||
return QVariant(contactModel->bestNameForContact(item.participants[0]));
|
||||
return QVariant("");
|
||||
}
|
||||
case Role::DisplayID: {
|
||||
if (!item.participants.isEmpty()) {
|
||||
auto& contact = contactModel->getContact(item.participants[0]);
|
||||
return QVariant(Utils::bestIdForContact(contact));
|
||||
}
|
||||
if (!item.participants.isEmpty())
|
||||
return QVariant(contactModel->bestIdForContact(item.participants[0]));
|
||||
return QVariant("");
|
||||
}
|
||||
case Role::Presence: {
|
||||
|
|
|
@ -256,8 +256,8 @@ Utils::contactPhoto(const QString& contactUri, const QSize& size)
|
|||
auto& accountInfo = LRCInstance::accountModel().getAccountInfo(LRCInstance::getCurrAccId());
|
||||
auto contactInfo = accountInfo.contactModel->getContact(contactUri);
|
||||
auto contactPhoto = contactInfo.profileInfo.avatar;
|
||||
auto bestName = Utils::bestNameForContact(contactInfo);
|
||||
auto bestId = Utils::bestIdForContact(contactInfo);
|
||||
auto bestName = accountInfo.contactModel->bestNameForContact(contactUri);
|
||||
auto bestId = accountInfo.contactModel->bestIdForContact(contactUri);
|
||||
if (accountInfo.profileInfo.type == lrc::api::profile::Type::SIP
|
||||
&& contactInfo.profileInfo.type == lrc::api::profile::Type::TEMPORARY) {
|
||||
photo = Utils::fallbackAvatar(QString(), QString());
|
||||
|
@ -439,96 +439,6 @@ removeEndlines(const QString& str)
|
|||
return trimmed;
|
||||
}
|
||||
|
||||
QString
|
||||
Utils::bestIdForConversation(const lrc::api::conversation::Info& conv,
|
||||
const lrc::api::ConversationModel& model)
|
||||
{
|
||||
auto contact = model.owner.contactModel->getContact(conv.participants[0]);
|
||||
if (!contact.registeredName.isEmpty()) {
|
||||
return removeEndlines(contact.registeredName);
|
||||
}
|
||||
return removeEndlines(contact.profileInfo.uri);
|
||||
}
|
||||
|
||||
QString
|
||||
Utils::bestIdForAccount(const lrc::api::account::Info& account)
|
||||
{
|
||||
if (!account.registeredName.isEmpty()) {
|
||||
return removeEndlines(account.registeredName);
|
||||
}
|
||||
return removeEndlines(account.profileInfo.uri);
|
||||
}
|
||||
|
||||
QString
|
||||
Utils::bestNameForAccount(const lrc::api::account::Info& account)
|
||||
{
|
||||
if (account.profileInfo.alias.isEmpty()) {
|
||||
return bestIdForAccount(account);
|
||||
}
|
||||
return account.profileInfo.alias;
|
||||
}
|
||||
|
||||
QString
|
||||
Utils::bestIdForContact(const lrc::api::contact::Info& contact)
|
||||
{
|
||||
if (!contact.registeredName.isEmpty()) {
|
||||
return removeEndlines(contact.registeredName);
|
||||
}
|
||||
return removeEndlines(contact.profileInfo.uri);
|
||||
}
|
||||
|
||||
QString
|
||||
Utils::bestNameForContact(const lrc::api::contact::Info& contact)
|
||||
{
|
||||
auto alias = removeEndlines(contact.profileInfo.alias);
|
||||
if (alias.length() == 0) {
|
||||
return bestIdForContact(contact);
|
||||
}
|
||||
return alias;
|
||||
}
|
||||
|
||||
QString
|
||||
Utils::bestNameForConversation(const lrc::api::conversation::Info& conv,
|
||||
const lrc::api::ConversationModel& model)
|
||||
{
|
||||
try {
|
||||
auto contact = model.owner.contactModel->getContact(conv.participants[0]);
|
||||
auto alias = removeEndlines(contact.profileInfo.alias);
|
||||
if (alias.length() == 0) {
|
||||
return bestIdForConversation(conv, model);
|
||||
}
|
||||
return alias;
|
||||
} catch (...) {
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns empty string if only infoHash is available,
|
||||
* second best identifier otherwise.
|
||||
*/
|
||||
QString
|
||||
Utils::secondBestNameForAccount(const lrc::api::account::Info& account)
|
||||
{
|
||||
auto alias = removeEndlines(account.profileInfo.alias);
|
||||
auto registeredName = removeEndlines(account.registeredName);
|
||||
auto infoHash = account.profileInfo.uri;
|
||||
|
||||
if (alias.length() != 0) {
|
||||
if (registeredName.length() != 0) {
|
||||
return registeredName;
|
||||
} else {
|
||||
return infoHash;
|
||||
}
|
||||
} else {
|
||||
if (registeredName.length() != 0) {
|
||||
return infoHash;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lrc::api::profile::Type
|
||||
Utils::profileType(const lrc::api::conversation::Info& conv,
|
||||
const lrc::api::ConversationModel& model)
|
||||
|
@ -828,8 +738,8 @@ Utils::accountPhoto(const lrc::api::account::Info& accountInfo, const QSize& siz
|
|||
QByteArray ba = accountInfo.profileInfo.avatar.toLocal8Bit();
|
||||
photo = contactPhotoFromBase64(ba, nullptr);
|
||||
} else {
|
||||
auto bestId = bestIdForAccount(accountInfo);
|
||||
auto bestName = bestNameForAccount(accountInfo);
|
||||
auto bestId = LRCInstance::accountModel().bestIdForAccount(accountInfo.id);
|
||||
auto bestName = LRCInstance::accountModel().bestNameForAccount(accountInfo.id);
|
||||
QString letterStr = bestId == bestName ? QString() : bestName;
|
||||
QString prefix = accountInfo.profileInfo.type == lrc::api::profile::Type::RING ? "ring:"
|
||||
: "sip:";
|
||||
|
|
|
@ -80,15 +80,6 @@ void removeOldVersions();
|
|||
/*
|
||||
* LRC helpers
|
||||
*/
|
||||
QString bestIdForConversation(const lrc::api::conversation::Info& conv,
|
||||
const lrc::api::ConversationModel& model);
|
||||
QString bestIdForAccount(const lrc::api::account::Info& account);
|
||||
QString bestNameForAccount(const lrc::api::account::Info& account);
|
||||
QString bestIdForContact(const lrc::api::contact::Info& contact);
|
||||
QString bestNameForContact(const lrc::api::contact::Info& contact);
|
||||
QString bestNameForConversation(const lrc::api::conversation::Info& conv,
|
||||
const lrc::api::ConversationModel& model);
|
||||
QString secondBestNameForAccount(const lrc::api::account::Info& account);
|
||||
lrc::api::profile::Type profileType(const lrc::api::conversation::Info& conv,
|
||||
const lrc::api::ConversationModel& model);
|
||||
std::string formatTimeString(const std::time_t& timestamp);
|
||||
|
|
|
@ -108,8 +108,11 @@ UtilsAdapter::checkStartupLink()
|
|||
const QString
|
||||
UtilsAdapter::getBestName(const QString& accountId, const QString& uid)
|
||||
{
|
||||
auto* convModel = LRCInstance::getAccountInfo(accountId).conversationModel.get();
|
||||
return Utils::bestNameForConversation(convModel->getConversationForUID(uid), *convModel);
|
||||
auto conv = LRCInstance::getConversationFromConvUid(uid);
|
||||
if (!conv.participants.isEmpty())
|
||||
return LRCInstance::getAccountInfo(accountId).contactModel->bestNameForContact(
|
||||
conv.participants[0]);
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString
|
||||
|
@ -117,15 +120,17 @@ UtilsAdapter::getBestId(const QString& accountId)
|
|||
{
|
||||
if (accountId.isEmpty())
|
||||
return {};
|
||||
auto& accountInfo = LRCInstance::getAccountInfo(accountId);
|
||||
return Utils::bestIdForAccount(accountInfo);
|
||||
return LRCInstance::accountModel().bestIdForAccount(accountId);
|
||||
}
|
||||
|
||||
const QString
|
||||
UtilsAdapter::getBestId(const QString& accountId, const QString& uid)
|
||||
{
|
||||
auto* convModel = LRCInstance::getAccountInfo(accountId).conversationModel.get();
|
||||
return Utils::bestIdForConversation(convModel->getConversationForUID(uid), *convModel);
|
||||
auto conv = LRCInstance::getConversationFromConvUid(uid);
|
||||
if (!conv.participants.isEmpty())
|
||||
return LRCInstance::getAccountInfo(accountId).contactModel->bestIdForContact(
|
||||
conv.participants[0]);
|
||||
return QString();
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Add table
Reference in a new issue