]> git.sur5r.net Git - minitube/commitdiff
recent keywords avigable with keyboard
authorFlavio Tordini <flavio.tordini@gmail.com>
Wed, 29 Jul 2009 08:51:09 +0000 (10:51 +0200)
committerFlavio Tordini <flavio.tordini@gmail.com>
Wed, 29 Jul 2009 08:51:09 +0000 (10:51 +0200)
cleanup

src/SearchView.cpp

index 61d1d04ff925ca52501474483e6308b08e87036e..6ed908dd11c17ed119bf12481dae27ae37a7eaaa 100644 (file)
@@ -67,7 +67,7 @@ SearchView::SearchView(QWidget *parent) : QWidget(parent) {
     QHBoxLayout *otherLayout = new QHBoxLayout();
 
     recentKeywordsLayout = new QVBoxLayout();
-    recentKeywordsLayout->setAlignment(Qt::AlignTop);
+    recentKeywordsLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
     recentKeywordsLabel = new QLabel(tr("Recent keywords").toUpper(), this);
     recentKeywordsLabel->hide();
     recentKeywordsLabel->setForegroundRole(QPalette::Dark);
@@ -82,8 +82,6 @@ SearchView::SearchView(QWidget *parent) : QWidget(parent) {
 
     setLayout(mainLayout);
 
-    // watchButton->setMinimumHeight(queryEdit->height());
-
     updateChecker = 0;
     checkForUpdate();
 }
@@ -127,9 +125,10 @@ void SearchView::updateRecentKeywords() {
                                        + "\" style=\"color:palette(text); text-decoration:none\">"
                                        + keyword + "</a>", this);
 
-        // Make links navigable with the keyboard
-        // this makes links nonclickable so it's disabled
-        // itemLabel->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard);
+        itemLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+        // Make links navigable with the keyboard too
+        itemLabel->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard | Qt::LinksAccessibleByMouse);
+
         connect(itemLabel, SIGNAL(linkActivated(QString)), this, SLOT(watch(QString)));
         recentKeywordsLayout->addWidget(itemLabel);
     }
@@ -153,14 +152,7 @@ void SearchView::watch(QString query) {
         return;
     }
 
-    // save keyword
-    QSettings settings;
-    QStringList keywords = settings.value(recentKeywordsKey).toStringList();
-    keywords.removeAll(query);
-    keywords.prepend(query);
-    while (keywords.size() > 10)
-        keywords.removeLast();
-    settings.setValue(recentKeywordsKey, keywords);
+    queryEdit->preventSuggest();
 
     // go!
     emit search(query);