mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed next/prev item and next unread selection
This commit is contained in:
parent
3a76f25152
commit
b179cb5796
@ -281,6 +281,10 @@ QVariant RsGxsForumModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
return QVariant(font);
|
||||
}
|
||||
|
||||
if(role == UnreadChildrenRole)
|
||||
return bool(fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_HAS_UNREAD_CHILDREN);
|
||||
|
||||
#ifdef DEBUG_FORUMMODEL
|
||||
std::cerr << " [ok]" << std::endl;
|
||||
#endif
|
||||
|
@ -73,10 +73,11 @@ public:
|
||||
COLUMN_THREAD_NB_COLUMNS =0x08,
|
||||
};
|
||||
|
||||
enum Roles{ SortRole = Qt::UserRole+1,
|
||||
ThreadPinnedRole = Qt::UserRole+2,
|
||||
MissingRole = Qt::UserRole+3,
|
||||
StatusRole = Qt::UserRole+4,
|
||||
enum Roles{ SortRole = Qt::UserRole+1,
|
||||
ThreadPinnedRole = Qt::UserRole+2,
|
||||
MissingRole = Qt::UserRole+3,
|
||||
StatusRole = Qt::UserRole+4,
|
||||
UnreadChildrenRole = Qt::UserRole+5,
|
||||
};
|
||||
|
||||
QModelIndex root() const{ return createIndex(0,0,(void*)NULL) ;}
|
||||
|
@ -2001,6 +2001,7 @@ void GxsForumThreadWidget::previousMessage()
|
||||
if (prevItem.isValid()) {
|
||||
ui->threadTreeWidget->setCurrentIndex(prevItem);
|
||||
ui->threadTreeWidget->setFocus();
|
||||
changedThread(prevItem);
|
||||
}
|
||||
}
|
||||
ui->previousButton->setEnabled(index-1 > 0);
|
||||
@ -2027,6 +2028,7 @@ void GxsForumThreadWidget::nextMessage()
|
||||
if (nextItem.isValid()) {
|
||||
ui->threadTreeWidget->setCurrentIndex(nextItem);
|
||||
ui->threadTreeWidget->setFocus();
|
||||
changedThread(nextItem);
|
||||
}
|
||||
}
|
||||
ui->previousButton->setEnabled(true);
|
||||
@ -2049,10 +2051,20 @@ void GxsForumThreadWidget::downloadAllFiles()
|
||||
|
||||
void GxsForumThreadWidget::nextUnreadMessage()
|
||||
{
|
||||
QModelIndex index = mThreadModel->getNextIndex(getCurrentIndex(),true);
|
||||
QModelIndex index = getCurrentIndex();
|
||||
|
||||
do
|
||||
{
|
||||
if(index.data(RsGxsForumModel::UnreadChildrenRole).toBool())
|
||||
ui->threadTreeWidget->expand(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->setFocus();
|
||||
changedThread(index);
|
||||
}
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
@ -2255,6 +2267,7 @@ bool GxsForumThreadWidget::navigate(const RsGxsMessageId &msgId)
|
||||
|
||||
ui->threadTreeWidget->setCurrentIndex(index);
|
||||
ui->threadTreeWidget->setFocus();
|
||||
changedThread(index);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user