fixed missed notification in Messages when new/draft msg happens by switching to new event system

This commit is contained in:
csoler 2020-10-28 21:26:07 +01:00
parent b74e6dbe42
commit b5cfa46073
6 changed files with 49 additions and 9 deletions

View file

@ -284,6 +284,30 @@ MessagesDialog::MessagesDialog(QWidget *parent)
connect(ui.messageTreeWidget->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumn(int,Qt::SortOrder)));
connect(ui.messageTreeWidget->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&)), this, SLOT(currentChanged(const QModelIndex&,const QModelIndex&)));
mEventHandlerId=0;
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId, RsEventType::MAIL_STATUS );
}
void MessagesDialog::handleEvent(std::shared_ptr<const RsEvent> event)
{
if(event->mType != RsEventType::MAIL_STATUS)
return;
const RsMailStatusEvent *fe = dynamic_cast<const RsMailStatusEvent*>(event.get());
if(!fe)
return;
switch (fe->mMailStatusEventCode)
{
case RsMailStatusEventCode::MESSAGE_SENT:
case RsMailStatusEventCode::MESSAGE_REMOVED:
case RsMailStatusEventCode::NEW_MESSAGE:
updateMessageSummaryList();
break;
default:
break;
}
}
void MessagesDialog::preModelUpdate()
@ -836,6 +860,8 @@ void MessagesDialog::changeBox(int box_row)
mMessageModel->setCurrentBox(RsMessageModel::BOX_NONE);
}
inChange = false;
updateMessageSummaryList();
}
void MessagesDialog::changeQuickView(int newrow)