Merge pull request #2083 from csoler/v0.6-BugFixing_2

[WIP] fixing GUI bugs
This commit is contained in:
csoler 2020-10-29 20:12:14 +01:00 committed by GitHub
commit dcb227da7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 811 additions and 397 deletions

View File

@ -1695,6 +1695,14 @@ void RsGenExchange::notifyReceivePublishKey(const RsGxsGroupId &grpId)
mNotifications.push_back(gc);
}
void RsGenExchange::notifyChangedGroupSyncParams(const RsGxsGroupId &grpId)
{
RS_STACK_MUTEX(mGenMtx);
RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_GROUP_SYNC_PARAMETERS_UPDATED,grpId, false);
mNotifications.push_back(gc);
}
void RsGenExchange::notifyChangedGroupStats(const RsGxsGroupId &grpId)
{
RS_STACK_MUTEX(mGenMtx);
@ -3437,6 +3445,10 @@ void RsGenExchange::removeDeleteExistingMessages( std::list<RsNxsMsg*>& msgs, Gx
}
}
DistantSearchGroupStatus RsGenExchange::getDistantSearchStatus(const RsGxsGroupId& group_id)
{
return mNetService->getDistantSearchStatus(group_id) ;
}
void RsGenExchange::turtleGroupRequest(const RsGxsGroupId& group_id)
{
mNetService->turtleGroupRequest(group_id) ;

View File

@ -133,28 +133,29 @@ public:
/*!
* @param messages messages are deleted after function returns
*/
virtual void receiveNewMessages(std::vector<RsNxsMsg*>& messages);
virtual void receiveNewMessages(std::vector<RsNxsMsg*>& messages) override;
/*!
* @param groups groups are deleted after function returns
*/
virtual void receiveNewGroups(std::vector<RsNxsGrp*>& groups);
virtual void receiveNewGroups(std::vector<RsNxsGrp*>& groups) override;
/*!
* @param grpId group id
*/
virtual void notifyReceivePublishKey(const RsGxsGroupId &grpId);
virtual void notifyReceivePublishKey(const RsGxsGroupId &grpId) override;
virtual void notifyChangedGroupSyncParams(const RsGxsGroupId &grpId) override;
/*!
* \brief notifyReceiveDistantSearchResults
* Should be called when new search results arrive.
* \param grpId
*/
virtual void receiveDistantSearchResults(TurtleRequestId id,const RsGxsGroupId &grpId);
virtual void receiveDistantSearchResults(TurtleRequestId id,const RsGxsGroupId &grpId) override;
/*!
* @param grpId group id
*/
virtual void notifyChangedGroupStats(const RsGxsGroupId &grpId);
virtual void notifyChangedGroupStats(const RsGxsGroupId &grpId) override;
/** E: Observer implementation **/
@ -221,7 +222,7 @@ public:
* @param msgIds a map of RsGxsGrpMsgIdPair -> msgList (vector)
* @return false if could not redeem token
*/
bool getMsgRelatedList(const uint32_t &token, MsgRelatedIdResult& msgIds);
bool getMsgRelatedList(const uint32_t &token, MsgRelatedIdResult& msgIds)override;
/*!
@ -230,14 +231,14 @@ public:
* @param groupInfo
* @return false if could not redeem token
*/
bool getGroupMeta(const uint32_t &token, std::list<RsGroupMetaData>& groupInfo);
bool getGroupMeta(const uint32_t &token, std::list<RsGroupMetaData>& groupInfo)override;
/*!
* retrieves message meta data associated to a request token
* @param token token to be redeemed
* @param msgInfo the meta data to be retrieved for token store here
*/
bool getMsgMeta(const uint32_t &token, GxsMsgMetaMap &msgInfo);
bool getMsgMeta(const uint32_t &token, GxsMsgMetaMap &msgInfo)override;
/*!
* Retrieve msg meta for a given token for message related info
@ -245,7 +246,7 @@ public:
* @param msgIds a map of RsGxsGrpMsgIdPair -> msgList (vector)
* @return false if could not redeem token
*/
bool getMsgRelatedMeta(const uint32_t &token, GxsMsgRelatedMetaMap& msgMeta);
bool getMsgRelatedMeta(const uint32_t &token, GxsMsgRelatedMetaMap& msgMeta)override;
/*!
* Retrieves the meta data of a newly created group. The meta is kept in cache for the current session.
@ -293,7 +294,7 @@ public:
*/
virtual bool acceptNewMessage(const RsGxsMsgMetaData *msgMeta, uint32_t size) ;
bool subscribeToGroup(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe);
bool subscribeToGroup(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe) override;
/*!
* Gets service statistic for a given services
@ -301,7 +302,7 @@ public:
* @param stats the status
* @return true if token exists false otherwise
*/
bool getServiceStatistic(const uint32_t& token, GxsServiceStatistic& stats);
bool getServiceStatistic(const uint32_t& token, GxsServiceStatistic& stats) override;
/*!
* Get group statistic
@ -309,7 +310,7 @@ public:
* @param stats the stats associated to token requ
* @return true if token is false otherwise
*/
bool getGroupStatistic(const uint32_t& token, GxsGroupStatistic& stats);
bool getGroupStatistic(const uint32_t& token, GxsGroupStatistic& stats) override;
/*!
* \brief turtleGroupRequest
@ -320,7 +321,14 @@ public:
void turtleGroupRequest(const RsGxsGroupId& group_id);
void turtleSearchRequest(const std::string& match_string);
/**
/*!
* \brief getDistantSearchStatus
* Returns the status of ongoing search: unknown (probably not even searched), known as a search result,
* data request ongoing and data available
*/
DistantSearchGroupStatus getDistantSearchStatus(const RsGxsGroupId& group_id) ;
/**
* @brief Search local groups. Blocking API.
* @param matchString string to look for in the search
* @param results storage for results
@ -719,21 +727,21 @@ public:
* \brief getDefaultStoragePeriod. All times in seconds.
* \return
*/
virtual uint32_t getDefaultStoragePeriod() { return mNetService->getDefaultKeepAge() ; }
virtual uint32_t getDefaultStoragePeriod() override{ return mNetService->getDefaultKeepAge() ; }
virtual uint32_t getStoragePeriod(const RsGxsGroupId& grpId) ;
virtual void setStoragePeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) ;
virtual uint32_t getStoragePeriod(const RsGxsGroupId& grpId) override;
virtual void setStoragePeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) override;
virtual uint32_t getDefaultSyncPeriod();
virtual uint32_t getSyncPeriod(const RsGxsGroupId& grpId) ;
virtual void setSyncPeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) ;
virtual bool getGroupNetworkStats(const RsGxsGroupId& grpId,RsGroupNetworkStats& stats);
virtual uint32_t getDefaultSyncPeriod()override;
virtual uint32_t getSyncPeriod(const RsGxsGroupId& grpId) override;
virtual void setSyncPeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) override;
virtual bool getGroupNetworkStats(const RsGxsGroupId& grpId,RsGroupNetworkStats& stats);
uint16_t serviceType() const override { return mServType ; }
uint32_t serviceFullType() const { return RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(mServType); }
virtual RsReputationLevel minReputationForForwardingMessages(
uint32_t group_sign_flags, uint32_t identity_flags );
uint32_t group_sign_flags, uint32_t identity_flags )override;
protected:
/** Notifications **/

View File

@ -446,6 +446,7 @@ int RsGxsNetService::tick()
should_notify = should_notify || !mNewMessagesToNotify.empty() ;
should_notify = should_notify || !mNewPublishKeysToNotify.empty() ;
should_notify = should_notify || !mNewStatsToNotify.empty() ;
should_notify = should_notify || !mNewGrpSyncParamsToNotify.empty() ;
}
if(should_notify)
@ -490,7 +491,7 @@ void RsGxsNetService::processObserverNotifications()
std::vector<RsNxsGrp*> grps_copy ;
std::vector<RsNxsMsg*> msgs_copy ;
std::set<RsGxsGroupId> stat_copy ;
std::set<RsGxsGroupId> keys_copy ;
std::set<RsGxsGroupId> keys_copy,grpss_copy ;
{
RS_STACK_MUTEX(mNxsMutex) ;
@ -499,11 +500,13 @@ void RsGxsNetService::processObserverNotifications()
msgs_copy = mNewMessagesToNotify ;
stat_copy = mNewStatsToNotify ;
keys_copy = mNewPublishKeysToNotify ;
grpss_copy = mNewGrpSyncParamsToNotify ;
mNewGroupsToNotify.clear() ;
mNewMessagesToNotify.clear() ;
mNewStatsToNotify.clear() ;
mNewPublishKeysToNotify.clear() ;
mNewGrpSyncParamsToNotify.clear() ;
}
if(!grps_copy.empty()) mObserver->receiveNewGroups (grps_copy);
@ -514,6 +517,9 @@ void RsGxsNetService::processObserverNotifications()
for(std::set<RsGxsGroupId>::const_iterator it(stat_copy.begin());it!=stat_copy.end();++it)
mObserver->notifyChangedGroupStats(*it);
for(std::set<RsGxsGroupId>::const_iterator it(grpss_copy.begin());it!=grpss_copy.end();++it)
mObserver->notifyChangedGroupSyncParams(*it);
}
void RsGxsNetService::rejectMessage(const RsGxsMessageId& msg_id)
@ -4740,6 +4746,10 @@ void RsGxsNetService::setSyncAge(const RsGxsGroupId &grpId, uint32_t age_in_secs
locked_resetClientTS(grpId);
IndicateConfigChanged();
// also send an event so that UI is updated
mNewGrpSyncParamsToNotify.insert(grpId);
}
}
void RsGxsNetService::setKeepAge(const RsGxsGroupId &grpId, uint32_t age_in_secs)
@ -5148,6 +5158,20 @@ bool RsGxsNetService::locked_stampMsgServerUpdateTS(const RsGxsGroupId& gid)
return true;
}
DistantSearchGroupStatus RsGxsNetService::getDistantSearchStatus(const RsGxsGroupId& group_id)
{
auto it = mSearchedGroups.find(group_id);
if(it != mSearchedGroups.end())
return it->second.status;
for(auto it2:mDistantSearchResults)
if(it2.second.find(group_id) != it2.second.end())
return DistantSearchGroupStatus::CAN_BE_REQUESTED;
return DistantSearchGroupStatus::UNKNOWN;
}
TurtleRequestId RsGxsNetService::turtleGroupRequest(const RsGxsGroupId& group_id)
{
RS_STACK_MUTEX(mNxsMutex) ;
@ -5170,6 +5194,7 @@ TurtleRequestId RsGxsNetService::turtleGroupRequest(const RsGxsGroupId& group_id
rec.request_id = req;
rec.ts = now;
rec.status = DistantSearchGroupStatus::ONGOING_REQUEST;
mSearchRequests[req] = group_id;
@ -5354,6 +5379,9 @@ void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req,const unsig
}
std::vector<RsNxsGrp*> new_grps(1,nxs_grp);
GroupRequestRecord& rec(mSearchedGroups[nxs_grp->grpId]) ;
rec.status = DistantSearchGroupStatus::HAVE_GROUP_DATA;
#ifdef NXS_NET_DEBUG_8
GXSNETDEBUG___ << " passing the grp data to observer." << std::endl;
#endif

View File

@ -57,10 +57,11 @@ class RsGroupNetworkStatsRecord
struct GroupRequestRecord
{
GroupRequestRecord(): ts(0), request_id(0) {}
GroupRequestRecord(): ts(0),request_id(0),status(DistantSearchGroupStatus::UNKNOWN) {}
rstime_t ts ;
TurtleRequestId request_id;
DistantSearchGroupStatus status;
};
/*!
@ -102,47 +103,48 @@ public:
virtual ~RsGxsNetService();
virtual RsServiceInfo getServiceInfo() { return mServiceInfo; }
virtual RsServiceInfo getServiceInfo() override { return mServiceInfo; }
virtual void getItemNames(std::map<uint8_t,std::string>& names) const ;
virtual void getItemNames(std::map<uint8_t,std::string>& names) const override ;
public:
virtual uint16_t serviceType() const { return mServType ; }
virtual uint16_t serviceType() const override { return mServType ; }
/*!
* Use this to set how far back synchronisation and storage of messages should take place
* @param age the max age a sync/storage item can to be allowed in a synchronisation
*/
virtual void setSyncAge(const RsGxsGroupId& grpId,uint32_t age_in_secs);
virtual void setKeepAge(const RsGxsGroupId& grpId,uint32_t age_in_secs);
virtual void setSyncAge(const RsGxsGroupId& grpId,uint32_t age_in_secs)override ;
virtual void setKeepAge(const RsGxsGroupId& grpId,uint32_t age_in_secs)override ;
virtual uint32_t getSyncAge(const RsGxsGroupId& id);
virtual uint32_t getKeepAge(const RsGxsGroupId& id);
virtual uint32_t getSyncAge(const RsGxsGroupId& id)override ;
virtual uint32_t getKeepAge(const RsGxsGroupId& id)override ;
virtual uint32_t getDefaultSyncAge() { return mDefaultMsgSyncPeriod ; }
virtual uint32_t getDefaultKeepAge() { return mDefaultMsgStorePeriod ; }
virtual uint32_t getDefaultSyncAge() override { return mDefaultMsgSyncPeriod ; }
virtual uint32_t getDefaultKeepAge() override { return mDefaultMsgStorePeriod ; }
virtual void setDefaultKeepAge(uint32_t t) { mDefaultMsgStorePeriod = t ; }
virtual void setDefaultSyncAge(uint32_t t) { mDefaultMsgSyncPeriod = t ; }
virtual void setDefaultKeepAge(uint32_t t) override { mDefaultMsgStorePeriod = t ; }
virtual void setDefaultSyncAge(uint32_t t) override { mDefaultMsgSyncPeriod = t ; }
/*!
* \brief Search methods.
* These four methods are used to request distant search and receive the results.
* \param group_id
*/
virtual TurtleRequestId turtleGroupRequest(const RsGxsGroupId& group_id);
virtual TurtleRequestId turtleSearchRequest(const std::string& match_string);
virtual TurtleRequestId turtleGroupRequest(const RsGxsGroupId& group_id)override ;
virtual TurtleRequestId turtleSearchRequest(const std::string& match_string)override ;
virtual bool search(const std::string& substring,std::list<RsGxsGroupSummary>& group_infos) ;
virtual bool search(const Sha1CheckSum& hashed_group_id,unsigned char *& encrypted_group_data,uint32_t& encrypted_group_data_len);
virtual void receiveTurtleSearchResults(TurtleRequestId req,const std::list<RsGxsGroupSummary>& group_infos);
virtual void receiveTurtleSearchResults(TurtleRequestId req,const unsigned char *encrypted_group_data,uint32_t encrypted_group_data_len);
virtual bool search(const std::string& substring,std::list<RsGxsGroupSummary>& group_infos) override ;
virtual bool search(const Sha1CheckSum& hashed_group_id,unsigned char *& encrypted_group_data,uint32_t& encrypted_group_data_len)override ;
virtual void receiveTurtleSearchResults(TurtleRequestId req,const std::list<RsGxsGroupSummary>& group_infos)override ;
virtual void receiveTurtleSearchResults(TurtleRequestId req,const unsigned char *encrypted_group_data,uint32_t encrypted_group_data_len)override ;
virtual bool retrieveDistantSearchResults(TurtleRequestId req, std::map<RsGxsGroupId, RsGxsGroupSearchResults> &group_infos);
virtual bool clearDistantSearchResults(const TurtleRequestId& id);
virtual bool retrieveDistantGroupSummary(const RsGxsGroupId&, RsGxsGroupSearchResults &);
virtual bool retrieveDistantSearchResults(TurtleRequestId req, std::map<RsGxsGroupId, RsGxsGroupSearchResults> &group_infos)override ;
virtual bool clearDistantSearchResults(const TurtleRequestId& id)override ;
virtual bool retrieveDistantGroupSummary(const RsGxsGroupId&, RsGxsGroupSearchResults &)override ;
virtual DistantSearchGroupStatus getDistantSearchStatus(const RsGxsGroupId&) override ;
/*!
* pauses synchronisation of subscribed groups and request for group id
@ -150,7 +152,7 @@ public:
* @param enabled set to false to disable pause, and true otherwise
*/
// NOT IMPLEMENTED
virtual void pauseSynchronisation(bool enabled);
virtual void pauseSynchronisation(bool enabled)override ;
/*!
@ -159,7 +161,7 @@ public:
* @param msgId the messages to retrieve
* @return request token to be redeemed
*/
virtual int requestMsg(const RsGxsGrpMsgIdPair& /* msgId */){ return 0;}
virtual int requestMsg(const RsGxsGrpMsgIdPair& /* msgId */)override { return 0;}
/*!
* Request for this group is sent through to peers on your network
@ -167,46 +169,46 @@ public:
* @param enabled set to false to disable pause, and true otherwise
* @return request token to be redeemed
*/
virtual int requestGrp(const std::list<RsGxsGroupId>& grpId, const RsPeerId& peerId);
virtual int requestGrp(const std::list<RsGxsGroupId>& grpId, const RsPeerId& peerId)override ;
/*!
* share publish keys for the specified group with the peers in the specified list.
*/
virtual int sharePublishKey(const RsGxsGroupId& grpId,const std::set<RsPeerId>& peers) ;
virtual int sharePublishKey(const RsGxsGroupId& grpId,const std::set<RsPeerId>& peers) override ;
/*!
* Returns statistics for the group networking activity: popularity (number of friends subscribers) and max_visible_msg_count,
* that is the max nnumber of messages reported by a friend.
*/
virtual bool getGroupNetworkStats(const RsGxsGroupId& id,RsGroupNetworkStats& stats) ;
virtual bool getGroupNetworkStats(const RsGxsGroupId& id,RsGroupNetworkStats& stats) override ;
/*!
* Used to inform the net service that we changed subscription status. That helps
* optimising data transfer when e.g. unsubsribed groups are updated less often, etc
*/
virtual void subscribeStatusChanged(const RsGxsGroupId& id,bool subscribed) ;
virtual void subscribeStatusChanged(const RsGxsGroupId& id,bool subscribed) override ;
virtual void rejectMessage(const RsGxsMessageId& msg_id) ;
virtual void rejectMessage(const RsGxsMessageId& msg_id) override ;
virtual bool getGroupServerUpdateTS(const RsGxsGroupId& gid,rstime_t& grp_server_update_TS,rstime_t& msg_server_update_TS) ;
virtual bool stampMsgServerUpdateTS(const RsGxsGroupId& gid) ;
virtual bool removeGroups(const std::list<RsGxsGroupId>& groups);
virtual bool isDistantPeer(const RsPeerId& pid);
virtual bool getGroupServerUpdateTS(const RsGxsGroupId& gid,rstime_t& grp_server_update_TS,rstime_t& msg_server_update_TS) override ;
virtual bool stampMsgServerUpdateTS(const RsGxsGroupId& gid) override ;
virtual bool removeGroups(const std::list<RsGxsGroupId>& groups)override ;
virtual bool isDistantPeer(const RsPeerId& pid)override ;
/* p3Config methods */
public:
bool loadList(std::list<RsItem *>& load);
bool saveList(bool &cleanup, std::list<RsItem *>&);
RsSerialiser *setupSerialiser();
bool loadList(std::list<RsItem *>& load)override ;
bool saveList(bool &cleanup, std::list<RsItem *>&)override ;
RsSerialiser *setupSerialiser()override ;
public:
/*!
* initiates synchronisation
*/
int tick();
int tick()override ;
void threadTick() override; /// @see RsTickingThread
@ -608,6 +610,7 @@ private:
std::vector<RsNxsMsg*> mNewMessagesToNotify ;
std::set<RsGxsGroupId> mNewStatsToNotify ;
std::set<RsGxsGroupId> mNewPublishKeysToNotify ;
std::set<RsGxsGroupId> mNewGrpSyncParamsToNotify ;
// Distant search result map
std::map<TurtleRequestId,std::map<RsGxsGroupId,RsGxsGroupSearchResults> > mDistantSearchResults ;

View File

@ -48,6 +48,7 @@ public:
TYPE_UPDATED = 0x07,
TYPE_MESSAGE_DELETED = 0x08,
TYPE_GROUP_DELETED = 0x09,
TYPE_GROUP_SYNC_PARAMETERS_UPDATED = 0x0a,
};
virtual NotifyType getType() = 0;

