added some missing notifications in circles dialog

This commit is contained in:
csoler 2020-01-28 22:22:04 +01:00
parent 424e7be52f
commit 841ba9e579
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
4 changed files with 54 additions and 20 deletions

View File

@ -182,9 +182,11 @@ enum class RsGxsCircleEventCode: uint8_t
/// mCircleId contains the circle id and mGxsId is the id of the new member
CIRCLE_MEMBERSHIP_JOIN = 0x04,
/** mCircleId contains the circle id and mGxsId is the id that was revoqued
* by admin */
/** mCircleId contains the circle id and mGxsId is the id that was revoqued * by admin */
CIRCLE_MEMBERSHIP_REVOQUED= 0x05,
/** mCircleId contains the circle id */
NEW_CIRCLE = 0x06,
};
struct RsGxsCircleEvent: RsEvent

View File

@ -547,6 +547,14 @@ void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes)
RsStackMutex stack(mCircleMtx); /********** STACK LOCKED MTX ******/
mCircleCache.erase(RsGxsCircleId(*git));
}
if(rsEvents && (c->getType() == RsGxsNotify::TYPE_RECEIVED_NEW|| c->getType() == RsGxsNotify::TYPE_PUBLISHED) )
{
auto ev = std::make_shared<RsGxsCircleEvent>();
ev->mCircleId = RsGxsCircleId(*git);
ev->mCircleEventType = RsGxsCircleEventCode::NEW_CIRCLE;
rsEvents->postEvent(ev);
}
}
}

View File

@ -150,8 +150,11 @@ 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 );
mEventHandlerId_identity = 0;
rsEvents->registerEventsHandler(RsEventType::GXS_IDENTITY, [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [=]() { handleEvent_main_thread(event); }, this ); }, mEventHandlerId_identity );
mEventHandlerId_circles = 0;
rsEvents->registerEventsHandler(RsEventType::GXS_CIRCLES, [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [=]() { handleEvent_main_thread(event); }, this ); }, mEventHandlerId_circles );
// 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);
@ -405,25 +408,45 @@ IdDialog::IdDialog(QWidget *parent) :
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)
if(event->mType == RsEventType::GXS_IDENTITY)
{
case RsGxsIdentityEventCode::DELETED_IDENTITY:
case RsGxsIdentityEventCode::NEW_IDENTITY:
const RsGxsIdentityEvent *e = dynamic_cast<const RsGxsIdentityEvent*>(event.get());
requestIdList();
getUserNotify()->updateIcon();
if(!e)
return;
default:
break;
switch(e->mIdentityEventCode)
{
case RsGxsIdentityEventCode::DELETED_IDENTITY:
case RsGxsIdentityEventCode::NEW_IDENTITY:
requestIdList();
default:
break;
}
}
else if(event->mType == RsEventType::GXS_CIRCLES)
{
const RsGxsCircleEvent *e = dynamic_cast<const RsGxsCircleEvent*>(event.get());
if(!e)
return;
switch(e->mCircleEventType)
{
case RsGxsCircleEventCode::NEW_CIRCLE:
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_REQUEST:
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_INVITE:
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_LEAVE:
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_JOIN:
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_REVOQUED:
requestIdList();
default:
break;
}
}
}
void IdDialog::clearPerson()

View File

@ -159,7 +159,8 @@ private:
int filter;
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
RsEventsHandlerId_t mEventHandlerId;
RsEventsHandlerId_t mEventHandlerId_identity;
RsEventsHandlerId_t mEventHandlerId_circles;
/* UI - Designer */
Ui::IdDialog *ui;