diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-12-08 12:25:54 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-12-08 12:25:54 +0100 |
commit | ecbe1d942e41a29a8d0bffdb328643e4c2a278b1 (patch) | |
tree | 4763b4e632dc81081fb1066f4f3bd66818101187 /src/urlbar/urlbar.cpp | |
parent | rekonq 0.3.19 (diff) | |
download | rekonq-ecbe1d942e41a29a8d0bffdb328643e4c2a278b1.tar.xz |
xss attach prevention.
I have to say, BRUTE prevention :)
Hope this works.
Also some fixes in Urlbar class to ensure that a KUrl is a KUrl
and a QString is a QString.
Removed the annoying "restore url on focus out" feature. No other browsers
have it and I really cannot understand gain
Diffstat (limited to 'src/urlbar/urlbar.cpp')
-rw-r--r-- | src/urlbar/urlbar.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index 2adfcd17..e9952c01 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -138,12 +138,13 @@ void UrlBar::setUrl(const QUrl& url) { if(url.scheme() == "about") { - m_currentUrl = ""; + m_currentUrl = KUrl(); setFocus(); } else - m_currentUrl = url; - + { + m_currentUrl = KUrl(url); + } updateUrl(); } @@ -166,8 +167,14 @@ void UrlBar::updateUrl() } KIcon icon; - if(m_currentUrl.isEmpty()) icon = KIcon("arrow-right"); - else icon = Application::icon(m_currentUrl); + if(m_currentUrl.isEmpty()) + { + icon = KIcon("arrow-right"); + } + else + { + icon = Application::icon(m_currentUrl); + } if (count()) { @@ -190,14 +197,14 @@ void UrlBar::updateUrl() } -void UrlBar::activated(const QString& url) +void UrlBar::activated(const QString& urlString) { - if (url.isEmpty()) + if (urlString.isEmpty()) return; - setUrl(url); + setUrl(urlString); - Application::historyManager()->addHistoryEntry(url); + Application::historyManager()->addHistoryEntry(urlString); emit activated(m_currentUrl); } @@ -260,15 +267,6 @@ void UrlBar::paintEvent(QPaintEvent *event) } -void UrlBar::focusOutEvent(QFocusEvent *event) -{ - // set back last loaded url in case user cleared it - if (!m_currentUrl.equals(KUrl(lineEdit()->text()))) setUrl(m_currentUrl); - - KHistoryComboBox::focusOutEvent(event); -} - - QSize UrlBar::sizeHint() const { return lineEdit()->sizeHint(); @@ -293,7 +291,7 @@ QLinearGradient UrlBar::generateGradient(const QColor &color, int height) void UrlBar::setBackgroundColor(QColor c) { - s_defaultBaseColor=c; + s_defaultBaseColor = c; repaint(); } |