mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 03:18:07 +00:00
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->makeConnectToCore(&ChatList::lUpdate, [this]() {
|
||||
clearData();
|
||||
emit listAboutToBeReset();
|
||||
beginResetModel();
|
||||
mModelConnection->invokeToModel([this]() {
|
||||
mustBeInLinphoneThread(getClassName());
|
||||
// Avoid copy to lambdas
|
||||
|
|
@ -107,10 +107,8 @@ void ChatList::setSelf(QSharedPointer<ChatList> me) {
|
|||
connectItem(chat);
|
||||
}
|
||||
mustBeInMainThread(getClassName());
|
||||
clearData();
|
||||
for (auto chat : *chats) {
|
||||
add(chat);
|
||||
}
|
||||
add(*chats);
|
||||
endResetModel();
|
||||
delete chats;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ signals:
|
|||
void chatRemoved(ChatGui *chat);
|
||||
void chatAdded();
|
||||
void chatUpdated();
|
||||
void listAboutToBeReset();
|
||||
|
||||
private:
|
||||
QString mFilter;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ void ChatProxy::setSourceModel(QAbstractItemModel *model) {
|
|||
connect(this, &ChatProxy::filterTextChanged, newChatList,
|
||||
[this, newChatList] { emit newChatList->filterChanged(getFilterText()); });
|
||||
connect(newChatList, &ChatList::chatRemoved, this, &ChatProxy::chatRemoved);
|
||||
connect(newChatList, &ChatList::listAboutToBeReset, this, &ChatProxy::listAboutToBeReset);
|
||||
connect(newChatList, &ChatList::chatAdded, this, [this] { invalidate(); });
|
||||
connect(newChatList, &ChatList::dataChanged, this, [this] { invalidate(); });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ public:
|
|||
|
||||
signals:
|
||||
void chatRemoved(ChatGui *chat);
|
||||
void listAboutToBeReset();
|
||||
|
||||
protected:
|
||||
QSharedPointer<ChatList> mList;
|
||||
|
|
|
|||
|
|
@ -17,9 +17,8 @@ ListView {
|
|||
property string searchText: searchBar?.text
|
||||
property real busyIndicatorSize: Math.round(60 * DefaultStyle.dp)
|
||||
|
||||
property ChatGui currentChatGui
|
||||
onCurrentIndexChanged: currentChatGui = model.getAt(currentIndex) || null
|
||||
onChatClicked: (chat) => {currentChatGui = chat}
|
||||
property ChatGui currentChatGui: model.getAt(currentIndex) || null
|
||||
onChatClicked: (chat) => {selectChat(chat)}
|
||||
|
||||
signal resultsReceived()
|
||||
signal markAllAsRead()
|
||||
|
|
@ -44,7 +43,7 @@ ListView {
|
|||
onModelReset: {
|
||||
mainItem.resultsReceived()
|
||||
}
|
||||
onListAboutToBeReset: {
|
||||
onModelAboutToBeReset: {
|
||||
loading = true
|
||||
}
|
||||
onChatRemoved: {
|
||||
|
|
@ -460,7 +459,6 @@ ListView {
|
|||
chatroomPopup.open()
|
||||
} else {
|
||||
mainItem.chatClicked(modelData)
|
||||
mainItem.currentIndex = model.index
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue