[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [Rekonq] [BAD EMAIL] 2bb95ad: properly handle modifiers+return key
From:       megabigbug <megabigbug () arrakis ! mail ! kde ! org (none)>
Date:       2010-09-11 23:24:02
Message-ID: 201009112324.o8BNO2Av031738 () kore ! kollide ! net
[Download RAW message or body]

commit 2bb95ad564a8befa09ab6188341b4928166517ed
Author: megabigbug <megabigbug@arrakis.(none)>
Date:   Sat Sep 11 13:27:11 2010 +0200

    properly handle modifiers+return key when the completion list is displayed
    TODO: fix when the completion list is not displayed

diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp
index be18900..f8bf6ee 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));
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic