partially fixed async navigate action in forums

This commit is contained in:
csoler 2018-12-13 21:02:32 +01:00
parent 39b7bc818b
commit 348f88b6ec
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C

View File

@ -1494,7 +1494,10 @@ bool GxsForumThreadWidget::navigate(const RsGxsMessageId &msgId)
QModelIndex source_index = mThreadModel->getIndexOfMessage(msgId); QModelIndex source_index = mThreadModel->getIndexOfMessage(msgId);
if(!source_index.isValid()) if(!source_index.isValid())
return false; {
mNavigatePendingMsgId = msgId; // not found. That means the forum may not be loaded yet. So we keep that post in mind, for after loading.
return true; // we have to return true here, otherwise the caller will intepret the async loading as an error.
}
QModelIndex indx = mThreadProxyModel->mapFromSource(source_index); QModelIndex indx = mThreadProxyModel->mapFromSource(source_index);
@ -1847,6 +1850,12 @@ void GxsForumThreadWidget::postForumLoading()
#ifdef DEBUG_FORUMS #ifdef DEBUG_FORUMS
std::cerr << "Post forum loading..." << std::endl; std::cerr << "Post forum loading..." << std::endl;
#endif #endif
if(!mNavigatePendingMsgId.isNull() && mThreadModel->getIndexOfMessage(mNavigatePendingMsgId).isValid())
{
mThreadId = mNavigatePendingMsgId;
mNavigatePendingMsgId.clear();
}
QModelIndex source_index = mThreadModel->getIndexOfMessage(mThreadId); QModelIndex source_index = mThreadModel->getIndexOfMessage(mThreadId);
if(!mThreadId.isNull() && source_index.isValid()) if(!mThreadId.isNull() && source_index.isValid())