invalidate meeting filter when meeting list becomes visible

invalidate meeting filter when meeting removed (try to fix #LINQT-2429)
This commit is contained in:
Gaelle Braud 2026-02-20 16:09:10 +01:00
parent 9bc953ca82
commit 226547d199
6 changed files with 31 additions and 8 deletions

View file

@ -118,6 +118,7 @@ ChatCore::ChatCore(const std::shared_ptr<linphone::ChatRoom> &chatRoom) : QObjec
ChatCore::~ChatCore() {
lDebug() << "[ChatCore] delete" << this;
mustBeInMainThread("~" + getClassName());
mChatModelConnection->disconnect();
emit mChatModel->removeListener();
}

View file

@ -53,6 +53,13 @@ ChatList::~ChatList() {
mModelConnection->disconnect();
}
void ChatList::disconnectItem(QSharedPointer<ChatCore> chat) {
disconnect(chat.get(), &ChatCore::deleted, this, nullptr);
disconnect(chat.get(), &ChatCore::unreadMessagesCountChanged, this, nullptr);
disconnect(chat.get(), &ChatCore::lastUpdatedTimeChanged, this, nullptr);
disconnect(chat.get(), &ChatCore::lastMessageChanged, this, nullptr);
}
void ChatList::connectItem(QSharedPointer<ChatCore> chat) {
connect(
chat.get(), &ChatCore::deleted, this,
@ -68,7 +75,7 @@ void ChatList::connectItem(QSharedPointer<ChatCore> chat) {
get(chat.get(), &i);
if (i != -1) {
auto modelIndex = index(i);
emit dataChanged(modelIndex, modelIndex);
if (modelIndex.isValid()) emit dataChanged(modelIndex, modelIndex);
}
};
connect(chat.get(), &ChatCore::unreadMessagesCountChanged, this, [this, dataChange] {
@ -117,10 +124,7 @@ void ChatList::setSelf(QSharedPointer<ChatList> me) {
mustBeInMainThread(getClassName());
for (auto &chat : getSharedList<ChatCore>()) {
if (chat) {
disconnect(chat.get(), &ChatCore::deleted, this, nullptr);
disconnect(chat.get(), &ChatCore::unreadMessagesCountChanged, this, nullptr);
disconnect(chat.get(), &ChatCore::lastUpdatedTimeChanged, this, nullptr);
disconnect(chat.get(), &ChatCore::lastMessageChanged, this, nullptr);
disconnectItem(chat);
}
}
mList.clear();

View file

@ -40,6 +40,7 @@ public:
~ChatList();
void setSelf(QSharedPointer<ChatList> me);
void connectItem(QSharedPointer<ChatCore> chat);
void disconnectItem(QSharedPointer<ChatCore> chat);
int findChatIndex(ChatGui *chat);
bool addChatInList(QSharedPointer<ChatCore> chatCore, bool emitAddSignal);

View file

@ -37,15 +37,22 @@ ConferenceInfoProxy::ConferenceInfoProxy(QObject *parent) : LimitProxy(parent) {
mList.get(), &ConferenceInfoList::haveCurrentDateChanged, this,
[this] {
auto sortModel = dynamic_cast<SortFilterList *>(sourceModel());
sortModel->invalidate(); // New date => sort and filter change.
if (sortModel) sortModel->invalidate(); // New date => sort and filter change.
loadUntil(nullptr);
},
Qt::QueuedConnection);
connect(
mList.get(), &ConferenceInfoList::rowsRemoved, this,
[this] {
auto sortModel = dynamic_cast<SortFilterList *>(sourceModel());
if (sortModel) sortModel->invalidate(); // New date => sort and filter change.
},
Qt::QueuedConnection);
connect(
mList.get(), &ConferenceInfoList::confInfoInserted, this,
[this](QSharedPointer<ConferenceInfoCore> data) {
auto sortModel = dynamic_cast<SortFilterList *>(sourceModel());
sortModel->invalidate(); // New conf => sort change. Filter can change if on current date.
if (sortModel) sortModel->invalidate(); // New conf => sort change. Filter can change if on current date.
static const QMetaMethod conferenceInfoCreatedSignal =
QMetaMethod::fromSignal(&ConferenceInfoProxy::conferenceInfoCreated);
if (isSignalConnected(conferenceInfoCreatedSignal)) emit conferenceInfoCreated(new ConferenceInfoGui(data));
@ -109,6 +116,11 @@ void ConferenceInfoProxy::clear() {
mList->clearData();
}
void ConferenceInfoProxy::invalidate() {
auto sortModel = dynamic_cast<SortFilterList *>(sourceModel());
if (sortModel) sortModel->invalidate();
}
ConferenceInfoGui *ConferenceInfoProxy::getCurrentDateConfInfo(bool enableCancelledConference) {
if (mList) {
auto confInfo = mList->getCurrentDateConfInfo();

View file

@ -47,6 +47,7 @@ public:
bool getAccountConnected() const;
Q_INVOKABLE void clear();
Q_INVOKABLE void invalidate();
Q_INVOKABLE ConferenceInfoGui *getCurrentDateConfInfo(bool enableCancelledConference = false);
Q_INVOKABLE int loadUntil(ConferenceInfoGui *confInfo);
int loadUntil(QSharedPointer<ConferenceInfoCore> data);

View file

@ -74,7 +74,11 @@ ListView {
}
//----------------------------------------------------------------
onAtYEndChanged: if(atYEnd) confInfoProxy.displayMore()
Component.onCompleted: {
console.log("meeting list view completed invalidate")
confInfoProxy.invalidate()
}
Keys.onPressed: (event)=> {
if(event.key == Qt.Key_Up) {