]> git.sur5r.net Git - minitube/commitdiff
Fix regression with recent keywords
authorFlavio <flavio@odisseo.local>
Wed, 26 Jan 2011 08:23:10 +0000 (09:23 +0100)
committerFlavio <flavio@odisseo.local>
Wed, 26 Jan 2011 08:23:10 +0000 (09:23 +0100)
src/SearchView.cpp
src/SearchView.h

index ce1cd8582a9523e8e9407fb8defdc46d63732bd1..347bdadf55a87e0682ebf54ce465cec8117591f1 100644 (file)
@@ -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";
 
index dfdfee9d72e50f8082891218b6c9f1820996eae1..5fd8f3b619eb3cbb488e5e12695294ee0958edb1 100644 (file)
@@ -39,6 +39,7 @@ public:
 public slots:
     void watch(QString query);
     void watchChannel(QString channel);
+    void watchKeywords(QString query);
     void gotNewVersion(QString version);
 
 signals: