From 026fc6c1ca6f877a9b26a60afdd8e90e3c34e66e Mon Sep 17 00:00:00 2001 From: Rok Povsic Date: Sun, 19 Jan 2025 12:16:59 +0100 Subject: [PATCH] UI/Qt: Add '.com' to the URL if CTRL is held while pressing return --- UI/Qt/LocationEdit.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/UI/Qt/LocationEdit.cpp b/UI/Qt/LocationEdit.cpp index 2a02051f54c..e7f41493376 100644 --- a/UI/Qt/LocationEdit.cpp +++ b/UI/Qt/LocationEdit.cpp @@ -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()); });