limited the search to > 4 chars, suppressed some debug output

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2319 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-02-14 15:34:53 +00:00
parent 94aa902a95
commit 1fe7b8262c
2 changed files with 22 additions and 1 deletions

View File

@ -99,6 +99,7 @@ SearchDialog::SearchDialog(QWidget *parent)
ui.setupUi(this);
ui.lineEdit->setFocus();
ui.lineEdit->setToolTip(tr("Enter a keyword here (at least 4 char long)"));
/* initialise the filetypes mapping */
if (!SearchDialog::initialised)
@ -115,6 +116,7 @@ SearchDialog::SearchDialog(QWidget *parent)
connect( ui.searchSummaryWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( searchtableWidget2CostumPopupMenu( QPoint ) ) );
connect( ui.lineEdit, SIGNAL( returnPressed ( void ) ), this, SLOT( searchKeywords( void ) ) );
connect( ui.lineEdit, SIGNAL( textChanged ( const QString& ) ), this, SLOT( checkText( const QString& ) ) );
connect( ui.pushButtonsearch, SIGNAL( released ( void ) ), this, SLOT( searchKeywords( void ) ) );
connect( ui.pushButtonDownload, SIGNAL( released ( void ) ), this, SLOT( download( void ) ) );
connect( ui.cloaseallsearchresultsButton, SIGNAL(clicked()), this, SLOT(searchRemoveAll()));
@ -182,6 +184,20 @@ SearchDialog::SearchDialog(QWidget *parent)
#endif
}
void SearchDialog::checkText(const QString& txt)
{
if(txt.length() < 4)
{
std::cout << "setting palette 1" << std::endl ;
ui.lineEdit->setStyleSheet("QLineEdit { background-color: blue; }");
}
else
{
ui.lineEdit->setStyleSheet("QLineEdit { background-color: white; }");
std::cout << "setting palette 2" << std::endl ;
}
}
void SearchDialog::initialiseFileTypeMappings()
{
/* edit these strings to change the range of extensions recognised by the search */
@ -525,6 +541,9 @@ void SearchDialog::searchKeywords()
QString qTxt = ui.lineEdit->text();
std::string txt = qTxt.toStdString();
if(txt.length() < 4)
return ;
std::cerr << "SearchDialog::searchKeywords() : " << txt << std::endl;
TurtleRequestId req_id = rsTurtle->turtleSearch(txt) ;
@ -628,11 +647,12 @@ void SearchDialog::updateFiles(qulonglong search_id,FileDetail file)
{
/* which extensions do we use? */
std::string txt = ui.lineEdit->text().toStdString();
#ifdef DEBUG
std::cout << "Updating file detail:" << std::endl ;
std::cout << " size = " << file.size << std::endl ;
std::cout << " name = " << file.name << std::endl ;
std::cout << " s_id = " << search_id << std::endl ;
#endif
if (ui.FileTypeComboBox->currentIndex() == FILETYPE_IDX_ANY)
insertFile(txt,search_id,file);

View File

@ -60,6 +60,7 @@ private slots:
void broadcastonchannel();
void recommendtofriends();
void checkText(const QString&) ;
void copysearchLink();