mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 23:49:35 -05:00
fixed forum search by content (patch from Phenom)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7720 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
21fe2413cd
commit
d164428bf9
@ -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
|
||||
|
||||
@ -815,7 +815,7 @@ void GxsForumThreadWidget::fillThreadStatus(QString text)
|
||||
ui->progressText->setText(text);
|
||||
}
|
||||
|
||||
QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn)
|
||||
QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn, QString filterString)
|
||||
{
|
||||
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole);
|
||||
item->moveToThread(ui->threadTreeWidget->thread());
|
||||
@ -874,12 +874,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,6 +895,9 @@ 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;
|
||||
}
|
||||
|
||||
@ -961,7 +964,8 @@ void GxsForumThreadWidget::insertThreads()
|
||||
mFillThread->mCompareRole = mThreadCompareRole;
|
||||
mFillThread->mForumId = mForumId;
|
||||
mFillThread->mFilterColumn = ui->filterLineEdit->currentFilter();
|
||||
mFillThread->mFilterColumn = COLUMN_THREAD_TITLE;
|
||||
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) {
|
||||
|
@ -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);
|
||||
QTreeWidgetItem *convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn, QString filterString);
|
||||
QTreeWidgetItem *generateMissingItem(const RsGxsMessageId &msgId);
|
||||
|
||||
// Callback for all Loads.
|
||||
|
@ -45,6 +45,7 @@ GxsForumsFillThread::GxsForumsFillThread(GxsForumThreadWidget *parent)
|
||||
mFillComplete = false;
|
||||
|
||||
mFilterColumn = 0;
|
||||
mFilterString = QString();
|
||||
|
||||
mViewType = 0;
|
||||
mFlatView = false;
|
||||
@ -110,7 +111,7 @@ void GxsForumsFillThread::run()
|
||||
service->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds);
|
||||
|
||||
/* wait for the answer */
|
||||
uint32_t requestStatus;
|
||||
uint32_t requestStatus = RsTokenService::GXS_REQUEST_V2_STATUS_PENDING;
|
||||
while (!wasStopped()) {
|
||||
requestStatus = service->requestStatus(token);
|
||||
if (requestStatus == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED ||
|
||||
@ -176,7 +177,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);
|
||||
QTreeWidgetItem *item = mParent->convertMsgToThreadWidget(msg, mUseChildTS, mFilterColumn, mFilterString);
|
||||
if (!mFlatView) {
|
||||
threadList.push_back(QPair<std::string, QTreeWidgetItem*>(msg.mMeta.mMsgId.toStdString(), item));
|
||||
}
|
||||
@ -218,9 +219,16 @@ void GxsForumsFillThread::run()
|
||||
std::cerr << "GxsForumsFillThread::run() adding " << msg.mMeta.mMsgId << std::endl;
|
||||
#endif
|
||||
|
||||
QTreeWidgetItem *item = mParent->convertMsgToThreadWidget(msg, mUseChildTS, mFilterColumn);
|
||||
QTreeWidgetItem *item = mParent->convertMsgToThreadWidget(msg, mUseChildTS, mFilterColumn, mFilterString);
|
||||
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 */
|
||||
|
@ -28,6 +28,7 @@ signals:
|
||||
public:
|
||||
RsGxsGroupId mForumId;
|
||||
int mFilterColumn;
|
||||
QString mFilterString;
|
||||
bool mFillComplete;
|
||||
int mViewType;
|
||||
bool mFlatView;
|
||||
|
Loading…
Reference in New Issue
Block a user