From: Flavio Tordini Date: Wed, 29 Jul 2009 08:51:09 +0000 (+0200) Subject: recent keywords avigable with keyboard X-Git-Tag: 0.5~10 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3abf774ca58807078e452ee6768f872bc6536d84;p=minitube recent keywords avigable with keyboard cleanup --- diff --git a/src/SearchView.cpp b/src/SearchView.cpp index 61d1d04..6ed908d 100644 --- a/src/SearchView.cpp +++ b/src/SearchView.cpp @@ -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 + "", 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);