On Monday 01 February 2010 07:42:00 pm thomas gahr wrote:
> 
> well, it removes a blank line in application.cpp - i noticed that but after
> going back and forth with git reset just to get rid of dozens of other
> stuff i added that wasn't needed (it was late and i was tired that day ;)
> ) i figured that this line won't hurt...
> it does modify urlbar.cpp, though - can it be that you opened it with
> kompare? just did the same and was shocked to only see that single line
> changed - until i clicked the urlbar-folder :)
> anyway, thanks for the hints, clarified a few things.


oops, sorry, forgot to attach the modified patch, hope this works.
From f7ce64c3369b7ae8523742cabb3212158e869650 Mon Sep 17 00:00:00 2001
From: thomas gahr <[email protected]>
Date: Fri, 29 Jan 2010 02:01:11 +0100
Subject: [PATCH] fix for trailing whitespace in url

---
 src/urlbar/urlbar.cpp |   51 +++++++++++++++++++++++++-----------------------
 1 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index be19dae..f35e4be 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -305,30 +305,33 @@ bool UrlBar::isLoading()
 void UrlBar::keyPressEvent(QKeyEvent *event)
 {
     QString currentText = m_lineEdit->text().trimmed();
-    if ((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
-        && !currentText.startsWith(QLatin1String("http://";), Qt::CaseInsensitive))
-    {
-        QString append;
-        if (event->modifiers() == Qt::ControlModifier)
-        {
-            append = QLatin1String(".com");
-        }
-        else if (event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier))
-        {
-            append = QLatin1String(".org");
-        }
-        else if (event->modifiers() == Qt::ShiftModifier)
-        {
-            append = QLatin1String(".net");
-        }
-
-        QUrl url(QLatin1String("http://www.";) + currentText);
-        QString host = url.host();
-        if (!host.endsWith(append, Qt::CaseInsensitive))
-        {
-            host += append;
-            url.setHost(host);
-            m_lineEdit->setText(url.toString());
+    if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return){
+        if( !currentText.startsWith(QLatin1String("http://";), Qt::CaseInsensitive)){
+            QString append;
+            if (event->modifiers() == Qt::ControlModifier)
+            {
+                append = QLatin1String(".com");
+            }
+            else if (event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier))
+            {
+                append = QLatin1String(".org");
+            }
+            else if (event->modifiers() == Qt::ShiftModifier)
+            {
+                append = QLatin1String(".net");
+            }
+
+            QUrl url(QLatin1String("http://www.";) + currentText);
+            QString host = url.host();
+            if (!host.endsWith(append, Qt::CaseInsensitive))
+            {
+                host += append;
+                url.setHost(host);
+                m_lineEdit->setText(url.toString());
+            }
+        }else{
+            //fill lineEdit with its stripped contents to remove trailing spaces
+            m_lineEdit->setText(currentText);
         }
     }
 
-- 
1.6.6

_______________________________________________
rekonq mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/rekonq

Reply via email to