1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Remove html5 permission dialog

Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
Juraj Oravec 2024-01-31 22:41:31 +01:00
parent c90f445368
commit ee61b0accf
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B
12 changed files with 62 additions and 787 deletions

View File

@ -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

View File

@ -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)) {

View File

@ -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);

View File

@ -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);

View File

@ -54,7 +54,6 @@ private Q_SLOTS:
void chooseDownPath();
void showCookieManager();
void showHtml5Permissions();
void useActualHomepage();
void useActualNewTab();
void showAcceptLanguage();

View File

@ -2018,6 +2018,56 @@
</widget>
<widget class="QWidget" name="privacyPage">
<layout class="QGridLayout" name="gridLayout_12">
<item row="18" column="0" colspan="4">
<widget class="QLabel" name="label_50">
<property name="text">
<string>&lt;b&gt;Other&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="15" column="0" colspan="4">
<widget class="QLabel" name="label_61">
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="text">
<string>&lt;b&gt;JavaScript&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="16" column="0" colspan="3">
<widget class="QLabel" name="label_25">
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="text">
<string>Manage JavaScript privacy options</string>
</property>
</widget>
</item>
<item row="20" column="0">
<spacer name="horizontalSpacer_20">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="20" column="1" colspan="3">
<widget class="QCheckBox" name="doNotTrack">
<property name="text">
<string>Send Do Not Track header to servers</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="3">
<widget class="QLabel" name="label_12">
<property name="text">
@ -2025,14 +2075,20 @@
</property>
</widget>
</item>
<item row="20" column="0" colspan="4">
<widget class="QLabel" name="label_50">
<property name="text">
<string>&lt;b&gt;Other&lt;/b&gt;</string>
<item row="8" column="3">
<spacer name="horizontalSpacer_22">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="28" column="0" colspan="4">
<item row="26" column="0" colspan="4">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -2058,16 +2114,6 @@
</property>
</widget>
</item>
<item row="15" column="0" colspan="4">
<widget class="QLabel" name="label_61">
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="text">
<string>&lt;b&gt;JavaScript&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="12" column="3">
<widget class="QPushButton" name="cookieManagerBut">
<property name="sizePolicy">
@ -2081,39 +2127,6 @@
</property>
</widget>
</item>
<item row="16" column="0" colspan="3">
<widget class="QLabel" name="label_25">
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="text">
<string>Manage JavaScript privacy options</string>
</property>
</widget>
</item>
<item row="22" column="0">
<spacer name="horizontalSpacer_20">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="19" column="0" colspan="3">
<widget class="QLabel" name="label_63">
<property name="text">
<string>Manage HTML5 permissions</string>
</property>
</widget>
</item>
<item row="12" column="0" colspan="3">
<widget class="QLabel" name="label_19">
<property name="text">
@ -2121,46 +2134,6 @@
</property>
</widget>
</item>
<item row="8" column="3">
<spacer name="horizontalSpacer_22">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="18" column="0" colspan="4">
<widget class="QLabel" name="label_62">
<property name="text">
<string>&lt;b&gt;HTML5 Permissions&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="19" column="3">
<widget class="QPushButton" name="html5permissions">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>HTML5 Permissions</string>
</property>
</widget>
</item>
<item row="22" column="1" colspan="3">
<widget class="QCheckBox" name="doNotTrack">
<property name="text">
<string>Send Do Not Track header to servers</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="notificationsPage">

View File

@ -1,191 +0,0 @@
/* ============================================================
* Falkon - Qt web browser
* Copyright (C) 2013-2014 David Rosca <nowrep@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
* ============================================================ */
#include "html5permissionsdialog.h"
#include "ui_html5permissionsdialog.h"
#include "settings.h"
#include "mainapplication.h"
#include "html5permissionsitem.h"
#include "html5permissionsmanager.h"
#include "sitesettingsmanager.h"
#include <QtWebEngineWidgetsVersion>
#include <sqldatabase.h>
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<SiteSettingsManager::Permission>(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<HTML5PermissionsItem*>(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());
}
}

View File

@ -1,66 +0,0 @@
/* ============================================================
* Falkon - Qt web browser
* Copyright (C) 2013-2014 David Rosca <nowrep@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
* ============================================================ */
#ifndef HTML5PERMISSIONSDIALOG_H
#define HTML5PERMISSIONSDIALOG_H
#include "sitesettingsmanager.h"
#include <QDialog>
#include <QStringList>
#include <QWebEnginePage>
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<QWebEnginePage::Feature, QList<SiteData>> m_data;
QHash<QWebEnginePage::Feature, QVariantList> m_removed;
};
#endif // HTML5PERMISSIONSDIALOG_H

View File

@ -1,210 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>HTML5PermissionsDialog</class>
<widget class="QDialog" name="HTML5PermissionsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>586</width>
<height>387</height>
</rect>
</property>
<property name="windowTitle">
<string>HTML5 Permissions</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Site permissions</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>183</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="remove">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QTreeWidget" name="treeWidget">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="indentation">
<number>0</number>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Site</string>
</property>
</column>
<column>
<property name="text">
<string>Behaviour</string>
</property>
</column>
</widget>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Permission for:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="feature">
<item>
<property name="text">
<string>Notifications</string>
</property>
</item>
<item>
<property name="text">
<string>Geolocation</string>
</property>
</item>
<item>
<property name="text">
<string>Microphone</string>
</property>
</item>
<item>
<property name="text">
<string>Camera</string>
</property>
</item>
<item>
<property name="text">
<string>Microphone and Camera</string>
</property>
</item>
<item>
<property name="text">
<string>Hide Pointer</string>
</property>
</item>
<item>
<property name="text">
<string>Display Capture</string>
</property>
</item>
<item>
<property name="text">
<string>Display and Audio Capture</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>81</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Defaults</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListWidget" name="listWidgetDefaults">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>HTML5PermissionsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>HTML5PermissionsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -1,93 +0,0 @@
/* ============================================================
* Falkon - Qt web browser
* Copyright (C) 2022 Juraj Oravec <jurajoravec@mailo.com>
*
* 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 <http://www.gnu.org/licenses/>.
* ============================================================ */
#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;
}

View File

@ -1,55 +0,0 @@
/* ============================================================
* Falkon - Qt web browser
* Copyright (C) 2022 Juraj Oravec <jurajoravec@mailo.com>
*
* 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 <http://www.gnu.org/licenses/>.
* ============================================================ */
#ifndef HTML5PERMISSIONSITEM_H
#define HTML5PERMISSIONSITEM_H
#include "qzcommon.h"
#include "sitesettingsmanager.h"
#include <QWebEnginePage>
#include <QWebEngineSettings>
#include <QWidget>
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

View File

@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>HTML5PermissionsItem</class>
<widget class="QWidget" name="HTML5PermissionsItem">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>319</width>
<height>38</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<item>
<property name="text">
<string>Allow</string>
</property>
</item>
<item>
<property name="text">
<string>Deny</string>
</property>
</item>
<item>
<property name="text">
<string>Ask</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>