mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-04 06:45: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)
|
ConversationListModel::ConversationListModel(LRCInstance* instance, QObject* parent)
|
||||||
: ConversationListModelBase(instance, parent)
|
: ConversationListModelBase(instance, parent)
|
||||||
{
|
{
|
||||||
|
if (!model_)
|
||||||
|
return;
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
model_,
|
model_,
|
||||||
&ConversationModel::beginInsertRows,
|
&ConversationModel::beginInsertRows,
|
||||||
|
|
|
@ -99,8 +99,6 @@ ConversationsAdapter::ConversationsAdapter(SystemTray* systemTray,
|
||||||
Q_EMIT convSrcModel_->dataChanged(index, index);
|
Q_EMIT convSrcModel_->dataChanged(index, index);
|
||||||
});
|
});
|
||||||
|
|
||||||
updateConversationFilterData();
|
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
// notification responses
|
// notification responses
|
||||||
connect(systemTray_,
|
connect(systemTray_,
|
||||||
|
@ -188,15 +186,8 @@ ConversationsAdapter::onCurrentAccountIdChanged()
|
||||||
{
|
{
|
||||||
lrcInstance_->deselectConversation();
|
lrcInstance_->deselectConversation();
|
||||||
|
|
||||||
convSrcModel_.reset(new ConversationListModel(lrcInstance_));
|
|
||||||
convModel_->bindSourceModel(convSrcModel_.get());
|
|
||||||
searchSrcModel_.reset(new SearchResultsListModel(lrcInstance_));
|
|
||||||
searchModel_->bindSourceModel(searchSrcModel_.get());
|
|
||||||
|
|
||||||
connectConversationModel();
|
connectConversationModel();
|
||||||
|
|
||||||
updateConversationFilterData();
|
|
||||||
|
|
||||||
set_currentTypeFilter(lrcInstance_->getCurrentAccountInfo().profileInfo.type);
|
set_currentTypeFilter(lrcInstance_->getCurrentAccountInfo().profileInfo.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,6 +493,14 @@ ConversationsAdapter::connectConversationModel(bool updateFilter)
|
||||||
if (updateFilter) {
|
if (updateFilter) {
|
||||||
currentTypeFilter_ = profile::Type::INVALID;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,19 +210,34 @@ LRCInstance::getConversationFromCallId(const QString& callId, const QString& acc
|
||||||
ConversationModel*
|
ConversationModel*
|
||||||
LRCInstance::getCurrentConversationModel()
|
LRCInstance::getCurrentConversationModel()
|
||||||
{
|
{
|
||||||
return getCurrentAccountInfo().conversationModel.get();
|
try {
|
||||||
|
const auto& accInfo = getCurrentAccountInfo();
|
||||||
|
return accInfo.conversationModel.get();
|
||||||
|
} catch (...) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NewCallModel*
|
NewCallModel*
|
||||||
LRCInstance::getCurrentCallModel()
|
LRCInstance::getCurrentCallModel()
|
||||||
{
|
{
|
||||||
return getCurrentAccountInfo().callModel.get();
|
try {
|
||||||
|
const auto& accInfo = getCurrentAccountInfo();
|
||||||
|
return accInfo.callModel.get();
|
||||||
|
} catch (...) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ContactModel*
|
ContactModel*
|
||||||
LRCInstance::getCurrentContactModel()
|
LRCInstance::getCurrentContactModel()
|
||||||
{
|
{
|
||||||
return getCurrentAccountInfo().contactModel.get();
|
try {
|
||||||
|
const auto& accInfo = getCurrentAccountInfo();
|
||||||
|
return accInfo.contactModel.get();
|
||||||
|
} catch (...) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString&
|
const QString&
|
||||||
|
|
Loading…
Add table
Reference in a new issue