summaryrefslogtreecommitdiff
path: root/src/urlbar/completionwidget.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-09-12 00:00:49 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-09-12 00:00:49 +0200
commitc324f2759303fa3f0aa9a38004573b5d92f24446 (patch)
tree4ee18b30af8ce7abcf92bcde6c280fe26c63941f /src/urlbar/completionwidget.cpp
parentFix green arrow show up (diff)
parentproperly handle modifiers+return key when the completion list is displayed (diff)
downloadrekonq-c324f2759303fa3f0aa9a38004573b5d92f24446.tar.xz
Merge commit 'refs/merge-requests/207' of git://gitorious.org/rekonq/mainline into m207
Diffstat (limited to 'src/urlbar/completionwidget.cpp')
-rw-r--r--src/urlbar/completionwidget.cpp37
1 files changed, 32 insertions, 5 deletions
diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp
index be189001..f8bf6ee2 100644
--- a/src/urlbar/completionwidget.cpp
+++ b/src/urlbar/completionwidget.cpp
@@ -273,12 +273,39 @@ bool CompletionWidget::eventFilter(QObject *obj, QEvent *ev)
case Qt::Key_Enter:
case Qt::Key_Return:
-
- // let urlbar handle Return + Modifiers
- if(!(kev->modifiers() & Qt::NoModifier))
- return false;
-
w = qobject_cast<UrlBar *>(parent());
+
+ if (!w->text().startsWith(QL1S("http://"), Qt::CaseInsensitive))
+ {
+ QString append;
+ if (kev->modifiers() == Qt::ControlModifier)
+ {
+ append = QL1S(".com");
+ }
+ else if (kev->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier))
+ {
+ append = QL1S(".org");
+ }
+ else if (kev->modifiers() == Qt::ShiftModifier)
+ {
+ append = QL1S(".net");
+ }
+
+ if (!append.isEmpty())
+ {
+ QUrl url(QL1S("http://www.") + w->text());
+ QString host = url.host();
+ if (!host.endsWith(append, Qt::CaseInsensitive))
+ {
+ host += append;
+ url.setHost(host);
+ }
+
+ emit chosenUrl(url, Rekonq::CurrentTab);
+ }
+ }
+
+
if( _currentIndex == -1)
_currentIndex = 0;
child = findChild<ListItem *>(QString::number(_currentIndex));