fix #LINQT-1910 wrong proxy index when chat list filtered
This commit is contained in:
parent
4203a9c9c0
commit
f516505287
5 changed files with 6 additions and 13 deletions
|
|
@ -82,7 +82,7 @@ void ChatList::setSelf(QSharedPointer<ChatList> me) {
|
||||||
mModelConnection = SafeConnection<ChatList, CoreModel>::create(me, CoreModel::getInstance());
|
mModelConnection = SafeConnection<ChatList, CoreModel>::create(me, CoreModel::getInstance());
|
||||||
mModelConnection->makeConnectToCore(&ChatList::lUpdate, [this]() {
|
mModelConnection->makeConnectToCore(&ChatList::lUpdate, [this]() {
|
||||||
clearData();
|
clearData();
|
||||||
emit listAboutToBeReset();
|
beginResetModel();
|
||||||
mModelConnection->invokeToModel([this]() {
|
mModelConnection->invokeToModel([this]() {
|
||||||
mustBeInLinphoneThread(getClassName());
|
mustBeInLinphoneThread(getClassName());
|
||||||
// Avoid copy to lambdas
|
// Avoid copy to lambdas
|
||||||
|
|
@ -107,10 +107,8 @@ void ChatList::setSelf(QSharedPointer<ChatList> me) {
|
||||||
connectItem(chat);
|
connectItem(chat);
|
||||||
}
|
}
|
||||||
mustBeInMainThread(getClassName());
|
mustBeInMainThread(getClassName());
|
||||||
clearData();
|
add(*chats);
|
||||||
for (auto chat : *chats) {
|
endResetModel();
|
||||||
add(chat);
|
|
||||||
}
|
|
||||||
delete chats;
|
delete chats;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@ signals:
|
||||||
void chatRemoved(ChatGui *chat);
|
void chatRemoved(ChatGui *chat);
|
||||||
void chatAdded();
|
void chatAdded();
|
||||||
void chatUpdated();
|
void chatUpdated();
|
||||||
void listAboutToBeReset();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString mFilter;
|
QString mFilter;
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ void ChatProxy::setSourceModel(QAbstractItemModel *model) {
|
||||||
connect(this, &ChatProxy::filterTextChanged, newChatList,
|
connect(this, &ChatProxy::filterTextChanged, newChatList,
|
||||||
[this, newChatList] { emit newChatList->filterChanged(getFilterText()); });
|
[this, newChatList] { emit newChatList->filterChanged(getFilterText()); });
|
||||||
connect(newChatList, &ChatList::chatRemoved, this, &ChatProxy::chatRemoved);
|
connect(newChatList, &ChatList::chatRemoved, this, &ChatProxy::chatRemoved);
|
||||||
connect(newChatList, &ChatList::listAboutToBeReset, this, &ChatProxy::listAboutToBeReset);
|
|
||||||
connect(newChatList, &ChatList::chatAdded, this, [this] { invalidate(); });
|
connect(newChatList, &ChatList::chatAdded, this, [this] { invalidate(); });
|
||||||
connect(newChatList, &ChatList::dataChanged, this, [this] { invalidate(); });
|
connect(newChatList, &ChatList::dataChanged, this, [this] { invalidate(); });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ public:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void chatRemoved(ChatGui *chat);
|
void chatRemoved(ChatGui *chat);
|
||||||
void listAboutToBeReset();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QSharedPointer<ChatList> mList;
|
QSharedPointer<ChatList> mList;
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,8 @@ ListView {
|
||||||
property string searchText: searchBar?.text
|
property string searchText: searchBar?.text
|
||||||
property real busyIndicatorSize: Math.round(60 * DefaultStyle.dp)
|
property real busyIndicatorSize: Math.round(60 * DefaultStyle.dp)
|
||||||
|
|
||||||
property ChatGui currentChatGui
|
property ChatGui currentChatGui: model.getAt(currentIndex) || null
|
||||||
onCurrentIndexChanged: currentChatGui = model.getAt(currentIndex) || null
|
onChatClicked: (chat) => {selectChat(chat)}
|
||||||
onChatClicked: (chat) => {currentChatGui = chat}
|
|
||||||
|
|
||||||
signal resultsReceived()
|
signal resultsReceived()
|
||||||
signal markAllAsRead()
|
signal markAllAsRead()
|
||||||
|
|
@ -44,7 +43,7 @@ ListView {
|
||||||
onModelReset: {
|
onModelReset: {
|
||||||
mainItem.resultsReceived()
|
mainItem.resultsReceived()
|
||||||
}
|
}
|
||||||
onListAboutToBeReset: {
|
onModelAboutToBeReset: {
|
||||||
loading = true
|
loading = true
|
||||||
}
|
}
|
||||||
onChatRemoved: {
|
onChatRemoved: {
|
||||||
|
|
@ -460,7 +459,6 @@ ListView {
|
||||||
chatroomPopup.open()
|
chatroomPopup.open()
|
||||||
} else {
|
} else {
|
||||||
mainItem.chatClicked(modelData)
|
mainItem.chatClicked(modelData)
|
||||||
mainItem.currentIndex = model.index
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue