From e9efc94f2d0e0180fda79fed394d6bb264d3c822 Mon Sep 17 00:00:00 2001
From: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
Date: Fri, 28 Apr 2017 16:35:50 -0400
Subject: [PATCH] RecentModel: initialize selection in constructor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

If there are any ongoing calls during the construction of the
RecentModel we want to make sure to sync the selection with the
CallModel, which will normally select the most recent Call.

This is mostly important for clients which run as seperate processes
from the daemon, and so its possible to have ongoing calls at the
time the client is initialized.

Change-Id: I1edd595ee77c03ca294baf44802f00065e8bca2b
Reviewed-by: Nicolas Jäger <nicolas.jager@savoirfairelinux.com>
---
 src/recentmodel.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/recentmodel.cpp b/src/recentmodel.cpp
index edcb56e7..ef4ce977 100644
--- a/src/recentmodel.cpp
+++ b/src/recentmodel.cpp
@@ -268,6 +268,9 @@ RecentModel::RecentModel(QObject* parent) : QAbstractItemModel(parent), d_ptr(ne
         auto conf = confList.at(i);
         d_ptr->slotConferenceAdded(conf);
     }
+
+    // sync initial selection with the CallModel in case there are any ongoing Calls
+    d_ptr->slotCurrentCallChanged(CallModel::instance().selectionModel()->currentIndex(), QModelIndex());
 }
 
 RecentModel::~RecentModel()
-- 
GitLab