View File

@ -141,6 +141,14 @@ public:
virtual bool search(const std::string& substring,std::list<RsGxsGroupSummary>& group_infos) =0;
virtual bool search(const Sha1CheckSum& hashed_group_id,unsigned char *& encrypted_group_data,uint32_t& encrypted_group_data_len)=0;
/*!
* \brief getDistantSearchStatus
* Request status of a possibly ongoing/finished search. If UNKNOWN is returned, it means that no
* such group is under request
* \return
*/
virtual DistantSearchGroupStatus getDistantSearchStatus(const RsGxsGroupId&) =0;
/*!
* Initiates a search through the network
* This returns messages which contains the search terms set in RsGxsSearch

View File

@ -61,6 +61,11 @@ public:
*/
virtual void notifyReceivePublishKey(const RsGxsGroupId &grpId) = 0;
/*!
* \brief notifyChangedGroupSyncParams
* \param caled when a group sync parameter is updated
*/
virtual void notifyChangedGroupSyncParams(const RsGxsGroupId &grpId) = 0;
/*!
* @param grpId group id
*/

View File

@ -113,6 +113,7 @@ enum class RsChannelEventCode: uint8_t
READ_STATUS_CHANGED = 0x07, // existing message has been read or set to unread
RECEIVED_DISTANT_SEARCH_RESULT = 0x08, // result for the given group id available for the given turtle request id
STATISTICS_CHANGED = 0x09, // stats (nb of supplier friends, how many msgs they have etc) has changed
SYNC_PARAMETERS_UPDATED = 0x0a, // sync and storage times have changed
};
struct RsGxsChannelEvent: RsEvent
@ -518,10 +519,16 @@ public:
* @param[out] distantGroup storage for group data
* @return false on error, true otherwise
*/
virtual bool getDistantSearchResultGroupData(
const RsGxsGroupId& groupId, RsGxsChannelGroup& distantGroup ) = 0;
virtual bool getDistantSearchResultGroupData(const RsGxsGroupId& groupId, RsGxsChannelGroup& distantGroup ) = 0;
/**
/**
* @brief getDistantSearchStatus
* Returns the status of ongoing search: unknown (probably not even searched), known as a search result,
* data request ongoing and data available
*/
virtual DistantSearchGroupStatus getDistantSearchStatus(const RsGxsGroupId& group_id) =0;
/**
* @brief Clear accumulated search results
* @jsonapi{development}
* @param[in] reqId search id

View File

@ -115,6 +115,7 @@ enum class RsForumEventCode: uint8_t
READ_STATUS_CHANGED = 0x06, /// msg was read or marked unread
STATISTICS_CHANGED = 0x07, /// suppliers and how many messages they have changed
MODERATOR_LIST_CHANGED = 0x08, /// forum moderation list has changed.
SYNC_PARAMETERS_UPDATED = 0x0a, /// sync and storage times have changed
};
struct RsGxsForumEvent: RsEvent

View File

@ -145,6 +145,14 @@ struct RsGxsChanges : RsEvent
RsTokenService* mService; /// Weak pointer, not serialized
};
enum class DistantSearchGroupStatus:uint8_t
{
UNKNOWN = 0x00, // no search ongoing for this group
CAN_BE_REQUESTED = 0x01, // a search result mentions this group, so the group data can be requested
ONGOING_REQUEST = 0x02, // the group data has been requested and the request is pending
HAVE_GROUP_DATA = 0x03, // group data has been received. Group can be subscribed.
};
/*!
* All implementations must offer thread safety
*/

View File

@ -116,6 +116,7 @@ enum class RsPostedEventCode: uint8_t
READ_STATUS_CHANGED = 0x06,
STATISTICS_CHANGED = 0x07,
MESSAGE_VOTES_UPDATED = 0x08,
SYNC_PARAMETERS_UPDATED = 0x09,
};

View File

@ -309,6 +309,15 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
}
break;
case RsGxsNotify::TYPE_GROUP_SYNC_PARAMETERS_UPDATED:
{
auto ev = std::make_shared<RsGxsChannelEvent>();
ev->mChannelGroupId = grpChange->mGroupId;
ev->mChannelEventCode = RsChannelEventCode::SYNC_PARAMETERS_UPDATED;
rsEvents->postEvent(ev);
}
break;
case RsGxsNotify::TYPE_STATISTICS_CHANGED:
{
auto ev = std::make_shared<RsGxsChannelEvent>();
@ -2414,6 +2423,10 @@ bool p3GxsChannels::retrieveDistantSearchResults(TurtleRequestId req,std::map<Rs
return netService()->retrieveDistantSearchResults(req,results);
}
DistantSearchGroupStatus p3GxsChannels::getDistantSearchStatus(const RsGxsGroupId& group_id)
{
return netService()->getDistantSearchStatus(group_id);
}
bool p3GxsChannels::getDistantSearchResultGroupData(const RsGxsGroupId& group_id,RsGxsChannelGroup& distant_group)
{
RsGxsGroupSearchResults gs;

View File

@ -71,6 +71,7 @@ protected:
virtual bool retrieveDistantSearchResults(TurtleRequestId req, std::map<RsGxsGroupId, RsGxsGroupSearchResults> &results) ;
virtual bool clearDistantSearchResults(TurtleRequestId req);
virtual bool getDistantSearchResultGroupData(const RsGxsGroupId& group_id,RsGxsChannelGroup& distant_group);
virtual DistantSearchGroupStatus getDistantSearchStatus(const RsGxsGroupId& group_id) ;
// Overloaded to cache new groups.
virtual RsGenExchange::ServiceCreate_Return service_CreateGroup(RsGxsGrpItem* grpItem, RsTlvSecurityKeySet& keySet);

View File

@ -256,7 +256,16 @@ void p3GxsForums::notifyChanges(std::vector<RsGxsNotify *> &changes)
}
break;
case RsGxsNotify::TYPE_PUBLISHED:
case RsGxsNotify::TYPE_GROUP_SYNC_PARAMETERS_UPDATED:
{
auto ev = std::make_shared<RsGxsForumEvent>();
ev->mForumGroupId = grpChange->mGroupId;
ev->mForumEventCode = RsForumEventCode::SYNC_PARAMETERS_UPDATED;
rsEvents->postEvent(ev);
}
break;
case RsGxsNotify::TYPE_PUBLISHED:
case RsGxsNotify::TYPE_RECEIVED_NEW:
{
/* group received */

View File

@ -1122,7 +1122,7 @@ uint32_t p3MsgService::sendMessage(RsMsgItem* item)
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;
}
@ -1196,10 +1196,15 @@ bool p3MsgService::MessageSend(MessageInfo &info)
info.msgId = std::to_string(msg->msgId);
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(
@ -1399,7 +1404,11 @@ bool p3MsgService::MessageToDraft(MessageInfo &info, const std::string &msgParen
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;
}

View File

@ -162,6 +162,15 @@ void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
}
break;
case RsGxsNotify::TYPE_GROUP_SYNC_PARAMETERS_UPDATED:
{
auto ev = std::make_shared<RsGxsPostedEvent>();
ev->mPostedGroupId = group_id;
ev->mPostedEventCode = RsPostedEventCode::SYNC_PARAMETERS_UPDATED;
rsEvents->postEvent(ev);
}
break;
case RsGxsNotify::TYPE_STATISTICS_CHANGED:
{
auto ev = std::make_shared<RsGxsPostedEvent>();

View File

@ -36,15 +36,15 @@ public:
/** Default Destructor */
~PostedDialog();
virtual QIcon iconPixmap() const { return QIcon(IMAGE_POSTED) ; } //MainPage
virtual QString pageName() const { return tr("Boards") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
virtual QIcon iconPixmap() const override { return QIcon(IMAGE_POSTED) ; } //MainPage
virtual QString pageName() const override { return tr("Boards") ; } //MainPage
virtual QString helpText() const override { return ""; } //MainPage
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; }
virtual QString getHelpString() const override;
virtual RetroShareLink::enumType getLinkType() override { return RetroShareLink::TYPE_POSTED; }
virtual GroupFrameSettings::Type groupFrameSettingsType() override { return GroupFrameSettings::Posted; }
void groupInfoToGroupItemInfo(const RsGxsGenericGroupData *groupData, GroupItemInfo &groupItemInfo) override;
bool getGroupData(std::list<RsGxsGenericGroupData*>& groupInfo) override;
@ -52,16 +52,16 @@ protected:
private:
/* GxsGroupFrameDialog */
virtual QString text(TextType type);
virtual QString icon(IconType type);
virtual QString settingsGroupName() { return "PostedDialog"; }
virtual GxsGroupDialog *createNewGroupDialog();
virtual GxsGroupDialog *createGroupDialog(GxsGroupDialog::Mode mode, RsGxsGroupId groupId);
virtual int shareKeyType();
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId);
virtual RsGxsCommentService *getCommentService();
virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId);
virtual uint32_t requestGroupSummaryType() { return GXS_REQUEST_TYPE_GROUP_DATA; } // request complete group data
virtual QString text(TextType type) override;
virtual QString icon(IconType type) override;
virtual QString settingsGroupName() override{ return "PostedDialog"; }
virtual GxsGroupDialog *createNewGroupDialog() override;
virtual GxsGroupDialog *createGroupDialog(GxsGroupDialog::Mode mode, RsGxsGroupId groupId) override;
virtual int shareKeyType() override;
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId) override;
virtual RsGxsCommentService *getCommentService() override;
virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) override;
virtual uint32_t requestGroupSummaryType() override { return GXS_REQUEST_TYPE_GROUP_DATA; } // request complete group data
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
RsEventsHandlerId_t mEventHandlerId;

