mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-03 22:35:45 +02:00
adapters: handle injecting lrcinstance with zero accounts
Change-Id: I1ec652c60620cf4e7e1caad7fd00ddf1aa40d64d
This commit is contained in:
parent
01cf3f9367
commit
8230fb863c
3 changed files with 29 additions and 12 deletions
|
@ -24,6 +24,9 @@
|
|||
ConversationListModel::ConversationListModel(LRCInstance* instance, QObject* parent)
|
||||
: ConversationListModelBase(instance, parent)
|
||||
{
|
||||
if (!model_)
|
||||
return;
|
||||
|
||||
connect(
|
||||
model_,
|
||||
&ConversationModel::beginInsertRows,
|
||||
|
|
|
@ -99,8 +99,6 @@ ConversationsAdapter::ConversationsAdapter(SystemTray* systemTray,
|
|||
Q_EMIT convSrcModel_->dataChanged(index, index);
|
||||
});
|
||||
|
||||
updateConversationFilterData();
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
// notification responses
|
||||
connect(systemTray_,
|
||||
|
@ -188,15 +186,8 @@ ConversationsAdapter::onCurrentAccountIdChanged()
|
|||
{
|
||||
lrcInstance_->deselectConversation();
|
||||
|
||||
convSrcModel_.reset(new ConversationListModel(lrcInstance_));
|
||||
convModel_->bindSourceModel(convSrcModel_.get());
|
||||
searchSrcModel_.reset(new SearchResultsListModel(lrcInstance_));
|
||||
searchModel_->bindSourceModel(searchSrcModel_.get());
|
||||
|
||||
connectConversationModel();
|
||||
|
||||
updateConversationFilterData();
|
||||
|
||||
set_currentTypeFilter(lrcInstance_->getCurrentAccountInfo().profileInfo.type);
|
||||
}
|
||||
|
||||
|
@ -502,6 +493,14 @@ ConversationsAdapter::connectConversationModel(bool updateFilter)
|
|||
if (updateFilter) {
|
||||
currentTypeFilter_ = profile::Type::INVALID;
|
||||
}
|
||||
|
||||
convSrcModel_.reset(new ConversationListModel(lrcInstance_));
|
||||
convModel_->bindSourceModel(convSrcModel_.get());
|
||||
searchSrcModel_.reset(new SearchResultsListModel(lrcInstance_));
|
||||
searchModel_->bindSourceModel(searchSrcModel_.get());
|
||||
|
||||
updateConversationFilterData();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -210,19 +210,34 @@ LRCInstance::getConversationFromCallId(const QString& callId, const QString& acc
|
|||
ConversationModel*
|
||||
LRCInstance::getCurrentConversationModel()
|
||||
{
|
||||
return getCurrentAccountInfo().conversationModel.get();
|
||||
try {
|
||||
const auto& accInfo = getCurrentAccountInfo();
|
||||
return accInfo.conversationModel.get();
|
||||
} catch (...) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
NewCallModel*
|
||||
LRCInstance::getCurrentCallModel()
|
||||
{
|
||||
return getCurrentAccountInfo().callModel.get();
|
||||
try {
|
||||
const auto& accInfo = getCurrentAccountInfo();
|
||||
return accInfo.callModel.get();
|
||||
} catch (...) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ContactModel*
|
||||
LRCInstance::getCurrentContactModel()
|
||||
{
|
||||
return getCurrentAccountInfo().contactModel.get();
|
||||
try {
|
||||
const auto& accInfo = getCurrentAccountInfo();
|
||||
return accInfo.contactModel.get();
|
||||
} catch (...) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
const QString&
|
||||
|
|
Loading…
Add table
Reference in a new issue