mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-14 02:52:12 +01:00
LocationCompleter: Fix search engine shortcuts
This commit is contained in:
parent
1387baade0
commit
04df4cbdf8
|
@ -327,7 +327,7 @@ void LocationCompleter::loadUrl(const QUrl &url)
|
||||||
closePopup();
|
closePopup();
|
||||||
|
|
||||||
// Show url in locationbar
|
// Show url in locationbar
|
||||||
emit showCompletion(url.toEncoded(), false);
|
emit showCompletion(url.toString(), false);
|
||||||
|
|
||||||
// Load url
|
// Load url
|
||||||
emit loadCompletion();
|
emit loadCompletion();
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "locationbar.h"
|
#include "locationbar.h"
|
||||||
#include "iconprovider.h"
|
#include "iconprovider.h"
|
||||||
#include "qzsettings.h"
|
#include "qzsettings.h"
|
||||||
|
#include "mainapplication.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
@ -147,7 +148,16 @@ void LocationCompleterDelegate::paint(QPainter* painter, const QStyleOptionViewI
|
||||||
if (!isSearchSuggestion && !isWebSearch) {
|
if (!isSearchSuggestion && !isWebSearch) {
|
||||||
link = tr("Visit");
|
link = tr("Visit");
|
||||||
} else if (opt.state.testFlag(QStyle::State_Selected) || opt.state.testFlag(QStyle::State_MouseOver)) {
|
} else if (opt.state.testFlag(QStyle::State_Selected) || opt.state.testFlag(QStyle::State_MouseOver)) {
|
||||||
link = tr("Search with %1").arg(LocationBar::searchEngine().name);
|
QString searchEngineName;
|
||||||
|
const int firstSpacePos = title.indexOf(QL1C(' '));
|
||||||
|
if (firstSpacePos != -1) {
|
||||||
|
const QString shortcut = title.left(firstSpacePos);
|
||||||
|
searchEngineName = mApp->searchEnginesManager()->engineForShortcut(shortcut).name;
|
||||||
|
}
|
||||||
|
if (searchEngineName.isEmpty()) {
|
||||||
|
searchEngineName = LocationBar::searchEngine().name;
|
||||||
|
}
|
||||||
|
link = tr("Search with %1").arg(searchEngineName);
|
||||||
} else {
|
} else {
|
||||||
link.clear();
|
link.clear();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user