From 00502fca3f005db6c8b5e4f09990060db3434c2a Mon Sep 17 00:00:00 2001
From: Ming Rui Zhang <mingrui.zhang@savoirfairelinux.com>
Date: Thu, 9 Apr 2020 13:41:00 -0400
Subject: [PATCH] callwidget: fix the issue that smartlist context menu does
 not show corresponding view

for issue #529

Change-Id: I5ad4c105961719b0eba0b28c8ed35765298b92e6
---
 src/callwidget.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/callwidget.cpp b/src/callwidget.cpp
index 5689802..4161c2c 100644
--- a/src/callwidget.cpp
+++ b/src/callwidget.cpp
@@ -383,22 +383,26 @@ CallWidget::setupSmartListContextMenu(const QPoint& pos)
     menu.addAction(videoCallAction);
     connect(videoCallAction, &QAction::triggered,
         [this, convUid, conversation, convModel]() {
-            convModel->placeCall(convUid);
+            if (!ui->messageView->isVisible())
+                showChatView(LRCInstance::getCurrAccId(), conversation);
             ui->callingPhoto->setPixmap(QPixmap::fromImage(imageForConv(convUid)));
             if (convUid != LRCInstance::getCurrentConvUid()) {
                 selectConversation(conversation);
             }
+            convModel->placeCall(convUid);
         });
     // audio call
     auto audioCallAction = new QAction(tr("Start audio call"), this);
     menu.addAction(audioCallAction);
     connect(audioCallAction, &QAction::triggered,
         [this, convUid, conversation, convModel]() {
-            convModel->placeAudioOnlyCall(convUid);
+            if (!ui->messageView->isVisible())
+                showChatView(LRCInstance::getCurrAccId(), conversation);
             ui->callingPhoto->setPixmap(QPixmap::fromImage(imageForConv(convUid)));
             if (convUid != LRCInstance::getCurrentConvUid()) {
                 selectConversation(conversation);
             }
+            convModel->placeAudioOnlyCall(convUid);
         });
     // clear conversation
     auto clearConversationAction = new QAction(tr("Clear conversation"), this);
-- 
GitLab