From 6d3252483703edcd2e86ad0749415de26991494f Mon Sep 17 00:00:00 2001 From: thunder2 Date: Sun, 30 Nov 2014 22:56:50 +0000 Subject: [PATCH] Rolled back commit 7720 and fixed forum search by content issue introduced in revision 7716. Fixed load/save of filter type in settings. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7722 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- .../src/gui/gxsforums/GxsForumThreadWidget.cpp | 16 ++++++---------- .../src/gui/gxsforums/GxsForumThreadWidget.h | 2 +- .../src/gui/gxsforums/GxsForumsFillThread.cpp | 12 ++---------- .../src/gui/gxsforums/GxsForumsFillThread.h | 1 - 4 files changed, 9 insertions(+), 22 deletions(-) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 209843122..b13c0c275 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -62,13 +62,13 @@ #define VIEW_FLAT 2 /* Thread constants */ +#define COLUMN_THREAD_COUNT 6 #define COLUMN_THREAD_TITLE 0 #define COLUMN_THREAD_READ 1 #define COLUMN_THREAD_DATE 2 #define COLUMN_THREAD_AUTHOR 3 #define COLUMN_THREAD_SIGNED 4 #define COLUMN_THREAD_CONTENT 5 -#define COLUMN_THREAD_COUNT 6 #define COLUMN_THREAD_DATA 0 // column for storing the userdata like msgid and parentid @@ -174,7 +174,8 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget ui->filterLineEdit->addFilter(QIcon(), tr("Date"), COLUMN_THREAD_DATE, tr("Search Date")); ui->filterLineEdit->addFilter(QIcon(), tr("Author"), COLUMN_THREAD_AUTHOR, tr("Search Author")); ui->filterLineEdit->addFilter(QIcon(), tr("Content"), COLUMN_THREAD_CONTENT, tr("Search Content")); - ui->filterLineEdit->setCurrentFilter(COLUMN_THREAD_TITLE); + // see processSettings + //ui->filterLineEdit->setCurrentFilter(COLUMN_THREAD_TITLE); mLastViewType = -1; @@ -815,7 +816,7 @@ void GxsForumThreadWidget::fillThreadStatus(QString text) ui->progressText->setText(text); } -QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn, QString filterString) +QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn) { GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole); item->moveToThread(ui->threadTreeWidget->thread()); @@ -874,12 +875,12 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum } #endif - //if (filterColumn == COLUMN_THREAD_CONTENT) { + if (filterColumn == COLUMN_THREAD_CONTENT) { // need content for filter QTextDocument doc; doc.setHtml(QString::fromUtf8(msg.mMsg.c_str())); item->setText(COLUMN_THREAD_CONTENT, doc.toPlainText().replace(QString("\n"), QString(" "))); - //} + } item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID, QString::fromStdString(msg.mMeta.mMsgId.toStdString())); //#TODO @@ -895,9 +896,6 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING, false); - item->setHidden(!item->text(filterColumn).contains(filterString, Qt::CaseInsensitive)); - - return item; } @@ -964,8 +962,6 @@ void GxsForumThreadWidget::insertThreads() mFillThread->mCompareRole = mThreadCompareRole; mFillThread->mForumId = mForumId; mFillThread->mFilterColumn = ui->filterLineEdit->currentFilter(); - mFillThread->mFilterString = ui->filterLineEdit->text(); - //mFillThread->mFilterColumn = COLUMN_THREAD_TITLE; mFillThread->mExpandNewMessages = Settings->getForumExpandNewMessages(); mFillThread->mViewType = ui->viewBox->currentIndex(); if (mLastViewType != mFillThread->mViewType || mLastForumID != mForumId) { diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h index 86a18661e..2bca33356 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h @@ -52,7 +52,7 @@ public: unsigned int newCount() { return mNewCount; } unsigned int unreadCount() { return mUnreadCount; } - QTreeWidgetItem *convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn, QString filterString); + QTreeWidgetItem *convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn); QTreeWidgetItem *generateMissingItem(const RsGxsMessageId &msgId); // Callback for all Loads. diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumsFillThread.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumsFillThread.cpp index 645664e5a..0b1a06a82 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumsFillThread.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumsFillThread.cpp @@ -45,7 +45,6 @@ GxsForumsFillThread::GxsForumsFillThread(GxsForumThreadWidget *parent) mFillComplete = false; mFilterColumn = 0; - mFilterString = QString(); mViewType = 0; mFlatView = false; @@ -177,7 +176,7 @@ void GxsForumsFillThread::run() std::cerr << "GxsForumsFillThread::run() Adding TopLevel Thread: mId: " << msg.mMeta.mMsgId << std::endl; #endif - QTreeWidgetItem *item = mParent->convertMsgToThreadWidget(msg, mUseChildTS, mFilterColumn, mFilterString); + QTreeWidgetItem *item = mParent->convertMsgToThreadWidget(msg, mUseChildTS, mFilterColumn); if (!mFlatView) { threadList.push_back(QPair(msg.mMeta.mMsgId.toStdString(), item)); } @@ -219,16 +218,9 @@ void GxsForumsFillThread::run() std::cerr << "GxsForumsFillThread::run() adding " << msg.mMeta.mMsgId << std::endl; #endif - QTreeWidgetItem *item = mParent->convertMsgToThreadWidget(msg, mUseChildTS, mFilterColumn, mFilterString); + QTreeWidgetItem *item = mParent->convertMsgToThreadWidget(msg, mUseChildTS, mFilterColumn); threadPair.second->addChild(item); - if ( !item->isHidden() && threadPair.second->isHidden() ){ - threadPair.second->setHidden(false); - for (QTreeWidgetItem *cursIt = threadPair.second->parent(); cursIt; cursIt = cursIt->parent()){ - cursIt->setHidden(false); - } - } - calculateExpand(msg, item); /* add item to process list */ diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumsFillThread.h b/retroshare-gui/src/gui/gxsforums/GxsForumsFillThread.h index 27febb3e8..58a461607 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumsFillThread.h +++ b/retroshare-gui/src/gui/gxsforums/GxsForumsFillThread.h @@ -28,7 +28,6 @@ signals: public: RsGxsGroupId mForumId; int mFilterColumn; - QString mFilterString; bool mFillComplete; int mViewType; bool mFlatView;