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 optional (to correctly detect versions of QtWebKit)
* pkg-config is required for Hunspell spellcheck * pkg-config is required for Hunspell spellcheck
* Hunspell development package for spellcheck * Hunspell development package for spellcheck
* QtWebKit 2.3 is needed to have support for spellcheck
**Windows** **Windows**
* QtWebKit 2.3 is required * QtWebKit 2.3 is required

View File

@ -21,6 +21,7 @@
#include "networkmanagerproxy.h" #include "networkmanagerproxy.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "webpage.h" #include "webpage.h"
#include "tabbedwebview.h"
#include "pluginproxy.h" #include "pluginproxy.h"
#include "adblockmanager.h" #include "adblockmanager.h"
#include "networkproxyfactory.h" #include "networkproxyfactory.h"
@ -300,9 +301,20 @@ void NetworkManager::authentication(QNetworkReply* reply, QAuthenticator* auth)
pass->setText(storedPassword); pass->setText(storedPassword);
} }
} }
emit wantsFocus(reply->url());
//Do not save when private browsing is enabled // 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()) { if (mApp->isPrivateSession()) {
save->setVisible(false); save->setVisible(false);
} }

View File

@ -58,7 +58,6 @@ public:
void disconnectObjects(); void disconnectObjects();
signals: signals:
void wantsFocus(const QUrl &url);
void sslDialogClosed(); void sslDialogClosed();
private slots: 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(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))); connect(p_QupZilla, SIGNAL(setWebViewMouseTracking(bool)), this, SLOT(trackMouse(bool)));
// Tracking mouse also on tabs created in fullscreen // Tracking mouse also on tabs created in fullscreen
@ -302,11 +300,9 @@ void TabbedWebView::openNewTab()
m_tabWidget->addView(QUrl()); m_tabWidget->addView(QUrl());
} }
void TabbedWebView::getFocus(const QUrl &urla) void TabbedWebView::setAsCurrentTab()
{ {
if (urla == url()) { m_tabWidget->setCurrentWidget(m_webTab);
m_tabWidget->setCurrentWidget(m_webTab);
}
} }
void TabbedWebView::mouseMoveEvent(QMouseEvent* event) void TabbedWebView::mouseMoveEvent(QMouseEvent* event)

View File

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