added notifications for identities

This commit is contained in:
csoler 2020-01-27 23:02:04 +01:00
parent 90bb6c0011
commit 424e7be52f
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
7 changed files with 92 additions and 52 deletions

View file

@ -35,10 +35,12 @@
#include "gui/chat/ChatDialog.h"
#include "gui/Circles/CreateCircleDialog.h"
#include "gui/common/UIStateHelper.h"
#include "gui/common/UserNotify.h"
#include "gui/gxs/GxsIdDetails.h"
#include "gui/gxs/RsGxsUpdateBroadcastBase.h"
#include "gui/msgs/MessageComposer.h"
#include "gui/settings/rsharesettings.h"
#include "util/qtthreadsutils.h"
#include "retroshare-gui/RsAutoUpdatePage.h"
#include "util/misc.h"
#include "util/QtVersion.h"
@ -148,6 +150,9 @@ IdDialog::IdDialog(QWidget *parent) :
mIdQueue = NULL;
mEventHandlerId = 0;
rsEvents->registerEventsHandler(RsEventType::GXS_IDENTITY, [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [=]() { handleEvent_main_thread(event); }, this ); }, mEventHandlerId );
// This is used to grab the broadcast of changes from p3GxsCircles, which is discarded by the current dialog, since it expects data for p3Identity only.
mCirclesBroadcastBase = new RsGxsUpdateBroadcastBase(rsGxsCircles, this);
connect(mCirclesBroadcastBase, SIGNAL(fillDisplay(bool)), this, SLOT(updateCirclesDisplay(bool)));
@ -398,6 +403,29 @@ IdDialog::IdDialog(QWidget *parent) :
tmer->start(10000) ; // update every 10 secs.
}
void IdDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
{
if(event->mType != RsEventType::GXS_IDENTITY)
return;
const RsGxsIdentityEvent *e = dynamic_cast<const RsGxsIdentityEvent*>(event.get());
if(!e)
return;
switch(e->mIdentityEventCode)
{
case RsGxsIdentityEventCode::DELETED_IDENTITY:
case RsGxsIdentityEventCode::NEW_IDENTITY:
requestIdList();
getUserNotify()->updateIcon();
default:
break;
}
}
void IdDialog::clearPerson()
{
QFontMetricsF f(ui->avLabel_Person->font()) ;