Fixed count of new and unread messages for Channels and Posted.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7561 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2014-09-24 23:57:47 +00:00
parent 3a0e944ecf
commit 37ddbf63cc
8 changed files with 65 additions and 24 deletions

View file

@ -74,6 +74,7 @@ GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *p
ui->setupUi(this);
mInitialized = false;
mCountChildMsgs = false;
mYourGroups = NULL;
mSubscribedGroups = NULL;
mPopularGroups = NULL;
@ -897,7 +898,7 @@ void GxsGroupFrameDialog::loadGroupStatistics(const uint32_t &token)
return;
}
ui->groupTreeWidget->setUnreadCount(item, stats.mNumMsgsUnread);
ui->groupTreeWidget->setUnreadCount(item, mCountChildMsgs ? (stats.mNumThreadMsgsUnread + stats.mNumChildMsgsUnread) : stats.mNumThreadMsgsUnread);
}
/*********************** **** **** **** ***********************/

View file

@ -169,6 +169,9 @@ private:
// void requestGroupSummary_CurrentGroup(const RsGxsGroupId &groupId);
// void loadGroupSummary_CurrentGroup(const uint32_t &token);
protected:
bool mCountChildMsgs; // Count unread child messages?
private:
bool mInitialized;
QString mSettingsName;

View file

@ -29,7 +29,9 @@
GxsUserNotify::GxsUserNotify(RsGxsIfaceHelper *ifaceImpl, QObject *parent) :
UserNotify(parent), TokenResponse()
{
mNewMessageCount = 0;
mNewThreadMessageCount = 0;
mNewChildMessageCount = 0;
mCountChildMsgs = false;
mInterface = ifaceImpl;
mTokenService = mInterface->getTokenService();
@ -51,7 +53,8 @@ GxsUserNotify::~GxsUserNotify()
void GxsUserNotify::startUpdate()
{
mNewMessageCount = 0;
mNewThreadMessageCount = 0;
mNewChildMessageCount = 0;
uint32_t token;
mTokenService->requestServiceStatistic(token);
@ -68,7 +71,8 @@ void GxsUserNotify::loadRequest(const TokenQueue *queue, const TokenRequest &req
GxsServiceStatistic stats;
mInterface->getServiceStatistic(req.mToken, stats);
mNewMessageCount = stats.mNumMsgsNew;
mNewThreadMessageCount = stats.mNumThreadMsgsNew;
mNewChildMessageCount = stats.mNumChildMsgsNew;
update();
}

View file

@ -44,14 +44,18 @@ protected:
virtual void startUpdate();
private:
virtual unsigned int getNewCount() { return mNewMessageCount; }
virtual unsigned int getNewCount() { return mCountChildMsgs ? (mNewThreadMessageCount + mNewChildMessageCount) : mNewThreadMessageCount; }
protected:
bool mCountChildMsgs; // Count new child messages?
private:
RsGxsIfaceHelper *mInterface;
RsTokenService *mTokenService;
TokenQueue *mTokenQueue;
RsGxsUpdateBroadcastBase *mBase;
unsigned int mNewMessageCount;
unsigned int mNewThreadMessageCount;
unsigned int mNewChildMessageCount;
};
#endif // GXSUSERNOTIFY_H

View file

@ -25,6 +25,7 @@
GxsForumUserNotify::GxsForumUserNotify(RsGxsIfaceHelper *ifaceImpl, QObject *parent) :
GxsUserNotify(ifaceImpl, parent)
{
mCountChildMsgs = true;
}
bool GxsForumUserNotify::hasSetting(QString *name, QString *group)

View file

@ -30,6 +30,7 @@
GxsForumsDialog::GxsForumsDialog(QWidget *parent)
: GxsGroupFrameDialog(rsGxsForums, parent)
{
mCountChildMsgs = true;
}
GxsForumsDialog::~GxsForumsDialog()