mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-17 13:24:15 -05:00
Merged parallel improvements to ForumsDialog into ForumsV2Dialog.
* Also fixed load bug for empty forums & inserting the actual Post. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5345 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2159ab92f2
commit
d5520a1cd8
@ -40,7 +40,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 "util/HandleRichText.h"
|
#include "util/HandleRichText.h"
|
||||||
|
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
@ -62,7 +62,7 @@
|
|||||||
#define IMAGE_FOLDERGREEN ":/images/folder_green.png"
|
#define IMAGE_FOLDERGREEN ":/images/folder_green.png"
|
||||||
#define IMAGE_FOLDERRED ":/images/folder_red.png"
|
#define IMAGE_FOLDERRED ":/images/folder_red.png"
|
||||||
#define IMAGE_FOLDERYELLOW ":/images/folder_yellow.png"
|
#define IMAGE_FOLDERYELLOW ":/images/folder_yellow.png"
|
||||||
#define IMAGE_FORUM ":/images/konversation16.png"
|
#define IMAGE_FORUM ":/images/konversation.png"
|
||||||
#define IMAGE_SUBSCRIBE ":/images/edit_add24.png"
|
#define IMAGE_SUBSCRIBE ":/images/edit_add24.png"
|
||||||
#define IMAGE_UNSUBSCRIBE ":/images/cancel.png"
|
#define IMAGE_UNSUBSCRIBE ":/images/cancel.png"
|
||||||
#define IMAGE_INFO ":/images/info16.png"
|
#define IMAGE_INFO ":/images/info16.png"
|
||||||
@ -136,6 +136,7 @@ ForumsV2Dialog::ForumsV2Dialog(QWidget *parent)
|
|||||||
|
|
||||||
m_bProcessSettings = false;
|
m_bProcessSettings = false;
|
||||||
subscribeFlags = 0;
|
subscribeFlags = 0;
|
||||||
|
inMsgAsReadUnread = false;
|
||||||
|
|
||||||
|
|
||||||
/* Setup Queue */
|
/* Setup Queue */
|
||||||
@ -163,10 +164,11 @@ ForumsV2Dialog::ForumsV2Dialog(QWidget *parent)
|
|||||||
|
|
||||||
connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(downloadAllFiles()));
|
connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(downloadAllFiles()));
|
||||||
|
|
||||||
connect(ui.clearButton, SIGNAL(clicked()), this, SLOT(clearFilter()));
|
connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString)));
|
||||||
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
|
||||||
@ -204,8 +206,6 @@ ForumsV2Dialog::ForumsV2Dialog(QWidget *parent)
|
|||||||
|
|
||||||
lastViewType = -1;
|
lastViewType = -1;
|
||||||
|
|
||||||
ui.clearButton->hide();
|
|
||||||
|
|
||||||
// load settings
|
// load settings
|
||||||
processSettings(true);
|
processSettings(true);
|
||||||
|
|
||||||
@ -214,7 +214,6 @@ ForumsV2Dialog::ForumsV2Dialog(QWidget *parent)
|
|||||||
ttheader->setResizeMode (COLUMN_THREAD_READ, QHeaderView::Fixed);
|
ttheader->setResizeMode (COLUMN_THREAD_READ, QHeaderView::Fixed);
|
||||||
ttheader->hideSection (COLUMN_THREAD_CONTENT);
|
ttheader->hideSection (COLUMN_THREAD_CONTENT);
|
||||||
|
|
||||||
ui.progressBar->setTextVisible(true);
|
|
||||||
ui.progressBar->hide();
|
ui.progressBar->hide();
|
||||||
ui.progLayOutTxt->hide();
|
ui.progLayOutTxt->hide();
|
||||||
ui.progressBarLayOut->setEnabled(false);
|
ui.progressBarLayOut->setEnabled(false);
|
||||||
@ -506,15 +505,15 @@ void ForumsV2Dialog::updateDisplay()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CleanupItems (QList<QTreeWidgetItem *> &Items)
|
static void CleanupItems (QList<QTreeWidgetItem *> &items)
|
||||||
{
|
{
|
||||||
QList<QTreeWidgetItem *>::iterator Item;
|
QList<QTreeWidgetItem *>::iterator item;
|
||||||
for (Item = Items.begin (); Item != Items.end (); Item++) {
|
for (item = items.begin (); item != items.end (); item++) {
|
||||||
if (*Item) {
|
if (*item) {
|
||||||
delete (*Item);
|
delete (*item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Items.clear();
|
items.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ForumsV2Dialog::forumInfoToGroupItemInfo(const RsGroupMetaData &forumInfo, GroupItemInfo &groupItemInfo)
|
void ForumsV2Dialog::forumInfoToGroupItemInfo(const RsGroupMetaData &forumInfo, GroupItemInfo &groupItemInfo)
|
||||||
@ -653,6 +652,35 @@ void ForumsV2Dialog::clickedThread (QTreeWidgetItem *item, int column)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ForumsV2Dialog::forumMsgReadStatusChanged(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 ForumsV2Dialog::CalculateIconsAndFonts(QTreeWidgetItem *pItem, bool &bHasReadChilddren, bool &bHasUnreadChilddren)
|
void ForumsV2Dialog::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();
|
||||||
@ -755,6 +783,8 @@ void ForumsV2Dialog::fillThreadFinished()
|
|||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
std::cerr << "ForumsV2Dialog::fillThreadFinished Add messages" << std::endl;
|
std::cerr << "ForumsV2Dialog::fillThreadFinished Add messages" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
ui.threadTreeWidget->setSortingEnabled(false);
|
||||||
|
|
||||||
/* add all messages in! */
|
/* add all messages in! */
|
||||||
if (lastViewType != mThreadLoad.ViewType || lastForumID != mCurrForumId)
|
if (lastViewType != mThreadLoad.ViewType || lastForumID != mCurrForumId)
|
||||||
{
|
{
|
||||||
@ -774,8 +804,8 @@ void ForumsV2Dialog::fillThreadFinished()
|
|||||||
CleanupItems (mThreadLoad.Items);
|
CleanupItems (mThreadLoad.Items);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui.threadTreeWidget->setSortingEnabled(true);
|
||||||
|
|
||||||
if (mThreadLoad.FocusMsgId.empty() == false)
|
if (mThreadLoad.FocusMsgId.empty() == false)
|
||||||
{
|
{
|
||||||
/* Search exisiting item */
|
/* Search exisiting item */
|
||||||
@ -804,9 +834,8 @@ void ForumsV2Dialog::fillThreadFinished()
|
|||||||
}
|
}
|
||||||
mThreadLoad.ItemToExpand.clear();
|
mThreadLoad.ItemToExpand.clear();
|
||||||
|
|
||||||
if (ui.filterPatternLineEdit->text().isEmpty() == false)
|
if (ui.filterLineEdit->text().isEmpty() == false) {
|
||||||
{
|
filterItems(ui.filterLineEdit->text());
|
||||||
FilterItems();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
insertPost ();
|
insertPost ();
|
||||||
@ -875,6 +904,7 @@ void ForumsV2Dialog::insertForumThreads(const RsGroupMetaData &fi)
|
|||||||
ui.progressBarLayOut->setEnabled(true);
|
ui.progressBarLayOut->setEnabled(true);
|
||||||
|
|
||||||
ui.progLayOutTxt->show();
|
ui.progLayOutTxt->show();
|
||||||
|
ui.progressBar->reset();
|
||||||
ui.progressBar->show();
|
ui.progressBar->show();
|
||||||
|
|
||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
@ -1045,6 +1075,25 @@ void ForumsV2Dialog::FillChildren(QTreeWidgetItem *Parent, QTreeWidgetItem *NewP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ForumsV2Dialog::titleFromInfo(const RsMsgMetaData &meta)
|
||||||
|
{
|
||||||
|
// NOTE - NOTE SURE HOW THIS WILL WORK!
|
||||||
|
if (meta.mMsgStatus & RS_DISTRIB_MISSING_MSG) {
|
||||||
|
return QApplication::translate("ForumsV2Dialog", "[ ... Missing Message ... ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString::fromUtf8(meta.mMsgName.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ForumsV2Dialog::messageFromInfo(const RsForumV2Msg &msg)
|
||||||
|
{
|
||||||
|
if (msg.mMeta.mMsgStatus & RS_DISTRIB_MISSING_MSG) {
|
||||||
|
return QApplication::translate("ForumsV2Dialog", "Placeholder for missing Message");
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString::fromUtf8(msg.mMsg.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
void ForumsV2Dialog::insertPost()
|
void ForumsV2Dialog::insertPost()
|
||||||
{
|
{
|
||||||
if ((mCurrForumId == "") || (mCurrThreadId == ""))
|
if ((mCurrForumId == "") || (mCurrThreadId == ""))
|
||||||
@ -1123,17 +1172,10 @@ void ForumsV2Dialog::insertPostData(const RsForumV2Msg &msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString extraTxt = RsHtml().formatText(ui.postText->document(), messageFromInfo(msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS);
|
||||||
#warning "THIS CODE TO BE FIXED"
|
|
||||||
QString extraTxt("");
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
QString info("");
|
|
||||||
QString extraTxt = RsHtml().formatText(QString::fromUtf8(msg.mMsg.c_str()), info, RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ui.postText->setHtml(extraTxt);
|
ui.postText->setHtml(extraTxt);
|
||||||
ui.threadTitle->setText(QString::fromUtf8(msg.mMeta.mMsgName.c_str()));
|
ui.threadTitle->setText(titleFromInfo(msg.mMeta));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1252,6 +1294,8 @@ void ForumsV2Dialog::setMsgAsReadUnread(QList<QTreeWidgetItem*> &Rows, bool bRea
|
|||||||
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 */
|
||||||
@ -1285,6 +1329,8 @@ void ForumsV2Dialog::setMsgAsReadUnread(QList<QTreeWidgetItem*> &Rows, bool bRea
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
@ -1530,6 +1576,27 @@ void ForumsV2Dialog::editForumDetails()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString buildReplyHeader(const RsMsgMetaData &meta)
|
||||||
|
{
|
||||||
|
RetroShareLink link;
|
||||||
|
link.createMessage(meta.mAuthorId, "");
|
||||||
|
QString from = link.toHtml();
|
||||||
|
|
||||||
|
QDateTime qtime;
|
||||||
|
qtime.setTime_t(meta.mPublishTs);
|
||||||
|
|
||||||
|
QString header = QString("<span>-----%1-----").arg(QApplication::translate("ForumsV2Dialog", "Original Message"));
|
||||||
|
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(QApplication::translate("ForumsV2Dialog", "From"), from);
|
||||||
|
|
||||||
|
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(QApplication::translate("ForumsV2Dialog", "Sent"), qtime.toString(Qt::SystemLocaleLongDate));
|
||||||
|
header += QString("<font size='3'><strong>%1: </strong>%2</font></span><br>").arg(QApplication::translate("ForumsV2Dialog", "Subject"), QString::fromUtf8(meta.mMsgName.c_str()));
|
||||||
|
header += "<br>";
|
||||||
|
|
||||||
|
header += QApplication::translate("ForumsV2Dialog", "On %1, %2 wrote:").arg(qtime.toString(Qt::SystemLocaleShortDate), from);
|
||||||
|
|
||||||
|
return header;
|
||||||
|
}
|
||||||
|
|
||||||
void ForumsV2Dialog::replytomessage()
|
void ForumsV2Dialog::replytomessage()
|
||||||
{
|
{
|
||||||
if (mCurrForumId.empty() || mCurrThreadId.empty()) {
|
if (mCurrForumId.empty() || mCurrThreadId.empty()) {
|
||||||
@ -1554,18 +1621,10 @@ void ForumsV2Dialog::replyMessageData(const RsForumV2Msg &msg)
|
|||||||
if (rsPeers->getPeerName(msg.mMeta.mAuthorId) !="")
|
if (rsPeers->getPeerName(msg.mMeta.mAuthorId) !="")
|
||||||
{
|
{
|
||||||
MessageComposer *nMsgDialog = MessageComposer::newMsg();
|
MessageComposer *nMsgDialog = MessageComposer::newMsg();
|
||||||
#warning "THIS CODE TO BE FIXED"
|
nMsgDialog->setTitleText(QString::fromUtf8(msg.mMeta.mMsgName.c_str()), MessageComposer::REPLY);
|
||||||
#if 0
|
|
||||||
nMsgDialog->insertTitleText(QString::fromUtf8(msg.mMeta.mMsgName.c_str()), MessageComposer::REPLY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QTextDocument doc ;
|
nMsgDialog->setQuotedMsg(QString::fromUtf8(msg.mMsg.c_str()), buildReplyHeader(msg.mMeta));
|
||||||
doc.setHtml(QString::fromUtf8(msg.mMsg.c_str())) ;
|
|
||||||
|
|
||||||
#warning "THIS CODE TO BE FIXED"
|
|
||||||
#if 0
|
|
||||||
nMsgDialog->insertPastedText(doc.toPlainText());
|
|
||||||
#endif
|
|
||||||
nMsgDialog->addRecipient(MessageComposer::TO, msg.mMeta.mAuthorId, false);
|
nMsgDialog->addRecipient(MessageComposer::TO, msg.mMeta.mAuthorId, false);
|
||||||
nMsgDialog->show();
|
nMsgDialog->show();
|
||||||
nMsgDialog->activateWindow();
|
nMsgDialog->activateWindow();
|
||||||
@ -1578,29 +1637,6 @@ void ForumsV2Dialog::replyMessageData(const RsForumV2Msg &msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ForumsV2Dialog::filterRegExpChanged()
|
|
||||||
{
|
|
||||||
// QRegExp regExp(ui.filterPatternLineEdit->text(), Qt::CaseInsensitive , QRegExp::FixedString);
|
|
||||||
// proxyModel->setFilterRegExp(regExp);
|
|
||||||
|
|
||||||
QString text = ui.filterPatternLineEdit->text();
|
|
||||||
|
|
||||||
if (text.isEmpty()) {
|
|
||||||
ui.clearButton->hide();
|
|
||||||
} else {
|
|
||||||
ui.clearButton->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
FilterItems();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* clear Filter */
|
|
||||||
void ForumsV2Dialog::clearFilter()
|
|
||||||
{
|
|
||||||
ui.filterPatternLineEdit->clear();
|
|
||||||
ui.filterPatternLineEdit->setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ForumsV2Dialog::changedViewBox()
|
void ForumsV2Dialog::changedViewBox()
|
||||||
{
|
{
|
||||||
if (m_bProcessSettings) {
|
if (m_bProcessSettings) {
|
||||||
@ -1624,21 +1660,20 @@ void ForumsV2Dialog::filterColumnChanged()
|
|||||||
// need content ... refill
|
// need content ... refill
|
||||||
insertThreads();
|
insertThreads();
|
||||||
} else {
|
} else {
|
||||||
FilterItems();
|
filterItems(ui.filterLineEdit->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
// save index
|
// save index
|
||||||
Settings->setValueToGroup("ForumsV2Dialog", "filterColumn", filterColumn);
|
Settings->setValueToGroup("ForumsV2Dialog", "filterColumn", filterColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ForumsV2Dialog::FilterItems()
|
void ForumsV2Dialog::filterItems(const QString& text)
|
||||||
{
|
{
|
||||||
QString sPattern = ui.filterPatternLineEdit->text();
|
|
||||||
int filterColumn = FilterColumnFromComboBox(ui.filterColumnComboBox->currentIndex());
|
int filterColumn = FilterColumnFromComboBox(ui.filterColumnComboBox->currentIndex());
|
||||||
|
|
||||||
int nCount = ui.threadTreeWidget->topLevelItemCount ();
|
int nCount = ui.threadTreeWidget->topLevelItemCount ();
|
||||||
for (int nIndex = 0; nIndex < nCount; nIndex++) {
|
for (int nIndex = 0; nIndex < nCount; nIndex++) {
|
||||||
FilterItem(ui.threadTreeWidget->topLevelItem(nIndex), sPattern, filterColumn);
|
filterItem(ui.threadTreeWidget->topLevelItem(nIndex), text, filterColumn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1648,12 +1683,12 @@ void ForumsV2Dialog::shareKey()
|
|||||||
shareUi.exec();
|
shareUi.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ForumsV2Dialog::FilterItem(QTreeWidgetItem *pItem, QString &sPattern, int filterColumn)
|
bool ForumsV2Dialog::filterItem(QTreeWidgetItem *pItem, const QString &text, int filterColumn)
|
||||||
{
|
{
|
||||||
bool bVisible = true;
|
bool bVisible = true;
|
||||||
|
|
||||||
if (sPattern.isEmpty() == false) {
|
if (text.isEmpty() == false) {
|
||||||
if (pItem->text(filterColumn).contains(sPattern, Qt::CaseInsensitive) == false) {
|
if (pItem->text(filterColumn).contains(text, Qt::CaseInsensitive) == false) {
|
||||||
bVisible = false;
|
bVisible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1661,7 +1696,7 @@ bool ForumsV2Dialog::FilterItem(QTreeWidgetItem *pItem, QString &sPattern, int f
|
|||||||
int nVisibleChildCount = 0;
|
int nVisibleChildCount = 0;
|
||||||
int nCount = pItem->childCount();
|
int nCount = pItem->childCount();
|
||||||
for (int nIndex = 0; nIndex < nCount; nIndex++) {
|
for (int nIndex = 0; nIndex < nCount; nIndex++) {
|
||||||
if (FilterItem(pItem->child(nIndex), sPattern, filterColumn)) {
|
if (filterItem(pItem->child(nIndex), text, filterColumn)) {
|
||||||
nVisibleChildCount++;
|
nVisibleChildCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1976,6 +2011,7 @@ void ForumsV2Dialog::loadGroupThreadData_InsertThreads(const uint32_t &token)
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
bool moreData = true;
|
bool moreData = true;
|
||||||
|
bool someData = false;
|
||||||
while(moreData)
|
while(moreData)
|
||||||
{
|
{
|
||||||
RsForumV2Msg msg;
|
RsForumV2Msg msg;
|
||||||
@ -1985,12 +2021,19 @@ void ForumsV2Dialog::loadGroupThreadData_InsertThreads(const uint32_t &token)
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
loadForumBaseThread(msg);
|
loadForumBaseThread(msg);
|
||||||
|
someData = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
moreData = false;
|
moreData = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* completed with no data */
|
||||||
|
if (!someData)
|
||||||
|
{
|
||||||
|
fillThreadFinished();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ForumsV2Dialog::convertMsgToThreadWidget(const RsForumV2Msg &msgInfo, std::string authorName,
|
bool ForumsV2Dialog::convertMsgToThreadWidget(const RsForumV2Msg &msgInfo, std::string authorName,
|
||||||
@ -2017,9 +2060,10 @@ bool ForumsV2Dialog::convertMsgToThreadWidget(const RsForumV2Msg &msgInfo, std::
|
|||||||
item->setText(COLUMN_THREAD_DATE, text);
|
item->setText(COLUMN_THREAD_DATE, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
item->setText(COLUMN_THREAD_TITLE, QString::fromUtf8(msgInfo.mMeta.mMsgName.c_str()));
|
item->setText(COLUMN_THREAD_TITLE, ForumsV2Dialog::titleFromInfo(msgInfo.mMeta));
|
||||||
|
|
||||||
text = QString::fromUtf8(authorName.c_str());
|
text = QString::fromUtf8(authorName.c_str());
|
||||||
|
|
||||||
if (text.isEmpty())
|
if (text.isEmpty())
|
||||||
{
|
{
|
||||||
item->setText(COLUMN_THREAD_AUTHOR, tr("Anonymous"));
|
item->setText(COLUMN_THREAD_AUTHOR, tr("Anonymous"));
|
||||||
@ -2154,7 +2198,6 @@ void ForumsV2Dialog::loadChildData_InsertThreads(const uint32_t &token)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ForumsV2Dialog::loadForumChildMsg(const RsForumV2Msg &msg, QTreeWidgetItem *parent)
|
void ForumsV2Dialog::loadForumChildMsg(const RsForumV2Msg &msg, QTreeWidgetItem *parent)
|
||||||
{
|
{
|
||||||
std::string authorName = rsPeers->getPeerName(msg.mMeta.mAuthorId);
|
std::string authorName = rsPeers->getPeerName(msg.mMeta.mAuthorId);
|
||||||
@ -2217,7 +2260,7 @@ void ForumsV2Dialog::requestMsgData_InsertPost(const std::string &msgId)
|
|||||||
|
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mForumQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, FORUMV2DIALOG_INSERT_POST);
|
mForumQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, FORUMV2DIALOG_INSERT_POST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,8 +130,8 @@ private slots:
|
|||||||
void changedViewBox();
|
void changedViewBox();
|
||||||
|
|
||||||
void filterColumnChanged();
|
void filterColumnChanged();
|
||||||
void filterRegExpChanged();
|
//void filterRegExpChanged();
|
||||||
void clearFilter();
|
///void clearFilter();
|
||||||
|
|
||||||
void generateMassData();
|
void generateMassData();
|
||||||
|
|
||||||
@ -146,6 +146,12 @@ private:
|
|||||||
void insertPost();
|
void insertPost();
|
||||||
void insertPostData(const RsForumV2Msg &msg); // Second Half.
|
void insertPostData(const RsForumV2Msg &msg); // Second Half.
|
||||||
|
|
||||||
|
// Utility Fns.
|
||||||
|
QString titleFromInfo(const RsMsgMetaData &meta);
|
||||||
|
QString messageFromInfo(const RsForumV2Msg &msg);
|
||||||
|
|
||||||
|
void forumMsgReadStatusChanged(const QString &forumId, const QString &msgId, int status);
|
||||||
|
|
||||||
void updateMessageSummaryList(std::string forumId);
|
void updateMessageSummaryList(std::string forumId);
|
||||||
//void forumInfoToGroupItemInfo(const ForumInfo &forumInfo, GroupItemInfo &groupItemInfo);
|
//void forumInfoToGroupItemInfo(const ForumInfo &forumInfo, GroupItemInfo &groupItemInfo);
|
||||||
void forumInfoToGroupItemInfo(const RsGroupMetaData &forumInfo, GroupItemInfo &groupItemInfo);
|
void forumInfoToGroupItemInfo(const RsGroupMetaData &forumInfo, GroupItemInfo &groupItemInfo);
|
||||||
@ -163,9 +169,8 @@ private:
|
|||||||
void processSettings(bool bLoad);
|
void processSettings(bool bLoad);
|
||||||
void togglethreadview_internal();
|
void togglethreadview_internal();
|
||||||
|
|
||||||
void FilterItems();
|
void filterItems(const QString& text);
|
||||||
bool FilterItem(QTreeWidgetItem *pItem, QString &sPattern, int filterColumn);
|
bool filterItem(QTreeWidgetItem *pItem, const QString &text, int filterColumn);
|
||||||
|
|
||||||
|
|
||||||
// New Request/Response Loading Functions.
|
// New Request/Response Loading Functions.
|
||||||
void insertForumsData(const std::list<RsGroupMetaData> &forumList);
|
void insertForumsData(const std::list<RsGroupMetaData> &forumList);
|
||||||
@ -215,6 +220,7 @@ private:
|
|||||||
int lastViewType;
|
int lastViewType;
|
||||||
std::string lastForumID;
|
std::string lastForumID;
|
||||||
|
|
||||||
|
bool inMsgAsReadUnread;
|
||||||
//ForumsV2FillThread *fillThread;
|
//ForumsV2FillThread *fillThread;
|
||||||
|
|
||||||
// New Datatypes to replace the FillThread.
|
// New Datatypes to replace the FillThread.
|
||||||
|
@ -1051,58 +1051,9 @@ border: 1px solid #CCCCCC;}</string>
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="filterPatternLineEdit">
|
<widget class="LineEditClear" name="filterLineEdit">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string>Search forums</string>
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
|
||||||
p, li { white-space: pre-wrap; }
|
|
||||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Search forums</span></p></body></html></string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="clearButton">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>16</width>
|
|
||||||
<height>16</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16</width>
|
|
||||||
<height>16</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>MS Shell Dlg 2</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Reset</string>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QPushButton
|
|
||||||
{
|
|
||||||
border-image: url(:/images/closenormal.png)
|
|
||||||
}
|
|
||||||
|
|
||||||
QPushButton:hover
|
|
||||||
{
|
|
||||||
border-image: url(:/images/closehover.png)
|
|
||||||
}
|
|
||||||
|
|
||||||
QPushButton:pressed {
|
|
||||||
border-image: url(:/images/closepressed.png)
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -1241,16 +1192,13 @@ border-image: url(:/images/closepressed.png)
|
|||||||
<property name="value">
|
<property name="value">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="textVisible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QTextBrowser" name="postText">
|
<widget class="LinkTextBrowser" name="postText">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -1262,12 +1210,6 @@ border-image: url(:/images/closepressed.png)
|
|||||||
<pointsize>9</pointsize>
|
<pointsize>9</pointsize>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="openExternalLinks">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="openLinks">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
@ -1291,6 +1233,16 @@ border-image: url(:/images/closepressed.png)
|
|||||||
<header>gui/common/GroupTreeWidget.h</header>
|
<header>gui/common/GroupTreeWidget.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>LineEditClear</class>
|
||||||
|
<extends>QLineEdit</extends>
|
||||||
|
<header>gui/common/LineEditClear.h</header>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>LinkTextBrowser</class>
|
||||||
|
<extends>QTextBrowser</extends>
|
||||||
|
<header>gui/common/LinkTextBrowser.h</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="images.qrc"/>
|
<include location="images.qrc"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user