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:
thunder2 2012-10-23 20:51:35 +00:00
parent 232af8e71e
commit c1c9894daf
2 changed files with 52 additions and 30 deletions

View File

@ -1227,22 +1227,33 @@ void ForumsDialog::downloadAllFiles()
void ForumsDialog::nextUnreadMessage()
{
QTreeWidgetItem *currentItem = ui.threadTreeWidget->currentItem();
if( !currentItem )
{
currentItem = ui.threadTreeWidget->topLevelItem(0);
if( !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;
}
do
{
uint32_t status = currentItem->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
if( IS_UNREAD(status) )
{
ui.threadTreeWidget->setCurrentItem(currentItem);
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

View File

@ -1239,22 +1239,33 @@ void ForumsV2Dialog::downloadAllFiles()
void ForumsV2Dialog::nextUnreadMessage()
{
QTreeWidgetItem *currentItem = ui.threadTreeWidget->currentItem();
if( !currentItem )
{
currentItem = ui.threadTreeWidget->topLevelItem(0);
if( !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;
}
do
{
uint32_t status = currentItem->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
if( IS_MSG_UNREAD(status) )
{
ui.threadTreeWidget->setCurrentItem(currentItem);
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