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
This commit is contained in:
thunder2 2014-11-30 22:56:50 +00:00
parent f511786a6a
commit 6d32524837
4 changed files with 9 additions and 22 deletions

View File

@ -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) {

View File

@ -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.

View File

@ -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<std::string, QTreeWidgetItem*>(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 */

View File

@ -28,7 +28,6 @@ signals:
public:
RsGxsGroupId mForumId;
int mFilterColumn;
QString mFilterString;
bool mFillComplete;
int mViewType;
bool mFlatView;