summaryrefslogtreecommitdiff
path: root/src/urlbar/urlbar.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-02-02 03:36:05 +0100
committerAndrea Diamantini <adjam7@gmail.com>2010-02-02 03:36:05 +0100
commit821a246b101038937f8070152a9c14ead1c4169b (patch)
treeb0ba8d37aa87abc2650ae7255b80f991276623bb /src/urlbar/urlbar.cpp
parentMerge commit 'refs/merge-requests/83' of git://gitorious.org/rekonq/mainline ... (diff)
downloadrekonq-821a246b101038937f8070152a9c14ead1c4169b.tar.xz
This should fix last wrong encoded urls
Diffstat (limited to 'src/urlbar/urlbar.cpp')
-rw-r--r--src/urlbar/urlbar.cpp53
1 files changed, 31 insertions, 22 deletions
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index be19dae4..adeba6ae 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -140,13 +140,15 @@ void UrlBar::setUrl(const QUrl& url)
if(url.scheme() == "about")
{
m_currentUrl = KUrl();
+ updateUrl(); // updateUrl before setFocus
setFocus();
}
else
{
m_currentUrl = KUrl(url);
+ updateUrl();
}
- updateUrl();
+
}
@@ -302,36 +304,43 @@ bool UrlBar::isLoading()
return true;
}
+
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))
+ if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
{
- QString append;
- if (event->modifiers() == Qt::ControlModifier)
+ if( !currentText.startsWith(QLatin1String("http://"), Qt::CaseInsensitive) )
{
- append = QLatin1String(".com");
+ 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 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))
+ else
{
- host += append;
- url.setHost(host);
- m_lineEdit->setText(url.toString());
+ // fill lineEdit with its stripped contents to remove trailing spaces
+ m_lineEdit->setText(currentText);
}
}
KHistoryComboBox::keyPressEvent(event);
}
-