mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
WebPage: Always build nonblock js dialogs support
Can be enabled with QUPZILLA_ENABLE_JS_NONBLOCK_DIALOGS environment variable.
This commit is contained in:
parent
642d835d55
commit
f87c6897a0
15
BUILDING.md
15
BUILDING.md
@ -73,21 +73,6 @@ Available Defines
|
||||
example:
|
||||
$ export PORTABLE_BUILD="true"
|
||||
|
||||
|
||||
NONBLOCK_JS_DIALOGS Enable non-blocking JavaScript dialogs from alert() prompt()
|
||||
and confirm() functions. They are shown inside page and are not
|
||||
blocking application window.
|
||||
However, due to synchronous API, there is a possible crash when
|
||||
closing browser windows with opened dialogs.
|
||||
If you can take this risk and/or make sure you aren't closing browser
|
||||
with opened dialogs, you may enable this option.
|
||||
These dialogs are much more beautiful than normal QDialogs.
|
||||
(disabled by default)
|
||||
|
||||
example:
|
||||
$ export NONBLOCK_JS_DIALOGS="true"
|
||||
|
||||
|
||||
Windows specific defines:
|
||||
|
||||
W7API Enable Windows 7 API support
|
||||
|
@ -55,10 +55,6 @@ option(PORTABLE_BUILD "TODO" OFF)
|
||||
if (PORTABLE_BUILD)
|
||||
add_definitions(-DPORTABLE_BUILD)
|
||||
endif()
|
||||
option(NONBLOCK_JS_DIALOGS "TODO" OFF)
|
||||
if (NONBLOCK_JS_DIALOGS)
|
||||
add_definitions(-DNONBLOCK_JS_DIALOGS)
|
||||
endif()
|
||||
option(DISABLE_DBUS "TODO" OFF)
|
||||
if (DISABLE_DBUS)
|
||||
add_definitions(-DDISABLE_DBUS)
|
||||
|
@ -39,15 +39,10 @@
|
||||
#include "networkmanager.h"
|
||||
#include "webhittestresult.h"
|
||||
#include "adblock/adblockmanager.h"
|
||||
|
||||
#ifdef NONBLOCK_JS_DIALOGS
|
||||
#include "ui_jsconfirm.h"
|
||||
#include "ui_jsalert.h"
|
||||
#include "ui_jsprompt.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <QDir>
|
||||
@ -60,12 +55,14 @@
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
#include <QAuthenticator>
|
||||
#include <QPushButton>
|
||||
|
||||
QString WebPage::s_lastUploadLocation = QDir::homePath();
|
||||
QUrl WebPage::s_lastUnsupportedUrl;
|
||||
QTime WebPage::s_lastUnsupportedUrlTime;
|
||||
|
||||
static const bool kEnableJsOutput = qEnvironmentVariableIsSet("QUPZILLA_ENABLE_JS_OUTPUT");
|
||||
static const bool kEnableJsNonBlockDialogs = qEnvironmentVariableIsSet("QUPZILLA_ENABLE_JS_NONBLOCK_DIALOGS");
|
||||
|
||||
WebPage::WebPage(QObject* parent)
|
||||
: QWebEnginePage(mApp->webProfile(), parent)
|
||||
@ -429,11 +426,10 @@ QVector<PasswordEntry> WebPage::autoFillData() const
|
||||
|
||||
bool WebPage::javaScriptPrompt(const QUrl &securityOrigin, const QString &msg, const QString &defaultValue, QString* result)
|
||||
{
|
||||
Q_UNUSED(securityOrigin)
|
||||
|
||||
#ifndef NONBLOCK_JS_DIALOGS
|
||||
if (!kEnableJsNonBlockDialogs) {
|
||||
return QWebEnginePage::javaScriptPrompt(securityOrigin, msg, defaultValue, result);
|
||||
#else
|
||||
}
|
||||
|
||||
if (m_runningLoop) {
|
||||
return false;
|
||||
}
|
||||
@ -469,16 +465,14 @@ bool WebPage::javaScriptPrompt(const QUrl &securityOrigin, const QString &msg, c
|
||||
view()->setFocus();
|
||||
|
||||
return _result;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool WebPage::javaScriptConfirm(const QUrl &securityOrigin, const QString &msg)
|
||||
{
|
||||
Q_UNUSED(securityOrigin)
|
||||
|
||||
#ifndef NONBLOCK_JS_DIALOGS
|
||||
if (!kEnableJsNonBlockDialogs) {
|
||||
return QWebEnginePage::javaScriptConfirm(securityOrigin, msg);
|
||||
#else
|
||||
}
|
||||
|
||||
if (m_runningLoop) {
|
||||
return false;
|
||||
}
|
||||
@ -510,7 +504,6 @@ bool WebPage::javaScriptConfirm(const QUrl &securityOrigin, const QString &msg)
|
||||
view()->setFocus();
|
||||
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
void WebPage::javaScriptAlert(const QUrl &securityOrigin, const QString &msg)
|
||||
@ -521,7 +514,7 @@ void WebPage::javaScriptAlert(const QUrl &securityOrigin, const QString &msg)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NONBLOCK_JS_DIALOGS
|
||||
if (!kEnableJsNonBlockDialogs) {
|
||||
QString title = tr("JavaScript alert");
|
||||
if (!url().host().isEmpty()) {
|
||||
title.append(QString(" - %1").arg(url().host()));
|
||||
@ -536,7 +529,9 @@ void WebPage::javaScriptAlert(const QUrl &securityOrigin, const QString &msg)
|
||||
dialog.exec();
|
||||
|
||||
m_blockAlerts = dialog.isChecked();
|
||||
#else
|
||||
return;
|
||||
}
|
||||
|
||||
ResizableFrame* widget = new ResizableFrame(view()->overlayWidget());
|
||||
|
||||
widget->setObjectName("jsFrame");
|
||||
@ -563,7 +558,6 @@ void WebPage::javaScriptAlert(const QUrl &securityOrigin, const QString &msg)
|
||||
delete widget;
|
||||
|
||||
view()->setFocus();
|
||||
#endif
|
||||
}
|
||||
|
||||
void WebPage::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString &message, int lineNumber, const QString &sourceID)
|
||||
|
Loading…
Reference in New Issue
Block a user