fixed closing of comments tab when comments update

This commit is contained in:
csoler 2020-10-03 21:47:00 +02:00
parent f064325592
commit 2af66e91c5
2 changed files with 21 additions and 5 deletions

View File

@ -432,9 +432,20 @@ void PostedListWidgetWithModel::handleEvent_main_thread(std::shared_ptr<const Rs
switch(e->mPostedEventCode)
{
case RsPostedEventCode::NEW_MESSAGE: // [[fallthrough]];
{
// special treatment here because the message might be a comment, so we need to refresh the comment tab if openned
for(int i=2;i<ui->tabWidget->count();++i)
{
auto *t = dynamic_cast<GxsCommentDialog*>(ui->tabWidget->widget(i));
if(t->groupId() == e->mPostedGroupId)
t->refresh();
}
}
case RsPostedEventCode::NEW_POSTED_GROUP: // [[fallthrough]];
case RsPostedEventCode::UPDATED_POSTED_GROUP: // [[fallthrough]];
case RsPostedEventCode::NEW_MESSAGE: // [[fallthrough]];
case RsPostedEventCode::UPDATED_MESSAGE:
{
if(e->mPostedGroupId == groupId())
@ -550,11 +561,14 @@ void PostedListWidgetWithModel::updateGroupData()
RsQThreadUtils::postToObject( [this,groups]()
{
bool group_changed = (groups[0].mMeta.mGroupId!=mGroup.mMeta.mGroupId);
mGroup = groups[0];
mPostedPostsModel->updateBoard(groupId());
insertBoardDetails(mGroup);
if(group_changed)
while(ui->tabWidget->widget(2) != nullptr)
tabCloseRequested(2);

View File

@ -43,8 +43,10 @@ public:
RsGxsGroupId groupId() { return mGrpId; }
RsGxsMessageId messageId() { return mMostRecentMsgId; }
private slots:
public slots:
void refresh();
private slots:
void idChooserReady();
void voterSelectionChanged( int index );
void sortComments(int);