1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

Fixed opening popup windows with QtWebKit 2.3

It now correctly opens new tab / popup window
according to arguments in window.open call.
This commit is contained in:
nowrep 2013-01-19 01:05:17 +01:00
parent c43ca265f6
commit fa62b299a0
3 changed files with 28 additions and 16 deletions

View File

@ -21,7 +21,6 @@
#include "qupzilla.h"
#include "tabwidget.h"
#include "tabbedwebview.h"
#include "qzsettings.h"
#include <QTimer>
#include <QStatusBar>
@ -57,7 +56,11 @@ PopupWebPage::PopupWebPage(QWebPage::WebWindowType type, QupZilla* mainClass)
void PopupWebPage::slotGeometryChangeRequested(const QRect &rect)
{
if (rect.isValid() && qzSettings->allowJsGeometryChange) {
/* Very ugly hack for QtWebKit 2.3
* It now sends QRect(0, 25, 100x100) if the popup window
* geometry was not set in window.open call.
*/
if (rect.isValid() && rect != QRect(0, 25, 100, 100)) {
m_geometry = rect;
m_createNewWindow = true;
}
@ -65,25 +68,16 @@ void PopupWebPage::slotGeometryChangeRequested(const QRect &rect)
void PopupWebPage::slotMenuBarVisibilityChangeRequested(bool visible)
{
if (!qzSettings->allowJsHideMenuBar) {
return;
}
m_menuBarVisible = visible;
}
void PopupWebPage::slotStatusBarVisibilityChangeRequested(bool visible)
{
if (!qzSettings->allowJsHideStatusBar) {
return;
}
m_statusBarVisible = visible;
}
void PopupWebPage::slotToolBarVisibilityChangeRequested(bool visible)
{
if (!qzSettings->allowJsHideToolBar) {
return;
}
m_toolBarVisible = visible;
}

View File

@ -21,6 +21,7 @@
#include "popupstatusbarmessage.h"
#include "progressbar.h"
#include "qupzilla.h"
#include "qzsettings.h"
#include "popuplocationbar.h"
#include "globalfunctions.h"
@ -152,8 +153,17 @@ void PopupWindow::closeEvent(QCloseEvent* event)
event->accept();
}
void PopupWindow::titleChanged()
{
setWindowTitle(tr("%1 - QupZilla").arg(m_view->title()));
}
void PopupWindow::setWindowGeometry(const QRect &newRect)
{
if (!qzSettings->allowJsGeometryChange) {
return;
}
if (newRect.isValid()) {
QRect oldRect = rect();
move(newRect.topLeft());
@ -175,20 +185,27 @@ void PopupWindow::setWindowGeometry(const QRect &newRect)
void PopupWindow::setStatusBarVisibility(bool visible)
{
if (!qzSettings->allowJsHideStatusBar) {
return;
}
Q_UNUSED(visible)
}
void PopupWindow::setMenuBarVisibility(bool visible)
{
if (!qzSettings->allowJsHideMenuBar) {
return;
}
Q_UNUSED(visible)
}
void PopupWindow::setToolBarVisibility(bool visible)
{
if (!qzSettings->allowJsHideToolBar) {
return;
}
Q_UNUSED(visible)
}
void PopupWindow::titleChanged()
{
setWindowTitle(tr("%1 - QupZilla").arg(m_view->title()));
}

View File

@ -77,6 +77,7 @@ AcceptLanguage::AcceptLanguage(QWidget* parent)
Settings settings;
settings.beginGroup("Language");
QStringList langs = settings.value("acceptLanguage", defaultLanguage()).toStringList();
settings.endGroup();
foreach(const QString & code, langs) {
QString code_ = code;