1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

Add option to open popup windows in tabs

Closes #1796
This commit is contained in:
David Rosca 2016-02-14 10:37:28 +01:00
parent 9c082ac480
commit e487e4c1f6
5 changed files with 29 additions and 16 deletions

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
*
* 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();
}

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
*
* 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;
};

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2015 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
*
* 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());

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>840</width>
<height>554</height>
<height>550</height>
</rect>
</property>
<property name="windowTitle">
@ -140,8 +140,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>596</width>
<height>468</height>
<width>582</width>
<height>489</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
@ -694,6 +694,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="openPopupsInTabs">
<property name="text">
<string>Open popup windows in tabs</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="alwaysSwitchTabsWithWheel">
<property name="text">

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2015 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
*
* 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;
}