View File

@ -29,6 +29,7 @@
#include "ui_PostedListWidgetWithModel.h"
#include "gui/feeds/GxsChannelPostItem.h"
#include "gui/gxs/GxsIdDetails.h"
#include "gui/gxs/GxsGroupFrameDialog.h"
#include "gui/gxs/GxsCommentDialog.h"
#include "util/misc.h"
#include "gui/Posted/PostedCreatePostDialog.h"
@ -54,6 +55,9 @@
#define ROLE_PUBLISH FEED_TREEWIDGET_SORTROLE
// number of posts to show at once.
#define POSTS_CHUNK_SIZE 25
/****
* #define DEBUG_POSTED
***/
@ -255,8 +259,8 @@ PostedListWidgetWithModel::PostedListWidgetWithModel(const RsGxsGroupId& postedI
ui->tabWidget->hideCloseButton(1);
connect(ui->sortStrategy_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(updateSorting(int)));
connect(ui->nextButton,SIGNAL(clicked()),this,SLOT(next10Posts()));
connect(ui->prevButton,SIGNAL(clicked()),this,SLOT(prev10Posts()));
connect(ui->nextButton,SIGNAL(clicked()),this,SLOT(nextPosts()));
connect(ui->prevButton,SIGNAL(clicked()),this,SLOT(prevPosts()));
connect(ui->postsTree,SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(postContextMenu(const QPoint&)));
connect(ui->viewModeButton,SIGNAL(clicked()),this,SLOT(switchDisplayMode()));
@ -274,7 +278,7 @@ PostedListWidgetWithModel::PostedListWidgetWithModel(const RsGxsGroupId& postedI
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()),this, SLOT(settingsChanged()));
/* add filter actions */
ui->postsTree->setPlaceholderText(tr("Thumbnails"));
ui->postsTree->setPlaceholderText(tr("No posts available in this board"));
//ui->postsTree->setMinimumWidth(COLUMN_SIZE_FONT_FACTOR_W*QFontMetricsF(font()).height()+1);
connect(ui->postsTree,SIGNAL(sizeChanged(QSize)),this,SLOT(handlePostsTreeSizeChange(QSize)));
@ -352,24 +356,24 @@ void PostedListWidgetWithModel::filterItems(QString text)
uint32_t count;
mPostedPostsModel->setFilter(lst,count) ;
ui->showLabel->setText(QString::number(mPostedPostsModel->displayedStartPostIndex()+1)+" - "+QString::number(std::min(mPostedPostsModel->filteredPostsCount(),mPostedPostsModel->displayedStartPostIndex()+10+1)));
ui->showLabel->setText(QString::number(mPostedPostsModel->displayedStartPostIndex()+1)+" - "+QString::number(std::min(mPostedPostsModel->filteredPostsCount(),mPostedPostsModel->displayedStartPostIndex()+POSTS_CHUNK_SIZE+1)));
}
void PostedListWidgetWithModel::next10Posts()
void PostedListWidgetWithModel::nextPosts()
{
if(mPostedPostsModel->displayedStartPostIndex() + 10 < mPostedPostsModel->filteredPostsCount())
if(mPostedPostsModel->displayedStartPostIndex() + POSTS_CHUNK_SIZE < mPostedPostsModel->filteredPostsCount())
{
mPostedPostsModel->setPostsInterval(10+mPostedPostsModel->displayedStartPostIndex(),10);
ui->showLabel->setText(QString::number(mPostedPostsModel->displayedStartPostIndex()+1)+" - "+QString::number(std::min(mPostedPostsModel->filteredPostsCount(),mPostedPostsModel->displayedStartPostIndex()+10+1)));
mPostedPostsModel->setPostsInterval(POSTS_CHUNK_SIZE+mPostedPostsModel->displayedStartPostIndex(),POSTS_CHUNK_SIZE);
ui->showLabel->setText(QString::number(mPostedPostsModel->displayedStartPostIndex()+1)+" - "+QString::number(std::min(mPostedPostsModel->filteredPostsCount(),mPostedPostsModel->displayedStartPostIndex()+POSTS_CHUNK_SIZE+1)));
}
}
void PostedListWidgetWithModel::prev10Posts()
void PostedListWidgetWithModel::prevPosts()
{
if((int)mPostedPostsModel->displayedStartPostIndex() - 10 >= 0)
if((int)mPostedPostsModel->displayedStartPostIndex() - POSTS_CHUNK_SIZE >= 0)
{
mPostedPostsModel->setPostsInterval(mPostedPostsModel->displayedStartPostIndex()-10,10);
ui->showLabel->setText(QString::number(mPostedPostsModel->displayedStartPostIndex()+1)+" - "+QString::number(std::min(mPostedPostsModel->filteredPostsCount(),mPostedPostsModel->displayedStartPostIndex()+10+1)));
mPostedPostsModel->setPostsInterval(mPostedPostsModel->displayedStartPostIndex()-POSTS_CHUNK_SIZE,POSTS_CHUNK_SIZE);
ui->showLabel->setText(QString::number(mPostedPostsModel->displayedStartPostIndex()+1)+" - "+QString::number(std::min(mPostedPostsModel->filteredPostsCount(),mPostedPostsModel->displayedStartPostIndex()+POSTS_CHUNK_SIZE+1)));
}
}
@ -485,7 +489,8 @@ void PostedListWidgetWithModel::handleEvent_main_thread(std::shared_ptr<const Rs
case RsPostedEventCode::NEW_POSTED_GROUP: // [[fallthrough]];
case RsPostedEventCode::UPDATED_POSTED_GROUP: // [[fallthrough]];
case RsPostedEventCode::UPDATED_MESSAGE:
{
case RsPostedEventCode::SYNC_PARAMETERS_UPDATED:
{
if(e->mPostedGroupId == groupId())
updateDisplay(true);
}
@ -634,7 +639,7 @@ void PostedListWidgetWithModel::postPostLoad()
else
std::cerr << "No pre-selected channel post." << std::endl;
whileBlocking(ui->showLabel)->setText(QString::number(mPostedPostsModel->displayedStartPostIndex()+1)+" - "+QString::number(std::min(mPostedPostsModel->filteredPostsCount(),mPostedPostsModel->displayedStartPostIndex()+10+1)));
whileBlocking(ui->showLabel)->setText(QString::number(mPostedPostsModel->displayedStartPostIndex()+1)+" - "+QString::number(std::min(mPostedPostsModel->filteredPostsCount(),mPostedPostsModel->displayedStartPostIndex()+POSTS_CHUNK_SIZE+1)));
whileBlocking(ui->filter_LE)->setText(QString());
}
@ -839,7 +844,10 @@ void PostedListWidgetWithModel::insertBoardDetails(const RsPostedGroup& group)
ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags));
ui->subscribeToolButton->setEnabled(true);
RetroShareLink link;
ui->syncPeriodLabel->setVisible(IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags));
ui->syncPeriodTitleLabel->setVisible(IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags));
RetroShareLink link;
if (IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags))
ui->subscribeToolButton->setText(tr("Subscribed") + " " + QString::number(group.mMeta.mPop) );
@ -848,11 +856,33 @@ void PostedListWidgetWithModel::insertBoardDetails(const RsPostedGroup& group)
ui->infoPosts->setText(QString::number(group.mMeta.mVisibleMsgCount));
if(group.mMeta.mLastPost==0)
ui->infoLastPost->setText(tr("Never"));
else
ui->infoLastPost->setText(DateTime::formatLongDateTime(group.mMeta.mLastPost));
QString formatDescription = QString::fromUtf8(group.mDescription.c_str());
if(group.mMeta.mLastPost==0)
ui->infoLastPost->setText(tr("Never"));
else
ui->infoLastPost->setText(DateTime::formatLongDateTime(group.mMeta.mLastPost));
uint32_t current_sync_time = GxsGroupFrameDialog::checkDelay(rsPosted->getSyncPeriod(group.mMeta.mGroupId))/86400 ;
QString sync_string;
switch(current_sync_time)
{
case 5: sync_string = tr("5 days"); break;
case 15: sync_string = tr("2 weeks"); break;
case 30: sync_string = tr("1 month"); break;
case 90: sync_string = tr("3 months"); break;
case 180: sync_string = tr("6 months"); break;
case 365: sync_string = tr("1 year"); break;
case 0: sync_string = tr("indefinitly"); break;
default:
sync_string = tr("Unknown");
}
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)";
ui->syncPeriodLabel->setText(sync_string);
QString formatDescription = QString::fromUtf8(group.mDescription.c_str());
unsigned int formatFlag = RSHTML_FORMATTEXT_EMBED_LINKS;

View File

@ -143,8 +143,8 @@ private slots:
void postPostLoad();
void postContextMenu(const QPoint&);
void copyMessageLink();
void next10Posts();
void prev10Posts();
void nextPosts();
void prevPosts();
void filterItems(QString s);
public slots:

View File

