Skip to content
Snippets Groups Projects
Commit 59c8a75c authored by Albert  Babí Oller's avatar Albert Babí Oller Committed by Andreas Traczyk
Browse files

callview: fix conversation selection when call ends

- avoid using smartlist index change for conversation selection
when call ends (instead it can be triggered from calladapter)
- break long lines

Gitlab: #260

Change-Id: Iaa1f9269d9ba6889fb1a7e466cd586fa86263bc7
parent f27f4374
No related branches found
No related tags found
No related merge requests found
...@@ -392,6 +392,7 @@ CallAdapter::connectCallModel(const QString& accountId) ...@@ -392,6 +392,7 @@ CallAdapter::connectCallModel(const QString& accountId)
case lrc::api::call::Status::TIMEOUT: case lrc::api::call::Status::TIMEOUT:
case lrc::api::call::Status::TERMINATING: { case lrc::api::call::Status::TERMINATING: {
lrcInstance_->renderer()->removeDistantRenderer(callId); lrcInstance_->renderer()->removeDistantRenderer(callId);
emit callSetupMainViewRequired(accountId, convInfo.uid);
if (convInfo.uid.isEmpty()) { if (convInfo.uid.isEmpty()) {
break; break;
} }
...@@ -424,9 +425,8 @@ CallAdapter::connectCallModel(const QString& accountId) ...@@ -424,9 +425,8 @@ CallAdapter::connectCallModel(const QString& accountId)
/* /*
* Reset the call view corresponding accountId, uid. * Reset the call view corresponding accountId, uid.
*/ */
lrcInstance_->setSelectedConvId(otherConv.uid);
updateCall(otherConv.uid, otherConv.accountId, forceCallOnly); updateCall(otherConv.uid, otherConv.accountId, forceCallOnly);
emit callSetupMainViewRequired(accountId, convInfo.uid);
} }
} }
} }
...@@ -451,8 +451,6 @@ CallAdapter::connectCallModel(const QString& accountId) ...@@ -451,8 +451,6 @@ CallAdapter::connectCallModel(const QString& accountId)
default: default:
break; break;
} }
emit lrcInstance_->updateSmartList();
}); });
remoteRecordingChangedConnection_ = QObject::connect( remoteRecordingChangedConnection_ = QObject::connect(
......
...@@ -192,7 +192,6 @@ ConversationsAdapter::connectConversationModel(bool updateFilter) ...@@ -192,7 +192,6 @@ ConversationsAdapter::connectConversationModel(bool updateFilter)
currentConversationModel, &lrc::api::ConversationModel::modelChanged, [this]() { currentConversationModel, &lrc::api::ConversationModel::modelChanged, [this]() {
conversationSmartListModel_->fillConversationsList(); conversationSmartListModel_->fillConversationsList();
updateConversationsFilterWidget(); updateConversationsFilterWidget();
emit updateListViewRequested();
auto* convModel = lrcInstance_->getCurrentConversationModel(); auto* convModel = lrcInstance_->getCurrentConversationModel();
const auto& convInfo = lrcInstance_->getConversationFromConvUid( const auto& convInfo = lrcInstance_->getConversationFromConvUid(
...@@ -257,7 +256,7 @@ ConversationsAdapter::connectConversationModel(bool updateFilter) ...@@ -257,7 +256,7 @@ ConversationsAdapter::connectConversationModel(bool updateFilter)
&lrc::api::ConversationModel::conversationCleared, &lrc::api::ConversationModel::conversationCleared,
[this](const QString& convUid) { [this](const QString& convUid) {
// If currently selected, switch to welcome screen (deselecting // If currently selected, switch to welcome screen (deselecting
// current smartlist item ). // current smartlist item).
if (convUid != lrcInstance_->getCurrentConvUid()) { if (convUid != lrcInstance_->getCurrentConvUid()) {
return; return;
} }
......
...@@ -42,6 +42,8 @@ ListView { ...@@ -42,6 +42,8 @@ ListView {
} }
function repositionIndex(uid = "") { function repositionIndex(uid = "") {
// Only update index if it has changed
var currentI = root.currentIndex
if (uid === "") if (uid === "")
uid = mainView.currentConvUID uid = mainView.currentConvUID
root.currentIndex = -1 root.currentIndex = -1
......
...@@ -41,12 +41,11 @@ ItemDelegate { ...@@ -41,12 +41,11 @@ ItemDelegate {
Connections { Connections {
target: conversationSmartListView target: conversationSmartListView
// Hack, make sure that smartListItemDelegate does not show extra item // Hack, make sure that smartListItemDelegate does not show extra item
// when searching new contacts. // when searching new contacts.
function onForceUpdatePotentialInvalidItem() { function onForceUpdatePotentialInvalidItem() {
smartListItemDelegate.visible = conversationSmartListView.model.rowCount( smartListItemDelegate.visible =
) <= index ? false : true conversationSmartListView.model.rowCount() <= index ? false : true
} }
...@@ -123,8 +122,9 @@ ItemDelegate { ...@@ -123,8 +122,9 @@ ItemDelegate {
id: textMetricsConversationSmartListUserName id: textMetricsConversationSmartListUserName
font: conversationSmartListUserName.font font: conversationSmartListUserName.font
elide: Text.ElideRight elide: Text.ElideRight
elideWidth: LastInteractionDate ? (smartListItemDelegate.width - lastInteractionPreferredWidth - conversationSmartListUserImage.width-32) : elideWidth: LastInteractionDate ? (smartListItemDelegate.width - lastInteractionPreferredWidth
smartListItemDelegate.width - lastInteractionPreferredWidth - conversationSmartListUserImage.width-32)
: smartListItemDelegate.width - lastInteractionPreferredWidth
text: DisplayName === undefined ? "" : DisplayName text: DisplayName === undefined ? "" : DisplayName
} }
text: textMetricsConversationSmartListUserName.elidedText text: textMetricsConversationSmartListUserName.elidedText
...@@ -161,8 +161,9 @@ ItemDelegate { ...@@ -161,8 +161,9 @@ ItemDelegate {
id: textMetricsConversationSmartListUserLastInteractionMessage id: textMetricsConversationSmartListUserLastInteractionMessage
font: conversationSmartListUserLastInteractionMessage.font font: conversationSmartListUserLastInteractionMessage.font
elide: Text.ElideRight elide: Text.ElideRight
elideWidth: LastInteractionDate ? (smartListItemDelegate.width - lastInteractionPreferredWidth - conversationSmartListUserImage.width-32) : elideWidth: LastInteractionDate ? (smartListItemDelegate.width - lastInteractionPreferredWidth
smartListItemDelegate.width - lastInteractionPreferredWidth - conversationSmartListUserImage.width-32)
: smartListItemDelegate.width - lastInteractionPreferredWidth
text: InCall ? UtilsAdapter.getCallStatusStr(CallState) : (Draft ? Draft : LastInteraction) text: InCall ? UtilsAdapter.getCallStatusStr(CallState) : (Draft ? Draft : LastInteraction)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment