diff --git a/README.md b/README.md index 8f14cca5c..e1a14d491 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/lib/network/networkmanager.cpp b/src/lib/network/networkmanager.cpp index c57cd2a9d..a467cf4be 100644 --- a/src/lib/network/networkmanager.cpp +++ b/src/lib/network/networkmanager.cpp @@ -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,9 +301,20 @@ void NetworkManager::authentication(QNetworkReply* reply, QAuthenticator* auth) 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(reply->request().originatingObject()); + if (frame) { + WebPage* page = qobject_cast(frame->page()); + if (page) { + TabbedWebView* view = qobject_cast(page->view()); + if (view) { + view->setAsCurrentTab(); + } + } + } + + // Do not save when private browsing is enabled if (mApp->isPrivateSession()) { save->setVisible(false); } diff --git a/src/lib/network/networkmanager.h b/src/lib/network/networkmanager.h index ee7e4f313..314d92ebf 100644 --- a/src/lib/network/networkmanager.h +++ b/src/lib/network/networkmanager.h @@ -58,7 +58,6 @@ public: void disconnectObjects(); signals: - void wantsFocus(const QUrl &url); void sslDialogClosed(); private slots: diff --git a/src/lib/webview/tabbedwebview.cpp b/src/lib/webview/tabbedwebview.cpp index d75234bea..419b24285 100644 --- a/src/lib/webview/tabbedwebview.cpp +++ b/src/lib/webview/tabbedwebview.cpp @@ -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,11 +300,9 @@ void TabbedWebView::openNewTab() 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) diff --git a/src/lib/webview/tabbedwebview.h b/src/lib/webview/tabbedwebview.h index f3c646cce..c6cbfb6e4 100644 --- a/src/lib/webview/tabbedwebview.h +++ b/src/lib/webview/tabbedwebview.h @@ -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();