1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

Fixed issue when history & url haven't been updated sometimes.

- workarounded QtWebKit bug: it didn't emit urlChanged signal

closes #358
This commit is contained in:
nowrep 2012-03-30 13:43:47 +02:00
parent a554d48e45
commit 1744eb759e
3 changed files with 24 additions and 9 deletions

View File

@ -217,11 +217,12 @@ void LocationBar::showUrl(const QUrl &url)
stringUrl = "";
}
if (url.toEncoded() != text()) {
setText(stringUrl);
if (stringUrl == text()) {
return;
}
p_QupZilla->statusBarMessage()->clearMessage();
setText(stringUrl);
hideGoButton();
m_bookmarkIcon->checkBookmark(url);
}

View File

@ -35,6 +35,7 @@
#include "pluginproxy.h"
#include <QDir>
#include <QTimer>
#include <QDesktopServices>
#include <QNetworkRequest>
#include <QWebHistory>
@ -53,7 +54,6 @@ WebView::WebView(QWidget* parent)
connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));
connect(this, SIGNAL(iconChanged()), this, SLOT(slotIconChanged()));
// Zoom levels same as in firefox
@ -98,7 +98,7 @@ QString WebView::title() const
QUrl WebView::url() const
{
QUrl returnUrl = QWebView::url();
QUrl returnUrl = page()->mainFrame()->baseUrl();
if (returnUrl.isEmpty()) {
returnUrl = m_aboutToLoadUrl;
@ -112,6 +112,8 @@ void WebView::setPage(QWebPage* page)
QWebView::setPage(page);
setZoom(WebViewSettings::defaultZoom);
connect(page, SIGNAL(saveFrameStateRequested(QWebFrame*,QWebHistoryItem*)), this, SLOT(frameStateChanged()));
}
void WebView::load(const QUrl &url)
@ -310,6 +312,17 @@ void WebView::slotLoadFinished()
m_lastUrl = url();
}
void WebView::frameStateChanged()
{
// QWebFrame::baseUrl() is not updated yet, so we are invoking 0 second timer
QTimer::singleShot(0, this, SLOT(emitChangedUrl()));
}
void WebView::emitChangedUrl()
{
emit urlChanged(url());
}
void WebView::slotIconChanged()
{
m_siteIcon = icon();
@ -437,7 +450,7 @@ void WebView::openUrlInBackgroundTab()
void WebView::loadClickedFrame()
{
QUrl frameUrl = m_clickedFrame->url();
QUrl frameUrl = m_clickedFrame->baseUrl();
if (frameUrl.isEmpty()) {
frameUrl = m_clickedFrame->requestedUrl();
}
@ -447,7 +460,7 @@ void WebView::loadClickedFrame()
void WebView::loadClickedFrameInNewTab()
{
QUrl frameUrl = m_clickedFrame->url();
QUrl frameUrl = m_clickedFrame->baseUrl();
if (frameUrl.isEmpty()) {
frameUrl = m_clickedFrame->requestedUrl();
}
@ -457,7 +470,7 @@ void WebView::loadClickedFrameInNewTab()
void WebView::reloadClickedFrame()
{
QUrl frameUrl = m_clickedFrame->url();
QUrl frameUrl = m_clickedFrame->baseUrl();
if (frameUrl.isEmpty()) {
frameUrl = m_clickedFrame->requestedUrl();
}

View File

@ -53,7 +53,6 @@ public:
signals:
void viewportResized(QSize);
void showNotification(QWidget*);
void iconChanged();
public slots:
void zoomIn();
@ -134,6 +133,8 @@ protected:
private slots:
void pauseMedia();
void muteMedia();
void frameStateChanged();
void emitChangedUrl();
private:
QList<int> m_zoomLevels;