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