@ -47,18 +47,6 @@
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLabel" name="namelabel">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="0" column="3">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
@ -127,26 +115,6 @@
</item>
</layout>
</item>
<item row="2" column="1">
<widget class="QLabel" name="infoPosts">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">0</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="5">
<widget class="QLabel" name="infoDistribution">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="logoLabel">
<property name="minimumSize">
@ -169,16 +137,23 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="createdlabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1" colspan="5">
<widget class="QLabel" name="infoLastPost">
<property name="text">
<string>Created</string>
<string notr="true">unknown</string>
</property>
</widget>
</item>
@ -195,33 +170,7 @@
</property>
</widget>
</item>
<item row="4" column="1" colspan="5">
<widget class="QLabel" name="createdinfolabel">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="infoPostsLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Posts</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
@ -234,18 +183,15 @@
</property>
</widget>
</item>
<item row="5" column="1" colspan="5">
<widget class="GxsIdLabel" name="infoAdministrator">
<item row="7" column="1" colspan="5">
<widget class="QLabel" name="infoDistribution">
<property name="text">
<string>unknown</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<item row="7" column="0">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
@ -253,7 +199,7 @@
</font>
</property>
<property name="text">
<string>Popularity</string>
<string>Distribution:</string>
</property>
</widget>
</item>
@ -276,8 +222,8 @@
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_3">
<item row="2" column="1">
<widget class="QLabel" name="infoPosts">
<property name="font">
<font>
<weight>75</weight>
@ -285,29 +231,103 @@
</font>
</property>
<property name="text">
<string>Distribution:</string>
<string notr="true">0</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="5">
<widget class="QLabel" name="infoLastPost">
<item row="6" column="0">
<widget class="QLabel" name="createdlabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">unknown</string>
<string>Created</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="0" column="1">
<widget class="QLabel" name="namelabel">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<property name="text">
<string>TextLabel</string>
</property>
</spacer>
</widget>
</item>
<item row="5" column="1" colspan="5">
<widget class="QLabel" name="createdinfolabel">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Popularity</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="infoPostsLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Posts</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="5">
<widget class="GxsIdLabel" name="infoAdministrator">
<property name="text">
<string>unknown</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="syncPeriodTitleLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Sync period:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="syncPeriodLabel">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
</layout>
</item>
@ -320,7 +340,7 @@
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;Description&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textInteractionFlags">
@ -602,8 +622,8 @@ p, li { white-space: pre-wrap; }
</customwidget>
</customwidgets>
<resources>
<include location="Posted_images.qrc"/>
<include location="../icons.qrc"/>
<include location="Posted_images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -66,7 +66,7 @@
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/svg/design.svg</normaloff>:/icons/svg/design.svg</iconset>
<normaloff>:/icons/svg/display_options.svg</normaloff>:/icons/svg/display_options.svg</iconset>
</property>
<property name="iconSize">
<size>
@ -137,7 +137,7 @@
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header location="global">gui/common/LineEditClear.h</header>
<header>gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>RSTreeWidget</class>
@ -146,7 +146,6 @@
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources>
<connections/>

View File

