mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05: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);
|
return QVariant(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(role == UnreadChildrenRole)
|
||||||
|
return bool(fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_HAS_UNREAD_CHILDREN);
|
||||||
|
|
||||||
#ifdef DEBUG_FORUMMODEL
|
#ifdef DEBUG_FORUMMODEL
|
||||||
std::cerr << " [ok]" << std::endl;
|
std::cerr << " [ok]" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
@ -73,10 +73,11 @@ public:
|
|||||||
COLUMN_THREAD_NB_COLUMNS =0x08,
|
COLUMN_THREAD_NB_COLUMNS =0x08,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Roles{ SortRole = Qt::UserRole+1,
|
enum Roles{ SortRole = Qt::UserRole+1,
|
||||||
ThreadPinnedRole = Qt::UserRole+2,
|
ThreadPinnedRole = Qt::UserRole+2,
|
||||||
MissingRole = Qt::UserRole+3,
|
MissingRole = Qt::UserRole+3,
|
||||||
StatusRole = Qt::UserRole+4,
|
StatusRole = Qt::UserRole+4,
|
||||||
|
UnreadChildrenRole = Qt::UserRole+5,
|
||||||
};
|
};
|
||||||
|
|
||||||
QModelIndex root() const{ return createIndex(0,0,(void*)NULL) ;}
|
QModelIndex root() const{ return createIndex(0,0,(void*)NULL) ;}
|
||||||
|
@ -2001,6 +2001,7 @@ void GxsForumThreadWidget::previousMessage()
|
|||||||
if (prevItem.isValid()) {
|
if (prevItem.isValid()) {
|
||||||
ui->threadTreeWidget->setCurrentIndex(prevItem);
|
ui->threadTreeWidget->setCurrentIndex(prevItem);
|
||||||
ui->threadTreeWidget->setFocus();
|
ui->threadTreeWidget->setFocus();
|
||||||
|
changedThread(prevItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ui->previousButton->setEnabled(index-1 > 0);
|
ui->previousButton->setEnabled(index-1 > 0);
|
||||||
@ -2027,6 +2028,7 @@ void GxsForumThreadWidget::nextMessage()
|
|||||||
if (nextItem.isValid()) {
|
if (nextItem.isValid()) {
|
||||||
ui->threadTreeWidget->setCurrentIndex(nextItem);
|
ui->threadTreeWidget->setCurrentIndex(nextItem);
|
||||||
ui->threadTreeWidget->setFocus();
|
ui->threadTreeWidget->setFocus();
|
||||||
|
changedThread(nextItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ui->previousButton->setEnabled(true);
|
ui->previousButton->setEnabled(true);
|
||||||
@ -2049,10 +2051,20 @@ void GxsForumThreadWidget::downloadAllFiles()
|
|||||||
|
|
||||||
void GxsForumThreadWidget::nextUnreadMessage()
|
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->setCurrentIndex(index);
|
||||||
ui->threadTreeWidget->setFocus();
|
ui->threadTreeWidget->setFocus();
|
||||||
|
changedThread(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TO_REMOVE
|
#ifdef TO_REMOVE
|
||||||
@ -2255,6 +2267,7 @@ bool GxsForumThreadWidget::navigate(const RsGxsMessageId &msgId)
|
|||||||
|
|
||||||
ui->threadTreeWidget->setCurrentIndex(index);
|
ui->threadTreeWidget->setCurrentIndex(index);
|
||||||
ui->threadTreeWidget->setFocus();
|
ui->threadTreeWidget->setFocus();
|
||||||
|
changedThread(index);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user