GxsForums:

- Fixed expand new messages
- Fixed creating of thread/post messages

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6065 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-01-07 22:11:16 +00:00
parent 84c910672e
commit f12473f7f7
5 changed files with 402 additions and 362 deletions

View file

@ -25,6 +25,7 @@
#include "GxsForumsFillThread.h"
#include "GxsForumThreadWidget.h"
#include "gxs/rsgxsflags.h"
#include <retroshare/rsgxsforums.h>
#include <iostream>
@ -74,6 +75,18 @@ void GxsForumsFillThread::stop()
wait();
}
void GxsForumsFillThread::calculateExpand(const RsGxsForumMsg &msg, QTreeWidgetItem *item)
{
if (mFillComplete && mExpandNewMessages && IS_MSG_UNREAD(msg.mMeta.mMsgStatus)) {
QTreeWidgetItem *parentItem = item;
while ((parentItem = parentItem->parent()) != NULL) {
if (std::find(mItemToExpand.begin(), mItemToExpand.end(), parentItem) == mItemToExpand.end()) {
mItemToExpand.push_back(parentItem);
}
}
}
}
void GxsForumsFillThread::run()
{
RsTokenService *service = rsGxsForums->getTokenService();
@ -162,6 +175,7 @@ void GxsForumsFillThread::run()
QTreeWidgetItem *item = mParent->convertMsgToThreadWidget(msg, mUseChildTS, mFilterColumn);
threadList.push_back(QPair<std::string, QTreeWidgetItem*>(msg.mMeta.mMsgId, item));
calculateExpand(msg, item);
mItems.append(item);
emit progress(++pos, count);
@ -202,6 +216,7 @@ void GxsForumsFillThread::run()
threadPair.second->addChild(item);
}
calculateExpand(msg, item);
/* add item to process list */
threadList.push_back(QPair<std::string, QTreeWidgetItem*>(msg.mMeta.mMsgId, item));