@ -559,9 +559,10 @@ void SubFileItem::cancel()
/* Only occurs - if it is downloading */
if (((mType == SFI_TYPE_ATTACH) || (mType == SFI_TYPE_CHANNEL)) && (mFlag & SFI_FLAG_CREATE))
{
hide();
rsFiles->ExtraFileRemove(FileHash());//, RS_FILE_REQ_ANONYMOUS_ROUTING | RS_FILE_REQ_EXTRA);
mPath = "";
del();
return; // do not update!
}
else
{

View File

@ -141,6 +141,7 @@ GxsCommentTreeWidget::GxsCommentTreeWidget(QWidget *parent)
{
// QTreeWidget* widget = this;
setVerticalScrollMode(ScrollPerPixel);
setContextMenuPolicy(Qt::CustomContextMenu);
RSElidedItemDelegate *itemDelegate = new RSElidedItemDelegate(this);
itemDelegate->setSpacing(QSize(0, 2));

View File

@ -388,7 +388,7 @@ void GxsGroupFrameDialog::removeAllSearches()
// Same function than the one in rsgxsnetservice.cc, so that all times are automatically consistent
static uint32_t checkDelay(uint32_t time_in_secs)
uint32_t GxsGroupFrameDialog::checkDelay(uint32_t time_in_secs)
{
if(time_in_secs < 1 * 86400)
return 0 ;
@ -485,6 +485,7 @@ void GxsGroupFrameDialog::groupTreeCustomPopupMenu(QPoint point)
actnn = ctxMenu2->addAction(tr(" 6 months" ),this,SLOT(setSyncPostsDelay())) ; actnn->setData(QVariant(180)) ; if(current_sync_time ==180) { actnn->setEnabled(false);actnn->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/start.png"));}
actnn = ctxMenu2->addAction(tr(" 1 year " ),this,SLOT(setSyncPostsDelay())) ; actnn->setData(QVariant(365)) ; if(current_sync_time ==365) { actnn->setEnabled(false);actnn->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/start.png"));}
actnn = ctxMenu2->addAction(tr(" Indefinitly"),this,SLOT(setSyncPostsDelay())) ; actnn->setData(QVariant( 0)) ; if(current_sync_time == 0) { actnn->setEnabled(false);actnn->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/start.png"));}
ctxMenu2->setEnabled(isSubscribed);
ctxMenu2 = contextMnu.addMenu(tr("Store posts for at most...")) ;
actnn = ctxMenu2->addAction(tr(" 5 days" ),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant( 5)) ; if(current_store_time == 5) { actnn->setEnabled(false);actnn->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/start.png"));}
@ -494,6 +495,7 @@ void GxsGroupFrameDialog::groupTreeCustomPopupMenu(QPoint point)
actnn = ctxMenu2->addAction(tr(" 6 months" ),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant(180)) ; if(current_store_time ==180) { actnn->setEnabled(false);actnn->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/start.png"));}
actnn = ctxMenu2->addAction(tr(" 1 year " ),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant(365)) ; if(current_store_time ==365) { actnn->setEnabled(false);actnn->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/start.png"));}
actnn = ctxMenu2->addAction(tr(" Indefinitly"),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant( 0)) ; if(current_store_time == 0) { actnn->setEnabled(false);actnn->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/start.png"));}
ctxMenu2->setEnabled(isSubscribed);
if (shareKeyType()) {
action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_SHARE), tr("Share publish permissions..."), this, SLOT(sharePublishKey()));

View File

@ -82,6 +82,8 @@ public:
void getServiceStatistics(GxsServiceStatistic& stats) const ;
static uint32_t checkDelay(uint32_t time_in_secs);
protected:
virtual void showEvent(QShowEvent *event) override;
virtual void paintEvent(QPaintEvent *pe) override;

View File

@ -67,9 +67,11 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId
connect(postButton, SIGNAL(clicked()), this, SLOT(sendMsg()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelMsg()));
connect(pasteFromClipboardButton, SIGNAL(clicked()), this, SLOT(pasteLink()));
connect(addFileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
connect(addfilepushButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
connect(removeAllFilesButton, SIGNAL(clicked() ), this , SLOT(clearAllAttachments()));
//connect(addfilepushButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
connect(subjectEdit,SIGNAL(textChanged(const QString&)),this,SLOT(updatePreviewText(const QString&)));
connect(addThumbnailButton, SIGNAL(clicked() ), this , SLOT(addThumbnail()));
@ -81,7 +83,6 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId
channelpostButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/comment.png"));
attachmentsButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/attachements.png"));
addThumbnailButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/add-image.png"));
addfilepushButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/add-file.png"));
aspectRatio_CB->setItemIcon(0,FilesDefs::getIconFromQtResourcePath(":/icons/svg/ratio-auto.svg"));
aspectRatio_CB->setItemIcon(1,FilesDefs::getIconFromQtResourcePath(":/icons/svg/ratio-1-1.svg"));
@ -158,6 +159,15 @@ void CreateGxsChannelMsg::changeAspectRatio(int s)
break;
}
}
void CreateGxsChannelMsg::reject()
{
if(QMessageBox::warning(nullptr,tr("Close this window?"),tr("Do you really want to discard your post?"),QMessageBox::Yes,QMessageBox::No) == QMessageBox::No)
return;
QDialog::reject();
}
void CreateGxsChannelMsg::contextMenu(QPoint /*point*/)
{
QList<RetroShareLink> links ;
@ -431,6 +441,16 @@ void CreateGxsChannelMsg::addAttachment(const RsFileHash &hash, const std::strin
if (mCheckAttachment)
checkAttachmentReady();
updateAttachmentCount();
}
void CreateGxsChannelMsg::updateAttachmentCount()
{
if(mAttachments.size() > 0)
attachmentsButton->setText(tr("Attachments (%1)").arg(mAttachments.size()));
else
attachmentsButton->setText(tr("Attachments"));
}
void CreateGxsChannelMsg::deleteAttachment()
@ -449,6 +469,21 @@ void CreateGxsChannelMsg::deleteAttachment()
}
else
++it;
updateAttachmentCount();
}
void CreateGxsChannelMsg::clearAllAttachments()
{
QLayoutItem* item;
while ( ( item = fileFrame->layout()->takeAt( 0 ) ) != NULL )
{
delete item->widget();
delete item;
}
mAttachments.clear();
attachmentsButton->setText(tr("Attachments"));
}
void CreateGxsChannelMsg::addExtraFile()
@ -489,7 +524,7 @@ void CreateGxsChannelMsg::addAttachment(const std::string &path)
setThumbNail(path, 2000);
/* add widget in for new destination */
uint32_t flags = SFI_TYPE_CHANNEL | SFI_STATE_EXTRA | SFI_FLAG_CREATE;
uint32_t flags = SFI_TYPE_CHANNEL | SFI_STATE_EXTRA | SFI_FLAG_CREATE;
// check attachment if hash exists already
std::list<SubFileItem* >::iterator it;
@ -516,16 +551,18 @@ void CreateGxsChannelMsg::addAttachment(const std::string &path)
//SubFileItem *file = new SubFileItem(hash, filename, path, size, flags, mChannelId);
SubFileItem *file = new SubFileItem(hash, filename, path, size, flags, RsPeerId());
mAttachments.push_back(file);
connect(file,SIGNAL(wantsToBeDeleted()),this,SLOT(deleteAttachment())) ;
mAttachments.push_back(file);
QLayout *layout = fileFrame->layout();
layout->addWidget(file);
if (mCheckAttachment)
{
checkAttachmentReady();
}
return;
updateAttachmentCount();
return;
}
bool CreateGxsChannelMsg::setThumbNail(const std::string& path, int frame){
@ -610,7 +647,9 @@ void CreateGxsChannelMsg::checkAttachmentReady()
cancelButton->setEnabled(true);
}
/* repeat... */
updateAttachmentCount();
/* repeat... */
int msec_rate = 1000;
QTimer::singleShot( msec_rate, this, SLOT(checkAttachmentReady(void)));
}

View File

@ -41,7 +41,9 @@ public:
/** Default Destructor */
~CreateGxsChannelMsg();
void addHtmlText(const QString& text) ;
void reject() override;
void addHtmlText(const QString& text) ;
void addSubject(const QString& text) ;
void addAttachment(const std::string &path);
void addAttachment(const RsFileHash &hash, const std::string &fname, uint64_t size, bool local, const RsPeerId &srcId,bool assume_file_ready = false);
@ -59,6 +61,7 @@ private slots:
void checkAttachmentReady();
void deleteAttachment();
void updatePreviewText(const QString &);
void clearAllAttachments();
void cancelMsg();
void sendMsg();
@ -76,6 +79,7 @@ private:
void loadChannelInfo();
void loadOriginalChannelPostInfo();
void saveChannelInfo(const RsGroupMetaData &group);
void updateAttachmentCount();
void parseRsFileListAttachments(const std::string &attachList);
void sendMessage(const std::string &subject, const std::string &msg, const std::list<RsGxsFile> &files);

View File

@ -185,6 +185,9 @@ p, li { white-space: pre-wrap; }
</item>
<item>
<widget class="QComboBox" name="aspectRatio_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Choose aspect ratio policy. In 'Auto' mode, the most suitable aspect ratio is chosen for you.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="iconSize">
<size>
<width>24</width>
@ -213,19 +216,6 @@ p, li { white-space: pre-wrap; }
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="addfilepushButton">
<property name="text">
<string>Add File to Attach</string>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
@ -256,6 +246,19 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="0" colspan="2">
@ -271,52 +274,113 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
<widget class="QWidget" name="stackedWidgetPage2">
<layout class="QGridLayout" name="attachmentsTabGLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="addFileButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add File&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>:/icons/png/add-file.png</normaloff>:/icons/png/add-file.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="addFileButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add File&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/add-file.png</normaloff>:/icons/png/add-file.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pasteFromClipboardButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Paste retroshare link(s) from clipboard.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/copy.png</normaloff>:/icons/png/copy.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeAllFilesButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add File&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/cancel.png</normaloff>:/icons/png/cancel.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="thumbNailCb">
<property name="toolTip">
<string>Allow channels to get frame for message thumbnail from movie media attachments or not</string>
</property>
<property name="text">
<string>Auto Thumbnail</string>
</property>
</widget>
</item>
<item>
<spacer name="attachmentsHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>334</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0" colspan="5">
<item>
<widget class="QScrollArea" name="attachmentsScrollArea">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
@ -329,7 +393,7 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>81</width>
<width>827</width>
<height>24</height>
</rect>
</property>
@ -376,29 +440,6 @@ p, li { white-space: pre-wrap; }
</widget>
</widget>
</item>
<item row="0" column="2">
<spacer name="attachmentsHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>334</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="thumbNailCb">
<property name="toolTip">
<string>Allow channels to get frame for message thumbnail from movie media attachments or not</string>
</property>
<property name="text">
<string>Auto Thumbnail</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -514,6 +555,7 @@ p, li { white-space: pre-wrap; }
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -118,7 +118,7 @@ void ChannelPostThumbnailView::init(const RsGxsChannelPost& post)
mPostImage->setPicture(thumbnail);
if(mFlags & FLAG_ALLOW_PAN)
mPostImage->setToolTip(tr("Use mouse to center and zoom into the image"));
mPostImage->setToolTip(tr("Use mouse to center and zoom\ninto the image, so as to\n crop it for your post."));
QVBoxLayout *layout = new QVBoxLayout(this);

View File

@ -319,13 +319,16 @@ Qt::ItemFlags RsGxsChannelPostsModel::flags(const QModelIndex& index) const
return QAbstractItemModel::flags(index);
}
void RsGxsChannelPostsModel::setNumColumns(int n)
bool RsGxsChannelPostsModel::setNumColumns(int n)
{
if(n < 1)
{
RsErr() << __PRETTY_FUNCTION__ << " Attempt to set a number of column of 0. This is wrong." << std::endl;
return;
return false;
}
if(mColumns == n)
return false;
preMods();
beginRemoveRows(QModelIndex(),0,rowCount()-1);
@ -337,6 +340,8 @@ void RsGxsChannelPostsModel::setNumColumns(int n)
endInsertRows();
postMods();
return true;
}
quintptr RsGxsChannelPostsModel::getChildRef(quintptr ref,int index) const

View File

@ -116,7 +116,9 @@ public:
void triggerViewUpdate();
void setNumColumns(int n);
// sets the number of columns. Returns 0 if nothing changes.
bool setNumColumns(int n);
void setMode(TreeMode mode);
TreeMode getMode() const { return mTreeMode; }

View File

@ -29,6 +29,7 @@
#include "ui_GxsChannelPostsWidgetWithModel.h"
#include "gui/feeds/GxsChannelPostItem.h"
#include "gui/gxs/GxsIdDetails.h"
#include "gui/gxs/GxsGroupFrameDialog.h"
#include "util/misc.h"
#include "gui/gxschannels/CreateGxsChannelMsg.h"
#include "gui/common/UIStateHelper.h"
@ -383,17 +384,17 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
ui->channelPostFiles_TV->setItemDelegate(new ChannelPostFilesDelegate());
ui->channelPostFiles_TV->setPlaceholderText(tr("No files in this post, or no post selected"));
ui->channelPostFiles_TV->setSortingEnabled(true);
ui->channelPostFiles_TV->sortByColumn(0, Qt::AscendingOrder);
ui->channelPostFiles_TV->sortByColumn(3, Qt::AscendingOrder); // sort by time
ui->channelPostFiles_TV->setAlternatingRowColors(false);
connect(ui->channelPostFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnPostFiles(int,Qt::SortOrder)));
connect(ui->channelFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnFiles(int,Qt::SortOrder)));
ui->channelFiles_TV->setModel(mChannelFilesModel = new RsGxsChannelPostFilesModel());
ui->channelFiles_TV->setItemDelegate(mFilesDelegate = new ChannelPostFilesDelegate());
ui->channelFiles_TV->setPlaceholderText(tr("No files in the channel, or no channel selected"));
ui->channelFiles_TV->setSortingEnabled(true);
ui->channelFiles_TV->sortByColumn(0, Qt::AscendingOrder);
connect(ui->channelPostFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnPostFiles(int,Qt::SortOrder)));
connect(ui->channelFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnFiles(int,Qt::SortOrder)));
ui->channelFiles_TV->sortByColumn(3, Qt::AscendingOrder); // sort by time
connect(ui->postsTree->selectionModel(),SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)),this,SLOT(showPostDetails()));
connect(ui->postsTree,SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(postContextMenu(const QPoint&)));
@ -429,7 +430,7 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
ui->filterLineEdit->setPlaceholderText(tr("Search..."));
connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
ui->postsTree->setPlaceholderText(tr("Thumbnails"));
ui->postsTree->setPlaceholderText(tr("No posts available in this channel"));
ui->postsTree->setMinimumWidth(COLUMN_SIZE_FONT_FACTOR_W*QFontMetricsF(font()).height()+1);
connect(ui->postsTree,SIGNAL(sizeChanged(QSize)),this,SLOT(handlePostsTreeSizeChange(QSize)));
@ -454,16 +455,19 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
QIcon icon;
icon.addPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/redled.png"), QIcon::Normal, QIcon::On);
icon.addPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/start.png"), QIcon::Normal, QIcon::Off);
#ifdef TO_REMOVE
mAutoDownloadAction = new QAction(icon, "", this);
mAutoDownloadAction->setCheckable(true);
connect(mAutoDownloadAction, SIGNAL(triggered()), this, SLOT(toggleAutoDownload()));
ui->subscribeToolButton->addSubscribedAction(mAutoDownloadAction);
setAutoDownload(false);
#endif
ui->commentsDialog->setTokenService(rsGxsChannels->getTokenService(),rsGxsChannels);
/* Initialize GUI */
setAutoDownload(false);
settingsChanged();
setGroupId(channelId);
@ -674,8 +678,19 @@ void GxsChannelPostsWidgetWithModel::handlePostsTreeSizeChange(QSize s,bool forc
int n_columns = std::max(1,(int)floor(s.width() / (mChannelPostsDelegate->cellSize(0,font(),ui->postsTree->width()))));
std::cerr << "nb columns: " << n_columns << " current count=" << mChannelPostsModel->columnCount() << std::endl;
if(force || (n_columns != mChannelPostsModel->columnCount()))
mChannelPostsModel->setNumColumns(n_columns);
// save current post. The setNumColumns() indeed loses selection
QModelIndex index = ui->postsTree->selectionModel()->currentIndex();
RsGxsMessageId current_mid;
if(index.isValid())
current_mid = index.data(Qt::UserRole).value<RsGxsChannelPost>().mMeta.mMsgId ;
if((force || (n_columns != mChannelPostsModel->columnCount())) && mChannelPostsModel->setNumColumns(n_columns))
{
// Restore current post. The setNumColumns() indeed loses selection
ui->postsTree->selectionModel()->setCurrentIndex(mChannelPostsModel->getIndexOfMessage(current_mid),QItemSelectionModel::ClearAndSelect);
}
}
void GxsChannelPostsWidgetWithModel::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
@ -691,7 +706,8 @@ void GxsChannelPostsWidgetWithModel::handleEvent_main_thread(std::shared_ptr<con
case RsChannelEventCode::UPDATED_CHANNEL: // [[fallthrough]];
case RsChannelEventCode::NEW_MESSAGE: // [[fallthrough]];
case RsChannelEventCode::UPDATED_MESSAGE:
{
case RsChannelEventCode::SYNC_PARAMETERS_UPDATED:
{
if(e->mChannelGroupId == groupId())
updateDisplay(true);
}
@ -706,7 +722,7 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
QModelIndex index = ui->postsTree->selectionModel()->currentIndex();
RsGxsChannelPost post = index.data(Qt::UserRole).value<RsGxsChannelPost>() ;
QTextDocument doc;
QTextDocument doc;
doc.setHtml(post.mMsg.c_str());
if(post.mMeta.mPublishTs == 0)
@ -726,9 +742,6 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
ui->postName_LB->show();
ui->postTime_LB->show();
if(index.row()==0 && index.column()==0)
std::cerr << "here" << std::endl;
std::cerr << "showPostDetails: setting mSelectedPost to current post Id " << post.mMeta.mMsgId << ". Previous value: " << mSelectedPost << std::endl;
mSelectedPost = post.mMeta.mMsgId;
@ -741,7 +754,7 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
auto all_msgs_versions(post.mOlderVersions);
all_msgs_versions.insert(post.mMeta.mMsgId);
ui->commentsDialog->commentLoad(post.mMeta.mGroupId, all_msgs_versions, post.mMeta.mMsgId);
ui->commentsDialog->commentLoad(post.mMeta.mGroupId, all_msgs_versions, post.mMeta.mMsgId,true);
std::cerr << "Showing details about selected index : "<< index.row() << "," << index.column() << std::endl;
@ -915,7 +928,7 @@ GxsChannelPostsWidgetWithModel::~GxsChannelPostsWidgetWithModel()
// save settings
processSettings(false);
delete(mAutoDownloadAction);
//delete(mAutoDownloadAction);
delete mFilesDelegate;
delete ui;
}
@ -1029,28 +1042,31 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
ui->postButton->setEnabled(bool(group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH));
ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags));
ui->subscribeToolButton->setEnabled(true);
#ifdef TO_REMOVE
bool autoDownload ;
rsGxsChannels->getChannelAutoDownload(group.mMeta.mGroupId,autoDownload);
setAutoDownload(autoDownload);
#endif
if (IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags))
setSubscribeButtonText(group.mMeta.mGroupId,group.mMeta.mSubscribeFlags);
if (IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags))
{
ui->subscribeToolButton->setText(tr("Subscribed") + " " + QString::number(group.mMeta.mPop) );
//ui->feedToolButton->setEnabled(true);
//ui->fileToolButton->setEnabled(true);
ui->channel_TW->setTabEnabled(CHANNEL_TABS_POSTS,true);
ui->channel_TW->setTabEnabled(CHANNEL_TABS_FILES,true);
ui->details_TW->setEnabled(true);
}
ui->infoSyncTimeLabel->show();
ui->syncPeriodTitleLabel->show();
}
else
{
ui->details_TW->setEnabled(false);
ui->channel_TW->setTabEnabled(CHANNEL_TABS_POSTS,false);
ui->channel_TW->setTabEnabled(CHANNEL_TABS_FILES,false);
ui->infoSyncTimeLabel->hide();
ui->syncPeriodTitleLabel->hide();
}
@ -1060,6 +1076,29 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
ui->infoLastPost->setText(tr("Never"));
else
ui->infoLastPost->setText(DateTime::formatLongDateTime(group.mMeta.mLastPost));
uint32_t current_sync_time = GxsGroupFrameDialog::checkDelay(rsGxsChannels->getSyncPeriod(group.mMeta.mGroupId))/86400 ;
QString sync_string;
switch(current_sync_time)
{
case 5: sync_string = tr("5 days"); break;
case 15: sync_string = tr("2 weeks"); break;
case 30: sync_string = tr("1 month"); break;
case 90: sync_string = tr("3 months"); break;
case 180: sync_string = tr("6 months"); break;
case 365: sync_string = tr("1 year"); break;
case 0: sync_string = tr("indefinitly"); break;
default:
sync_string = tr("Unknown");
}
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)";
ui->infoSyncTimeLabel->setText(sync_string);
QString formatDescription = QString::fromUtf8(group.mDescription.c_str());
unsigned int formatFlag = RSHTML_FORMATTEXT_EMBED_LINKS;
@ -1120,11 +1159,47 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
//ui->feedToolButton->setEnabled(false);
//ui->fileToolButton->setEnabled(false);
#endif
ui->subscribeToolButton->setText(tr("Subscribe ") + " " + QString::number(group.mMeta.mPop) );
setSubscribeButtonText(group.mMeta.mGroupId,group.mMeta.mSubscribeFlags);
showPostDetails();
}
void GxsChannelPostsWidgetWithModel::setSubscribeButtonText(const RsGxsGroupId& group_id,uint32_t flags)
{
if(IS_GROUP_SUBSCRIBED(flags))
{
ui->subscribeToolButton->setText(tr("Unsubscribe"));
ui->subscribeToolButton->setSubscribed(true);
ui->subscribeToolButton->setEnabled(true);
}
else
{
switch(rsGxsChannels->getDistantSearchStatus(group_id))
{
case DistantSearchGroupStatus::UNKNOWN: // means no search ongoing. This is not a distant search
case DistantSearchGroupStatus::HAVE_GROUP_DATA: // fallthrough
ui->subscribeToolButton->setText(tr("Subscribe"));
ui->subscribeToolButton->setToolTip("");
ui->subscribeToolButton->setSubscribed(false);
ui->subscribeToolButton->setEnabled(true);
break;
case DistantSearchGroupStatus::CAN_BE_REQUESTED: // means no search ongoing. This is not a distant search
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->setSubscribed(false);
ui->subscribeToolButton->setEnabled(false);
break;
case DistantSearchGroupStatus::ONGOING_REQUEST:
ui->subscribeToolButton->setText(tr("Subscribe"));
ui->subscribeToolButton->setToolTip("");
ui->subscribeToolButton->setSubscribed(true);
ui->subscribeToolButton->setEnabled(false);
break;
}
}
}
void GxsChannelPostsWidgetWithModel::switchOnlyUnread(bool)
{
filterChanged(ui->filterLineEdit->text());
@ -1195,10 +1270,11 @@ void GxsChannelPostsWidgetWithModel::subscribeGroup(bool subscribe)
} );
}
#ifdef TO_REMOVE
void GxsChannelPostsWidgetWithModel::setAutoDownload(bool autoDl)
{
mAutoDownloadAction->setChecked(autoDl);
mAutoDownloadAction->setText(autoDl ? tr("Disable Auto-Download") : tr("Enable Auto-Download"));
mAutoDownloadAction->setChecked(autoDl);
mAutoDownloadAction->setText(autoDl ? tr("Disable Auto-Download") : tr("Enable Auto-Download"));
}
void GxsChannelPostsWidgetWithModel::toggleAutoDownload()
@ -1226,6 +1302,7 @@ void GxsChannelPostsWidgetWithModel::toggleAutoDownload()
}
});
}
#endif
class GxsChannelPostsReadData
{

View File

@ -103,8 +103,8 @@ public:
~GxsChannelPostsWidgetWithModel();
/* GxsMessageFrameWidget */
virtual QIcon groupIcon();
virtual void groupIdChanged() { updateDisplay(true); }
virtual QIcon groupIcon() override;
virtual void groupIdChanged() override { updateDisplay(true); }
virtual QString groupName(bool) override;
virtual bool navigate(const RsGxsMessageId&) override;
@ -126,7 +126,7 @@ protected:
virtual bool insertGroupData(const RsGxsGenericGroupData *data) override;
#endif
virtual bool useThread() { return mUseThread; }
virtual void blank() ;
virtual void blank() override ;
#ifdef TODO
virtual bool getGroupData(RsGxsGenericGroupData *& data) override;
@ -137,14 +137,14 @@ protected:
#endif
/* GxsMessageFrameWidget */
virtual void setAllMessagesReadDo(bool read, uint32_t &token);
virtual void setAllMessagesReadDo(bool read, uint32_t &token) override;
private slots:
void showPostDetails();
void updateGroupData();
void download();
void createMsg();
void toggleAutoDownload();
// void toggleAutoDownload();
void subscribeGroup(bool subscribe);
void filterChanged(QString);
void settingsChanged();
@ -168,14 +168,16 @@ private:
RsGxsMessageId getCurrentItemId() const;
void selectItem(const RsGxsMessageId& msg_id);
void setAutoDownload(bool autoDl);
// void setAutoDownload(bool autoDl);
static bool filterItem(FeedItem *feedItem, const QString &text, int filter);
void insertChannelDetails(const RsGxsChannelGroup &group);
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
private:
QAction *mAutoDownloadAction;
void setSubscribeButtonText(const RsGxsGroupId& group_id,uint32_t flags);
// QAction *mAutoDownloadAction;
RsGxsChannelGroup mGroup;
bool mUseThread;

View File

@ -181,7 +181,7 @@
<item>
<widget class="QTabWidget" name="channel_TW">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab_3">
<attribute name="title">
@ -219,7 +219,27 @@
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="3">
<item row="4" column="1" colspan="2">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Distribution:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="infoPosts">
<property name="text">
<string notr="true">0</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="GxsIdLabel" name="infoAdministrator">
<property name="text">
<string>unknown</string>
@ -229,6 +249,20 @@
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="infoLastPost">
<property name="text">
<string notr="true">unknown</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QLabel" name="infoDistribution">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLabel" name="infoLastPostLabel">
<property name="sizePolicy">
@ -248,14 +282,7 @@
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QLabel" name="infoCreated">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<item row="3" column="1" colspan="2">
<widget class="QLabel" name="label">
<property name="font">
<font>
@ -268,53 +295,6 @@
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="infoLastPost">
<property name="text">
<string notr="true">unknown</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Distribution:</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Created:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="infoPosts">
<property name="text">
<string notr="true">0</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="infoDistribution">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLabel" name="infoPostsLabel">
<property name="sizePolicy">
@ -337,6 +317,46 @@
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QLabel" name="infoCreated">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Created:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="syncPeriodTitleLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Sync period:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="infoSyncTimeLabel">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
</layout>
</item>
<item>

View File

@ -383,7 +383,8 @@ void GxsForumThreadWidget::handleEvent_main_thread(std::shared_ptr<const RsEvent
case RsForumEventCode::NEW_FORUM: // [[fallthrough]];
case RsForumEventCode::UPDATED_MESSAGE: // [[fallthrough]];
case RsForumEventCode::NEW_MESSAGE:
if(e->mForumGroupId == mForumGroup.mMeta.mGroupId)
case RsForumEventCode::SYNC_PARAMETERS_UPDATED:
if(e->mForumGroupId == mForumGroup.mMeta.mGroupId)
updateDisplay(true);
break;
default: break;
@ -534,7 +535,8 @@ void GxsForumThreadWidget::updateDisplay(bool complete)
#ifdef DEBUG_FORUMS
std::cerr << " group_id=0. Return!"<< std::endl;
#endif
return;
ui->nextUnreadButton->setEnabled(false);
return;
}
if(mForumGroup.mMeta.mGroupId.isNull() && !groupId().isNull())
@ -984,7 +986,6 @@ void GxsForumThreadWidget::blankPost()
ui->newmessageButton->setEnabled(false);
ui->previousButton->setEnabled(false);
ui->nextButton->setEnabled(false);
ui->nextUnreadButton->setEnabled(false);
ui->downloadButton->setEnabled(false);
ui->lineLeft->hide();
ui->time_label->clear();
@ -1048,8 +1049,11 @@ void GxsForumThreadWidget::updateForumDescription(bool success)
else
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Last post")).arg(DateTime::formatLongDateTime(group.mMeta.mLastPost));
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Synchronization")).arg(getDurationString( rsGxsForums->getSyncPeriod(group.mMeta.mGroupId)/86400 )) ;
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Storage")).arg(getDurationString( rsGxsForums->getStoragePeriod(group.mMeta.mGroupId)/86400));
if(IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags))
{
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Synchronization")).arg(getDurationString( rsGxsForums->getSyncPeriod(group.mMeta.mGroupId)/86400 )) ;
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Storage")).arg(getDurationString( rsGxsForums->getStoragePeriod(group.mMeta.mGroupId)/86400));
}
QString distrib_string = tr("[unknown]");
switch(group.mMeta.mCircleType)
@ -1850,7 +1854,10 @@ void GxsForumThreadWidget::filterItems(const QString& text)
void GxsForumThreadWidget::postForumLoading()
{
if(groupId().isNull())
return;
{
ui->nextUnreadButton->setEnabled(false);
return;
}
#ifdef DEBUG_FORUMS
std::cerr << "Post forum loading..." << std::endl;
@ -1905,6 +1912,8 @@ void GxsForumThreadWidget::postForumLoading()
recursRestoreExpandedItems(mThreadProxyModel->mapFromSource(mThreadModel->root()),mSavedExpandedMessages);
//mUpdating = false;
ui->nextUnreadButton->setEnabled(true);
}
void GxsForumThreadWidget::updateGroupData()

