1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

[code] Remove wantsFocus(QUrl) signal. Instead using better solution.

When HTTP authorization is requested, this signal is used to
set the originating WebTab as current widget in tabwidget.
This commit is contained in:
nowrep 2013-02-10 10:38:12 +01:00
parent 00cf5cdbd2
commit d8527917ca
5 changed files with 18 additions and 10 deletions

View File

@ -44,6 +44,7 @@ and you have read the BUILDING information.
* pkg-config is optional (to correctly detect versions of QtWebKit)
* pkg-config is required for Hunspell spellcheck
* Hunspell development package for spellcheck
* QtWebKit 2.3 is needed to have support for spellcheck
**Windows**
* QtWebKit 2.3 is required

View File

@ -21,6 +21,7 @@
#include "networkmanagerproxy.h"
#include "mainapplication.h"
#include "webpage.h"
#include "tabbedwebview.h"
#include "pluginproxy.h"
#include "adblockmanager.h"
#include "networkproxyfactory.h"
@ -300,7 +301,18 @@ void NetworkManager::authentication(QNetworkReply* reply, QAuthenticator* auth)
pass->setText(storedPassword);
}
}
emit wantsFocus(reply->url());
// Try to set the originating WebTab as a current tab
QWebFrame* frame = qobject_cast<QWebFrame*>(reply->request().originatingObject());
if (frame) {
WebPage* page = qobject_cast<WebPage*>(frame->page());
if (page) {
TabbedWebView* view = qobject_cast<TabbedWebView*>(page->view());
if (view) {
view->setAsCurrentTab();
}
}
}
// Do not save when private browsing is enabled
if (mApp->isPrivateSession()) {

View File

@ -58,7 +58,6 @@ public:
void disconnectObjects();
signals:
void wantsFocus(const QUrl &url);
void sslDialogClosed();
private slots:

View File

@ -57,8 +57,6 @@ TabbedWebView::TabbedWebView(QupZilla* mainClass, WebTab* webTab)
connect(this, SIGNAL(statusBarMessage(QString)), p_QupZilla->statusBar(), SLOT(showMessage(QString)));
connect(mApp->networkManager(), SIGNAL(wantsFocus(QUrl)), this, SLOT(getFocus(QUrl)));
connect(p_QupZilla, SIGNAL(setWebViewMouseTracking(bool)), this, SLOT(trackMouse(bool)));
// Tracking mouse also on tabs created in fullscreen
@ -302,12 +300,10 @@ void TabbedWebView::openNewTab()
m_tabWidget->addView(QUrl());
}
void TabbedWebView::getFocus(const QUrl &urla)
void TabbedWebView::setAsCurrentTab()
{
if (urla == url()) {
m_tabWidget->setCurrentWidget(m_webTab);
}
}
void TabbedWebView::mouseMoveEvent(QMouseEvent* event)
{

View File

@ -58,6 +58,7 @@ signals:
public slots:
void titleChanged();
void setAsCurrentTab();
void stop();
void showIcon();
@ -76,7 +77,6 @@ private slots:
void slotLoadFinished();
void urlChanged(const QUrl &url);
void linkHovered(const QString &link, const QString &title, const QString &content);
void getFocus(const QUrl &urla);
void setIp(const QHostInfo &info);
void checkRss();
void slotIconChanged();