diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index eb100ed9d..2394438ac 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -245,8 +245,6 @@ set(SRCS ${SRCS}
tools/focusselectlineedit.cpp
tools/headerview.cpp
tools/horizontallistwidget.cpp
- tools/html5permissions/html5permissionsdialog.cpp
- tools/html5permissions/html5permissionsitem.cpp
tools/html5permissions/html5permissionsmanager.cpp
tools/html5permissions/html5permissionsnotification.cpp
tools/iconprovider.cpp
@@ -479,8 +477,6 @@ set(SRCS ${SRCS}
tools/focusselectlineedit.h
tools/headerview.h
tools/horizontallistwidget.h
- tools/html5permissions/html5permissionsdialog.h
- tools/html5permissions/html5permissionsitem.h
tools/html5permissions/html5permissionsmanager.h
tools/html5permissions/html5permissionsnotification.h
tools/iconprovider.h
@@ -569,8 +565,6 @@ qt_wrap_ui(SRCS
sidebar/historysidebar.ui
tools/certificateinfowidget.ui
tools/docktitlebarwidget.ui
- tools/html5permissions/html5permissionsdialog.ui
- tools/html5permissions/html5permissionsitem.ui
tools/html5permissions/html5permissionsnotification.ui
webengine/jsalert.ui
webengine/jsconfirm.ui
diff --git a/src/lib/other/sitesettingsmanager.cpp b/src/lib/other/sitesettingsmanager.cpp
index 712ee4621..34d6dedca 100644
--- a/src/lib/other/sitesettingsmanager.cpp
+++ b/src/lib/other/sitesettingsmanager.cpp
@@ -280,16 +280,6 @@ SiteSettingsManager::Permission SiteSettingsManager::getDefaultPermission(const
return defaultAttributes[attribute];
}
-void SiteSettingsManager::setDefaultPermission(const QWebEnginePage::Feature& feature, const SiteSettingsManager::Permission& value)
-{
- if (!supportedFeatures.contains(feature)) {
- qWarning() << "Unknown feature:" << feature;
- return;
- }
-
- defaultFeatures[feature] = value;
-}
-
SiteSettingsManager::Permission SiteSettingsManager::testAttribute(const QWebEngineSettings::WebAttribute attribute) const
{
if (mApp->webSettings()->testAttribute(attribute)) {
diff --git a/src/lib/other/sitesettingsmanager.h b/src/lib/other/sitesettingsmanager.h
index b2daab426..5285ff4a8 100644
--- a/src/lib/other/sitesettingsmanager.h
+++ b/src/lib/other/sitesettingsmanager.h
@@ -102,7 +102,6 @@ public:
Permission getDefaultPermission(const PageOptions &option);
Permission getDefaultPermission(const QWebEnginePage::Feature &feature);
Permission getDefaultPermission(const QWebEngineSettings::WebAttribute &attribute);
- void setDefaultPermission(const QWebEnginePage::Feature &feature, const Permission &value);
QString getOptionName(const SiteSettingsManager::PageOptions &option);
QString getOptionName(const QWebEnginePage::Feature &feature);
diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp
index 731f39667..3a8436751 100644
--- a/src/lib/preferences/preferences.cpp
+++ b/src/lib/preferences/preferences.cpp
@@ -43,7 +43,6 @@
#include "useragentdialog.h"
#include "registerqappassociation.h"
#include "profilemanager.h"
-#include "html5permissions/html5permissionsdialog.h"
#include "certificatemanager.h"
#include "searchenginesdialog.h"
#include "webscrollbarmanager.h"
@@ -535,7 +534,6 @@ Preferences::Preferences(BrowserWindow* window)
//CONNECTS
connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &Preferences::buttonClicked);
connect(ui->cookieManagerBut, &QAbstractButton::clicked, this, &Preferences::showCookieManager);
- connect(ui->html5permissions, &QAbstractButton::clicked, this, &Preferences::showHtml5Permissions);
connect(ui->preferredLanguages, &QAbstractButton::clicked, this, &Preferences::showAcceptLanguage);
connect(ui->deleteHtml5storage, &QAbstractButton::clicked, this, &Preferences::deleteHtml5storage);
connect(ui->uaManager, &QAbstractButton::clicked, this, &Preferences::openUserAgentManager);
@@ -739,12 +737,6 @@ void Preferences::showCookieManager()
dialog->show();
}
-void Preferences::showHtml5Permissions()
-{
- auto* dialog = new HTML5PermissionsDialog(this);
- dialog->open();
-}
-
void Preferences::openJsOptions()
{
auto* dialog = new JsOptions(this);
diff --git a/src/lib/preferences/preferences.h b/src/lib/preferences/preferences.h
index 3855a054a..5fe40eee9 100644
--- a/src/lib/preferences/preferences.h
+++ b/src/lib/preferences/preferences.h
@@ -54,7 +54,6 @@ private Q_SLOTS:
void chooseDownPath();
void showCookieManager();
- void showHtml5Permissions();
void useActualHomepage();
void useActualNewTab();
void showAcceptLanguage();
diff --git a/src/lib/preferences/preferences.ui b/src/lib/preferences/preferences.ui
index 688bd2d14..9a15f2c65 100644
--- a/src/lib/preferences/preferences.ui
+++ b/src/lib/preferences/preferences.ui
@@ -2018,6 +2018,56 @@
+ -
+
+
+ <b>Other</b>
+
+
+
+ -
+
+
+ true
+
+
+ <b>JavaScript</b>
+
+
+
+ -
+
+
+ false
+
+
+ Manage JavaScript privacy options
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 20
+
+
+
+
+ -
+
+
+ Send Do Not Track header to servers
+
+
+
-
@@ -2025,14 +2075,20 @@
- -
-
-
- <b>Other</b>
+
-
+
+
+ Qt::Horizontal
-
+
+
+ 40
+ 20
+
+
+
- -
+
-
Qt::Vertical
@@ -2058,16 +2114,6 @@
- -
-
-
- true
-
-
- <b>JavaScript</b>
-
-
-
-
@@ -2081,39 +2127,6 @@
- -
-
-
- false
-
-
- Manage JavaScript privacy options
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 20
- 20
-
-
-
-
- -
-
-
- Manage HTML5 permissions
-
-
-
-
@@ -2121,46 +2134,6 @@
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- <b>HTML5 Permissions</b>
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- HTML5 Permissions
-
-
-
- -
-
-
- Send Do Not Track header to servers
-
-
-
diff --git a/src/lib/tools/html5permissions/html5permissionsdialog.cpp b/src/lib/tools/html5permissions/html5permissionsdialog.cpp
deleted file mode 100644
index 212f764b3..000000000
--- a/src/lib/tools/html5permissions/html5permissionsdialog.cpp
+++ /dev/null
@@ -1,191 +0,0 @@
-/* ============================================================
-* Falkon - Qt web browser
-* Copyright (C) 2013-2014 David Rosca
-*
-* 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
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-* ============================================================ */
-#include "html5permissionsdialog.h"
-#include "ui_html5permissionsdialog.h"
-#include "settings.h"
-#include "mainapplication.h"
-#include "html5permissionsitem.h"
-#include "html5permissionsmanager.h"
-#include "sitesettingsmanager.h"
-
-#include
-#include
-
-
-HTML5PermissionsDialog::HTML5PermissionsDialog(QWidget* parent)
- : QDialog(parent)
- , ui(new Ui::HTML5PermissionsDialog)
-{
- setAttribute(Qt::WA_DeleteOnClose);
-
- ui->setupUi(this);
-
- ui->treeWidget->header()->resizeSection(0, 220);
-
- connect(ui->remove, &QPushButton::clicked, this, &HTML5PermissionsDialog::removeEntry);
- connect(ui->feature, SIGNAL(currentIndexChanged(int)), this, SLOT(featureIndexChanged()));
- connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &HTML5PermissionsDialog::saveSettings);
-
- showFeaturePermissions(currentFeature());
- showDefaultPermissions();
-}
-
-HTML5PermissionsDialog::~HTML5PermissionsDialog()
-{
- delete ui;
-}
-
-void HTML5PermissionsDialog::showFeaturePermissions(QWebEnginePage::Feature feature)
-{
- ui->treeWidget->clear();
-
- if (m_data[feature].length() == 0) {
- QString column = mApp->siteSettingsManager()->featureToSqlColumn(feature);
- QSqlQuery query(SqlDatabase::instance()->database());
- query.prepare(QSL("SELECT id, server, %1 FROM site_settings WHERE %1 != ?").arg(column));
- query.addBindValue(SiteSettingsManager::Default);
- query.exec();
-
- while (query.next()) {
- SiteData siteData;
- siteData.id = query.value(0).toInt();
- siteData.host = query.value(1).toString();
- siteData.perm = static_cast(query.value(2).toInt());
- m_data[feature].append(siteData);
-
- createEntry(siteData);
- }
- }
- else {
- for (const auto &siteData : m_data[feature]) {
- createEntry(siteData);
- }
- }
-}
-
-void HTML5PermissionsDialog::featureIndexChanged()
-{
- showFeaturePermissions(currentFeature());
-}
-
-void HTML5PermissionsDialog::createEntry(const HTML5PermissionsDialog::SiteData& siteData)
-{
- if (m_removed.contains(currentFeature()) && m_removed[currentFeature()].contains(siteData.id)) {
- return;
- }
- auto* item = new QTreeWidgetItem(ui->treeWidget);
- item->setText(0, siteData.host);
-
- switch (siteData.perm) {
- case SiteSettingsManager::Allow:
- item->setText(1, tr("Allow"));
- break;
- case SiteSettingsManager::Deny:
- item->setText(1, tr("Deny"));
- break;
- case SiteSettingsManager::Ask:
- item->setText(1, tr("Ask"));
- break;
- default:
- qWarning() << "Unknown unknown permission" << siteData.perm;
- item->setText(1, tr("Default"));
- break;
- }
- item->setData(0, Qt::UserRole + 10, siteData.id);
- ui->treeWidget->addTopLevelItem(item);
-}
-
-void HTML5PermissionsDialog::removeEntry()
-{
- QTreeWidgetItem* item = ui->treeWidget->currentItem();
- if (!item) {
- return;
- }
-
- const int domainId = item->data(0, Qt::UserRole + 10).toInt();
- m_removed[currentFeature()].append(domainId);
-
- delete item;
-}
-
-QWebEnginePage::Feature HTML5PermissionsDialog::currentFeature() const
-{
- return indexToFeature(ui->feature->currentIndex());
-}
-
-QWebEnginePage::Feature HTML5PermissionsDialog::indexToFeature(const int index) const
-{
- switch (index) {
- case 0:
- return QWebEnginePage::Notifications;
- case 1:
- return QWebEnginePage::Geolocation;
- case 2:
- return QWebEnginePage::MediaAudioCapture;
- case 3:
- return QWebEnginePage::MediaVideoCapture;
- case 4:
- return QWebEnginePage::MediaAudioVideoCapture;
- case 5:
- return QWebEnginePage::MouseLock;
- case 6:
- return QWebEnginePage::DesktopVideoCapture;
- case 7:
- return QWebEnginePage::DesktopAudioVideoCapture;
- default:
- qWarning() << "Unknown feature index" << index;
- return QWebEnginePage::Notifications;
- }
-}
-
-void HTML5PermissionsDialog::saveSettings()
-{
- QSqlQuery query(SqlDatabase::instance()->database());
-
- for (int i = 0; i < 8; ++i) {
- const QWebEnginePage::Feature feature = indexToFeature(i);
- const QString column = mApp->siteSettingsManager()->featureToSqlColumn(feature);
- query.prepare(QSL("UPDATE site_settings SET %1 = ? WHERE id = ?").arg(column));
- query.addBindValue(SiteSettingsManager::Default);
- query.addBindValue(m_removed[feature]);
-
- if (!query.execBatch()) {
- qDebug() << query.lastError();
- }
- }
-
- for (int i = 0; i < 8; ++i) {
- auto* item = static_cast(ui->listWidgetDefaults->itemWidget(ui->listWidgetDefaults->item(i)));
- const auto feature = item->getFeature();
- const auto permission = item->getPermission();
- mApp->siteSettingsManager()->setDefaultPermission(feature, permission);
- }
-}
-
-void HTML5PermissionsDialog::showDefaultPermissions()
-{
- for (int i = 0; i < 8; ++i) {
- const auto feature = indexToFeature(i);
- const auto permission = mApp->siteSettingsManager()->getDefaultPermission(feature);
-
- auto* listItem = new QListWidgetItem(ui->listWidgetDefaults);
- auto* permItem = new HTML5PermissionsItem(feature, permission, this);
- ui->listWidgetDefaults->setItemWidget(listItem, permItem);
- listItem->setSizeHint(permItem->sizeHint());
- }
-}
diff --git a/src/lib/tools/html5permissions/html5permissionsdialog.h b/src/lib/tools/html5permissions/html5permissionsdialog.h
deleted file mode 100644
index 1ee1ebb7f..000000000
--- a/src/lib/tools/html5permissions/html5permissionsdialog.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* ============================================================
-* Falkon - Qt web browser
-* Copyright (C) 2013-2014 David Rosca
-*
-* 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
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-* ============================================================ */
-#ifndef HTML5PERMISSIONSDIALOG_H
-#define HTML5PERMISSIONSDIALOG_H
-
-#include "sitesettingsmanager.h"
-#include
-#include
-#include
-
-namespace Ui
-{
-class HTML5PermissionsDialog;
-}
-
-class HTML5PermissionsDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit HTML5PermissionsDialog(QWidget* parent = nullptr);
- ~HTML5PermissionsDialog();
-
- void showFeaturePermissions(QWebEnginePage::Feature feature);
-
-private Q_SLOTS:
- void removeEntry();
- void featureIndexChanged();
-
- void showDefaultPermissions();
-
- void saveSettings();
-
-private:
- struct SiteData {
- SiteSettingsManager::Permission perm;
- int id;
- QString host;
- };
- void createEntry(const SiteData &siteData);
-
- QWebEnginePage::Feature currentFeature() const;
- QWebEnginePage::Feature indexToFeature(const int index) const;
-
- Ui::HTML5PermissionsDialog* ui;
-
- QHash> m_data;
- QHash m_removed;
-};
-
-#endif // HTML5PERMISSIONSDIALOG_H
diff --git a/src/lib/tools/html5permissions/html5permissionsdialog.ui b/src/lib/tools/html5permissions/html5permissionsdialog.ui
deleted file mode 100644
index aecb79c1c..000000000
--- a/src/lib/tools/html5permissions/html5permissionsdialog.ui
+++ /dev/null
@@ -1,210 +0,0 @@
-
-
- HTML5PermissionsDialog
-
-
-
- 0
- 0
- 586
- 387
-
-
-
- HTML5 Permissions
-
-
- -
-
-
- 0
-
-
-
- Site permissions
-
-
-
-
-
-
-
-
-
- Qt::Vertical
-
-
-
- 20
- 183
-
-
-
-
- -
-
-
- Remove
-
-
-
-
-
- -
-
-
- true
-
-
- 0
-
-
- true
-
-
- true
-
-
-
- Site
-
-
-
-
- Behaviour
-
-
-
-
- -
-
-
-
-
-
- Permission for:
-
-
-
- -
-
-
-
-
- Notifications
-
-
- -
-
- Geolocation
-
-
- -
-
- Microphone
-
-
- -
-
- Camera
-
-
- -
-
- Microphone and Camera
-
-
- -
-
- Hide Pointer
-
-
- -
-
- Display Capture
-
-
- -
-
- Display and Audio Capture
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 81
- 20
-
-
-
-
-
-
-
-
-
-
- Defaults
-
-
- -
-
-
- true
-
-
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok
-
-
-
-
-
-
-
-
- buttonBox
- accepted()
- HTML5PermissionsDialog
- accept()
-
-
- 248
- 254
-
-
- 157
- 274
-
-
-
-
- buttonBox
- rejected()
- HTML5PermissionsDialog
- reject()
-
-
- 316
- 260
-
-
- 286
- 274
-
-
-
-
-
diff --git a/src/lib/tools/html5permissions/html5permissionsitem.cpp b/src/lib/tools/html5permissions/html5permissionsitem.cpp
deleted file mode 100644
index b2bf4449e..000000000
--- a/src/lib/tools/html5permissions/html5permissionsitem.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/* ============================================================
- * Falkon - Qt web browser
- * Copyright (C) 2022 Juraj Oravec
- *
- * 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
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- * ============================================================ */
-#include "html5permissionsitem.h"
-#include "ui_html5permissionsitem.h"
-#include "mainapplication.h"
-
-
-HTML5PermissionsItem::HTML5PermissionsItem(const QWebEnginePage::Feature& feature, const SiteSettingsManager::Permission& permission, QWidget* parent)
-: QWidget(parent)
-, ui(new Ui::HTML5PermissionsItem())
-, m_feature(feature)
-, m_permission(permission)
-{
- ui->setupUi(this);
-
- setLabel();
- setCombo();
-
- connect(ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(permissionIndexChanged()));
-}
-
-HTML5PermissionsItem::~HTML5PermissionsItem() noexcept
-{
- delete ui;
-}
-
-void HTML5PermissionsItem::permissionIndexChanged()
-{
- switch (ui->comboBox->currentIndex()) {
- case 0:
- m_permission = SiteSettingsManager::Allow;
- break;
- case 1:
- m_permission = SiteSettingsManager::Deny;
- break;
- case 2:
- m_permission = SiteSettingsManager::Ask;
- break;
- default:
- qWarning() << "Unknown permission index" << ui->comboBox->currentIndex();
- break;
- }
-}
-
-void HTML5PermissionsItem::setLabel()
-{
- ui->label->setText(mApp->siteSettingsManager()->getOptionName(m_feature));
-}
-
-void HTML5PermissionsItem::setCombo()
-{
- switch (m_permission) {
- case SiteSettingsManager::Allow:
- ui->comboBox->setCurrentIndex(0);
- break;
- case SiteSettingsManager::Deny:
- ui->comboBox->setCurrentIndex(1);
- break;
- case SiteSettingsManager::Ask:
- case SiteSettingsManager::Default:
- ui->comboBox->setCurrentIndex(2);
- break;
- default:
- ui->comboBox->setCurrentIndex(2);
- qWarning() << "Unknown permission" << m_permission;
- break;
- }
-}
-
-QWebEnginePage::Feature HTML5PermissionsItem::getFeature() const
-{
- return m_feature;
-}
-
-SiteSettingsManager::Permission HTML5PermissionsItem::getPermission() const
-{
- return m_permission;
-}
diff --git a/src/lib/tools/html5permissions/html5permissionsitem.h b/src/lib/tools/html5permissions/html5permissionsitem.h
deleted file mode 100644
index 9588ae54b..000000000
--- a/src/lib/tools/html5permissions/html5permissionsitem.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* ============================================================
- * Falkon - Qt web browser
- * Copyright (C) 2022 Juraj Oravec
- *
- * 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
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- * ============================================================ */
-#ifndef HTML5PERMISSIONSITEM_H
-#define HTML5PERMISSIONSITEM_H
-
-
-#include "qzcommon.h"
-#include "sitesettingsmanager.h"
-#include
-#include
-#include
-
-namespace Ui
-{
-class HTML5PermissionsItem;
-}
-
-class FALKON_EXPORT HTML5PermissionsItem : public QWidget
-{
- Q_OBJECT
-public:
- explicit HTML5PermissionsItem(const QWebEnginePage::Feature &feature, const SiteSettingsManager::Permission &permission, QWidget* parent = nullptr);
- ~HTML5PermissionsItem();
-
- QWebEnginePage::Feature getFeature() const;
- SiteSettingsManager::Permission getPermission() const;
-
-private Q_SLOTS:
- void permissionIndexChanged();
-
-private:
- void setLabel();
- void setCombo();
-
- Ui::HTML5PermissionsItem* ui;
- QWebEnginePage::Feature m_feature;
- SiteSettingsManager::Permission m_permission;
-};
-
-#endif // HTML5PERMISSIONSITEM_H
diff --git a/src/lib/tools/html5permissions/html5permissionsitem.ui b/src/lib/tools/html5permissions/html5permissionsitem.ui
deleted file mode 100644
index da54ac52b..000000000
--- a/src/lib/tools/html5permissions/html5permissionsitem.ui
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
- HTML5PermissionsItem
-
-
-
- 0
- 0
- 319
- 38
-
-
-
- -
-
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
-
- Allow
-
-
- -
-
- Deny
-
-
- -
-
- Ask
-
-
-
-
-
-
-
-
-