mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 16:39:29 -05:00
fixed a few problems in jumping to next unread post
This commit is contained in:
parent
348f88b6ec
commit
117c19b104
@ -664,6 +664,11 @@ QVariant RsGxsForumModel::decorationRole(const ForumModelPostEntry& fmpe,int col
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const RsGxsGroupId& RsGxsForumModel::currentGroupId() const
|
||||||
|
{
|
||||||
|
return mForumGroup.mMeta.mGroupId;
|
||||||
|
}
|
||||||
|
|
||||||
void RsGxsForumModel::updateForum(const RsGxsGroupId& forum_group_id)
|
void RsGxsForumModel::updateForum(const RsGxsGroupId& forum_group_id)
|
||||||
{
|
{
|
||||||
if(forum_group_id.isNull())
|
if(forum_group_id.isNull())
|
||||||
|
@ -106,6 +106,8 @@ public:
|
|||||||
|
|
||||||
// This method will asynchroneously update the data
|
// This method will asynchroneously update the data
|
||||||
void updateForum(const RsGxsGroupId& forumGroup);
|
void updateForum(const RsGxsGroupId& forumGroup);
|
||||||
|
const RsGxsGroupId& currentGroupId() const;
|
||||||
|
|
||||||
void setTreeMode(TreeMode mode) ;
|
void setTreeMode(TreeMode mode) ;
|
||||||
void setSortMode(SortMode mode) ;
|
void setSortMode(SortMode mode) ;
|
||||||
|
|
||||||
|
@ -532,9 +532,7 @@ void GxsForumThreadWidget::groupIdChanged()
|
|||||||
|
|
||||||
mNewCount = 0;
|
mNewCount = 0;
|
||||||
mUnreadCount = 0;
|
mUnreadCount = 0;
|
||||||
mThreadId.clear();
|
|
||||||
|
|
||||||
//mThreadModel->updateForum(groupId());
|
|
||||||
updateDisplay(true);
|
updateDisplay(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -718,7 +716,9 @@ void GxsForumThreadWidget::updateDisplay(bool complete)
|
|||||||
{
|
{
|
||||||
saveExpandedItems(mSavedExpandedMessages);
|
saveExpandedItems(mSavedExpandedMessages);
|
||||||
|
|
||||||
//mUpdating=true;
|
if(groupId() != mThreadModel->currentGroupId())
|
||||||
|
mThreadId.clear();
|
||||||
|
|
||||||
updateGroupData();
|
updateGroupData();
|
||||||
mThreadModel->updateForum(groupId());
|
mThreadModel->updateForum(groupId());
|
||||||
|
|
||||||
@ -975,11 +975,7 @@ void GxsForumThreadWidget::changedThread(QModelIndex index)
|
|||||||
// return;
|
// return;
|
||||||
|
|
||||||
if(!index.isValid())
|
if(!index.isValid())
|
||||||
{
|
|
||||||
mThreadId.clear();
|
|
||||||
mOrigThreadId.clear();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
RsGxsMessageId new_id(index.sibling(index.row(),RsGxsForumModel::COLUMN_THREAD_MSGID).data(Qt::UserRole).toString().toStdString());
|
RsGxsMessageId new_id(index.sibling(index.row(),RsGxsForumModel::COLUMN_THREAD_MSGID).data(Qt::UserRole).toString().toStdString());
|
||||||
|
|
||||||
@ -1427,19 +1423,24 @@ void GxsForumThreadWidget::nextUnreadMessage()
|
|||||||
|
|
||||||
if(!index.isValid())
|
if(!index.isValid())
|
||||||
index = mThreadProxyModel->index(0,0);
|
index = mThreadProxyModel->index(0,0);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(index.data(RsGxsForumModel::UnreadChildrenRole).toBool())
|
||||||
|
ui->threadTreeWidget->expand(index);
|
||||||
|
|
||||||
do
|
index = ui->threadTreeWidget->indexBelow(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
while(index.isValid() && !IS_MSG_UNREAD(index.sibling(index.row(),RsGxsForumModel::COLUMN_THREAD_DATA).data(RsGxsForumModel::StatusRole).toUInt()))
|
||||||
{
|
{
|
||||||
if(index.data(RsGxsForumModel::UnreadChildrenRole).toBool())
|
if(index.data(RsGxsForumModel::UnreadChildrenRole).toBool())
|
||||||
ui->threadTreeWidget->expand(index);
|
ui->threadTreeWidget->expand(index);
|
||||||
|
|
||||||
index = ui->threadTreeWidget->indexBelow(index);
|
index = ui->threadTreeWidget->indexBelow(index);
|
||||||
}
|
}
|
||||||
while(index.isValid() && !IS_MSG_UNREAD(index.sibling(index.row(),RsGxsForumModel::COLUMN_THREAD_DATA).data(RsGxsForumModel::StatusRole).toUInt()));
|
|
||||||
|
|
||||||
ui->threadTreeWidget->setCurrentIndex(index);
|
ui->threadTreeWidget->setCurrentIndex(index);
|
||||||
ui->threadTreeWidget->scrollTo(index,QAbstractItemView::PositionAtCenter);
|
ui->threadTreeWidget->scrollTo(index);
|
||||||
//ui->threadTreeWidget->setFocus();
|
|
||||||
changedThread(index);
|
changedThread(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1502,7 +1503,7 @@ bool GxsForumThreadWidget::navigate(const RsGxsMessageId &msgId)
|
|||||||
QModelIndex indx = mThreadProxyModel->mapFromSource(source_index);
|
QModelIndex indx = mThreadProxyModel->mapFromSource(source_index);
|
||||||
|
|
||||||
ui->threadTreeWidget->setCurrentIndex(indx);
|
ui->threadTreeWidget->setCurrentIndex(indx);
|
||||||
ui->threadTreeWidget->scrollTo(indx,QAbstractItemView::PositionAtCenter);
|
ui->threadTreeWidget->scrollTo(indx);
|
||||||
ui->threadTreeWidget->setFocus();
|
ui->threadTreeWidget->setFocus();
|
||||||
changedThread(indx);
|
changedThread(indx);
|
||||||
return true;
|
return true;
|
||||||
@ -1862,7 +1863,7 @@ void GxsForumThreadWidget::postForumLoading()
|
|||||||
{
|
{
|
||||||
QModelIndex index = mThreadProxyModel->mapFromSource(source_index);
|
QModelIndex index = mThreadProxyModel->mapFromSource(source_index);
|
||||||
ui->threadTreeWidget->selectionModel()->setCurrentIndex(index,QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
|
ui->threadTreeWidget->selectionModel()->setCurrentIndex(index,QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
|
||||||
ui->threadTreeWidget->scrollTo(index,QAbstractItemView::PositionAtCenter);
|
ui->threadTreeWidget->scrollTo(index);
|
||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
std::cerr << " re-selecting index of message " << mThreadId << " to " << source_index.row() << "," << source_index.column() << " " << (void*)source_index.internalPointer() << std::endl;
|
std::cerr << " re-selecting index of message " << mThreadId << " to " << source_index.row() << "," << source_index.column() << " " << (void*)source_index.internalPointer() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user