1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

LocationCompleterDelegate: Only show Visit action on hovered/active items

This commit is contained in:
David Rosca 2018-01-27 13:37:39 +01:00
parent 0cf48359f9
commit 538299116f
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

@ -146,16 +146,16 @@ void LocationCompleterDelegate::paint(QPainter* painter, const QStyleOptionViewI
} }
if (isVisitSearchItem || isSearchSuggestion) { if (isVisitSearchItem || isSearchSuggestion) {
if (isVisitSearchItem && (!isWebSearch || m_forceVisitItem)) { if (!opt.state.testFlag(QStyle::State_Selected) && !opt.state.testFlag(QStyle::State_MouseOver)) {
link.clear();
} else if (isVisitSearchItem && (!isWebSearch || m_forceVisitItem)) {
link = tr("Visit"); link = tr("Visit");
} else if (opt.state.testFlag(QStyle::State_Selected) || opt.state.testFlag(QStyle::State_MouseOver)) { } else {
QString searchEngineName = loadAction.searchEngine.name; QString searchEngineName = loadAction.searchEngine.name;
if (searchEngineName.isEmpty()) { if (searchEngineName.isEmpty()) {
searchEngineName = LocationBar::searchEngine().name; searchEngineName = LocationBar::searchEngine().name;
} }
link = tr("Search with %1").arg(searchEngineName); link = tr("Search with %1").arg(searchEngineName);
} else {
link.clear();
} }
} }