From d61b72bd87d3db42b1e3a6708c097c31ff2ab4e6 Mon Sep 17 00:00:00 2001 From: nowrep Date: Wed, 8 Jan 2014 10:39:41 +0100 Subject: [PATCH] [SearchShortcuts] Fixed using search shortcuts longer than one character --- src/lib/navigation/locationbar.cpp | 9 +++++++-- src/lib/navigation/locationbar.h | 3 ++- src/lib/opensearch/searchenginesmanager.cpp | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lib/navigation/locationbar.cpp b/src/lib/navigation/locationbar.cpp index 26f505c25..36ad8254b 100644 --- a/src/lib/navigation/locationbar.cpp +++ b/src/lib/navigation/locationbar.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2013 David Rosca +* Copyright (C) 2010-2014 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -166,7 +166,7 @@ QUrl LocationBar::createUrl() } } - if (m_inlineCompletionVisible) { + if (isInlineCompletionVisible()) { urlToLoad = WebView::guessUrlFromString(text() + m_completer.domainCompletion()); } @@ -194,6 +194,11 @@ QString LocationBar::convertUrlToText(const QUrl &url) const return stringUrl; } +bool LocationBar::isInlineCompletionVisible() const +{ + return m_inlineCompletionVisible && !m_completer.domainCompletion().isEmpty(); +} + void LocationBar::urlEnter() { const QUrl url = createUrl(); diff --git a/src/lib/navigation/locationbar.h b/src/lib/navigation/locationbar.h index e22c65725..c5536651d 100644 --- a/src/lib/navigation/locationbar.h +++ b/src/lib/navigation/locationbar.h @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2013 David Rosca +* Copyright (C) 2010-2014 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -96,6 +96,7 @@ private: QUrl createUrl(); QString convertUrlToText(const QUrl &url) const; + bool isInlineCompletionVisible() const; void showGoButton(); void hideGoButton(); diff --git a/src/lib/opensearch/searchenginesmanager.cpp b/src/lib/opensearch/searchenginesmanager.cpp index ff2638141..10b8fb35a 100644 --- a/src/lib/opensearch/searchenginesmanager.cpp +++ b/src/lib/opensearch/searchenginesmanager.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2013 David Rosca +* Copyright (C) 2010-2014 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -97,6 +97,7 @@ void SearchEnginesManager::loadSettings() SearchEngine SearchEnginesManager::engineForShortcut(const QString &shortcut) { Engine returnEngine; + if (shortcut.isEmpty()) { return returnEngine; }