mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 08:59:37 -05:00
Merge pull request #1772 from csoler/v0.6-ImprovedGUI_3
Fixing missing notifications and cleaning up notification system.
This commit is contained in:
commit
ca18b27eec
@ -156,9 +156,17 @@ class p3ChatService::AvatarInfo
|
||||
|
||||
void init(const unsigned char *jpeg_data,int size)
|
||||
{
|
||||
_image_size = size ;
|
||||
_image_data = (unsigned char*)rs_malloc(size) ;
|
||||
memcpy(_image_data,jpeg_data,size) ;
|
||||
if(size == 0)
|
||||
{
|
||||
_image_size = 0;
|
||||
_image_data = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
_image_size = size ;
|
||||
_image_data = (unsigned char*)rs_malloc(size) ;
|
||||
memcpy(_image_data,jpeg_data,size) ;
|
||||
}
|
||||
}
|
||||
AvatarInfo(const unsigned char *jpeg_data,int size)
|
||||
{
|
||||
|
@ -107,10 +107,13 @@ void LocalDirectoryUpdater::threadTick()
|
||||
}
|
||||
}
|
||||
|
||||
void LocalDirectoryUpdater::forceUpdate()
|
||||
void LocalDirectoryUpdater::forceUpdate(bool add_safe_delay)
|
||||
{
|
||||
mForceUpdate = true ;
|
||||
mLastSweepTime = 0 ;
|
||||
mLastSweepTime = rstime_t(time(NULL)) - rstime_t(mDelayBetweenDirectoryUpdates) ;
|
||||
|
||||
if(add_safe_delay)
|
||||
mLastSweepTime += rstime_t(MIN_TIME_AFTER_LAST_MODIFICATION);
|
||||
|
||||
if(mHashCache != NULL && mHashCache->hashingProcessPaused())
|
||||
mHashCache->togglePauseHashingProcess();
|
||||
@ -363,7 +366,7 @@ void LocalDirectoryUpdater::setFollowSymLinks(bool b)
|
||||
|
||||
mFollowSymLinks = b ;
|
||||
|
||||
forceUpdate();
|
||||
forceUpdate(false);
|
||||
}
|
||||
|
||||
bool LocalDirectoryUpdater::followSymLinks() const
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
LocalDirectoryUpdater(HashStorage *hash_cache,LocalDirectoryStorage *lds) ;
|
||||
virtual ~LocalDirectoryUpdater() {}
|
||||
|
||||
void forceUpdate();
|
||||
void forceUpdate(bool add_safe_delay);
|
||||
bool inDirectoryCheck() const ;
|
||||
void togglePauseHashingProcess();
|
||||
bool hashingProcessPaused();
|
||||
|
@ -48,7 +48,7 @@ static const std::string LOCAL_SHARED_DIRS_FILE_NAME = "local_dir_hierarchy.bin"
|
||||
|
||||
static const uint32_t MIN_INTERVAL_BETWEEN_HASH_CACHE_SAVE = 20 ; // never save hash cache more often than every 20 secs.
|
||||
static const uint32_t MIN_INTERVAL_BETWEEN_REMOTE_DIRECTORY_SAVE = 23 ; // never save remote directories more often than this
|
||||
static const uint32_t MIN_TIME_AFTER_LAST_MODIFICATION = 20 ; // never hash a file that is just being modified, otherwise we end up with a corrupted hash
|
||||
static const uint32_t MIN_TIME_AFTER_LAST_MODIFICATION = 10 ; // never hash a file that is just being modified, otherwise we end up with a corrupted hash
|
||||
|
||||
static const uint32_t MAX_DIR_SYNC_RESPONSE_DATA_SIZE = 20000 ; // Maximum RsItem data size in bytes for serialised directory transmission
|
||||
static const uint32_t DEFAULT_HASH_STORAGE_DURATION_DAYS = 30 ; // remember deleted/inaccessible files for 30 days
|
||||
|
@ -114,7 +114,7 @@ void p3FileDatabase::setSharedDirectories(const std::list<SharedDirInfo>& shared
|
||||
RS_STACK_MUTEX(mFLSMtx) ;
|
||||
|
||||
mLocalSharedDirs->setSharedDirectoryList(shared_dirs) ;
|
||||
mLocalDirWatcher->forceUpdate();
|
||||
mLocalDirWatcher->forceUpdate(false);
|
||||
|
||||
}
|
||||
|
||||
@ -1231,9 +1231,9 @@ uint32_t p3FileDatabase::getType(void *ref,FileSearchFlags flags) const
|
||||
}
|
||||
}
|
||||
|
||||
void p3FileDatabase::forceDirectoryCheck() // Force re-sweep the directories and see what's changed
|
||||
void p3FileDatabase::forceDirectoryCheck(bool add_safe_delay) // Force re-sweep the directories and see what's changed
|
||||
{
|
||||
mLocalDirWatcher->forceUpdate();
|
||||
mLocalDirWatcher->forceUpdate(add_safe_delay);
|
||||
}
|
||||
void p3FileDatabase::togglePauseHashingProcess()
|
||||
{
|
||||
|
@ -168,7 +168,7 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub
|
||||
|
||||
// interfact for directory parsing
|
||||
|
||||
void forceDirectoryCheck(); // Force re-sweep the directories and see what's changed
|
||||
void forceDirectoryCheck(bool add_safe_delay); // Force re-sweep the directories and see what's changed
|
||||
bool inDirectoryCheck();
|
||||
void togglePauseHashingProcess();
|
||||
bool hashingProcessPaused();
|
||||
|
@ -821,7 +821,7 @@ bool ftController::completeFile(const RsFileHash& hash)
|
||||
RsServer::notify()->notifyDownloadComplete(hash.toStdString());
|
||||
RsServer::notify()->notifyDownloadCompleteCount(completeCount);
|
||||
|
||||
rsFiles->ForceDirectoryCheck() ;
|
||||
rsFiles->ForceDirectoryCheck(true) ;
|
||||
|
||||
IndicateConfigChanged(); /* completed transfer -> save */
|
||||
return true;
|
||||
|
@ -791,9 +791,9 @@ void ftServer::updateSinceGroupPermissionsChanged()
|
||||
{
|
||||
mFileDatabase->forceSyncWithPeers();
|
||||
}
|
||||
void ftServer::ForceDirectoryCheck()
|
||||
void ftServer::ForceDirectoryCheck(bool add_safe_delay)
|
||||
{
|
||||
mFileDatabase->forceDirectoryCheck();
|
||||
mFileDatabase->forceDirectoryCheck(add_safe_delay);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -275,7 +275,7 @@ public:
|
||||
* Utility Functions
|
||||
***/
|
||||
virtual bool ConvertSharedFilePath(std::string path, std::string &fullpath);
|
||||
virtual void ForceDirectoryCheck();
|
||||
virtual void ForceDirectoryCheck(bool add_safe_delay);
|
||||
virtual void updateSinceGroupPermissionsChanged() ;
|
||||
virtual bool InDirectoryCheck();
|
||||
virtual bool copyFile(const std::string& source, const std::string& dest);
|
||||
|
@ -656,8 +656,7 @@ void p3GxsTrans::notifyChanges(std::vector<RsGxsNotify*>& changes)
|
||||
#ifdef DEBUG_GXSTRANS
|
||||
std::cout << "p3GxsTrans::notifyChanges(...)" << std::endl;
|
||||
#endif
|
||||
for( std::vector<RsGxsNotify*>::const_iterator it = changes.begin();
|
||||
it != changes.end(); ++it )
|
||||
for( auto it = changes.begin(); it != changes.end(); ++it )
|
||||
{
|
||||
RsGxsGroupChange* grpChange = dynamic_cast<RsGxsGroupChange *>(*it);
|
||||
RsGxsMsgChange* msgChange = dynamic_cast<RsGxsMsgChange *>(*it);
|
||||
@ -697,8 +696,8 @@ void p3GxsTrans::notifyChanges(std::vector<RsGxsNotify*>& changes)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
delete *it;
|
||||
}
|
||||
RsGxsIfaceHelper::receiveChanges(changes);
|
||||
}
|
||||
|
||||
uint32_t p3GxsTrans::AuthenPolicy()
|
||||
|
@ -85,6 +85,9 @@ enum class RsEventType : uint32_t
|
||||
/// @see RsGxsPostedEvent
|
||||
GXS_POSTED = 11,
|
||||
|
||||
/// @see RsGxsPostedEvent
|
||||
GXS_IDENTITY = 12,
|
||||
|
||||
MAX /// Used to detect invalid event type passed
|
||||
};
|
||||
|
||||
|
@ -591,9 +591,10 @@ public:
|
||||
|
||||
/**
|
||||
* @brief Force shared directories check
|
||||
* @param[in] add_safe_delay Schedule the check 20 seconds from now, to ensure to capture files written just now.
|
||||
* @jsonapi{development}
|
||||
*/
|
||||
virtual void ForceDirectoryCheck() = 0;
|
||||
virtual void ForceDirectoryCheck(bool add_safe_delay=false) = 0;
|
||||
|
||||
virtual void updateSinceGroupPermissionsChanged() = 0;
|
||||
virtual bool InDirectoryCheck() = 0;
|
||||
|
@ -122,6 +122,10 @@ enum class RsChannelEventCode: uint8_t
|
||||
|
||||
/// subscription for channel mChannelGroupId changed.
|
||||
SUBSCRIBE_STATUS_CHANGED = 0x06,
|
||||
|
||||
/// existing message has been read or set to unread
|
||||
READ_STATUS_CHANGED = 0x07,
|
||||
|
||||
};
|
||||
|
||||
struct RsGxsChannelEvent: RsEvent
|
||||
|
@ -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
|
||||
|
@ -110,15 +110,10 @@ enum class RsForumEventCode: uint8_t
|
||||
UNKNOWN = 0x00,
|
||||
NEW_FORUM = 0x01, /// emitted when new forum is received
|
||||
UPDATED_FORUM = 0x02, /// emitted when existing forum is updated
|
||||
|
||||
/// new message reeived in a particular forum
|
||||
NEW_MESSAGE = 0x03,
|
||||
|
||||
/// existing message has been updated in a particular forum
|
||||
UPDATED_MESSAGE = 0x04,
|
||||
|
||||
/// forum was subscribed or unsubscribed
|
||||
SUBSCRIBE_STATUS_CHANGED = 0x05,
|
||||
NEW_MESSAGE = 0x03, /// new message reeived in a particular forum
|
||||
UPDATED_MESSAGE = 0x04, /// existing message has been updated in a particular forum
|
||||
SUBSCRIBE_STATUS_CHANGED = 0x05, /// forum was subscribed or unsubscribed
|
||||
READ_STATUS_CHANGED = 0x06, /// msg was read or marked unread
|
||||
};
|
||||
|
||||
struct RsGxsForumEvent: RsEvent
|
||||
|
@ -304,6 +304,32 @@ private:
|
||||
RsIdentityUsage();
|
||||
};
|
||||
|
||||
enum class RsGxsIdentityEventCode: uint8_t
|
||||
{
|
||||
UNKNOWN = 0x00,
|
||||
NEW_IDENTITY = 0x01,
|
||||
DELETED_IDENTITY = 0x02,
|
||||
};
|
||||
|
||||
struct RsGxsIdentityEvent: public RsEvent
|
||||
{
|
||||
RsGxsIdentityEvent()
|
||||
: RsEvent(RsEventType::GXS_IDENTITY),
|
||||
mIdentityEventCode(RsGxsIdentityEventCode::UNKNOWN) {}
|
||||
|
||||
RsGxsIdentityEventCode mIdentityEventCode;
|
||||
RsGxsGroupId mIdentityId;
|
||||
|
||||
///* @see RsEvent @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext& ctx ) override
|
||||
{
|
||||
RsEvent::serial_process(j, ctx);
|
||||
RS_SERIAL_PROCESS(mIdentityEventCode);
|
||||
RS_SERIAL_PROCESS(mIdentityId);
|
||||
}
|
||||
|
||||
~RsGxsIdentityEvent() override = default;
|
||||
};
|
||||
|
||||
struct RsIdentityDetails : RsSerializable
|
||||
{
|
||||
|
@ -70,9 +70,13 @@ std::ostream &operator<<(std::ostream &out, const RsPostedPost &post);
|
||||
|
||||
enum class RsPostedEventCode: uint8_t
|
||||
{
|
||||
UNKNOWN = 0x00,
|
||||
NEW_POSTED_GROUP = 0x01,
|
||||
NEW_MESSAGE = 0x02
|
||||
UNKNOWN = 0x00,
|
||||
NEW_POSTED_GROUP = 0x01,
|
||||
NEW_MESSAGE = 0x02,
|
||||
SUBSCRIBE_STATUS_CHANGED = 0x03,
|
||||
UPDATED_POSTED_GROUP = 0x04,
|
||||
UPDATED_MESSAGE = 0x05,
|
||||
READ_STATUS_CHANGED = 0x06,
|
||||
};
|
||||
|
||||
|
||||
|
@ -364,13 +364,11 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
}
|
||||
|
||||
/* shouldn't need to worry about groups - as they need to be subscribed to */
|
||||
delete *it;
|
||||
}
|
||||
|
||||
if(!unprocessedGroups.empty())
|
||||
request_SpecificSubscribedGroups(unprocessedGroups);
|
||||
|
||||
// the call below deletes changes and its content.
|
||||
RsGxsIfaceHelper::receiveChanges(changes);
|
||||
}
|
||||
|
||||
void p3GxsChannels::service_tick()
|
||||
@ -1764,8 +1762,17 @@ void p3GxsChannels::setMessageReadStatus( uint32_t& token,
|
||||
if (read) status = 0;
|
||||
|
||||
setMsgStatusFlags(token, msgId, status, mask);
|
||||
}
|
||||
|
||||
if (rsEvents)
|
||||
{
|
||||
auto ev = std::make_shared<RsGxsChannelEvent>();
|
||||
|
||||
ev->mChannelMsgId = msgId.second;
|
||||
ev->mChannelGroupId = msgId.first;
|
||||
ev->mChannelEventCode = RsChannelEventCode::READ_STATUS_CHANGED;
|
||||
rsEvents->postEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************************************/
|
||||
/********************************************************************************************/
|
||||
|
@ -477,8 +477,8 @@ void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
#endif
|
||||
|
||||
p3Notify *notify = RsServer::notify();
|
||||
std::vector<RsGxsNotify *>::iterator it;
|
||||
for(it = changes.begin(); it != changes.end(); ++it)
|
||||
|
||||
for(auto it = changes.begin(); it != changes.end(); ++it)
|
||||
{
|
||||
RsGxsGroupChange *groupChange = dynamic_cast<RsGxsGroupChange *>(*it);
|
||||
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange *>(*it);
|
||||
@ -602,11 +602,26 @@ void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// reset circle from cache since the number of invitee may have changed.
|
||||
{
|
||||
RsStackMutex stack(mCircleMtx); /********** STACK LOCKED MTX ******/
|
||||
mCircleCache.erase(RsGxsCircleId(*git));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
delete *it;
|
||||
}
|
||||
RsGxsIfaceHelper::receiveChanges(changes); // this clear up the vector and delete its elements
|
||||
}
|
||||
|
||||
/********************************************************************************/
|
||||
|
@ -315,9 +315,9 @@ void p3GxsForums::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
}
|
||||
|
||||
/* shouldn't need to worry about groups - as they need to be subscribed to */
|
||||
}
|
||||
|
||||
RsGxsIfaceHelper::receiveChanges(changes);
|
||||
delete *it;
|
||||
}
|
||||
}
|
||||
|
||||
void p3GxsForums::service_tick()
|
||||
@ -861,12 +861,19 @@ void p3GxsForums::setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair&
|
||||
uint32_t mask = GXS_SERV::GXS_MSG_STATUS_GUI_NEW | GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
|
||||
uint32_t status = GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
|
||||
if (read)
|
||||
{
|
||||
status = 0;
|
||||
}
|
||||
|
||||
setMsgStatusFlags(token, msgId, status, mask);
|
||||
|
||||
if (rsEvents)
|
||||
{
|
||||
auto ev = std::make_shared<RsGxsForumEvent>();
|
||||
|
||||
ev->mForumMsgId = msgId.second;
|
||||
ev->mForumGroupId = msgId.first;
|
||||
ev->mForumEventCode = RsForumEventCode::READ_STATUS_CHANGED;
|
||||
rsEvents->postEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************************************/
|
||||
|
@ -603,7 +603,6 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
|
||||
for(uint32_t i = 0;i<changes.size();++i)
|
||||
{
|
||||
RsGxsGroupChange *groupChange = dynamic_cast<RsGxsGroupChange *>(changes[i]);
|
||||
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange *>(changes[i]);
|
||||
|
||||
if (msgChange && !msgChange->metaChange())
|
||||
@ -614,8 +613,8 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
#endif
|
||||
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgChangeMap = msgChange->msgChangeMap;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> >::iterator mit;
|
||||
for(mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit)
|
||||
|
||||
for(auto mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit)
|
||||
{
|
||||
#ifdef DEBUG_IDS
|
||||
std::cerr << "p3IdService::notifyChanges() Msgs for Group: " << mit->first;
|
||||
@ -624,7 +623,8 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
}
|
||||
}
|
||||
|
||||
/* shouldn't need to worry about groups - as they need to be subscribed to */
|
||||
RsGxsGroupChange *groupChange = dynamic_cast<RsGxsGroupChange *>(changes[i]);
|
||||
|
||||
if (groupChange && !groupChange->metaChange())
|
||||
{
|
||||
#ifdef DEBUG_IDS
|
||||
@ -632,9 +632,8 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
std::list<RsGxsGroupId> &groupList = groupChange->mGrpIdList;
|
||||
std::list<RsGxsGroupId>::iterator git;
|
||||
|
||||
for(git = groupList.begin(); git != groupList.end();)
|
||||
for(auto git = groupList.begin(); git != groupList.end();++git)
|
||||
{
|
||||
#ifdef DEBUG_IDS
|
||||
std::cerr << "p3IdService::notifyChanges() Auto Subscribe to Incoming Groups: " << *git;
|
||||
@ -649,21 +648,29 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
|
||||
timeStampKey(RsGxsId(*git),RsIdentityUsage(serviceType(),RsIdentityUsage::IDENTITY_DATA_UPDATE)) ;
|
||||
|
||||
++git;
|
||||
}
|
||||
else
|
||||
git = groupList.erase(git) ;
|
||||
}
|
||||
// notify that a new identity is received, if needed
|
||||
|
||||
if(groupList.empty())
|
||||
{
|
||||
delete changes[i] ;
|
||||
changes[i] = NULL ;
|
||||
switch(groupChange->getType())
|
||||
{
|
||||
case RsGxsNotify::TYPE_PUBLISHED:
|
||||
case RsGxsNotify::TYPE_RECEIVED_NEW:
|
||||
{
|
||||
auto ev = std::make_shared<RsGxsIdentityEvent>();
|
||||
ev->mIdentityId = *git;
|
||||
ev->mIdentityEventCode = RsGxsIdentityEventCode::NEW_IDENTITY;
|
||||
rsEvents->postEvent(ev);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RsGxsIfaceHelper::receiveChanges(changes);
|
||||
delete changes[i];
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************************/
|
||||
@ -1070,6 +1077,14 @@ bool p3IdService::deleteIdentity(RsGxsId& id)
|
||||
return false;
|
||||
}
|
||||
|
||||
if(rsEvents)
|
||||
{
|
||||
auto ev = std::make_shared<RsGxsIdentityEvent>();
|
||||
ev->mIdentityId = grouId;
|
||||
ev->mIdentityEventCode = RsGxsIdentityEventCode::DELETED_IDENTITY;
|
||||
rsEvents->postEvent(ev);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -87,12 +87,10 @@ void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::vector<RsGxsNotify *>::iterator it;
|
||||
|
||||
for(it = changes.begin(); it != changes.end(); ++it)
|
||||
for(auto it = changes.begin(); it != changes.end(); ++it)
|
||||
{
|
||||
RsGxsGroupChange *groupChange = dynamic_cast<RsGxsGroupChange *>(*it);
|
||||
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange *>(*it);
|
||||
|
||||
if (msgChange)
|
||||
{
|
||||
#ifdef POSTBASE_DEBUG
|
||||
@ -124,34 +122,58 @@ void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
}
|
||||
}
|
||||
|
||||
RsGxsGroupChange *grpChange = dynamic_cast<RsGxsGroupChange *>(*it);
|
||||
|
||||
/* pass on Group Changes to GUI */
|
||||
if (groupChange)
|
||||
if (grpChange && rsEvents)
|
||||
{
|
||||
#ifdef POSTBASE_DEBUG
|
||||
std::cerr << "p3PostBase::notifyChanges() Found Group Change Notification";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::list<RsGxsGroupId> &groupList = groupChange->mGrpIdList;
|
||||
|
||||
for(auto git = groupList.begin(); git != groupList.end(); ++git)
|
||||
switch(grpChange->getType())
|
||||
{
|
||||
default:
|
||||
case RsGxsNotify::TYPE_PROCESSED: // happens when the group is subscribed
|
||||
{
|
||||
#ifdef POSTBASE_DEBUG
|
||||
std::cerr << "p3PostBase::notifyChanges() Incoming Group: " << *git;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if (rsEvents && groupChange->getType() == RsGxsNotify::TYPE_RECEIVED_NEW)
|
||||
std::list<RsGxsGroupId> &grpList = grpChange->mGrpIdList;
|
||||
std::list<RsGxsGroupId>::iterator git;
|
||||
for (git = grpList.begin(); git != grpList.end(); ++git)
|
||||
{
|
||||
auto ev = std::make_shared<RsGxsPostedEvent>();
|
||||
ev->mPostedGroupId = *git;
|
||||
ev->mPostedEventCode = RsPostedEventCode::SUBSCRIBE_STATUS_CHANGED;
|
||||
rsEvents->postEvent(ev);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case RsGxsNotify::TYPE_PUBLISHED:
|
||||
case RsGxsNotify::TYPE_RECEIVED_NEW:
|
||||
{
|
||||
/* group received */
|
||||
const std::list<RsGxsGroupId>& grpList = grpChange->mGrpIdList;
|
||||
|
||||
for (auto git = grpList.begin(); git != grpList.end(); ++git)
|
||||
{
|
||||
#ifdef POSTBASE_DEBUG
|
||||
std::cerr << "p3PostBase::notifyChanges() Incoming Group: " << *git;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
auto ev = std::make_shared<RsGxsPostedEvent>();
|
||||
ev->mPostedGroupId = *git;
|
||||
ev->mPostedEventCode = RsPostedEventCode::NEW_POSTED_GROUP;
|
||||
rsEvents->postEvent(ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
delete *it;
|
||||
}
|
||||
receiveHelperChanges(changes);
|
||||
|
||||
#ifdef POSTBASE_DEBUG
|
||||
std::cerr << "p3PostBase::notifyChanges() -> receiveChanges()";
|
||||
@ -183,6 +205,15 @@ void p3PostBase::setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair&
|
||||
|
||||
setMsgStatusFlags(token, msgId, status, mask);
|
||||
|
||||
if (rsEvents)
|
||||
{
|
||||
auto ev = std::make_shared<RsGxsPostedEvent>();
|
||||
|
||||
ev->mPostedMsgId = msgId.second;
|
||||
ev->mPostedGroupId = msgId.first;
|
||||
ev->mPostedEventCode = RsPostedEventCode::READ_STATUS_CHANGED;
|
||||
rsEvents->postEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -133,7 +133,7 @@ FeedReaderDialog::~FeedReaderDialog()
|
||||
}
|
||||
}
|
||||
|
||||
UserNotify *FeedReaderDialog::getUserNotify(QObject *parent)
|
||||
UserNotify *FeedReaderDialog::createUserNotify(QObject *parent)
|
||||
{
|
||||
return new FeedReaderUserNotify(this, mFeedReader, mNotify, parent);
|
||||
}
|
||||
|
@ -42,11 +42,10 @@ public:
|
||||
FeedReaderDialog(RsFeedReader *feedReader, FeedReaderNotify *notify, QWidget *parent = 0);
|
||||
~FeedReaderDialog();
|
||||
|
||||
virtual UserNotify *getUserNotify(QObject *parent);
|
||||
|
||||
static QIcon iconFromFeed(const FeedInfo &feedInfo);
|
||||
|
||||
protected:
|
||||
virtual UserNotify *createUserNotify(QObject *parent) override;
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
|
||||
|
@ -226,12 +226,11 @@ ChatLobbyWidget::~ChatLobbyWidget()
|
||||
}
|
||||
}
|
||||
|
||||
UserNotify *ChatLobbyWidget::getUserNotify(QObject *parent)
|
||||
UserNotify *ChatLobbyWidget::createUserNotify(QObject *parent)
|
||||
{
|
||||
if (!myChatLobbyUserNotify){
|
||||
myChatLobbyUserNotify = new ChatLobbyUserNotify(parent);
|
||||
connect(myChatLobbyUserNotify, SIGNAL(countChanged(ChatLobbyId, unsigned int)), this, SLOT(updateNotify(ChatLobbyId, unsigned int)));
|
||||
}
|
||||
myChatLobbyUserNotify = new ChatLobbyUserNotify(parent);
|
||||
connect(myChatLobbyUserNotify, SIGNAL(countChanged(ChatLobbyId, unsigned int)), this, SLOT(updateNotify(ChatLobbyId, unsigned int)));
|
||||
|
||||
return myChatLobbyUserNotify;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
virtual QString pageName() const { return tr("Chats") ; } //MainPage
|
||||
virtual QString helpText() const { return ""; } //MainPage
|
||||
|
||||
virtual UserNotify *getUserNotify(QObject *parent); //MainPage
|
||||
virtual UserNotify *createUserNotify(QObject *parent) override; //MainPage
|
||||
|
||||
virtual void updateDisplay();
|
||||
|
||||
@ -137,7 +137,7 @@ private:
|
||||
QAction* showTopicAct;
|
||||
int getNumColVisible();
|
||||
|
||||
ChatLobbyUserNotify* myChatLobbyUserNotify;
|
||||
ChatLobbyUserNotify* myChatLobbyUserNotify; // local copy that avoids dynamic casts
|
||||
|
||||
QAbstractButton* myInviteYesButton;
|
||||
GxsIdChooser* myInviteIdChooser;
|
||||
|
@ -62,9 +62,6 @@ CirclesDialog::CirclesDialog(QWidget *parent)
|
||||
mStateHelper->addWidget(CIRCLESDIALOG_GROUPMETA, ui.pushButton_editCircle);
|
||||
|
||||
mStateHelper->addWidget(CIRCLESDIALOG_GROUPMETA, ui.treeWidget_membership, UISTATE_ACTIVE_ENABLED);
|
||||
// mStateHelper->addWidget(CIRCLESDIALOG_GROUPMETA, ui.treeWidget_friends, UISTATE_ACTIVE_ENABLED);
|
||||
// mStateHelper->addWidget(CIRCLESDIALOG_GROUPMETA, ui.treeWidget_category, UISTATE_ACTIVE_ENABLED);
|
||||
|
||||
mStateHelper->setWidgetEnabled(ui.pushButton_editCircle, false);
|
||||
|
||||
/* Connect signals */
|
||||
@ -74,19 +71,13 @@ CirclesDialog::CirclesDialog(QWidget *parent)
|
||||
connect(ui.todoPushButton, SIGNAL(clicked()), this, SLOT(todo()));
|
||||
|
||||
connect(ui.treeWidget_membership, SIGNAL(itemSelectionChanged()), this, SLOT(circle_selected()));
|
||||
// connect(ui.treeWidget_friends, SIGNAL(itemSelectionChanged()), this, SLOT(friend_selected()));
|
||||
// connect(ui.treeWidget_category, SIGNAL(itemSelectionChanged()), this, SLOT(category_selected()));
|
||||
|
||||
/* Setup TokenQueue */
|
||||
mCircleQueue = new TokenQueue(rsGxsCircles->getTokenService(), this);
|
||||
|
||||
/* Set header resize modes and initial section sizes */
|
||||
QHeaderView * membership_header = ui.treeWidget_membership->header () ;
|
||||
membership_header->resizeSection ( CIRCLEGROUP_CIRCLE_COL_GROUPNAME, 200 );
|
||||
|
||||
// QHeaderView * friends_header = ui.treeWidget_friends->header () ;
|
||||
// friends_header->resizeSection ( CIRCLEGROUP_FRIEND_COL_NAME, 200 );
|
||||
|
||||
QHeaderView * membership_header = ui.treeWidget_membership->header () ;
|
||||
membership_header->resizeSection ( CIRCLEGROUP_CIRCLE_COL_GROUPNAME, 200 );
|
||||
}
|
||||
|
||||
CirclesDialog::~CirclesDialog()
|
||||
|
@ -58,35 +58,9 @@ private slots:
|
||||
void friend_selected();
|
||||
void category_selected();
|
||||
|
||||
#if 0
|
||||
void OpenOrShowAddPageDialog();
|
||||
void OpenOrShowAddGroupDialog();
|
||||
void OpenOrShowEditDialog();
|
||||
void OpenOrShowRepublishDialog();
|
||||
|
||||
void groupTreeChanged();
|
||||
|
||||
void newGroup();
|
||||
void showGroupDetails();
|
||||
void editGroupDetails();
|
||||
|
||||
void insertWikiGroups();
|
||||
#endif
|
||||
|
||||
private:
|
||||
void reloadAll();
|
||||
|
||||
#if 0
|
||||
voidclearWikiPage();
|
||||
void clearGroupTree();
|
||||
|
||||
void updateWikiPage(const RsWikiSnapshot &page);
|
||||
|
||||
bool getSelectedPage(std::string &groupId, std::string &pageId, std::string &origPageId);
|
||||
std::string getSelectedPage();
|
||||
std::string getSelectedGroup();
|
||||
#endif
|
||||
|
||||
void requestGroupMeta();
|
||||
void loadGroupMeta(const uint32_t &token);
|
||||
|
||||
|
@ -1114,7 +1114,7 @@ void TransfersDialog::activatePage(TransfersDialog::Page page)
|
||||
}
|
||||
}
|
||||
|
||||
UserNotify *TransfersDialog::getUserNotify(QObject *parent)
|
||||
UserNotify *TransfersDialog::createUserNotify(QObject *parent)
|
||||
{
|
||||
return new TransferUserNotify(parent);
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
virtual QString pageName() const { return tr("Files") ; } //MainPage
|
||||
virtual QString helpText() const { return ""; } //MainPage
|
||||
|
||||
virtual UserNotify *getUserNotify(QObject *parent);
|
||||
virtual UserNotify *createUserNotify(QObject *parent) override;
|
||||
|
||||
void activatePage(TransfersDialog::Page page) ;
|
||||
|
||||
|
@ -163,7 +163,7 @@ void FriendsDialog::activatePage(FriendsDialog::Page page)
|
||||
}
|
||||
}
|
||||
|
||||
UserNotify *FriendsDialog::getUserNotify(QObject *parent)
|
||||
UserNotify *FriendsDialog::createUserNotify(QObject *parent)
|
||||
{
|
||||
return new ChatUserNotify(parent);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
virtual QString pageName() const { return tr("Network") ; } //MainPage
|
||||
virtual QString helpText() const { return ""; } //MainPage
|
||||
|
||||
virtual UserNotify *getUserNotify(QObject *parent);
|
||||
virtual UserNotify *createUserNotify(QObject *parent) override;
|
||||
|
||||
static bool isGroupChatActive();
|
||||
static void groupChatActivate();
|
||||
|
@ -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,12 @@ IdDialog::IdDialog(QWidget *parent) :
|
||||
|
||||
mIdQueue = NULL;
|
||||
|
||||
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);
|
||||
connect(mCirclesBroadcastBase, SIGNAL(fillDisplay(bool)), this, SLOT(updateCirclesDisplay(bool)));
|
||||
@ -398,6 +406,49 @@ 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)
|
||||
{
|
||||
const RsGxsIdentityEvent *e = dynamic_cast<const RsGxsIdentityEvent*>(event.get());
|
||||
|
||||
if(!e)
|
||||
return;
|
||||
|
||||
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:
|
||||
|
||||
requestCircleGroupMeta();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void IdDialog::clearPerson()
|
||||
{
|
||||
QFontMetricsF f(ui->avLabel_Person->font()) ;
|
||||
@ -701,7 +752,7 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
|
||||
for(std::map<RsGxsId,uint32_t>::const_iterator it(details.mSubscriptionFlags.begin());it!=details.mSubscriptionFlags.end();++it)
|
||||
{
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << " ID " << *it << ": " ;
|
||||
std::cerr << " ID " << it->first << ": " ;
|
||||
#endif
|
||||
bool is_own_id = rsIdentity->isOwnId(it->first) ;
|
||||
bool invited ( it->second & GXS_EXTERNAL_CIRCLE_FLAGS_IN_ADMIN_LIST );
|
||||
@ -2095,7 +2146,7 @@ void IdDialog::modifyReputation()
|
||||
rsReputations->setOwnOpinion(id,op);
|
||||
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << "IdDialog::modifyReputation() ID: " << id << " Mod: " << op;
|
||||
std::cerr << "IdDialog::modifyReputation() ID: " << id << " Mod: " << static_cast<int>(op);
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
|
@ -158,6 +158,10 @@ private:
|
||||
RsGxsGroupId mIdToNavigate;
|
||||
int filter;
|
||||
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
RsEventsHandlerId_t mEventHandlerId_identity;
|
||||
RsEventsHandlerId_t mEventHandlerId_circles;
|
||||
|
||||
/* UI - Designer */
|
||||
Ui::IdDialog *ui;
|
||||
};
|
||||
|
@ -31,6 +31,15 @@ MainPage::MainPage(QWidget *parent , Qt::WindowFlags flags ) : QWidget(parent, f
|
||||
mIcon = QIcon();
|
||||
mName = "";
|
||||
mHelp = "";
|
||||
mUserNotify = nullptr;
|
||||
}
|
||||
|
||||
UserNotify *MainPage::getUserNotify()
|
||||
{
|
||||
if(!mUserNotify)
|
||||
mUserNotify = createUserNotify(this);
|
||||
|
||||
return mUserNotify;
|
||||
}
|
||||
|
||||
void MainPage::registerHelpButton(QToolButton *button, const QString& help_html_text, const QString &code_name)
|
||||
|
@ -469,7 +469,7 @@ void MainWindow::initStackedPage()
|
||||
//List All notify before Setting was created
|
||||
QList<QPair<MainPage*, QPair<QAction*, QListWidgetItem*> > >::iterator notifyIt;
|
||||
for (notifyIt = notify.begin(); notifyIt != notify.end(); ++notifyIt) {
|
||||
UserNotify *userNotify = notifyIt->first->getUserNotify(this);
|
||||
UserNotify *userNotify = notifyIt->first->getUserNotify();
|
||||
if (userNotify) {
|
||||
userNotify->initialize(ui->toolBarPage, notifyIt->second.first, notifyIt->second.second);
|
||||
connect(userNotify, SIGNAL(countChanged()), this, SLOT(updateTrayCombine()));
|
||||
|
@ -141,7 +141,7 @@ NewsFeed::~NewsFeed()
|
||||
}
|
||||
}
|
||||
|
||||
UserNotify *NewsFeed::getUserNotify(QObject *parent)
|
||||
UserNotify *NewsFeed::createUserNotify(QObject *parent)
|
||||
{
|
||||
return new NewsFeedUserNotify(this, parent);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
virtual QString pageName() const { return tr("Log") ; } //MainPage
|
||||
virtual QString helpText() const { return ""; } //MainPage
|
||||
|
||||
virtual UserNotify *getUserNotify(QObject *parent);
|
||||
virtual UserNotify *createUserNotify(QObject *parent) override;
|
||||
|
||||
/* FeedHolder Functions (for FeedItem functionality) */
|
||||
virtual QScrollArea *getScrollArea();
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "gui/gxs/GxsGroupShareKey.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/common/GroupTreeWidget.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
@ -43,13 +44,48 @@ public:
|
||||
PostedDialog::PostedDialog(QWidget *parent)
|
||||
: GxsGroupFrameDialog(rsPosted, parent)
|
||||
{
|
||||
mEventHandlerId = 0;
|
||||
// Needs to be asynced because this function is likely to be called by another thread!
|
||||
|
||||
rsEvents->registerEventsHandler(RsEventType::GXS_POSTED, [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [=]() { handleEvent_main_thread(event); }, this ); }, mEventHandlerId );
|
||||
}
|
||||
|
||||
void PostedDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
if(event->mType == RsEventType::GXS_POSTED)
|
||||
{
|
||||
const RsGxsPostedEvent *e = dynamic_cast<const RsGxsPostedEvent*>(event.get());
|
||||
if(!e) return;
|
||||
|
||||
switch(e->mPostedEventCode)
|
||||
{
|
||||
case RsPostedEventCode::NEW_MESSAGE:
|
||||
updateMessageSummaryList(e->mPostedGroupId);
|
||||
break;
|
||||
|
||||
case RsPostedEventCode::UPDATED_MESSAGE: // [[fallthrough]];
|
||||
updateDisplay(false);
|
||||
break;
|
||||
|
||||
case RsPostedEventCode::READ_STATUS_CHANGED: // [[fallthrough]];
|
||||
updateMessageSummaryList(e->mPostedGroupId);
|
||||
break;
|
||||
|
||||
case RsPostedEventCode::NEW_POSTED_GROUP: // [[fallthrough]];
|
||||
case RsPostedEventCode::SUBSCRIBE_STATUS_CHANGED: // [[fallthrough]];
|
||||
updateDisplay(true);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PostedDialog::~PostedDialog()
|
||||
{
|
||||
}
|
||||
|
||||
UserNotify *PostedDialog::getUserNotify(QObject *parent)
|
||||
UserNotify *PostedDialog::createUserNotify(QObject *parent)
|
||||
{
|
||||
return new PostedUserNotify(rsPosted, parent);
|
||||
}
|
||||
|
@ -40,9 +40,8 @@ public:
|
||||
virtual QString pageName() const { return tr("Links") ; } //MainPage
|
||||
virtual QString helpText() const { return ""; } //MainPage
|
||||
|
||||
virtual UserNotify *getUserNotify(QObject *parent);
|
||||
|
||||
protected:
|
||||
virtual UserNotify *createUserNotify(QObject *parent) override;
|
||||
virtual QString getHelpString() const ;
|
||||
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_POSTED; }
|
||||
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Posted; }
|
||||
@ -61,6 +60,9 @@ private:
|
||||
virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId);
|
||||
virtual uint32_t requestGroupSummaryType() { return GXS_REQUEST_TYPE_GROUP_DATA; } // request complete group data
|
||||
virtual void loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata* &userdata);
|
||||
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "PostedListWidget.h"
|
||||
#include "ui_PostedListWidget.h"
|
||||
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "PostedCreatePostDialog.h"
|
||||
#include "PostedItem.h"
|
||||
@ -94,7 +95,6 @@ PostedListWidget::PostedListWidget(const RsGxsGroupId &postedId, QWidget *parent
|
||||
/* Initialize GUI */
|
||||
setGroupId(postedId);
|
||||
}
|
||||
|
||||
PostedListWidget::~PostedListWidget()
|
||||
{
|
||||
// save settings
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "gui/common/RSTreeWidget.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/common/UIStateHelper.h"
|
||||
#include "gui/common/UserNotify.h"
|
||||
#include "GxsCommentDialog.h"
|
||||
|
||||
//#define DEBUG_GROUPFRAMEDIALOG
|
||||
@ -1173,6 +1174,8 @@ void GxsGroupFrameDialog::loadGroupStatistics(const uint32_t &token)
|
||||
}
|
||||
|
||||
ui->groupTreeWidget->setUnreadCount(item, mCountChildMsgs ? (stats.mNumThreadMsgsUnread + stats.mNumChildMsgsUnread) : stats.mNumThreadMsgsUnread);
|
||||
|
||||
getUserNotify()->updateIcon();
|
||||
}
|
||||
|
||||
/*********************** **** **** **** ***********************/
|
||||
|
@ -96,6 +96,8 @@ protected:
|
||||
virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata);
|
||||
virtual void checkRequestGroup(const RsGxsGroupId& /* grpId */) {} // overload this one in order to retrieve full group data when the group is browsed
|
||||
|
||||
void updateMessageSummaryList(RsGxsGroupId groupId);
|
||||
|
||||
private slots:
|
||||
void todo();
|
||||
|
||||
@ -153,7 +155,6 @@ private:
|
||||
|
||||
void initUi();
|
||||
|
||||
void updateMessageSummaryList(RsGxsGroupId groupId);
|
||||
void updateSearchResults();
|
||||
|
||||
void openGroupInNewTab(const RsGxsGroupId &groupId);
|
||||
|
@ -64,8 +64,23 @@ void GxsChannelDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> ev
|
||||
|
||||
switch(e->mChannelEventCode)
|
||||
{
|
||||
case RsChannelEventCode::SUBSCRIBE_STATUS_CHANGED: updateDisplay(true);
|
||||
case RsChannelEventCode::NEW_MESSAGE:
|
||||
updateMessageSummaryList(e->mChannelGroupId);
|
||||
break;
|
||||
|
||||
case RsChannelEventCode::UPDATED_MESSAGE: // [[fallthrough]];
|
||||
updateDisplay(false);
|
||||
break;
|
||||
|
||||
case RsChannelEventCode::READ_STATUS_CHANGED:
|
||||
updateMessageSummaryList(e->mChannelGroupId);
|
||||
break;
|
||||
|
||||
case RsChannelEventCode::NEW_CHANNEL: // [[fallthrough]];
|
||||
case RsChannelEventCode::SUBSCRIBE_STATUS_CHANGED:
|
||||
updateDisplay(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -92,7 +107,7 @@ QString GxsChannelDialog::getHelpString() const
|
||||
return hlp_str ;
|
||||
}
|
||||
|
||||
UserNotify *GxsChannelDialog::getUserNotify(QObject *parent)
|
||||
UserNotify *GxsChannelDialog::createUserNotify(QObject *parent)
|
||||
{
|
||||
return new GxsChannelUserNotify(rsGxsChannels, parent);
|
||||
}
|
||||
|
@ -39,8 +39,6 @@ public:
|
||||
virtual QString pageName() const { return tr("Channels") ; } //MainPage
|
||||
virtual QString helpText() const { return ""; } //MainPage
|
||||
|
||||
virtual UserNotify *getUserNotify(QObject *parent);
|
||||
|
||||
void shareOnChannel(const RsGxsGroupId& channel_id, const QList<RetroShareLink>& file_link) ;
|
||||
|
||||
protected:
|
||||
@ -54,6 +52,7 @@ protected:
|
||||
virtual TurtleRequestId distantSearch(const QString& search_string) ;
|
||||
virtual void checkRequestGroup(const RsGxsGroupId& grpId) ;
|
||||
|
||||
virtual UserNotify *createUserNotify(QObject *parent) override;
|
||||
private slots:
|
||||
void toggleAutoDownload();
|
||||
void setDefaultDirectory();
|
||||
|
@ -59,7 +59,21 @@ void GxsForumsDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> eve
|
||||
|
||||
switch(e->mForumEventCode)
|
||||
{
|
||||
case RsForumEventCode::SUBSCRIBE_STATUS_CHANGED: updateDisplay(true);
|
||||
case RsForumEventCode::NEW_MESSAGE:
|
||||
updateMessageSummaryList(e->mForumGroupId);
|
||||
break;
|
||||
|
||||
case RsForumEventCode::UPDATED_MESSAGE: // [[fallthrough]];
|
||||
updateDisplay(false);
|
||||
break;
|
||||
|
||||
case RsForumEventCode::READ_STATUS_CHANGED:
|
||||
updateMessageSummaryList(e->mForumGroupId);
|
||||
break;
|
||||
|
||||
case RsForumEventCode::NEW_FORUM: // [[fallthrough]];
|
||||
case RsForumEventCode::SUBSCRIBE_STATUS_CHANGED:
|
||||
updateDisplay(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -102,7 +116,7 @@ void GxsForumsDialog::shareInMessage(const RsGxsGroupId& forum_id,const QList<Re
|
||||
msgDialog->show();
|
||||
}
|
||||
|
||||
UserNotify *GxsForumsDialog::getUserNotify(QObject *parent)
|
||||
UserNotify *GxsForumsDialog::createUserNotify(QObject *parent)
|
||||
{
|
||||
return new GxsForumUserNotify(rsGxsForums, parent);
|
||||
}
|
||||
|
@ -37,11 +37,11 @@ public:
|
||||
virtual QString pageName() const { return tr("Forums") ; } //MainPage
|
||||
virtual QString helpText() const { return ""; } //MainPage
|
||||
|
||||
virtual UserNotify *getUserNotify(QObject *parent);
|
||||
|
||||
void shareInMessage(const RsGxsGroupId& forum_id, const QList<RetroShareLink>& file_link) ;
|
||||
|
||||
protected:
|
||||
virtual UserNotify *createUserNotify(QObject *parent) override;
|
||||
|
||||
virtual QString getHelpString() const ;
|
||||
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_FORUM; }
|
||||
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Forum; }
|
||||
|
@ -325,7 +325,7 @@ MessagesDialog::~MessagesDialog()
|
||||
processSettings(false);
|
||||
}
|
||||
|
||||
UserNotify *MessagesDialog::getUserNotify(QObject *parent)
|
||||
UserNotify *MessagesDialog::createUserNotify(QObject *parent)
|
||||
{
|
||||
return new MessageUserNotify(parent);
|
||||
}
|
||||
|
@ -50,8 +50,6 @@ public:
|
||||
virtual QString pageName() const { return tr("Mail") ; } //MainPage
|
||||
virtual QString helpText() const { return ""; } //MainPage
|
||||
|
||||
virtual UserNotify *getUserNotify(QObject *parent);
|
||||
|
||||
// replaced by shortcut
|
||||
// virtual void keyPressEvent(QKeyEvent *) ;
|
||||
|
||||
@ -64,6 +62,7 @@ signals:
|
||||
void messagesLoaded();
|
||||
|
||||
protected:
|
||||
virtual UserNotify *createUserNotify(QObject *parent) override;
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
int getSelectedMessages(QList<QString>& mid);
|
||||
|
||||
|
@ -55,14 +55,19 @@ public:
|
||||
void setHelpText(QString help) { mHelp = help; }
|
||||
|
||||
virtual void retranslateUi() {}
|
||||
virtual UserNotify *getUserNotify(QObject */*parent*/) { return NULL; }
|
||||
|
||||
// Override this if needed.
|
||||
virtual UserNotify *createUserNotify(QObject */*parent*/) { return NULL; }
|
||||
|
||||
// Call this to add some help info to the page. The way the info is
|
||||
// shown is handled by showHelp() below;
|
||||
//
|
||||
void registerHelpButton(QToolButton *button, const QString& help_html_text, const QString &code_name) ;
|
||||
|
||||
UserNotify *getUserNotify() ;
|
||||
|
||||
protected:
|
||||
|
||||
virtual void showEvent(QShowEvent *);
|
||||
|
||||
private:
|
||||
@ -71,6 +76,8 @@ private:
|
||||
QString mName;
|
||||
QString mHelp;
|
||||
QString mHelpCodeName;
|
||||
|
||||
UserNotify *mUserNotify;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user