diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2013-04-28 12:32:50 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2013-04-28 12:32:50 +0200 |
commit | dc749ed11ad8c241a9e17fc51b4f70a61bba461b (patch) | |
tree | da77ea70794a686f5df98a814d36411cb3606b76 /src/urlbar | |
parent | clean up search url detection the rekonq way (diff) | |
download | rekonq-dc749ed11ad8c241a9e17fc51b4f70a61bba461b.tar.xz |
Let url detection work the same when suggestions are active or not
Diffstat (limited to 'src/urlbar')
-rw-r--r-- | src/urlbar/urlbar.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index 6af68a3d..19816d35 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -284,9 +284,9 @@ void UrlBar::paintEvent(QPaintEvent *event) void UrlBar::keyPressEvent(QKeyEvent *event) { - QString currentText = text().trimmed(); + QString trimmedText = text().trimmed(); - if (currentText.isEmpty()) + if (trimmedText.isEmpty()) { disconnect(_icon); _icon->setIcon(KIcon("arrow-right")); @@ -296,26 +296,29 @@ void UrlBar::keyPressEvent(QKeyEvent *event) // this handles the Modifiers + Return key combinations if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) { + KUrl urlToLoad; switch (event->modifiers()) { case Qt::AltModifier: - loadRequestedUrl(currentText, Rekonq::NewFocusedTab); + urlToLoad = UrlResolver::urlFromTextTyped(text()); + loadRequestedUrl(urlToLoad, Rekonq::NewFocusedTab); break; case Qt::ControlModifier: - loadRequestedUrl(guessUrlWithCustomFirstLevel(currentText, QL1S(".com"))); + loadRequestedUrl(guessUrlWithCustomFirstLevel(trimmedText, QL1S(".com"))); break; case 0x06000000: // Qt::ControlModifier | Qt::ShiftModifier: - loadRequestedUrl(guessUrlWithCustomFirstLevel(currentText, QL1S(".org"))); + loadRequestedUrl(guessUrlWithCustomFirstLevel(trimmedText, QL1S(".org"))); break; case Qt::ShiftModifier: - loadRequestedUrl(guessUrlWithCustomFirstLevel(currentText, QL1S(".net"))); + loadRequestedUrl(guessUrlWithCustomFirstLevel(trimmedText, QL1S(".net"))); break; default: - loadRequestedUrl(currentText); + urlToLoad = UrlResolver::urlFromTextTyped(text()); + loadRequestedUrl(urlToLoad); break; } } |