mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Don't duplicate convertUrlToText function in WebView
This commit is contained in:
parent
b75e8a8451
commit
04d4555b47
@ -210,11 +210,11 @@ LoadRequest LocationBar::createLoadRequest() const
|
||||
return req;
|
||||
}
|
||||
|
||||
QString LocationBar::convertUrlToText(const QUrl &url) const
|
||||
QString LocationBar::convertUrlToText(const QUrl &url)
|
||||
{
|
||||
// It was most probably entered by user, so don't urlencode it
|
||||
if (url.scheme().isEmpty()) {
|
||||
return url.toString();
|
||||
return QUrl::fromPercentEncoding(url.toEncoded());
|
||||
}
|
||||
|
||||
QString stringUrl = QzTools::urlEncodeQueryString(url);
|
||||
|
@ -44,6 +44,8 @@ public:
|
||||
TabbedWebView* webView() const;
|
||||
void setWebView(TabbedWebView* view);
|
||||
|
||||
static QString convertUrlToText(const QUrl &url);
|
||||
|
||||
public slots:
|
||||
void setText(const QString &text);
|
||||
void showUrl(const QUrl &url);
|
||||
@ -88,7 +90,6 @@ private:
|
||||
void paintEvent(QPaintEvent* event);
|
||||
|
||||
LoadRequest createLoadRequest() const;
|
||||
QString convertUrlToText(const QUrl &url) const;
|
||||
void refreshTextFormat();
|
||||
|
||||
LocationCompleter* m_completer;
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "settings.h"
|
||||
#include "qzsettings.h"
|
||||
#include "enhancedmenu.h"
|
||||
#include "locationbar.h"
|
||||
|
||||
#ifdef USE_HUNSPELL
|
||||
#include "qtwebkit/spellcheck/speller.h"
|
||||
@ -129,27 +130,11 @@ bool WebView::isTitleEmpty() const
|
||||
return QWebView::title().isEmpty();
|
||||
}
|
||||
|
||||
static QString convertUrlToText(const QUrl &url)
|
||||
{
|
||||
// It was most probably entered by user, so don't urlencode it
|
||||
if (url.scheme().isEmpty()) {
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
QString stringUrl = QzTools::urlEncodeQueryString(url);
|
||||
|
||||
if (stringUrl == QLatin1String("about:blank")) {
|
||||
stringUrl.clear();
|
||||
}
|
||||
|
||||
return stringUrl;
|
||||
}
|
||||
|
||||
QUrl WebView::url() const
|
||||
{
|
||||
QUrl returnUrl = page()->url();
|
||||
|
||||
if (convertUrlToText(returnUrl).isEmpty()) {
|
||||
if (LocationBar::convertUrlToText(returnUrl).isEmpty()) {
|
||||
returnUrl = m_aboutToLoadUrl;
|
||||
}
|
||||
|
||||
@ -417,7 +402,7 @@ void WebView::reload()
|
||||
{
|
||||
m_isReloading = true;
|
||||
|
||||
if (convertUrlToText(QWebView::url()).isEmpty() && !m_aboutToLoadUrl.isEmpty()) {
|
||||
if (LocationBar::convertUrlToText(QWebView::url()).isEmpty() && !m_aboutToLoadUrl.isEmpty()) {
|
||||
load(m_aboutToLoadUrl);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user