UI/Qt: Add '.com' to the URL if CTRL is held while pressing return

This commit is contained in:
Rok Povsic 2025-01-19 12:16:59 +01:00 committed by Sam Atkins
parent 3b81d9d91d
commit 026fc6c1ca
Notes: github-actions[bot] 2025-01-20 19:23:00 +00:00

View file

@ -43,7 +43,10 @@ LocationEdit::LocationEdit(QWidget* parent)
auto query = ak_string_from_qstring(text());
if (auto url = WebView::sanitize_url(query, search_engine_url); url.has_value())
auto ctrl_held = QApplication::keyboardModifiers() & Qt::ControlModifier;
auto append_tld = ctrl_held ? WebView::AppendTLD::Yes : WebView::AppendTLD::No;
if (auto url = WebView::sanitize_url(query, search_engine_url, append_tld); url.has_value())
set_url(url.release_value());
});