From: Flavio Date: Wed, 26 Jan 2011 08:23:10 +0000 (+0100) Subject: Fix regression with recent keywords X-Git-Tag: 1.4~35 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7a183af3cb3960341e818e65f892f258f05672a5;p=minitube Fix regression with recent keywords --- diff --git a/src/SearchView.cpp b/src/SearchView.cpp index ce1cd85..347bdad 100644 --- a/src/SearchView.cpp +++ b/src/SearchView.cpp @@ -214,7 +214,7 @@ void SearchView::updateRecentKeywords() { // Make links navigable with the keyboard too itemLabel->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard | Qt::LinksAccessibleByMouse); - connect(itemLabel, SIGNAL(linkActivated(QString)), this, SLOT(watch(QString))); + connect(itemLabel, SIGNAL(linkActivated(QString)), this, SLOT(watchKeywords(QString))); recentKeywordsLayout->addWidget(itemLabel); } @@ -314,6 +314,23 @@ void SearchView::watchChannel(QString channel) { emit search(searchParams); } +void SearchView::watchKeywords(QString query) { + + query = query.simplified(); + + // check for empty query + if (query.length() == 0) { + queryEdit->setFocus(Qt::OtherFocusReason); + return; + } + + SearchParams *searchParams = new SearchParams(); + searchParams->setKeywords(query); + + // go! + emit search(searchParams); +} + void SearchView::checkForUpdate() { static const QString updateCheckKey = "updateCheck"; diff --git a/src/SearchView.h b/src/SearchView.h index dfdfee9..5fd8f3b 100644 --- a/src/SearchView.h +++ b/src/SearchView.h @@ -39,6 +39,7 @@ public: public slots: void watch(QString query); void watchChannel(QString channel); + void watchKeywords(QString query); void gotNewVersion(QString version); signals: