From d5c9b4060128c62b0063693a52978d76017f0fd7 Mon Sep 17 00:00:00 2001 From: nowrep Date: Mon, 5 Dec 2011 16:12:48 +0100 Subject: [PATCH] [Fix:] Opening link (target=blank) in new selected tab (regression) --- src/webview/tabwidget.cpp | 6 +++--- src/webview/tabwidget.h | 2 +- src/webview/webpage.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/webview/tabwidget.cpp b/src/webview/tabwidget.cpp index e2966a478..bffa0708c 100644 --- a/src/webview/tabwidget.cpp +++ b/src/webview/tabwidget.cpp @@ -245,7 +245,7 @@ int TabWidget::addView(QUrl url, const QString &title, OpenUrlIn openIn, bool se { m_lastTabIndex = currentIndex(); - if (url.isEmpty() && openIn != CleanPage) { + if (url.isEmpty() && openIn != CleanPage && openIn != CleanSelectedPage) { url = m_urlOnNewTab; } @@ -259,7 +259,7 @@ int TabWidget::addView(QUrl url, const QString &title, OpenUrlIn openIn, bool se webView->animationLoading(index, true)->movie()->stop(); webView->animationLoading(index, false)->setPixmap(_iconForUrl(url).pixmap(16, 16)); - if (openIn == TabWidget::NewSelectedTab) { + if (openIn == NewSelectedTab || openIn == CleanSelectedPage) { setCurrentIndex(index); } @@ -289,7 +289,7 @@ int TabWidget::addView(QUrl url, const QString &title, OpenUrlIn openIn, bool se p_QupZilla->locationBar()->setFocus(); } - if (openIn == NewSelectedTab) { + if (openIn == NewSelectedTab || openIn == CleanSelectedPage) { m_isClosingToLastTabIndex = true; m_locationBars->setCurrentWidget(locBar); } diff --git a/src/webview/tabwidget.h b/src/webview/tabwidget.h index 4af4bed59..da55718f7 100644 --- a/src/webview/tabwidget.h +++ b/src/webview/tabwidget.h @@ -43,7 +43,7 @@ class TabWidget : public QTabWidget public: explicit TabWidget(QupZilla* mainclass, QWidget* parent = 0); ~TabWidget(); - enum OpenUrlIn { CurrentTab, NewSelectedTab, NewNotSelectedTab, NewTab = NewSelectedTab, CleanPage }; + enum OpenUrlIn { CurrentTab, NewSelectedTab, NewNotSelectedTab, NewTab = NewSelectedTab, CleanPage, CleanSelectedPage }; QByteArray saveState(); bool restoreState(const QByteArray &state); diff --git a/src/webview/webpage.cpp b/src/webview/webpage.cpp index a93ba68ac..7ce01ee2f 100644 --- a/src/webview/webpage.cpp +++ b/src/webview/webpage.cpp @@ -213,7 +213,7 @@ QWebPage* WebPage::createWindow(QWebPage::WebWindowType type) // view->show(); // return view->page(); Q_UNUSED(type); - int index = p_QupZilla->tabWidget()->addView(QUrl(), tr("New tab"), TabWidget::CleanPage); + int index = p_QupZilla->tabWidget()->addView(QUrl(), tr("New tab"), TabWidget::CleanSelectedPage); return p_QupZilla->weView(index)->page(); }