mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-07 06:02:41 -04:00
Fixed update of the forum message state and the summary in ForumsDialog when the message is read in the news feed.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5015 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
fedba02d18
commit
c918ac84af
3 changed files with 42 additions and 1 deletions
|
@ -38,6 +38,7 @@
|
||||||
#include "common/PopularityDefs.h"
|
#include "common/PopularityDefs.h"
|
||||||
#include "RetroShareLink.h"
|
#include "RetroShareLink.h"
|
||||||
#include "channels/ShareKey.h"
|
#include "channels/ShareKey.h"
|
||||||
|
#include "notifyqt.h"
|
||||||
|
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include <retroshare/rsforums.h>
|
#include <retroshare/rsforums.h>
|
||||||
|
@ -135,6 +136,7 @@ ForumsDialog::ForumsDialog(QWidget *parent)
|
||||||
|
|
||||||
m_bProcessSettings = false;
|
m_bProcessSettings = false;
|
||||||
subscribeFlags = 0;
|
subscribeFlags = 0;
|
||||||
|
inMsgAsReadUnread = false;
|
||||||
|
|
||||||
connect( ui.forumTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( forumListCustomPopupMenu( QPoint ) ) );
|
connect( ui.forumTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( forumListCustomPopupMenu( QPoint ) ) );
|
||||||
connect( ui.threadTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( threadListCustomPopupMenu( QPoint ) ) );
|
connect( ui.threadTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( threadListCustomPopupMenu( QPoint ) ) );
|
||||||
|
@ -160,6 +162,8 @@ ForumsDialog::ForumsDialog(QWidget *parent)
|
||||||
connect(ui.filterPatternLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterRegExpChanged()));
|
connect(ui.filterPatternLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterRegExpChanged()));
|
||||||
connect(ui.filterColumnComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(filterColumnChanged()));
|
connect(ui.filterColumnComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(filterColumnChanged()));
|
||||||
|
|
||||||
|
connect(NotifyQt::getInstance(), SIGNAL(forumMsgReadSatusChanged(QString,QString,int)), this, SLOT(forumMsgReadSatusChanged(QString,QString,int)));
|
||||||
|
|
||||||
/* Set initial size the splitter */
|
/* Set initial size the splitter */
|
||||||
QList<int> sizes;
|
QList<int> sizes;
|
||||||
sizes << 300 << width(); // Qt calculates the right sizes
|
sizes << 300 << width(); // Qt calculates the right sizes
|
||||||
|
@ -631,6 +635,35 @@ void ForumsDialog::clickedThread (QTreeWidgetItem *item, int column)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ForumsDialog::forumMsgReadSatusChanged(const QString &forumId, const QString &msgId, int status)
|
||||||
|
{
|
||||||
|
if (inMsgAsReadUnread) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (forumId.toStdString() == mCurrForumId) {
|
||||||
|
/* Search exisiting item */
|
||||||
|
QTreeWidgetItemIterator itemIterator(ui.threadTreeWidget);
|
||||||
|
QTreeWidgetItem *item = NULL;
|
||||||
|
while ((item = *itemIterator) != NULL) {
|
||||||
|
itemIterator++;
|
||||||
|
|
||||||
|
if (item->data(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID).toString() == msgId) {
|
||||||
|
// update status
|
||||||
|
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS, status);
|
||||||
|
|
||||||
|
QTreeWidgetItem *parentItem = item;
|
||||||
|
while (parentItem->parent()) {
|
||||||
|
parentItem = parentItem->parent();
|
||||||
|
}
|
||||||
|
CalculateIconsAndFonts(parentItem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateMessageSummaryList(forumId.toStdString());
|
||||||
|
}
|
||||||
|
|
||||||
void ForumsDialog::CalculateIconsAndFonts(QTreeWidgetItem *pItem, bool &bHasReadChilddren, bool &bHasUnreadChilddren)
|
void ForumsDialog::CalculateIconsAndFonts(QTreeWidgetItem *pItem, bool &bHasReadChilddren, bool &bHasUnreadChilddren)
|
||||||
{
|
{
|
||||||
uint32_t status = pItem->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
uint32_t status = pItem->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
||||||
|
@ -1260,6 +1293,8 @@ void ForumsDialog::setMsgAsReadUnread(QList<QTreeWidgetItem*> &Rows, bool bRead)
|
||||||
QList<QTreeWidgetItem*>::iterator Row;
|
QList<QTreeWidgetItem*>::iterator Row;
|
||||||
std::list<QTreeWidgetItem*> changedItems;
|
std::list<QTreeWidgetItem*> changedItems;
|
||||||
|
|
||||||
|
inMsgAsReadUnread = true;
|
||||||
|
|
||||||
for (Row = Rows.begin(); Row != Rows.end(); Row++) {
|
for (Row = Rows.begin(); Row != Rows.end(); Row++) {
|
||||||
if ((*Row)->data(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING).toBool()) {
|
if ((*Row)->data(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING).toBool()) {
|
||||||
/* Missing message */
|
/* Missing message */
|
||||||
|
@ -1293,6 +1328,8 @@ void ForumsDialog::setMsgAsReadUnread(QList<QTreeWidgetItem*> &Rows, bool bRead)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inMsgAsReadUnread = false;
|
||||||
|
|
||||||
if (changedItems.size()) {
|
if (changedItems.size()) {
|
||||||
for (std::list<QTreeWidgetItem*>::iterator it = changedItems.begin(); it != changedItems.end(); it++) {
|
for (std::list<QTreeWidgetItem*>::iterator it = changedItems.begin(); it != changedItems.end(); it++) {
|
||||||
CalculateIconsAndFonts(*it);
|
CalculateIconsAndFonts(*it);
|
||||||
|
|
|
@ -61,6 +61,7 @@ private slots:
|
||||||
void changedForum(const QString &id);
|
void changedForum(const QString &id);
|
||||||
void changedThread();
|
void changedThread();
|
||||||
void clickedThread (QTreeWidgetItem *item, int column);
|
void clickedThread (QTreeWidgetItem *item, int column);
|
||||||
|
void forumMsgReadSatusChanged(const QString &forumId, const QString &msgId, int status);
|
||||||
|
|
||||||
void replytomessage();
|
void replytomessage();
|
||||||
//void print();
|
//void print();
|
||||||
|
@ -130,6 +131,7 @@ private:
|
||||||
bool FilterItem(QTreeWidgetItem *pItem, QString &sPattern, int filterColumn);
|
bool FilterItem(QTreeWidgetItem *pItem, QString &sPattern, int filterColumn);
|
||||||
|
|
||||||
bool m_bProcessSettings;
|
bool m_bProcessSettings;
|
||||||
|
bool inMsgAsReadUnread;
|
||||||
|
|
||||||
QTreeWidgetItem *yourForums;
|
QTreeWidgetItem *yourForums;
|
||||||
QTreeWidgetItem *subscribedForums;
|
QTreeWidgetItem *subscribedForums;
|
||||||
|
|
|
@ -127,7 +127,9 @@ MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WFlags flags)
|
||||||
processSettings("MessageWidget", true);
|
processSettings("MessageWidget", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hide platform specific features */
|
ui.dateText-> setText("");
|
||||||
|
|
||||||
|
/* Hide platform specific features */
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue