fixed update of threads in new model

This commit is contained in:
csoler 2018-11-25 17:40:48 +01:00
parent 419bd2157a
commit dc913e37c9
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
2 changed files with 14 additions and 8 deletions

View File

@ -459,6 +459,8 @@ void RsGxsForumModel::setForum(const RsGxsGroupId& forum_group_id)
void RsGxsForumModel::setPosts(const RsGxsForumGroup& group, const std::vector<ForumModelPostEntry>& posts) void RsGxsForumModel::setPosts(const RsGxsForumGroup& group, const std::vector<ForumModelPostEntry>& posts)
{ {
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(0,COLUMN_THREAD_NB_COLUMNS-1,(void*)NULL));
mForumGroup = group; mForumGroup = group;
mPosts = posts; mPosts = posts;
@ -476,7 +478,6 @@ void RsGxsForumModel::setPosts(const RsGxsForumGroup& group, const std::vector<F
debug_dump(); debug_dump();
emit layoutChanged(); emit layoutChanged();
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(0,COLUMN_THREAD_NB_COLUMNS-1,(void*)NULL));
} }
void RsGxsForumModel::update_posts(const RsGxsGroupId& group_id) void RsGxsForumModel::update_posts(const RsGxsGroupId& group_id)

View File

@ -367,7 +367,7 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
/* Set header resize modes and initial section sizes */ /* Set header resize modes and initial section sizes */
QHeaderView * ttheader = ui->threadTreeWidget->header () ; QHeaderView * ttheader = ui->threadTreeWidget->header () ;
QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_TITLE, QHeaderView::Interactive); QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_TITLE, QHeaderView::Interactive);
QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_DISTRIBUTION, QHeaderView::ResizeToContents); QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_DISTRIBUTION, QHeaderView::ResizeToContents);
float f = QFontMetricsF(font()).height()/14.0f ; float f = QFontMetricsF(font()).height()/14.0f ;
@ -451,9 +451,11 @@ void GxsForumThreadWidget::blank()
#endif #endif
ui->forumName->setText(""); ui->forumName->setText("");
#ifdef SUSPENDED_CODE
mStateHelper->setWidgetEnabled(ui->newthreadButton, false); mStateHelper->setWidgetEnabled(ui->newthreadButton, false);
mStateHelper->setWidgetEnabled(ui->previousButton, false); mStateHelper->setWidgetEnabled(ui->previousButton, false);
mStateHelper->setWidgetEnabled(ui->nextButton, false); mStateHelper->setWidgetEnabled(ui->nextButton, false);
#endif
ui->versions_CB->hide(); ui->versions_CB->hide();
} }
@ -520,10 +522,8 @@ void GxsForumThreadWidget::groupIdChanged()
mNewCount = 0; mNewCount = 0;
mUnreadCount = 0; mUnreadCount = 0;
emit groupChanged(this);
mThreadModel->setForum(groupId()); mThreadModel->setForum(groupId());
//fillComplete(); updateDisplay(true);
} }
QString GxsForumThreadWidget::groupName(bool withUnreadCount) QString GxsForumThreadWidget::groupName(bool withUnreadCount)
@ -1077,7 +1077,7 @@ void GxsForumThreadWidget::insertGroupData()
#ifdef DEBUG_FORUMS #ifdef DEBUG_FORUMS
std::cerr << "GxsForumThreadWidget::insertGroupData" << std::endl; std::cerr << "GxsForumThreadWidget::insertGroupData" << std::endl;
#endif #endif
GxsIdDetails::process(mForumGroup.mMeta.mAuthorId, &loadAuthorIdCallback, this); //GxsIdDetails::process(mForumGroup.mMeta.mAuthorId, &loadAuthorIdCallback, this);
calculateIconsAndFonts(); calculateIconsAndFonts();
} }
@ -1788,9 +1788,10 @@ void GxsForumThreadWidget::insertMessage()
{ {
if (groupId().isNull()) if (groupId().isNull())
{ {
#ifdef SUSPENDED_CODE
mStateHelper->setActive(mTokenTypeMessageData, false); mStateHelper->setActive(mTokenTypeMessageData, false);
mStateHelper->clear(mTokenTypeMessageData); mStateHelper->clear(mTokenTypeMessageData);
#endif
ui->versions_CB->hide(); ui->versions_CB->hide();
ui->time_label->show(); ui->time_label->show();
@ -1800,8 +1801,10 @@ void GxsForumThreadWidget::insertMessage()
if (mThreadId.isNull()) if (mThreadId.isNull())
{ {
#ifdef SUSPENDED_CODE
mStateHelper->setActive(mTokenTypeMessageData, false); mStateHelper->setActive(mTokenTypeMessageData, false);
mStateHelper->clear(mTokenTypeMessageData); mStateHelper->clear(mTokenTypeMessageData);
#endif
ui->versions_CB->hide(); ui->versions_CB->hide();
ui->time_label->show(); ui->time_label->show();
@ -1810,7 +1813,9 @@ void GxsForumThreadWidget::insertMessage()
return; return;
} }
#ifdef SUSPENDED_CODE
mStateHelper->setActive(mTokenTypeMessageData, true); mStateHelper->setActive(mTokenTypeMessageData, true);
#endif
#ifdef TODO #ifdef TODO
QTreeWidgetItem *item = ui->threadTreeWidget->currentItem(); QTreeWidgetItem *item = ui->threadTreeWidget->currentItem();
@ -2717,7 +2722,7 @@ void GxsForumThreadWidget::updateGroupData()
*/ */
mForumGroup = group; mForumGroup = group;
insertGroupData(); //insertGroupData();
mSubscribeFlags = group.mMeta.mSubscribeFlags; mSubscribeFlags = group.mMeta.mSubscribeFlags;
ui->threadTreeWidget->setColumnHidden(RsGxsForumModel::COLUMN_THREAD_DISTRIBUTION, !IS_GROUP_PGP_KNOWN_AUTHED(mForumGroup.mMeta.mSignFlags) && !(IS_GROUP_PGP_AUTHED(mForumGroup.mMeta.mSignFlags))); ui->threadTreeWidget->setColumnHidden(RsGxsForumModel::COLUMN_THREAD_DISTRIBUTION, !IS_GROUP_PGP_KNOWN_AUTHED(mForumGroup.mMeta.mSignFlags) && !(IS_GROUP_PGP_AUTHED(mForumGroup.mMeta.mSignFlags)));