mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-21 05:44:29 -05:00
search result filtering
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2383 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f9a1bbf8c8
commit
c4a5577ffb
@ -129,7 +129,8 @@ SearchDialog::SearchDialog(QWidget *parent)
|
|||||||
connect ( ui.searchSummaryWidget, SIGNAL( currentItemChanged ( QTreeWidgetItem *, QTreeWidgetItem * ) ),
|
connect ( ui.searchSummaryWidget, SIGNAL( currentItemChanged ( QTreeWidgetItem *, QTreeWidgetItem * ) ),
|
||||||
this, SLOT( selectSearchResults( void ) ) );
|
this, SLOT( selectSearchResults( void ) ) );
|
||||||
|
|
||||||
connect(ui.FileTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onComboIndexChanged(int)));
|
//connect(ui.FileTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onComboIndexChanged(int)));
|
||||||
|
connect(ui.FileTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectSearchResults(int)));
|
||||||
|
|
||||||
/* hide the Tree +/- */
|
/* hide the Tree +/- */
|
||||||
ui.searchResultWidget -> setRootIsDecorated( true );
|
ui.searchResultWidget -> setRootIsDecorated( true );
|
||||||
@ -833,6 +834,7 @@ void SearchDialog::insertDirectory(const std::string &txt, qulonglong searchId,
|
|||||||
ui.searchSummaryWidget->setCurrentItem(item2);
|
ui.searchSummaryWidget->setCurrentItem(item2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectSearchResults();
|
||||||
// TODO: check for duplicate directories
|
// TODO: check for duplicate directories
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1086,8 +1088,13 @@ void SearchDialog::resultsToTree(std::string txt,qulonglong searchId, const std:
|
|||||||
ui.searchResultWidget->setSortingEnabled(true);
|
ui.searchResultWidget->setSortingEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchDialog::selectSearchResults()
|
void SearchDialog::selectSearchResults(int index)
|
||||||
{
|
{
|
||||||
|
index = (index == -1)?ui.FileTypeComboBox->currentIndex():index;
|
||||||
|
QString alltypes = FileTypeExtensionMap->value(index);
|
||||||
|
QStringList types = alltypes.split(" ");
|
||||||
|
|
||||||
|
|
||||||
/* highlight this search in summary window */
|
/* highlight this search in summary window */
|
||||||
QTreeWidgetItem *ci = ui.searchSummaryWidget->currentItem();
|
QTreeWidgetItem *ci = ui.searchSummaryWidget->currentItem();
|
||||||
if (!ci)
|
if (!ci)
|
||||||
@ -1108,7 +1115,14 @@ void SearchDialog::selectSearchResults()
|
|||||||
QTreeWidgetItem *ti = ui.searchResultWidget->topLevelItem(i);
|
QTreeWidgetItem *ti = ui.searchResultWidget->topLevelItem(i);
|
||||||
if (ti->text(SR_SEARCH_ID_COL) == searchId)
|
if (ti->text(SR_SEARCH_ID_COL) == searchId)
|
||||||
{
|
{
|
||||||
|
if (index == FILETYPE_IDX_ANY)
|
||||||
ti->setHidden(false);
|
ti->setHidden(false);
|
||||||
|
else if (index == FILETYPE_IDX_DIRECTORY && ti->text(SR_HASH_COL).isEmpty())
|
||||||
|
ti->setHidden(false);
|
||||||
|
else if (types.contains(QFileInfo(ti->text(SR_NAME_COL)).suffix(), Qt::CaseInsensitive))
|
||||||
|
ti->setHidden(false);
|
||||||
|
else
|
||||||
|
ti->setHidden(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1246,6 +1260,7 @@ void SearchDialog::togglereset()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// not in use for the moment
|
||||||
void SearchDialog::onComboIndexChanged(int index)
|
void SearchDialog::onComboIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if (!FileTypeExtensionMap->contains(index) && index != FILETYPE_IDX_DIRECTORY)
|
if (!FileTypeExtensionMap->contains(index) && index != FILETYPE_IDX_DIRECTORY)
|
||||||
|
@ -83,7 +83,7 @@ private slots:
|
|||||||
/** perform the advanced search */
|
/** perform the advanced search */
|
||||||
void advancedSearch(Expression*);
|
void advancedSearch(Expression*);
|
||||||
|
|
||||||
void selectSearchResults();
|
void selectSearchResults(int index = -1);
|
||||||
|
|
||||||
void clearKeyword();
|
void clearKeyword();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user