mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-09 03:18:41 -05:00
fixed missed notification in Messages when new/draft msg happens by switching to new event system
This commit is contained in:
parent
b74e6dbe42
commit
b5cfa46073
@ -1122,7 +1122,7 @@ uint32_t p3MsgService::sendMessage(RsMsgItem* item)
|
|||||||
|
|
||||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||||
|
|
||||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST, NOTIFY_TYPE_ADD);
|
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST, NOTIFY_TYPE_ADD); // deprecated
|
||||||
|
|
||||||
return item->msgId;
|
return item->msgId;
|
||||||
}
|
}
|
||||||
@ -1196,10 +1196,15 @@ bool p3MsgService::MessageSend(MessageInfo &info)
|
|||||||
info.msgId = std::to_string(msg->msgId);
|
info.msgId = std::to_string(msg->msgId);
|
||||||
info .msgflags = msg->msgFlags;
|
info .msgflags = msg->msgFlags;
|
||||||
|
|
||||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_ADD);
|
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_ADD);// deprecated. Should be removed. Oct. 28, 2020
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
auto pEvent = std::make_shared<RsMailStatusEvent>();
|
||||||
|
pEvent->mMailStatusEventCode = RsMailStatusEventCode::MESSAGE_SENT;
|
||||||
|
pEvent->mChangedMsgIds.insert(std::to_string(msg->msgId));
|
||||||
|
rsEvents->postEvent(pEvent);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t p3MsgService::sendMail(
|
uint32_t p3MsgService::sendMail(
|
||||||
@ -1399,7 +1404,11 @@ bool p3MsgService::MessageToDraft(MessageInfo &info, const std::string &msgParen
|
|||||||
|
|
||||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||||
|
|
||||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
// RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||||
|
|
||||||
|
auto pEvent = std::make_shared<RsMailStatusEvent>();
|
||||||
|
pEvent->mMailStatusEventCode = RsMailStatusEventCode::MESSAGE_SENT;
|
||||||
|
rsEvents->postEvent(pEvent);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -877,7 +877,7 @@ void PostedListWidgetWithModel::insertBoardDetails(const RsPostedGroup& group)
|
|||||||
sync_string = tr("Unknown");
|
sync_string = tr("Unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(group.mMeta.mLastPost + rsPosted->getSyncPeriod(group.mMeta.mGroupId) < time(NULL) && IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags))
|
if(group.mMeta.mLastPost > 0 && group.mMeta.mLastPost + rsPosted->getSyncPeriod(group.mMeta.mGroupId) < time(NULL) && IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags))
|
||||||
sync_string += " (Warning: will not allow latest posts to sync)";
|
sync_string += " (Warning: will not allow latest posts to sync)";
|
||||||
|
|
||||||
ui->syncPeriodLabel->setText(sync_string);
|
ui->syncPeriodLabel->setText(sync_string);
|
||||||
|
@ -1093,7 +1093,7 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
|
|||||||
sync_string = tr("Unknown");
|
sync_string = tr("Unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(group.mMeta.mLastPost + rsGxsChannels->getSyncPeriod(group.mMeta.mGroupId) < time(NULL) && IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags))
|
if(group.mMeta.mLastPost > 0 && group.mMeta.mLastPost + rsGxsChannels->getSyncPeriod(group.mMeta.mGroupId) < time(NULL) && IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags))
|
||||||
sync_string += " (Warning: will not allow latest posts to sync)";
|
sync_string += " (Warning: will not allow latest posts to sync)";
|
||||||
|
|
||||||
ui->infoSyncTimeLabel->setText(sync_string);
|
ui->infoSyncTimeLabel->setText(sync_string);
|
||||||
@ -1185,13 +1185,13 @@ void GxsChannelPostsWidgetWithModel::setSubscribeButtonText(const RsGxsGroupId&
|
|||||||
ui->subscribeToolButton->setEnabled(true);
|
ui->subscribeToolButton->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case DistantSearchGroupStatus::CAN_BE_REQUESTED: // means no search ongoing. This is not a distant search
|
case DistantSearchGroupStatus::CAN_BE_REQUESTED: // means no search ongoing. This is not a distant search
|
||||||
ui->subscribeToolButton->setText(tr("Request data"));
|
ui->subscribeToolButton->setText(tr("Subscribe"));
|
||||||
ui->subscribeToolButton->setToolTip(tr("Hit this button to retrieve the data you need to subscribe to this channel") );
|
ui->subscribeToolButton->setToolTip(tr("Hit this button to retrieve the data you need to subscribe to this channel") );
|
||||||
ui->subscribeToolButton->setSubscribed(false);
|
ui->subscribeToolButton->setSubscribed(false);
|
||||||
ui->subscribeToolButton->setEnabled(false);
|
ui->subscribeToolButton->setEnabled(false);
|
||||||
break;
|
break;
|
||||||
case DistantSearchGroupStatus::ONGOING_REQUEST:
|
case DistantSearchGroupStatus::ONGOING_REQUEST:
|
||||||
ui->subscribeToolButton->setText(tr("Ongoing request..."));
|
ui->subscribeToolButton->setText(tr("Subscribe"));
|
||||||
ui->subscribeToolButton->setToolTip("");
|
ui->subscribeToolButton->setToolTip("");
|
||||||
ui->subscribeToolButton->setSubscribed(true);
|
ui->subscribeToolButton->setSubscribed(true);
|
||||||
ui->subscribeToolButton->setEnabled(false);
|
ui->subscribeToolButton->setEnabled(false);
|
||||||
|
@ -1427,7 +1427,7 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
|
|||||||
break ;
|
break ;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
std::cerr << __PRETTY_FUNCTION__ << ": Unhandled desitnation type " << dtype << std::endl;
|
std::cerr << __PRETTY_FUNCTION__ << ": Unhandled destination type " << dtype << std::endl;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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->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&)));
|
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()
|
void MessagesDialog::preModelUpdate()
|
||||||
@ -836,6 +860,8 @@ void MessagesDialog::changeBox(int box_row)
|
|||||||
mMessageModel->setCurrentBox(RsMessageModel::BOX_NONE);
|
mMessageModel->setCurrentBox(RsMessageModel::BOX_NONE);
|
||||||
}
|
}
|
||||||
inChange = false;
|
inChange = false;
|
||||||
|
|
||||||
|
updateMessageSummaryList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesDialog::changeQuickView(int newrow)
|
void MessagesDialog::changeQuickView(int newrow)
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
|
#include <retroshare/rsevents.h>
|
||||||
#include <retroshare-gui/mainpage.h>
|
#include <retroshare-gui/mainpage.h>
|
||||||
|
|
||||||
#include "ui_MessagesDialog.h"
|
#include "ui_MessagesDialog.h"
|
||||||
@ -110,6 +111,8 @@ private slots:
|
|||||||
void tabCloseRequested(int tab);
|
void tabCloseRequested(int tab);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void handleEvent(std::shared_ptr<const RsEvent> event);
|
||||||
|
|
||||||
void updateInterface();
|
void updateInterface();
|
||||||
|
|
||||||
void connectActions();
|
void connectActions();
|
||||||
@ -157,6 +160,8 @@ private:
|
|||||||
|
|
||||||
QList<QString> mTmpSavedSelectedIds;
|
QList<QString> mTmpSavedSelectedIds;
|
||||||
QModelIndex lastSelectedIndex;
|
QModelIndex lastSelectedIndex;
|
||||||
|
|
||||||
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user