From af8f2826a5f54d2bbb100ffbc8aebe56965920bb Mon Sep 17 00:00:00 2001
From: Olivier SOLDANO <olivier.soldano@savoirfairelinux.com>
Date: Tue, 11 Jul 2017 12:15:18 -0400
Subject: [PATCH] force display of all incoming calls invites
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

whenever the user receives a call (even when in another call)
display the incoming call invite page.
The previous comportment was to stay on the active page.

Change-Id: I6986f5eb36981d1b329652bf2acadf500e2c0202
Reviewed-by: Anthony Léonard <anthony.leonard@savoirfairelinux.com>
---
 callwidget.cpp | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/callwidget.cpp b/callwidget.cpp
index c8c51c8..a3ad48a 100644
--- a/callwidget.cpp
+++ b/callwidget.cpp
@@ -128,6 +128,16 @@ CallWidget::CallWidget(QWidget* parent) :
                 this,
                 SLOT(smartListCurrentChanged(QModelIndex,QModelIndex)));
 
+        connect(&RecentModel::instance(), &QAbstractItemModel::dataChanged, [=](const QModelIndex &topLeft, const QModelIndex &bottomRight,const QVector<int> &vec){
+            Q_UNUSED(bottomRight)
+            Q_UNUSED(vec)
+            auto realIdx = RecentModel::instance().peopleProxy()->mapFromSource(topLeft);
+
+            if (realIdx.isValid() && RecentModel::instance().hasActiveCall(realIdx)){
+                ui->smartList->selectionModel()->setCurrentIndex(realIdx,QItemSelectionModel::ClearAndSelect);
+            }
+        });
+
         connect(RecentModel::instance().selectionModel(), &QItemSelectionModel::selectionChanged, [=](const QItemSelection &selected, const QItemSelection &deselected) {
                     // lambda used to focus on the correct smartList element when switching automatically between two calls
                     Q_UNUSED(deselected)
@@ -142,15 +152,6 @@ CallWidget::CallWidget(QWidget* parent) :
                     }
                 });
 
-        connect(&RecentModel::instance(), &QAbstractItemModel::dataChanged, [=](const QModelIndex &topLeft, const QModelIndex &bottomRight,const QVector<int> &vec){
-            Q_UNUSED(bottomRight)
-            Q_UNUSED(vec)
-            auto realIdx = RecentModel::instance().peopleProxy()->mapFromSource(topLeft);
-            if (realIdx.isValid() && RecentModel::instance().hasActiveCall(realIdx)){
-                ui->smartList->selectionModel()->setCurrentIndex(realIdx,QItemSelectionModel::ClearAndSelect);
-            }
-        });
-
         connect(&NameDirectory::instance(), SIGNAL(registeredNameFound(Account*,NameDirectory::LookupStatus,const QString&,const QString&)),
                 this, SLOT(contactLineEdit_registeredNameFound(Account*,NameDirectory::LookupStatus,const QString&,const QString&)));
 
-- 
GitLab