View File

@ -9,6 +9,7 @@
<file>icons/svg/ratio-16-9.svg</file>
<file>icons/svg/randomness.svg</file>
<file>icons/svg/password.svg</file>
<file>icons/svg/display_options.svg</file>
<file>icons/svg/listlayout.svg</file>
<file>icons/svg/gridlayout.svg</file>
<file>icons/stars/star0.png</file>

View File

@ -0,0 +1,2 @@
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" version="1.1" width="512" height="512" x="0" y="0" viewBox="0 0 682.66669 682" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g transform="matrix(0.92,0,0,0.92,45.59999999999991,74.02656247615806)"><path xmlns="http://www.w3.org/2000/svg" d="m0 467.832031c0 24.160157 19.589844 43.75 43.75 43.75h552.5c24.160156 0 43.75-19.589843 43.75-43.75v-31.25h-640zm0 0" fill="#039bd5" data-original="#000000" style="" class=""/><path xmlns="http://www.w3.org/2000/svg" d="m443.210938 549.082031h-246.421876l-10.503906 26.941407c-2.253906 5.765624-1.511718 12.273437 1.988282 17.390624 3.488281 5.113282 9.285156 8.167969 15.476562 8.167969h232.5c6.195312 0 11.988281-3.054687 15.484375-8.167969 3.492187-5.117187 4.238281-11.625 1.984375-17.390624zm0 0" fill="#039bd5" data-original="#000000" style="" class=""/><path xmlns="http://www.w3.org/2000/svg" d="m322.5 117.863281c-.421875-.003906-.828125-.03125-1.25-.03125-44.800781 0-81.25 36.453125-81.25 81.25 0 44.800781 36.449219 81.25 81.25 81.25.421875 0 .828125-.023437 1.25-.027343 44.222656-.675782 80-36.835938 80-81.222657 0-44.382812-35.777344-80.546875-80-81.21875zm0 0" fill="#039bd5" data-original="#000000" style="" class=""/><path xmlns="http://www.w3.org/2000/svg" d="m596.25-.917969h-552.5c-24.160156 0-43.75 19.589844-43.75 43.75v356.25h640v-356.25c0-24.160156-19.589844-43.75-43.75-43.75zm-137.5 218.75h-20.234375c-4.691406 29.453125-20.253906 55.328125-42.425781 73.375l10.152344 17.578125c5.171874 8.96875 2.101562 20.433594-6.867188 25.617188-8.964844 5.175781-20.433594 2.101562-25.609375-6.867188l-10.125-17.527344c-12.800781 4.90625-26.664063 7.644532-41.136719 7.796876-.417968.003906-.832031.027343-1.25.027343-14.929687 0-29.21875-2.777343-42.390625-7.824219l-10.121093 17.527344c-5.179688 8.96875-16.640626 12.046875-25.613282 6.867188-8.96875-5.183594-12.039062-16.648438-6.863281-25.617188l10.148437-17.578125c-22.175781-18.046875-37.734374-43.921875-42.425781-73.375h-20.238281c-10.355469 0-18.75-8.390625-18.75-18.75 0-10.355469 8.394531-18.75 18.75-18.75h20.234375c4.691406-29.453125 20.253906-55.324219 42.425781-73.371093l-10.152344-17.578126c-5.171874-8.972656-2.101562-20.4375 6.867188-25.617187 2.949219-1.703125 6.175781-2.515625 9.355469-2.515625 6.484375 0 12.785156 3.367188 16.253906 9.382812l10.125 17.527344c13.171875-5.046875 27.464844-7.828125 42.390625-7.828125.421875 0 .828125.027344 1.25.03125 14.472656.152344 28.339844 2.890625 41.136719 7.796875l10.121093-17.527344c3.472657-6.015624 9.777344-9.382812 16.257813-9.382812 3.183594 0 6.40625.8125 9.359375 2.515625 8.964844 5.179687 12.039062 16.644531 6.859375 25.617187l-10.144531 17.578126c22.171875 18.046874 37.734375 43.917968 42.421875 73.371093h20.238281c10.355469 0 18.75 8.394531 18.75 18.75 0 10.359375-8.394531 18.75-18.75 18.75zm0 0" fill="#039bd5" data-original="#000000" style="" class=""/></g></svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -1427,7 +1427,7 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
break ;
default:
std::cerr << __PRETTY_FUNCTION__ << ": Unhandled desitnation type " << dtype << std::endl;
std::cerr << __PRETTY_FUNCTION__ << ": Unhandled destination type " << dtype << std::endl;
break ;
}
}

