mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
The next unread button in forums search for child items and start at the top when the end of the list is reached.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5716 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
232af8e71e
commit
c1c9894daf
@ -1226,23 +1226,34 @@ void ForumsDialog::downloadAllFiles()
|
||||
|
||||
void ForumsDialog::nextUnreadMessage()
|
||||
{
|
||||
QTreeWidgetItem* currentItem = ui.threadTreeWidget->currentItem();
|
||||
if( !currentItem )
|
||||
{
|
||||
currentItem = ui.threadTreeWidget->topLevelItem(0);
|
||||
if( !currentItem )
|
||||
return;
|
||||
}
|
||||
QTreeWidgetItem *currentItem = ui.threadTreeWidget->currentItem();
|
||||
|
||||
do
|
||||
{
|
||||
uint32_t status = currentItem->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
||||
if( IS_UNREAD(status) )
|
||||
{
|
||||
ui.threadTreeWidget->setCurrentItem(currentItem);
|
||||
return;
|
||||
while (TRUE) {
|
||||
QTreeWidgetItemIterator itemIterator = currentItem ? QTreeWidgetItemIterator(currentItem, QTreeWidgetItemIterator::NotHidden) : QTreeWidgetItemIterator(ui.threadTreeWidget, QTreeWidgetItemIterator::NotHidden);
|
||||
|
||||
QTreeWidgetItem *item;
|
||||
while ((item = *itemIterator) != NULL) {
|
||||
itemIterator++;
|
||||
|
||||
if (item == currentItem) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32_t status = item->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
||||
if (IS_UNREAD(status)) {
|
||||
ui.threadTreeWidget->setCurrentItem(item);
|
||||
ui.threadTreeWidget->scrollToItem(item, QAbstractItemView::EnsureVisible);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} while( (currentItem = ui.threadTreeWidget->itemBelow(currentItem)) != NULL );
|
||||
|
||||
if (currentItem == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* start from top */
|
||||
currentItem = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
@ -1238,23 +1238,34 @@ void ForumsV2Dialog::downloadAllFiles()
|
||||
|
||||
void ForumsV2Dialog::nextUnreadMessage()
|
||||
{
|
||||
QTreeWidgetItem* currentItem = ui.threadTreeWidget->currentItem();
|
||||
if( !currentItem )
|
||||
{
|
||||
currentItem = ui.threadTreeWidget->topLevelItem(0);
|
||||
if( !currentItem )
|
||||
return;
|
||||
}
|
||||
QTreeWidgetItem *currentItem = ui.threadTreeWidget->currentItem();
|
||||
|
||||
do
|
||||
{
|
||||
uint32_t status = currentItem->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
||||
if( IS_MSG_UNREAD(status) )
|
||||
{
|
||||
ui.threadTreeWidget->setCurrentItem(currentItem);
|
||||
return;
|
||||
while (TRUE) {
|
||||
QTreeWidgetItemIterator itemIterator = currentItem ? QTreeWidgetItemIterator(currentItem, QTreeWidgetItemIterator::NotHidden) : QTreeWidgetItemIterator(ui.threadTreeWidget, QTreeWidgetItemIterator::NotHidden);
|
||||
|
||||
QTreeWidgetItem *item;
|
||||
while ((item = *itemIterator) != NULL) {
|
||||
itemIterator++;
|
||||
|
||||
if (item == currentItem) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32_t status = item->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
||||
if (IS_UNREAD(status)) {
|
||||
ui.threadTreeWidget->setCurrentItem(item);
|
||||
ui.threadTreeWidget->scrollToItem(item, QAbstractItemView::EnsureVisible);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} while( (currentItem = ui.threadTreeWidget->itemBelow(currentItem)) != NULL );
|
||||
|
||||
if (currentItem == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* start from top */
|
||||
currentItem = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
Loading…
Reference in New Issue
Block a user