summaryrefslogtreecommitdiff
path: root/src/urlbar
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-09-12 00:12:10 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-09-12 00:12:10 +0200
commitd974bbb169a28b7c056d2b8b5d13858f75dabd51 (patch)
tree6d8e2386c3137f7a0ec2d5333c2a917fb8c24706 /src/urlbar
parentMerge commit 'refs/merge-requests/207' of git://gitorious.org/rekonq/mainline... (diff)
parent- Modifiers are now correctly handled after Esc (diff)
downloadrekonq-d974bbb169a28b7c056d2b8b5d13858f75dabd51.tar.xz
Merge remote branch 'yoann/fixRegressionSearch2' into m207
Diffstat (limited to 'src/urlbar')
-rw-r--r--src/urlbar/urlbar.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index d7f906f3..61c44907 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -89,9 +89,6 @@ UrlBar::UrlBar(QWidget *parent)
// doesn't show the clear button
setClearButtonShown(false);
- // trap Key_Enter & Key_Return events, while emitting the returnPressed signal
- setTrapReturnKey(true);
-
// insert decoded URLs
setUrlDropsEnabled(true);
@@ -116,9 +113,6 @@ UrlBar::UrlBar(QWidget *parent)
// bookmark icon
connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(const QString &, const QString &)), this, SLOT(onBookmarksChanged()));
- // load typed urls
- connect(this, SIGNAL(returnPressed(const QString &)), this, SLOT(loadTyped(const QString &)));
-
_suggestionTimer->setSingleShot(true);
connect(_suggestionTimer, SIGNAL(timeout()), this, SLOT(suggest()));
@@ -240,7 +234,8 @@ void UrlBar::keyPressEvent(QKeyEvent *event)
// this handles the Modifiers + Return key combinations
QString currentText = text().trimmed();
if ((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
- && !currentText.startsWith(QL1S("http://"), Qt::CaseInsensitive))
+ && !currentText.startsWith(QL1S("http://"), Qt::CaseInsensitive)
+ && event->modifiers() != Qt::NoModifier)
{
QString append;
if (event->modifiers() == Qt::ControlModifier)
@@ -256,19 +251,28 @@ void UrlBar::keyPressEvent(QKeyEvent *event)
append = QL1S(".net");
}
- QUrl url(QL1S("http://www.") + currentText);
- QString host = url.host();
- if (!host.endsWith(append, Qt::CaseInsensitive))
+ if (!append.isEmpty())
{
- host += append;
- url.setHost(host);
+ QUrl url(QL1S("http://www.") + currentText);
+ QString host = url.host();
+ if (!host.endsWith(append, Qt::CaseInsensitive))
+ {
+ host += append;
+ url.setHost(host);
+ }
+
+ // now, load it!
+ activated(url);
}
+ }
- // now, load it!
- activated(url);
+ else if ((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
+ && !currentText.isEmpty())
+ {
+ loadTyped(currentText);
}
- if (event->key() == Qt::Key_Escape)
+ else if (event->key() == Qt::Key_Escape)
{
clearFocus();
event->accept();