fixed missing event handler registration

This commit is contained in:
csoler 2023-10-29 21:05:02 +01:00
parent 55651e73d9
commit ab61149cb1
4 changed files with 19 additions and 12 deletions

View File

@ -37,9 +37,20 @@ GxsChannelGroupItem::GxsChannelGroupItem(FeedHolder *feedHolder, uint32_t feedId
GxsGroupFeedItem(feedHolder, feedId, groupId, isHome, rsGxsChannels, autoUpdate) GxsGroupFeedItem(feedHolder, feedId, groupId, isHome, rsGxsChannels, autoUpdate)
{ {
setup(); setup();
requestGroup(); requestGroup();
addEventHandler();
}
GxsChannelGroupItem::GxsChannelGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, bool isHome, bool autoUpdate) :
GxsGroupFeedItem(feedHolder, feedId, group.mMeta.mGroupId, isHome, rsGxsChannels, autoUpdate)
{
setup();
setGroup(group);
addEventHandler();
}
void GxsChannelGroupItem::addEventHandler()
{
mEventHandlerId = 0; mEventHandlerId = 0;
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
{ {
@ -64,14 +75,6 @@ GxsChannelGroupItem::GxsChannelGroupItem(FeedHolder *feedHolder, uint32_t feedId
}, mEventHandlerId, RsEventType::GXS_CHANNELS ); }, mEventHandlerId, RsEventType::GXS_CHANNELS );
} }
GxsChannelGroupItem::GxsChannelGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, bool isHome, bool autoUpdate) :
GxsGroupFeedItem(feedHolder, feedId, group.mMeta.mGroupId, isHome, rsGxsChannels, autoUpdate)
{
setup();
setGroup(group);
}
GxsChannelGroupItem::~GxsChannelGroupItem() GxsChannelGroupItem::~GxsChannelGroupItem()
{ {
rsEvents->unregisterEventsHandler(mEventHandlerId); rsEvents->unregisterEventsHandler(mEventHandlerId);

View File

@ -60,6 +60,7 @@ private slots:
private: private:
void fill(); void fill();
void setup(); void setup();
void addEventHandler();
private: private:
RsGxsChannelGroup mGroup; RsGxsChannelGroup mGroup;

View File

@ -36,8 +36,7 @@ GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, co
{ {
setup(); setup();
requestGroup(); requestGroup();
addEventHandler();
} }
GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const std::list<RsGxsId>& added_moderators,const std::list<RsGxsId>& removed_moderators,bool isHome, bool autoUpdate): GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const std::list<RsGxsId>& added_moderators,const std::list<RsGxsId>& removed_moderators,bool isHome, bool autoUpdate):
@ -46,9 +45,12 @@ GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, co
mRemovedModerators(removed_moderators) mRemovedModerators(removed_moderators)
{ {
setup(); setup();
requestGroup(); requestGroup();
addEventHandler();
}
void GxsForumGroupItem::addEventHandler()
{
mEventHandlerId = 0; mEventHandlerId = 0;
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
{ {

View File

@ -61,6 +61,7 @@ private slots:
private: private:
void fill(); void fill();
void setup(); void setup();
void addEventHandler();
private: private:
RsGxsForumGroup mGroup; RsGxsForumGroup mGroup;