View File

@ -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->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()
@ -836,6 +860,8 @@ void MessagesDialog::changeBox(int box_row)
mMessageModel->setCurrentBox(RsMessageModel::BOX_NONE);
}
inChange = false;
updateMessageSummaryList();
}
void MessagesDialog::changeQuickView(int newrow)

View File

@ -23,6 +23,7 @@
#include <QSortFilterProxyModel>
#include <retroshare/rsevents.h>
#include <retroshare-gui/mainpage.h>
#include "ui_MessagesDialog.h"
@ -110,6 +111,8 @@ private slots:
void tabCloseRequested(int tab);
private:
void handleEvent(std::shared_ptr<const RsEvent> event);
void updateInterface();
void connectActions();
@ -157,6 +160,8 @@ private:
QList<QString> mTmpSavedSelectedIds;
QModelIndex lastSelectedIndex;
RsEventsHandlerId_t mEventHandlerId;
};
#endif

View File

@ -40,6 +40,8 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
ui.testFeedButton->hide(); // do not show in release
connect(ui.testFeedButton, SIGNAL(clicked()), this, SLOT(testFeed()));
connect(ui.testToasterButton, SIGNAL(clicked()), this, SLOT(testToaster()));
connect(ui.pushButtonDisableAll,SIGNAL(toggled(bool)), NotifyQt::getInstance(), SLOT(SetDisableAll(bool)));

View File

@ -18,7 +18,7 @@
</property>
<widget class="QWidget" name="tabFeed">
<attribute name="title">
<string>Feed</string>
<string>Log</string>
</attribute>
<layout class="QVBoxLayout" name="tabFeedVLayout">
<item>