try to fix calls to qprocess:startdetached
This commit is contained in:
parent
dfbaf3601d
commit
ab68236cbc
@ -26,7 +26,7 @@
|
||||
<url type="donation">https://github.com/sponsors/martinrotter</url>
|
||||
<content_rating type="oars-1.1" />
|
||||
<releases>
|
||||
<release version="4.2.3" date="2022-06-21"/>
|
||||
<release version="4.2.3" date="2022-07-07"/>
|
||||
</releases>
|
||||
<content_rating type="oars-1.0">
|
||||
<content_attribute id="violence-cartoon">none</content_attribute>
|
||||
|
@ -80,7 +80,7 @@ cd "$old_pwd"
|
||||
# Build application.
|
||||
mkdir "rssguard-build"
|
||||
cd "rssguard-build"
|
||||
& "$cmake_path" ".." -G Ninja -DCMAKE_BUILD_TYPE="Release" -DBUILD_WITH_QT6="$with_qt6" -DREVISION_FROM_GIT=ON -DUSE_WEBENGINE="$webengine" -DFEEDLY_CLIENT_ID="$env:FEEDLY_CLIENT_ID" -DFEEDLY_CLIENT_SECRET="$env:FEEDLY_CLIENT_SECRET" -DGMAIL_CLIENT_ID="$env:GMAIL_CLIENT_ID" -DGMAIL_CLIENT_SECRET="$env:GMAIL_CLIENT_SECRET" -DINOREADER_CLIENT_ID="$env:INOREADER_CLIENT_ID" -DINOREADER_CLIENT_SECRET="$env:INOREADER_CLIENT_SECRET"
|
||||
& "$cmake_path" ".." -G Ninja -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DBUILD_WITH_QT6="$with_qt6" -DREVISION_FROM_GIT=ON -DUSE_WEBENGINE="$webengine" -DFEEDLY_CLIENT_ID="$env:FEEDLY_CLIENT_ID" -DFEEDLY_CLIENT_SECRET="$env:FEEDLY_CLIENT_SECRET" -DGMAIL_CLIENT_ID="$env:GMAIL_CLIENT_ID" -DGMAIL_CLIENT_SECRET="$env:GMAIL_CLIENT_SECRET" -DINOREADER_CLIENT_ID="$env:INOREADER_CLIENT_ID" -DINOREADER_CLIENT_SECRET="$env:INOREADER_CLIENT_SECRET"
|
||||
& "$cmake_path" --build .
|
||||
& "$cmake_path" --install . --prefix app
|
||||
|
||||
|
@ -52,13 +52,14 @@
|
||||
|
||||
#define SOUNDS_BUILTIN_DIRECTORY ":/sounds"
|
||||
#define ARGUMENTS_LIST_SEPARATOR "\n"
|
||||
#define IS_IN_ARRAY(offset, \
|
||||
array) ((offset >= 0) && (offset < array.count()))
|
||||
#define IS_IN_ARRAY(offset, array) ((offset >= 0) && (offset < array.count()))
|
||||
#define DEFAULT_SQL_MESSAGES_FILTER "0 > 1"
|
||||
#define MAX_MULTICOLUMN_SORT_STATES 3
|
||||
#define RELEASES_LIST "https://api.github.com/repos/martinrotter/rssguard/releases"
|
||||
#define MSG_FILTERING_HELP "https://github.com/martinrotter/rssguard/blob/master/resources/docs/Documentation.md#fltr"
|
||||
#define URL_REGEXP "^(http|https|feed|ftp):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&:/~\\+#]*[\\w\\-\\@?^=%&/~\\+#])?$"
|
||||
#define URL_REGEXP \
|
||||
"^(http|https|feed|ftp):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&:/~\\+#]*[\\w\\-\\@?^=%&/" \
|
||||
"~\\+#])?$"
|
||||
#define SCRIPT_SOURCE_TYPE_REGEXP "^.+#.*$"
|
||||
#define TEXT_TITLE_LIMIT 30
|
||||
#define TEXT_TOOLTIP_LIMIT 50
|
||||
@ -96,7 +97,6 @@
|
||||
#define GOOGLE_SEARCH_URL "https://www.google.com/search?q=%1&ie=utf-8&oe=utf-8"
|
||||
#define GOOGLE_SUGGEST_URL "http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=%1"
|
||||
|
||||
#define EXECUTION_LINE_SEPARATOR "#"
|
||||
#define EXTERNAL_TOOL_SEPARATOR "|||"
|
||||
|
||||
#define USER_DATA_PLACEHOLDER "%data%"
|
||||
@ -164,11 +164,13 @@
|
||||
#define ZOOM_FACTOR_STEP 0.05f
|
||||
|
||||
#if defined(USE_WEBENGINE)
|
||||
#define HTTP_COMPLETE_USERAGENT (QWebEngineProfile::defaultProfile()->httpUserAgent().toLocal8Bit() + QByteArrayLiteral(" ") + QByteArrayLiteral(APP_USERAGENT))
|
||||
#define HTTP_COMPLETE_USERAGENT \
|
||||
(QWebEngineProfile::defaultProfile()->httpUserAgent().toLocal8Bit() + QByteArrayLiteral(" ") + \
|
||||
QByteArrayLiteral(APP_USERAGENT))
|
||||
#else
|
||||
#define HTTP_COMPLETE_USERAGENT (QByteArrayLiteral( \
|
||||
"Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.15.2 Chrome/83.0.4103.122 Safari/537.36 ") \
|
||||
+ \
|
||||
#define HTTP_COMPLETE_USERAGENT \
|
||||
(QByteArrayLiteral("Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " \
|
||||
"QtWebEngine/5.15.2 Chrome/83.0.4103.122 Safari/537.36 ") + \
|
||||
QByteArrayLiteral(APP_USERAGENT))
|
||||
#endif
|
||||
|
||||
|
@ -35,11 +35,15 @@ SingleNotificationEditor::SingleNotificationEditor(const Notification& notificat
|
||||
}
|
||||
|
||||
Notification SingleNotificationEditor::notification() const {
|
||||
return Notification(m_notificationEvent, m_ui.m_cbBalloon->isChecked(), m_ui.m_txtSound->text(), m_ui.m_slidVolume->value());
|
||||
return Notification(m_notificationEvent,
|
||||
m_ui.m_cbBalloon->isChecked(),
|
||||
m_ui.m_txtSound->text(),
|
||||
m_ui.m_slidVolume->value());
|
||||
}
|
||||
|
||||
void SingleNotificationEditor::selectSoundFile() {
|
||||
auto fil = QFileDialog::getOpenFileName(window(), tr("Select sound file"),
|
||||
auto fil = QFileDialog::getOpenFileName(window(),
|
||||
tr("Select sound file"),
|
||||
qApp->homeFolder(),
|
||||
tr("WAV files (*.wav);;MP3 files (*.mp3)"));
|
||||
|
||||
|
@ -82,6 +82,9 @@
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSlider" name="m_slidVolume">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
@ -74,6 +74,11 @@ bool ExternalTool::run(const QString& target) {
|
||||
return IOFactory::startProcessDetached(executable(), {target});
|
||||
}
|
||||
else {
|
||||
return IOFactory::startProcessDetached(executable(), QStringList() << parameters() << target);
|
||||
auto pars = parameters();
|
||||
pars += QSL(" \"%1\"").arg(target);
|
||||
|
||||
auto params = TextFactory::tokenizeProcessArguments(pars);
|
||||
|
||||
return IOFactory::startProcessDetached(executable(), params);
|
||||
}
|
||||
}
|
||||
|
@ -72,23 +72,13 @@ QString IOFactory::filterBadCharsFromFilename(const QString& name) {
|
||||
return value;
|
||||
}
|
||||
|
||||
bool IOFactory::startProcessDetached(const QString& program, const QStringList& arguments,
|
||||
const QString& native_arguments, const QString& working_directory) {
|
||||
bool IOFactory::startProcessDetached(const QString& executable,
|
||||
const QStringList& arguments,
|
||||
const QString& working_directory) {
|
||||
QProcess process;
|
||||
|
||||
process.setProgram(program);
|
||||
process.setProgram(executable);
|
||||
process.setArguments(arguments);
|
||||
|
||||
#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
|
||||
if (!native_arguments.isEmpty()) {
|
||||
process.setNativeArguments(native_arguments);
|
||||
}
|
||||
#else
|
||||
if (arguments.isEmpty() && !native_arguments.isEmpty()) {
|
||||
process.setArguments({ native_arguments });
|
||||
}
|
||||
#endif
|
||||
|
||||
process.setWorkingDirectory(working_directory);
|
||||
|
||||
return process.startDetached(nullptr);
|
||||
@ -134,8 +124,7 @@ QString IOFactory::startProcessGetOutput(const QString& executable,
|
||||
|
||||
proc.start();
|
||||
|
||||
if (proc.waitForFinished() &&
|
||||
proc.exitStatus() == QProcess::ExitStatus::NormalExit &&
|
||||
if (proc.waitForFinished() && proc.exitStatus() == QProcess::ExitStatus::NormalExit &&
|
||||
proc.exitCode() == EXIT_SUCCESS) {
|
||||
return proc.readAllStandardOutput();
|
||||
}
|
||||
@ -179,11 +168,8 @@ bool IOFactory::copyFile(const QString& source, const QString& destination) {
|
||||
if (QFile::exists(destination)) {
|
||||
QFile file(destination);
|
||||
|
||||
file.setPermissions(file.permissions() |
|
||||
QFileDevice::WriteOwner |
|
||||
QFileDevice::WriteUser |
|
||||
QFileDevice::WriteGroup |
|
||||
QFileDevice::WriteOther);
|
||||
file.setPermissions(file.permissions() | QFileDevice::WriteOwner | QFileDevice::WriteUser |
|
||||
QFileDevice::WriteGroup | QFileDevice::WriteOther);
|
||||
|
||||
if (!QFile::remove(destination)) {
|
||||
return false;
|
||||
|
@ -28,9 +28,8 @@ class IOFactory {
|
||||
|
||||
// Filters out shit characters from filename.
|
||||
static QString filterBadCharsFromFilename(const QString& name);
|
||||
static bool startProcessDetached(const QString& program,
|
||||
const QStringList& arguments,
|
||||
const QString& native_arguments = {},
|
||||
static bool startProcessDetached(const QString& executable,
|
||||
const QStringList& arguments = {},
|
||||
const QString& working_directory = {});
|
||||
static void startProcess(QProcess* const proc,
|
||||
const QString& executable,
|
||||
|
@ -50,14 +50,15 @@ void Notification::playSound(Application* app) const {
|
||||
|
||||
if (m_soundPath.startsWith(QSL(":"))) {
|
||||
play->setSource(QUrl(QSL("qrc") + m_soundPath));
|
||||
|
||||
}
|
||||
else {
|
||||
play->setSource(QUrl::fromLocalFile(
|
||||
QDir::toNativeSeparators(app->replaceDataUserDataFolderPlaceholder(m_soundPath))));
|
||||
play
|
||||
->setSource(QUrl::
|
||||
fromLocalFile(QDir::toNativeSeparators(app
|
||||
->replaceDataUserDataFolderPlaceholder(m_soundPath))));
|
||||
}
|
||||
|
||||
play->setVolume(m_volume);
|
||||
play->setVolume(fractionalVolume());
|
||||
play->play();
|
||||
}
|
||||
else {
|
||||
@ -79,13 +80,15 @@ void Notification::playSound(Application* app) const {
|
||||
|
||||
if (m_soundPath.startsWith(QSL(":"))) {
|
||||
play->setSource(QUrl(QSL("qrc") + m_soundPath));
|
||||
|
||||
}
|
||||
else {
|
||||
play->setSource(QUrl::fromLocalFile(QDir::toNativeSeparators(app->replaceDataUserDataFolderPlaceholder(m_soundPath))));
|
||||
play
|
||||
->setSource(QUrl::
|
||||
fromLocalFile(QDir::toNativeSeparators(app
|
||||
->replaceDataUserDataFolderPlaceholder(m_soundPath))));
|
||||
}
|
||||
|
||||
play->audioOutput()->setVolume((m_volume * 1.0f) / 100.0f);
|
||||
play->audioOutput()->setVolume(fractionalVolume());
|
||||
play->play();
|
||||
#else
|
||||
QObject::connect(play, &QMediaPlayer::stateChanged, play, [play](QMediaPlayer::State state) {
|
||||
@ -96,12 +99,10 @@ void Notification::playSound(Application* app) const {
|
||||
|
||||
if (m_soundPath.startsWith(QSL(":"))) {
|
||||
play->setMedia(QMediaContent(QUrl(QSL("qrc") + m_soundPath)));
|
||||
|
||||
}
|
||||
else {
|
||||
play->setMedia(QMediaContent(
|
||||
QUrl::fromLocalFile(
|
||||
QDir::toNativeSeparators(app->replaceDataUserDataFolderPlaceholder(m_soundPath)))));
|
||||
QUrl::fromLocalFile(QDir::toNativeSeparators(app->replaceDataUserDataFolderPlaceholder(m_soundPath)))));
|
||||
}
|
||||
|
||||
play->setVolume(m_volume);
|
||||
@ -113,16 +114,14 @@ void Notification::playSound(Application* app) const {
|
||||
}
|
||||
|
||||
QList<Notification::Event> Notification::allEvents() {
|
||||
return {
|
||||
Event::GeneralEvent,
|
||||
return {Event::GeneralEvent,
|
||||
Event::NewUnreadArticlesFetched,
|
||||
Event::ArticlesFetchingStarted,
|
||||
Event::LoginDataRefreshed,
|
||||
Event::LoginFailure,
|
||||
Event::NewAppVersionAvailable,
|
||||
Event::NodePackageUpdated,
|
||||
Event::NodePackageFailedToUpdate
|
||||
};
|
||||
Event::NodePackageFailedToUpdate};
|
||||
}
|
||||
|
||||
QString Notification::nameForEvent(Notification::Event event) {
|
||||
@ -160,6 +159,10 @@ int Notification::volume() const {
|
||||
return m_volume;
|
||||
}
|
||||
|
||||
qreal Notification::fractionalVolume() const {
|
||||
return (m_volume * 1.0f) / 100.0f;
|
||||
}
|
||||
|
||||
void Notification::setVolume(int volume) {
|
||||
m_volume = volume;
|
||||
}
|
||||
|
@ -43,7 +43,9 @@ class Notification {
|
||||
NodePackageFailedToUpdate = 8
|
||||
};
|
||||
|
||||
explicit Notification(Event event = Event::NoEvent, bool balloon = {}, const QString& sound_path = {},
|
||||
explicit Notification(Event event = Event::NoEvent,
|
||||
bool balloon = {},
|
||||
const QString& sound_path = {},
|
||||
int volume = DEFAULT_NOTIFICATION_VOLUME);
|
||||
|
||||
bool balloonEnabled() const;
|
||||
@ -52,6 +54,7 @@ class Notification {
|
||||
void setEvent(Event event);
|
||||
|
||||
int volume() const;
|
||||
qreal fractionalVolume() const;
|
||||
void setVolume(int volume);
|
||||
|
||||
// Returns full path to audio file which should be played when notification
|
||||
@ -69,7 +72,7 @@ class Notification {
|
||||
Event m_event;
|
||||
bool m_balloonEnabled;
|
||||
QString m_soundPath;
|
||||
int m_volume;
|
||||
qreal m_volume;
|
||||
};
|
||||
|
||||
#endif // NOTIFICATION_H
|
||||
|
@ -28,8 +28,7 @@
|
||||
#include <QWebEngineUrlScheme>
|
||||
#endif
|
||||
|
||||
WebFactory::WebFactory(QObject* parent)
|
||||
: QObject(parent) {
|
||||
WebFactory::WebFactory(QObject* parent) : QObject(parent) {
|
||||
m_adBlock = new AdBlockManager(this);
|
||||
|
||||
#if defined(USE_WEBENGINE)
|
||||
@ -63,17 +62,21 @@ WebFactory::~WebFactory() {
|
||||
|
||||
bool WebFactory::sendMessageViaEmail(const Message& message) {
|
||||
if (qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailEnabled)).toBool()) {
|
||||
const QString browser = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailExecutable)).toString();
|
||||
const QString arguments = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailArguments)).toString();
|
||||
const QString browser =
|
||||
qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailExecutable)).toString();
|
||||
const QString arguments =
|
||||
qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailArguments)).toString();
|
||||
const QStringList tokenized_arguments =
|
||||
TextFactory::tokenizeProcessArguments(arguments.arg(message.m_title, stripTags(message.m_contents)));
|
||||
|
||||
return IOFactory::startProcessDetached(browser, {}, arguments.arg(message.m_title, stripTags(message.m_contents)));
|
||||
return IOFactory::startProcessDetached(browser, tokenized_arguments);
|
||||
}
|
||||
else {
|
||||
// Send it via mailto protocol.
|
||||
// NOTE: http://en.wikipedia.org/wiki/Mailto
|
||||
return QDesktopServices::openUrl(QSL("mailto:?subject=%1&body=%2").arg(QString(QUrl::toPercentEncoding(message.m_title)),
|
||||
QString(QUrl::toPercentEncoding(stripTags(
|
||||
message.m_contents)))));
|
||||
return QDesktopServices::openUrl(QSL("mailto:?subject=%1&body=%2")
|
||||
.arg(QString(QUrl::toPercentEncoding(message.m_title)),
|
||||
QString(QUrl::toPercentEncoding(stripTags(message.m_contents)))));
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,13 +86,15 @@ bool WebFactory::openUrlInExternalBrowser(const QString& url) const {
|
||||
bool result = false;
|
||||
|
||||
if (qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserEnabled)).toBool()) {
|
||||
const QString browser = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserExecutable)).toString();
|
||||
const QString arguments = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserArguments)).toString();
|
||||
auto nice_args = arguments.arg(url);
|
||||
const QString browser =
|
||||
qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserExecutable)).toString();
|
||||
const QString arguments =
|
||||
qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserArguments)).toString();
|
||||
const auto nice_args = arguments.arg(url);
|
||||
|
||||
qDebugNN << LOGSEC_NETWORK << "Arguments for external browser:" << QUOTE_W_SPACE_DOT(nice_args);
|
||||
|
||||
result = IOFactory::startProcessDetached(browser, {}, nice_args);
|
||||
result = IOFactory::startProcessDetached(browser, TextFactory::tokenizeProcessArguments(nice_args));
|
||||
|
||||
if (!result) {
|
||||
qDebugNN << LOGSEC_NETWORK << "External web browser call failed.";
|
||||
@ -105,7 +110,8 @@ bool WebFactory::openUrlInExternalBrowser(const QString& url) const {
|
||||
QMessageBox::Icon::Critical,
|
||||
tr("Navigate to website manually"),
|
||||
tr("%1 was unable to launch your web browser with the given URL, you need to open the "
|
||||
"below website URL in your web browser manually.").arg(QSL(APP_NAME)),
|
||||
"below website URL in your web browser manually.")
|
||||
.arg(QSL(APP_NAME)),
|
||||
{},
|
||||
url,
|
||||
QMessageBox::StandardButton::Ok);
|
||||
@ -127,7 +133,8 @@ QString WebFactory::unescapeHtml(const QString& html) {
|
||||
generateUnescapes();
|
||||
}
|
||||
|
||||
QString output; output.reserve(html.size());
|
||||
QString output;
|
||||
output.reserve(html.size());
|
||||
|
||||
// Traverse input HTML string and replace named/number entities.
|
||||
for (int pos = 0; pos < html.size();) {
|
||||
@ -223,9 +230,8 @@ QString WebFactory::processFeedUriScheme(const QString& url) {
|
||||
}
|
||||
|
||||
void WebFactory::updateProxy() {
|
||||
const QNetworkProxy::ProxyType selected_proxy_type = static_cast<QNetworkProxy::ProxyType>(qApp->settings()->value(GROUP(Proxy),
|
||||
SETTING(Proxy::Type)).
|
||||
toInt());
|
||||
const QNetworkProxy::ProxyType selected_proxy_type =
|
||||
static_cast<QNetworkProxy::ProxyType>(qApp->settings()->value(GROUP(Proxy), SETTING(Proxy::Type)).toInt());
|
||||
|
||||
if (selected_proxy_type == QNetworkProxy::NoProxy) {
|
||||
qDebugNN << LOGSEC_NETWORK << "Disabling application-wide proxy completely.";
|
||||
@ -249,10 +255,8 @@ void WebFactory::updateProxy() {
|
||||
new_proxy.setPassword(settings->password(GROUP(Proxy), SETTING(Proxy::Password)).toString());
|
||||
|
||||
qWarningNN << LOGSEC_NETWORK
|
||||
<< "Activating application-wide custom proxy, address:"
|
||||
<< QUOTE_W_SPACE_COMMA(new_proxy.hostName())
|
||||
<< " type:"
|
||||
<< QUOTE_W_SPACE_DOT(new_proxy.type());
|
||||
<< "Activating application-wide custom proxy, address:" << QUOTE_W_SPACE_COMMA(new_proxy.hostName())
|
||||
<< " type:" << QUOTE_W_SPACE_DOT(new_proxy.type());
|
||||
|
||||
QNetworkProxy::setApplicationProxy(new_proxy);
|
||||
}
|
||||
@ -269,7 +273,8 @@ NetworkUrlInterceptor* WebFactory::urlIinterceptor() const {
|
||||
|
||||
QAction* WebFactory::engineSettingsAction() {
|
||||
if (m_engineSettings == nullptr) {
|
||||
m_engineSettings = new QAction(qApp->icons()->fromTheme(QSL("applications-internet")), tr("Web engine settings"), this);
|
||||
m_engineSettings =
|
||||
new QAction(qApp->icons()->fromTheme(QSL("applications-internet")), tr("Web engine settings"), this);
|
||||
m_engineSettings->setMenu(new QMenu());
|
||||
createMenu(m_engineSettings->menu());
|
||||
connect(m_engineSettings->menu(), &QMenu::aboutToShow, this, [this]() {
|
||||
@ -294,35 +299,56 @@ void WebFactory::createMenu(QMenu* menu) {
|
||||
|
||||
actions << createEngineSettingsAction(tr("Auto-load images"), QWebEngineSettings::WebAttribute::AutoLoadImages);
|
||||
actions << createEngineSettingsAction(tr("JS enabled"), QWebEngineSettings::WebAttribute::JavascriptEnabled);
|
||||
actions << createEngineSettingsAction(tr("JS can open popup windows"), QWebEngineSettings::WebAttribute::JavascriptCanOpenWindows);
|
||||
actions << createEngineSettingsAction(tr("JS can access clipboard"), QWebEngineSettings::WebAttribute::JavascriptCanAccessClipboard);
|
||||
actions << createEngineSettingsAction(tr("Hyperlinks can get focus"), QWebEngineSettings::WebAttribute::LinksIncludedInFocusChain);
|
||||
actions << createEngineSettingsAction(tr("Local storage enabled"), QWebEngineSettings::WebAttribute::LocalStorageEnabled);
|
||||
actions << createEngineSettingsAction(tr("Local content can access remote URLs"), QWebEngineSettings::WebAttribute::LocalContentCanAccessRemoteUrls);
|
||||
actions << createEngineSettingsAction(tr("XSS auditing enabled"), QWebEngineSettings::WebAttribute::XSSAuditingEnabled);
|
||||
actions << createEngineSettingsAction(tr("Spatial navigation enabled"), QWebEngineSettings::WebAttribute::SpatialNavigationEnabled);
|
||||
actions << createEngineSettingsAction(tr("Local content can access local files"), QWebEngineSettings::WebAttribute::LocalContentCanAccessFileUrls);
|
||||
actions << createEngineSettingsAction(tr("Hyperlink auditing enabled"), QWebEngineSettings::WebAttribute::HyperlinkAuditingEnabled);
|
||||
actions << createEngineSettingsAction(tr("Animate scrolling"), QWebEngineSettings::WebAttribute::ScrollAnimatorEnabled);
|
||||
actions << createEngineSettingsAction(tr("JS can open popup windows"),
|
||||
QWebEngineSettings::WebAttribute::JavascriptCanOpenWindows);
|
||||
actions << createEngineSettingsAction(tr("JS can access clipboard"),
|
||||
QWebEngineSettings::WebAttribute::JavascriptCanAccessClipboard);
|
||||
actions << createEngineSettingsAction(tr("Hyperlinks can get focus"),
|
||||
QWebEngineSettings::WebAttribute::LinksIncludedInFocusChain);
|
||||
actions << createEngineSettingsAction(tr("Local storage enabled"),
|
||||
QWebEngineSettings::WebAttribute::LocalStorageEnabled);
|
||||
actions << createEngineSettingsAction(tr("Local content can access remote URLs"),
|
||||
QWebEngineSettings::WebAttribute::LocalContentCanAccessRemoteUrls);
|
||||
actions << createEngineSettingsAction(tr("XSS auditing enabled"),
|
||||
QWebEngineSettings::WebAttribute::XSSAuditingEnabled);
|
||||
actions << createEngineSettingsAction(tr("Spatial navigation enabled"),
|
||||
QWebEngineSettings::WebAttribute::SpatialNavigationEnabled);
|
||||
actions << createEngineSettingsAction(tr("Local content can access local files"),
|
||||
QWebEngineSettings::WebAttribute::LocalContentCanAccessFileUrls);
|
||||
actions << createEngineSettingsAction(tr("Hyperlink auditing enabled"),
|
||||
QWebEngineSettings::WebAttribute::HyperlinkAuditingEnabled);
|
||||
actions << createEngineSettingsAction(tr("Animate scrolling"),
|
||||
QWebEngineSettings::WebAttribute::ScrollAnimatorEnabled);
|
||||
actions << createEngineSettingsAction(tr("Error pages enabled"), QWebEngineSettings::WebAttribute::ErrorPageEnabled);
|
||||
actions << createEngineSettingsAction(tr("Plugins enabled"), QWebEngineSettings::WebAttribute::PluginsEnabled);
|
||||
actions << createEngineSettingsAction(tr("Fullscreen enabled"), QWebEngineSettings::WebAttribute::FullScreenSupportEnabled);
|
||||
actions << createEngineSettingsAction(tr("Fullscreen enabled"),
|
||||
QWebEngineSettings::WebAttribute::FullScreenSupportEnabled);
|
||||
|
||||
#if !defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
||||
actions << createEngineSettingsAction(tr("Screen capture enabled"), QWebEngineSettings::WebAttribute::ScreenCaptureEnabled);
|
||||
actions << createEngineSettingsAction(tr("Screen capture enabled"),
|
||||
QWebEngineSettings::WebAttribute::ScreenCaptureEnabled);
|
||||
actions << createEngineSettingsAction(tr("WebGL enabled"), QWebEngineSettings::WebAttribute::WebGLEnabled);
|
||||
actions << createEngineSettingsAction(tr("Accelerate 2D canvas"), QWebEngineSettings::WebAttribute::Accelerated2dCanvasEnabled);
|
||||
actions << createEngineSettingsAction(tr("Print element backgrounds"), QWebEngineSettings::WebAttribute::PrintElementBackgrounds);
|
||||
actions << createEngineSettingsAction(tr("Allow running insecure content"), QWebEngineSettings::WebAttribute::AllowRunningInsecureContent);
|
||||
actions << createEngineSettingsAction(tr("Allow geolocation on insecure origins"), QWebEngineSettings::WebAttribute::AllowGeolocationOnInsecureOrigins);
|
||||
actions << createEngineSettingsAction(tr("Accelerate 2D canvas"),
|
||||
QWebEngineSettings::WebAttribute::Accelerated2dCanvasEnabled);
|
||||
actions << createEngineSettingsAction(tr("Print element backgrounds"),
|
||||
QWebEngineSettings::WebAttribute::PrintElementBackgrounds);
|
||||
actions << createEngineSettingsAction(tr("Allow running insecure content"),
|
||||
QWebEngineSettings::WebAttribute::AllowRunningInsecureContent);
|
||||
actions << createEngineSettingsAction(tr("Allow geolocation on insecure origins"),
|
||||
QWebEngineSettings::WebAttribute::AllowGeolocationOnInsecureOrigins);
|
||||
#endif
|
||||
|
||||
actions << createEngineSettingsAction(tr("JS can activate windows"), QWebEngineSettings::WebAttribute::AllowWindowActivationFromJavaScript);
|
||||
actions << createEngineSettingsAction(tr("JS can activate windows"),
|
||||
QWebEngineSettings::WebAttribute::AllowWindowActivationFromJavaScript);
|
||||
actions << createEngineSettingsAction(tr("Show scrollbars"), QWebEngineSettings::WebAttribute::ShowScrollBars);
|
||||
actions << createEngineSettingsAction(tr("Media playback with gestures"), QWebEngineSettings::WebAttribute::PlaybackRequiresUserGesture);
|
||||
actions << createEngineSettingsAction(tr("WebRTC uses only public interfaces"), QWebEngineSettings::WebAttribute::WebRTCPublicInterfacesOnly);
|
||||
actions << createEngineSettingsAction(tr("JS can paste from clipboard"), QWebEngineSettings::WebAttribute::JavascriptCanPaste);
|
||||
actions << createEngineSettingsAction(tr("DNS prefetch enabled"), QWebEngineSettings::WebAttribute::DnsPrefetchEnabled);
|
||||
actions << createEngineSettingsAction(tr("Media playback with gestures"),
|
||||
QWebEngineSettings::WebAttribute::PlaybackRequiresUserGesture);
|
||||
actions << createEngineSettingsAction(tr("WebRTC uses only public interfaces"),
|
||||
QWebEngineSettings::WebAttribute::WebRTCPublicInterfacesOnly);
|
||||
actions << createEngineSettingsAction(tr("JS can paste from clipboard"),
|
||||
QWebEngineSettings::WebAttribute::JavascriptCanPaste);
|
||||
actions << createEngineSettingsAction(tr("DNS prefetch enabled"),
|
||||
QWebEngineSettings::WebAttribute::DnsPrefetchEnabled);
|
||||
|
||||
#if QT_VERSION >= 0x050D00 // Qt >= 5.13.0
|
||||
actions << createEngineSettingsAction(tr("PDF viewer enabled"), QWebEngineSettings::WebAttribute::PdfViewerEnabled);
|
||||
@ -345,7 +371,9 @@ QAction* WebFactory::createEngineSettingsAction(const QString& title, QWebEngine
|
||||
|
||||
act->setData(attribute);
|
||||
act->setCheckable(true);
|
||||
act->setChecked(qApp->settings()->value(WebEngineAttributes::ID, QString::number(static_cast<int>(attribute)), true).toBool());
|
||||
act->setChecked(qApp->settings()
|
||||
->value(WebEngineAttributes::ID, QString::number(static_cast<int>(attribute)), true)
|
||||
.toBool());
|
||||
QWebEngineProfile::defaultProfile()->settings()->setAttribute(attribute, act->isChecked());
|
||||
connect(act, &QAction::toggled, this, &WebFactory::webEngineSettingChanged);
|
||||
return act;
|
||||
|
Loading…
x
Reference in New Issue
Block a user