diff --git a/src/lib/other/qzsettings.cpp b/src/lib/other/qzsettings.cpp index 4416ac031..41f1124aa 100644 --- a/src/lib/other/qzsettings.cpp +++ b/src/lib/other/qzsettings.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2014 David Rosca +* Copyright (C) 2010-2016 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -54,6 +54,7 @@ void QzSettings::loadSettings() settings.beginGroup("Browser-Tabs-Settings"); newTabPosition = settings.value("OpenNewTabsSelected", false).toBool() ? Qz::NT_CleanSelectedTab : Qz::NT_CleanNotSelectedTab; tabsOnTop = settings.value("TabsOnTop", true).toBool(); + openPopupsInTabs = settings.value("OpenPopupsInTabs", false).toBool(); alwaysSwitchTabsWithWheel = settings.value("AlwaysSwitchTabsWithWheel", false).toBool(); settings.endGroup(); } diff --git a/src/lib/other/qzsettings.h b/src/lib/other/qzsettings.h index fee2d6874..85e389333 100644 --- a/src/lib/other/qzsettings.h +++ b/src/lib/other/qzsettings.h @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2014 David Rosca +* Copyright (C) 2010-2016 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,6 +56,7 @@ public: // Browser-Tabs-Settings Qz::NewTabPositionFlags newTabPosition; bool tabsOnTop; + bool openPopupsInTabs; bool alwaysSwitchTabsWithWheel; }; diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index 80e287199..ac25d94d7 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2015 David Rosca +* Copyright (C) 2010-2016 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -230,6 +230,7 @@ Preferences::Preferences(BrowserWindow* window) ui->activateLastTab->setChecked(settings.value("ActivateLastTabWhenClosingActual", false).toBool()); ui->openNewTabAfterActive->setChecked(settings.value("newTabAfterActive", true).toBool()); ui->openNewEmptyTabAfterActive->setChecked(settings.value("newEmptyTabAfterActive", false).toBool()); + ui->openPopupsInTabs->setChecked(settings.value("OpenPopupsInTabs", false).toBool()); ui->alwaysSwitchTabsWithWheel->setChecked(settings.value("AlwaysSwitchTabsWithWheel", false).toBool()); ui->switchToNewTabs->setChecked(settings.value("OpenNewTabsSelected", false).toBool()); ui->dontCloseOnLastTab->setChecked(settings.value("dontCloseWithOneTab", false).toBool()); @@ -854,6 +855,7 @@ void Preferences::saveSettings() settings.setValue("ActivateLastTabWhenClosingActual", ui->activateLastTab->isChecked()); settings.setValue("newTabAfterActive", ui->openNewTabAfterActive->isChecked()); settings.setValue("newEmptyTabAfterActive", ui->openNewEmptyTabAfterActive->isChecked()); + settings.setValue("OpenPopupsInTabs", ui->openPopupsInTabs->isChecked()); settings.setValue("AlwaysSwitchTabsWithWheel", ui->alwaysSwitchTabsWithWheel->isChecked()); settings.setValue("OpenNewTabsSelected", ui->switchToNewTabs->isChecked()); settings.setValue("dontCloseWithOneTab", ui->dontCloseOnLastTab->isChecked()); diff --git a/src/lib/preferences/preferences.ui b/src/lib/preferences/preferences.ui index dfec65689..d65c7a83d 100644 --- a/src/lib/preferences/preferences.ui +++ b/src/lib/preferences/preferences.ui @@ -7,7 +7,7 @@ 0 0 840 - 554 + 550 @@ -140,8 +140,8 @@ 0 0 - 596 - 468 + 582 + 489 @@ -694,6 +694,13 @@ + + + + Open popup windows in tabs + + + diff --git a/src/lib/webengine/webpage.cpp b/src/lib/webengine/webpage.cpp index 3dca96cc9..d2b58a189 100644 --- a/src/lib/webengine/webpage.cpp +++ b/src/lib/webengine/webpage.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2015 David Rosca +* Copyright (C) 2010-2016 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -587,6 +587,17 @@ QWebEnginePage* WebPage::createWindow(QWebEnginePage::WebWindowType type) qWarning() << "Asked to created WebBrowserWindow!"; break; + case QWebEnginePage::WebDialog: + if (!qzSettings->openPopupsInTabs) { + PopupWebView* view = new PopupWebView; + view->setPage(new WebPage); + PopupWindow* popup = new PopupWindow(view); + popup->show(); + window->addDeleteOnCloseWidget(popup); + return view->page(); + } + // else fallthrough + case QWebEnginePage::WebBrowserTab: { int index = window->tabWidget()->addView(QUrl(), Qz::NT_CleanSelectedTab); TabbedWebView* view = window->weView(index); @@ -594,15 +605,6 @@ QWebEnginePage* WebPage::createWindow(QWebEnginePage::WebWindowType type) return view->page(); } - case QWebEnginePage::WebDialog: { - PopupWebView* view = new PopupWebView; - view->setPage(new WebPage); - PopupWindow* popup = new PopupWindow(view); - popup->show(); - window->addDeleteOnCloseWidget(popup); - return view->page(); - } - default: break; }