fixed update of posts list in new ForumModel

This commit is contained in:
csoler 2018-11-22 09:47:58 +01:00
parent e01de33e1a
commit b28a76e35b
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
2 changed files with 21 additions and 15 deletions

View File

@ -202,7 +202,8 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
mThreadCompareRole = new RSTreeWidgetItemCompareRole;
mThreadCompareRole->setRole(COLUMN_THREAD_DATE, ROLE_THREAD_SORT);
ui->threadTreeWidget->setModel(new RsGxsForumModel(this));
mThreadModel = new RsGxsForumModel(this);
ui->threadTreeWidget->setModel(mThreadModel);
ui->threadTreeWidget->setItemDelegateForColumn(COLUMN_THREAD_DISTRIBUTION,new DistributionItemDelegate()) ;
connect(ui->versions_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(changedVersion()));
@ -395,7 +396,8 @@ void GxsForumThreadWidget::groupIdChanged()
emit groupChanged(this);
fillComplete();
mThreadModel->setForum(groupId());
//fillComplete();
}
QString GxsForumThreadWidget::groupName(bool withUnreadCount)
@ -474,7 +476,7 @@ void GxsForumThreadWidget::updateDisplay(bool complete)
if (complete) {
/* Fill complete */
requestGroupData();
insertThreads();
//insertThreads();
insertMessage();
mIgnoredMsgId.clear();
@ -492,7 +494,7 @@ void GxsForumThreadWidget::updateDisplay(bool complete)
if (grpIds.find(groupId())!=grpIds.end()){
updateGroup = true;
/* Update threads */
insertThreads();
//insertThreads();
} else {
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgIds;
getAllMsgIds(msgIds);
@ -504,7 +506,7 @@ void GxsForumThreadWidget::updateDisplay(bool complete)
if (msgIds.find(groupId()) != msgIds.end()) {
/* Update threads */
insertThreads();
//insertThreads();
}
}
@ -1427,7 +1429,7 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
return item;
}
#ifdef TO_REMOVE
void GxsForumThreadWidget::insertThreads()
{
#ifdef DEBUG_FORUMS
@ -1502,9 +1504,9 @@ void GxsForumThreadWidget::insertThreads()
ui->threadTreeWidget->setRootIsDecorated(!mFillThread->mFlatView);
// connect thread
connect(mFillThread, SIGNAL(finished()), this, SLOT(fillThreadFinished()), Qt::BlockingQueuedConnection);
connect(mFillThread, SIGNAL(status(QString)), this, SLOT(fillThreadStatus(QString)));
connect(mFillThread, SIGNAL(progress(int,int)), this, SLOT(fillThreadProgress(int,int)));
// connect(mFillThread, SIGNAL(finished()), this, SLOT(fillThreadFinished()), Qt::BlockingQueuedConnection);
// connect(mFillThread, SIGNAL(status(QString)), this, SLOT(fillThreadStatus(QString)));
// connect(mFillThread, SIGNAL(progress(int,int)), this, SLOT(fillThreadProgress(int,int)));
#ifdef DEBUG_FORUMS
std::cerr << "ForumsDialog::insertThreads() Start fill thread" << std::endl;
@ -1535,7 +1537,6 @@ static void copyItem(QTreeWidgetItem *item, const QTreeWidgetItem *newItem)
void GxsForumThreadWidget::fillThreads(QList<QTreeWidgetItem *> &threadList, bool expandNewMessages, QList<QTreeWidgetItem*> &itemToExpand)
{
#ifdef TODO
#ifdef DEBUG_FORUMS
std::cerr << "GxsForumThreadWidget::fillThreads()" << std::endl;
#endif
@ -1607,9 +1608,10 @@ void GxsForumThreadWidget::fillThreads(QList<QTreeWidgetItem *> &threadList, boo
#ifdef DEBUG_FORUMS
std::cerr << "GxsForumThreadWidget::fillThreads() done" << std::endl;
#endif
#endif
}
#endif
#ifdef TO_REMOVE
void GxsForumThreadWidget::fillChildren(QTreeWidgetItem *parentItem, QTreeWidgetItem *newParentItem, bool expandNewMessages, QList<QTreeWidgetItem*> &itemToExpand)
{
int index = 0;
@ -1673,6 +1675,7 @@ void GxsForumThreadWidget::fillChildren(QTreeWidgetItem *parentItem, QTreeWidget
}
}
}
#endif
void GxsForumThreadWidget::insertMessage()
{
@ -2487,7 +2490,7 @@ void GxsForumThreadWidget::filterColumnChanged(int column)
if (column == COLUMN_THREAD_CONTENT) {
// need content ... refill
insertThreads();
//insertThreads();
} else {
filterItems(ui->filterLineEdit->text());
}

View File

@ -32,6 +32,7 @@ class RSTreeWidgetItemCompareRole;
class RsGxsForumMsg;
class GxsForumsFillThread;
class RsGxsForumGroup;
class RsGxsForumModel;
namespace Ui {
class GxsForumThreadWidget;
@ -149,11 +150,11 @@ private slots:
private:
void insertMessageData(const RsGxsForumMsg &msg);
void insertThreads();
void insertMessage();
void fillThreads(QList<QTreeWidgetItem *> &threadList, bool expandNewMessages, QList<QTreeWidgetItem*> &itemToExpand);
void fillChildren(QTreeWidgetItem *parentItem, QTreeWidgetItem *newParentItem, bool expandNewMessages, QList<QTreeWidgetItem*> &itemToExpand);
//void insertThreads();
//void fillThreads(QList<QTreeWidgetItem *> &threadList, bool expandNewMessages, QList<QTreeWidgetItem*> &itemToExpand);
//void fillChildren(QTreeWidgetItem *parentItem, QTreeWidgetItem *newParentItem, bool expandNewMessages, QList<QTreeWidgetItem*> &itemToExpand);
int getSelectedMsgCount(QList<QTreeWidgetItem*> *pRows, QList<QTreeWidgetItem*> *pRowsRead, QList<QTreeWidgetItem*> *pRowsUnread);
void setMsgReadStatus(QList<QTreeWidgetItem*> &rows, bool read);
@ -225,6 +226,8 @@ private:
QMap<RsGxsMessageId,QVector<QPair<time_t,RsGxsMessageId> > > mPostVersions ; // holds older versions of posts
RsGxsForumModel *mThreadModel;
Ui::GxsForumThreadWidget *ui;
};