From 7a183af3cb3960341e818e65f892f258f05672a5 Mon Sep 17 00:00:00 2001 From: Flavio Date: Wed, 26 Jan 2011 09:23:10 +0100 Subject: [PATCH] Fix regression with recent keywords --- src/SearchView.cpp | 19 ++++++++++++++++++- src/SearchView.h | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) 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: -- 2.39.5