+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
-
- This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-android>.
-
- Privacy Browser PC 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.
-
- Privacy Browser PC 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 Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>. -->
-
-<ui version="4.0">
- <class>BrowserView</class>
- <!-- Main widget. -->
- <widget class="QWidget" name="BrowserView">
- <!-- Main layout. -->
- <layout class="QVBoxLayout">
- <!-- Set the spacing between items to 0. -->
- <property name="spacing">
- <number>0</number>
- </property>
-
- <!-- Set the margins to 0. -->
- <property name="topMargin">
- <number>0</number>
- </property>
-
- <property name="bottomMargin">
- <number>0</number>
- </property>
-
- <property name="leftMargin">
- <number>0</number>
- </property>
-
- <property name="rightMargin">
- <number>0</number>
- </property>
-
- <!-- WebEngine view. -->
- <item>
- <widget class="QWebEngineView" name="webEngineView" />
- </item>
- </layout>
- </widget>
-</ui>
)
# Include the KConfig controller file.
-kconfig_add_kcfg_files(privacy-browser Settings.kcfgc)
+kconfig_add_kcfg_files(privacy-browser settings/Settings.kcfgc)
# Use KDE Frameworks to handle internationalization of the following UI files.
ki18n_wrap_ui(privacy-browser
- BrowserView.ui
- DomainSettingsDialog.ui
- SettingsGeneral.ui
- SettingsPrivacy.ui
+ ui/BrowserView.ui
+ ui/DomainSettingsDialog.ui
+ ui/SettingsGeneral.ui
+ ui/SettingsPrivacy.ui
)
# Link the following libraries.
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
-
- This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-android>.
-
- Privacy Browser PC 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.
-
- Privacy Browser PC 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 Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>. -->
-
-<ui version="4.0">
- <class>DomainSettingsDialog</class>
-
- <widget class="QWidget" name="DomainSettingsDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <height>1000</height>
- <width>1500</width>
- </rect>
- </property>
-
- <!-- Main layout. -->
- <layout class="QHBoxLayout">
- <item>
- <layout class="QVBoxLayout">
- <!-- Domains list view. -->
- <item>
- <widget class="QListView" name="domainsListView"/>
- </item>
-
- <!-- Domain buttons. -->
- <item>
- <layout class="QHBoxLayout">
- <!-- Add domain button. -->
- <item>
- <widget class="QPushButton" name="addDomainButton">
- <property name="text">
- <string>Add Domain</string>
- </property>
-
- <property name="icon">
- <iconset theme="list-add"/>
- </property>
- </widget>
- </item>
-
- <!-- Delete domain button. -->
- <item>
- <widget class="QPushButton" name="deleteDomainButton">
- <property name="text">
- <string>Delete domain</string>
- </property>
-
- <property name="icon">
- <iconset theme="list-remove"/>
- </property>
- </widget>
- </item>
-
- <!-- Spacer. -->
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </item>
-
- <item>
- <layout class="QVBoxLayout">
- <item>
- <widget class="QWidget" name="domainSettingsWidget">
- <!-- Domain settings form layout. -->
- <layout class="QFormLayout">
- <!-- Domain name. -->
- <item row="0" column="0">
- <widget class="QLabel" name="domainNameLabel">
- <property name="text">
- <string>Domain name</string>
- </property>
- </widget>
- </item>
-
- <item row="0" column="1">
- <widget class="KLineEdit" name="domainNameLineEdit">
- <property name="toolTip">
- <string>*. may be prepended to a domain to include all subdomains (eg. *.stoutner.com).</string>
- </property>
- </widget>
- </item>
-
- <!-- JavaScript. -->
- <item row="1" column="0">
- <widget class="QLabel">
- <property name="text">
- <string>JavaScript</string>
- </property>
- </widget>
- </item>
-
- <item row="1" column="1">
- <widget class="QComboBox" name="javaScriptComboBox">
- <property name="toolTip">
- <string>JavaScript allows websites to run programs (scripts) on the device.</string>
- </property>
-
- <item>
- <property name="text">
- <string>System default</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>JavaScript disabled</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>JavaScript enabled</string>
- </property>
- </item>
- </widget>
- </item>
-
- <item row="2" column="1">
- <widget class="QLabel" name="javaScriptLabel">
- <property name="textFormat">
- <enum>Qt::RichText</enum>
- </property>
- </widget>
- </item>
-
- <!-- User Agent. -->
- <item row="3" column="0">
- <widget class="QLabel">
- <property name="text">
- <string>User Agent</string>
- </property>
- </widget>
- </item>
-
- <item row="3" column="1">
- <widget class="QComboBox" name="userAgentComboBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
-
- <property name="editable">
- <bool>true</bool>
- </property>
-
- <item>
- <property name="text">
- <string>System default</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Privacy Browser</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Firefox on Linux</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Chromium on Linux</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Firefox on Windows</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Chrome on Windows</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Edge on Windows</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Safari on macOS</string>
- </property>
- </item>
- </widget>
- </item>
-
- <item row="4" column="1">
- <widget class="QLabel" name="userAgentLabel">
- <property name="textFormat">
- <enum>Qt::RichText</enum>
- </property>
- </widget>
- </item>
-
- <!-- Zoom factor. -->
- <item row="5" column="0">
- <widget class="QLabel">
- <property name="text">
- <string>Zoom factor</string>
- </property>
- </widget>
- </item>
-
- <item row="5" column="1">
- <widget class="QComboBox" name="zoomFactorComboBox">
- <item>
- <property name="text">
- <string>System default</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Custom</string>
- </property>
- </item>
- </widget>
- </item>
-
- <item row="6" column="1">
- <widget class="QDoubleSpinBox" name="customZoomFactorSpinBox">
- <property name="toolTip">
- <string>Set the zoom factor between 0.25 and 5.00. The default is 1.00.</string>
- </property>
-
- <property name="minimum">
- <double>0.250000000000000</double>
- </property>
-
- <property name="maximum">
- <double>5.000000000000000</double>
- </property>
-
- <property name="singleStep">
- <double>0.250000000000000</double>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
-
- <!-- Spacer. -->
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- </spacer>
- </item>
-
- <!-- Dialog buttons. -->
- <item>
- <widget class="QDialogButtonBox" name="dialogButtonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Reset | QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
-</ui>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
-
- This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-android>.
-
- Privacy Browser PC 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.
-
- Privacy Browser PC 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 Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>. -->
-
-<!-- The options are partially documented at <https://api.kde.org/frameworks/kconfig/html/classKConfigSkeleton.html>. -->
-<kcfg
- xmlns="http://www.kde.org/standards/kcfg/1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
-
- <!-- This is the name of the file located in `~/.config/` where the settings are stored. -->
- <kcfgfile name="privacybrowser"/>
-
- <group name="Privacy">
- <entry name="javaScript" type="Bool">
- <default>false</default>
- </entry>
-
- <entry name="userAgent" type="String">
- <default>Privacy Browser</default>
- </entry>
- </group>
-
- <group name="General">
- <entry name="homepage" type="String">
- <default>https://www.mojeek.com/</default>
- </entry>
-
- <entry name="searchEngine" type="String">
- <default>Mojeek</default>
- </entry>
-
- <entry name="zoomFactor" type="Double">
- <default>1.00</default>
- </entry>
- </group>
-</kcfg>
+++ /dev/null
-# Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
-#
-# This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
-#
-# Privacy Browser PC 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.
-#
-# Privacy Browser PC 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 Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>.
-
-
-# Specify the KConfig file.
-File=Settings.kcfg
-
-# Specify the class name, which will be used to autogenerate .cpp and .h files.
-ClassName=Settings
-
-# Make the generated class a singleton. TODO, the default is false. This may not be needed.
-Singleton=true
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
-
- This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-android>.
-
- Privacy Browser PC 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.
-
- Privacy Browser PC 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 Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>. -->
-
-<ui version="4.0">
- <!-- The name of the generated class. -->
- <class>GeneralSettings</class>
-
- <widget class="QWidget">
- <layout class="QFormLayout">
- <!-- Homepage. -->
- <item row="0" column="0">
- <widget class="QLabel" name="homepageLabel">
- <property name="text">
- <string>Homepage</string>
- </property>
- </widget>
- </item>
-
- <item row="0" column="1">
- <widget class="KLineEdit" name="kcfg_homepage">
- <property name="toolTip">
- <string>The default is https://www.mojeek.com/.</string>
- </property>
- </widget>
- </item>
-
- <!-- Search engine. -->
- <item row="1" column="0">
- <widget class="QLabel">
- <property name="text">
- <string>Search engine</string>
- </property>
- </widget>
- </item>
-
- <item row="1" column="1">
- <widget class="QComboBox" name="kcfg_searchEngine">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
-
- <property name="toolTip">
- <string>The default is Mojeek.</string>
- </property>
-
- <property name="editable">
- <bool>true</bool>
- </property>
-
- <item>
- <property name="text">
- <string>Mojeek</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Monocles</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>MetaGer</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Google</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Bing</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Yahoo</string>
- </property>
- </item>
- </widget>
- </item>
-
- <item row="2" column="1">
- <widget class="QLabel" name="searchEngineLabel">
- <property name="textInteractionFlags">
- <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
-
- <!-- Zoom factor. -->
- <item row="3" column="0">
- <widget class="QLabel" name="zoomFactorLabel">
- <property name="text">
- <string>Zoom factor</string>
- </property>
- </widget>
- </item>
-
- <item row="3" column="1">
- <widget class="QDoubleSpinBox" name="kcfg_zoomFactor">
- <property name="toolTip">
- <string>Set the zoom factor between 0.25 and 5.00. The default is 1.00.</string>
- </property>
-
- <property name="minimum">
- <double>0.250000000000000</double>
- </property>
-
- <property name="maximum">
- <double>5.000000000000000</double>
- </property>
-
- <property name="singleStep">
- <double>0.250000000000000</double>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
-</ui>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
-
- This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-android>.
-
- Privacy Browser PC 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.
-
- Privacy Browser PC 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 Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>. -->
-
-<ui version="4.0">
- <!-- The name of the generated class. -->
- <class>PrivacySettings</class>
-
- <widget class="QWidget">
- <layout class="QFormLayout">
- <!-- JavaScript. -->
- <item row="0" column="0">
- <widget class="QCheckBox" name="kcfg_javaScript">
- <property name="text">
- <string>JavaScript</string>
- </property>
-
- <property name="toolTip">
- <string>JavaScript allows websites to run programs (scripts) on the device. The default is disabled.</string>
- </property>
- </widget>
- </item>
-
- <!-- User agent. -->
- <item row="1" column="0">
- <widget class="QLabel">
- <property name="text">
- <string>User agent</string>
- </property>
- </widget>
- </item>
-
- <item row="1" column="1">
- <widget class="QComboBox" name="kcfg_userAgent">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
-
- <property name="toolTip">
- <string>The default is Privacy Browser.</string>
- </property>
-
- <property name="editable">
- <bool>true</bool>
- </property>
-
- <item>
- <property name="text">
- <string>Privacy Browser</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Firefox Linux</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Chromium Linux</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Firefox Windows</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Chrome Windows</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Edge Windows</string>
- </property>
- </item>
-
- <item>
- <property name="text">
- <string>Safari macOS</string>
- </property>
- </item>
- </widget>
- </item>
-
- <item row="2" column="1">
- <widget class="QLabel" name="userAgentLabel">
- <property name="textInteractionFlags">
- <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
-</ui>
domainNameLineEditPointer = domainSettingsDialogUi.domainNameLineEdit;
javaScriptComboBoxPointer = domainSettingsDialogUi.javaScriptComboBox;
javaScriptLabelPointer = domainSettingsDialogUi.javaScriptLabel;
+ localStorageComboBoxPointer = domainSettingsDialogUi.localStorageComboBox;
+ localStorageLabelPointer = domainSettingsDialogUi.localStorageLabel;
userAgentComboBoxPointer = domainSettingsDialogUi.userAgentComboBox;
userAgentLabelPointer = domainSettingsDialogUi.userAgentLabel;
zoomFactorComboBoxPointer = domainSettingsDialogUi.zoomFactorComboBox;
// Connect the domain settings.
connect(domainNameLineEditPointer, SIGNAL(textEdited(QString)), this, SLOT(domainNameChanged(QString)));
connect(javaScriptComboBoxPointer, SIGNAL(currentIndexChanged(int)), this, SLOT(javaScriptChanged(int)));
+ connect(localStorageComboBoxPointer, SIGNAL(currentIndexChanged(int)), this, SLOT(localStorageChanged(int)));
connect(userAgentComboBoxPointer, SIGNAL(currentTextChanged(QString)), this, SLOT(userAgentChanged(QString)));
connect(zoomFactorComboBoxPointer, SIGNAL(currentIndexChanged(int)), this, SLOT(zoomFactorComboBoxChanged(int)));
connect(customZoomFactorSpinBoxPointer, SIGNAL(valueChanged(double)), this, SLOT(customZoomFactorChanged(double)));
updateUi();
}
-
void DomainSettingsDialog::domainNameChanged(const QString &updatedDomainName) const
{
// Update the domains table model.
updateUi();
}
-
void DomainSettingsDialog::domainSelected(const QModelIndex &modelIndex) const
{
// Populate the domain name line edit pointer.
// Populate the JavaScript combo box.
javaScriptComboBoxPointer->setCurrentIndex(modelIndex.siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::JAVASCRIPT)).data().toInt());
+ // Populate the local storage combo box.
+ localStorageComboBoxPointer->setCurrentIndex(modelIndex.siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::LOCAL_STORAGE)).data().toInt());
+
// Get the user agent string.
QString userAgent = modelIndex.siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::USER_AGENT)).data().toString();
// Populate the labels.
populateJavaScriptLabel();
+ populateLocalStorageLabel();
populateUserAgentLabel(userAgentComboBoxPointer->currentText());
// Update the UI.
updateUi();
}
+void DomainSettingsDialog::localStorageChanged(const int &newIndex) const
+{
+ // Update the domains table model.
+ domainsTableModelPointer->setData(domainsListViewPointer->selectionModel()->currentIndex().siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::LOCAL_STORAGE)),
+ newIndex);
+
+ // Populate the local storage label.
+ populateLocalStorageLabel();
+
+ // Update the UI.
+ updateUi();
+}
void DomainSettingsDialog::ok()
{
case (DomainsDatabaseHelper::SYSTEM_DEFAULT):
{
// Set the text according to the system default.
- if (Settings::javaScript())
- {
- javaScriptLabelPointer->setText(i18nc("Domains settings labels", "JavaScript enabled"));
- }
- else
- {
- javaScriptLabelPointer->setText(i18nc("Domain settings labels", "JavaScript disabled"));
- }
+ if (Settings::javaScript()) javaScriptLabelPointer->setText(i18nc("Domains settings label", "JavaScript enabled"));
+ else javaScriptLabelPointer->setText(i18nc("Domain settings label", "JavaScript disabled"));
+
+ break;
+ }
+
+ case (DomainsDatabaseHelper::DISABLED):
+ {
+ // Set the label text in bold.
+ javaScriptLabelPointer->setText(i18nc("Domain settings label. The <strong> tags should be retained.", "<strong>JavaScript disabled</strong>"));
+
+ break;
+ }
+
+ case (DomainsDatabaseHelper::ENABLED):
+ {
+ // Set the label text in bold.
+ javaScriptLabelPointer->setText(i18nc("Domains settings label. The <strong> tags should be retained.", "<strong>JavaScript enabled</strong>"));
+
+ break;
+ }
+ }
+}
+
+void DomainSettingsDialog::populateLocalStorageLabel() const
+{
+ // Populate the label according to the currently selected index.
+ switch (localStorageComboBoxPointer->currentIndex())
+ {
+ case (DomainsDatabaseHelper::SYSTEM_DEFAULT):
+ {
+ // Set the text according to the system default.
+ if (Settings::localStorage()) localStorageLabelPointer->setText(i18nc("Local storage label", "Local storage enabled"));
+ else localStorageLabelPointer->setText(i18nc("Local storage label", "Local storage disabled"));
break;
}
case (DomainsDatabaseHelper::DISABLED):
{
// Set the label text in bold.
- javaScriptLabelPointer->setText(i18nc("Domain settings labels. The <strong> tags should be retained.", "<strong>JavaScript disabled</strong>"));
+ localStorageLabelPointer->setText(i18nc("Local storage label. The <string> tags should be retained.", "<strong>Local storage disabled</strong>"));
break;
}
case (DomainsDatabaseHelper::ENABLED):
{
// Set the label text in bold.
- javaScriptLabelPointer->setText(i18nc("Domains settings labels. The <strong> tags should be retained.", "<strong>JavaScript enabled</strong>"));
+ localStorageLabelPointer->setText(i18nc("Local storage label. The <strong> tags should be retained.", "<strong>Local storage enabled</strong>"));
break;
}
// Set the values for the new domain.
newDomainRecord.setValue(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::DOMAIN_NAME), newDomainName);
newDomainRecord.setValue(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::JAVASCRIPT), DomainsDatabaseHelper::SYSTEM_DEFAULT);
+ newDomainRecord.setValue(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::LOCAL_STORAGE), DomainsDatabaseHelper::SYSTEM_DEFAULT);
newDomainRecord.setValue(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::USER_AGENT), UserAgentHelper::SYSTEM_DEFAULT_DATABASE);
newDomainRecord.setValue(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::ZOOM_FACTOR), DomainsDatabaseHelper::SYSTEM_DEFAULT);
newDomainRecord.setValue(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::CUSTOM_ZOOM_FACTOR), 1.0);
void domainNameChanged(const QString &updatedDomainName) const;
void domainSelected(const QModelIndex &modelIndex) const;
void javaScriptChanged(const int &newIndex) const;
+ void localStorageChanged(const int &newIndex) const;
void ok();
void reset() const;
void showAddMessageBox();
QSqlTableModel *domainsTableModelPointer;
QComboBox *javaScriptComboBoxPointer;
QLabel *javaScriptLabelPointer;
+ QComboBox *localStorageComboBoxPointer;
+ QLabel *localStorageLabelPointer;
QPushButton *resetButtonPointer;
QComboBox *userAgentComboBoxPointer;
QLabel *userAgentLabelPointer;
// The private functions.
void populateJavaScriptLabel() const;
+ void populateLocalStorageLabel() const;
void populateUserAgentLabel(const QString &userAgentName) const;
void updateUi() const;
};
const QString DomainsDatabaseHelper::DOMAINS_TABLE = "domains";
// Define the private static schema constants.
-const int DomainsDatabaseHelper::SCHEMA_VERSION = 3;
+const int DomainsDatabaseHelper::SCHEMA_VERSION = 4;
// Define the public static database field names.
const QString DomainsDatabaseHelper::_ID = "_id";
const QString DomainsDatabaseHelper::DOMAIN_NAME = "domain_name";
const QString DomainsDatabaseHelper::JAVASCRIPT = "javascript";
+const QString DomainsDatabaseHelper::LOCAL_STORAGE = "local_storage";
const QString DomainsDatabaseHelper::USER_AGENT = "user_agent";
const QString DomainsDatabaseHelper::ZOOM_FACTOR = "zoom_factor";
const QString DomainsDatabaseHelper::CUSTOM_ZOOM_FACTOR = "custom_zoom_factor";
// Add the JavaScript column.
domainsDatabase.exec("ALTER TABLE " + DOMAINS_TABLE + " ADD COLUMN " + JAVASCRIPT + " INTEGER DEFAULT 0");
- // Set the default value.
- domainsDatabase.exec("UPDATE " + DOMAINS_TABLE + " SET " + JAVASCRIPT + " = 0" );
-
// Fallthrough to the next case.
[[fallthrough]];
}
// Add the Zoom Factor columns.
domainsDatabase.exec("ALTER TABLE " + DOMAINS_TABLE + " ADD COLUMN " + ZOOM_FACTOR + " INTEGER DEFAULT 0");
domainsDatabase.exec("ALTER TABLE " + DOMAINS_TABLE + " ADD COLUMN " + CUSTOM_ZOOM_FACTOR + " REAL DEFAULT 1.0");
+
+ // Fallthrough to the next case.
+ [[fallthrough]];
}
+
+ // Upgrade from schema version 3.
+ case 3:
+ // Add the Local Storage column.
+ domainsDatabase.exec("ALTER TABLE " + DOMAINS_TABLE + " ADD COLUMN " + LOCAL_STORAGE + " INTEGER DEFAULT 0");
}
// Update the schema version.
_ID + " INTEGER PRIMARY KEY, " +
DOMAIN_NAME + " TEXT, " +
JAVASCRIPT + " INTEGER DEFAULT 0, " +
+ LOCAL_STORAGE + " INTEGER DEFAULT 0, " +
USER_AGENT + " TEXT DEFAULT '" + UserAgentHelper::SYSTEM_DEFAULT_DATABASE + "', " +
ZOOM_FACTOR + " INTEGER DEFAULT 0, " +
CUSTOM_ZOOM_FACTOR + " REAL DEFAULT 1.0)"
static const QString DOMAIN_NAME;
static const QString DOMAINS_TABLE;
static const QString JAVASCRIPT;
+ static const QString LOCAL_STORAGE;
static const QString USER_AGENT;
static const QString ZOOM_FACTOR;
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
+
+ This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-android>.
+
+ Privacy Browser PC 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.
+
+ Privacy Browser PC 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 Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>. -->
+
+<!-- The options are partially documented at <https://api.kde.org/frameworks/kconfig/html/classKConfigSkeleton.html>. -->
+<kcfg
+ xmlns="http://www.kde.org/standards/kcfg/1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
+
+ <!-- This is the name of the file located in `~/.config/` where the settings are stored. -->
+ <kcfgfile name="privacybrowser"/>
+
+ <group name="Privacy">
+ <entry name="javaScript" type="Bool">
+ <default>false</default>
+ </entry>
+
+ <entry name="localStorage" type="Bool">
+ <default>false</default>
+ </entry>
+
+ <entry name="userAgent" type="String">
+ <default>Privacy Browser</default>
+ </entry>
+ </group>
+
+ <group name="General">
+ <entry name="homepage" type="String">
+ <default>https://www.mojeek.com/</default>
+ </entry>
+
+ <entry name="searchEngine" type="String">
+ <default>Mojeek</default>
+ </entry>
+
+ <entry name="zoomFactor" type="Double">
+ <default>1.00</default>
+ </entry>
+ </group>
+</kcfg>
--- /dev/null
+# Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
+#
+# This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
+#
+# Privacy Browser PC 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.
+#
+# Privacy Browser PC 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 Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>.
+
+
+# Specify the KConfig file.
+File=Settings.kcfg
+
+# Specify the class name, which will be used to autogenerate .cpp and .h files.
+ClassName=Settings
+
+# Make the generated class a singleton. TODO, the default is false. This may not be needed.
+Singleton=true
</ToolBar>
<!-- The URL toolbar. -->
- <ToolBar name="url_toolbar" iconText="icononly"> <text>URL Toolbar</text> </ToolBar>
+ <ToolBar name="url_toolbar" iconText="icononly"> <text>URL Toolbar</text>
+ <Action name="javascript" />
+ <Action name="local_storage" />
+ <Action name="domain_settings" />
+ </ToolBar>
</gui>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
+
+ This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-android>.
+
+ Privacy Browser PC 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.
+
+ Privacy Browser PC 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 Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>. -->
+
+<ui version="4.0">
+ <class>BrowserView</class>
+ <!-- Main widget. -->
+ <widget class="QWidget" name="BrowserView">
+ <!-- Main layout. -->
+ <layout class="QVBoxLayout">
+ <!-- Set the spacing between items to 0. -->
+ <property name="spacing">
+ <number>0</number>
+ </property>
+
+ <!-- Set the margins to 0. -->
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+
+ <!-- WebEngine view. -->
+ <item>
+ <widget class="QWebEngineView" name="webEngineView" />
+ </item>
+ </layout>
+ </widget>
+</ui>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
+
+ This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-android>.
+
+ Privacy Browser PC 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.
+
+ Privacy Browser PC 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 Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>. -->
+
+<ui version="4.0">
+ <class>DomainSettingsDialog</class>
+
+ <widget class="QWidget" name="DomainSettingsDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <height>1000</height>
+ <width>1500</width>
+ </rect>
+ </property>
+
+ <!-- Main layout. -->
+ <layout class="QHBoxLayout">
+ <item>
+ <layout class="QVBoxLayout">
+ <!-- Domains list view. -->
+ <item>
+ <widget class="QListView" name="domainsListView"/>
+ </item>
+
+ <!-- Domain buttons. -->
+ <item>
+ <layout class="QHBoxLayout">
+ <!-- Add domain button. -->
+ <item>
+ <widget class="QPushButton" name="addDomainButton">
+ <property name="text">
+ <string>Add Domain</string>
+ </property>
+
+ <property name="icon">
+ <iconset theme="list-add"/>
+ </property>
+ </widget>
+ </item>
+
+ <!-- Delete domain button. -->
+ <item>
+ <widget class="QPushButton" name="deleteDomainButton">
+ <property name="text">
+ <string>Delete domain</string>
+ </property>
+
+ <property name="icon">
+ <iconset theme="list-remove"/>
+ </property>
+ </widget>
+ </item>
+
+ <!-- Spacer. -->
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+
+ <item>
+ <layout class="QVBoxLayout">
+ <item>
+ <widget class="QWidget" name="domainSettingsWidget">
+ <!-- Domain settings form layout. -->
+ <layout class="QFormLayout">
+ <!-- Domain name. -->
+ <item row="0" column="0">
+ <widget class="QLabel" name="domainNameLabel">
+ <property name="text">
+ <string>Domain name</string>
+ </property>
+ </widget>
+ </item>
+
+ <item row="0" column="1">
+ <widget class="KLineEdit" name="domainNameLineEdit">
+ <property name="toolTip">
+ <string>*. may be prepended to a domain to include all subdomains (eg. *.stoutner.com).</string>
+ </property>
+ </widget>
+ </item>
+
+ <!-- JavaScript. -->
+ <item row="1" column="0">
+ <widget class="QLabel">
+ <property name="text">
+ <string>JavaScript</string>
+ </property>
+ </widget>
+ </item>
+
+ <item row="1" column="1">
+ <widget class="QComboBox" name="javaScriptComboBox">
+ <property name="toolTip">
+ <string>JavaScript allows websites to run programs (scripts) on the device.</string>
+ </property>
+
+ <item>
+ <property name="text">
+ <string>System default</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>JavaScript disabled</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>JavaScript enabled</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+
+ <item row="2" column="1">
+ <widget class="QLabel" name="javaScriptLabel">
+ <property name="textFormat">
+ <enum>Qt::RichText</enum>
+ </property>
+ </widget>
+ </item>
+
+ <!-- Local storage. -->
+ <item row="3" column="0">
+ <widget class="QLabel">
+ <property name="text">
+ <string>Local storage</string>
+ </property>
+ </widget>
+ </item>
+
+ <item row="3" column="1">
+ <widget class="QComboBox" name="localStorageComboBox">
+ <property name="toolTip">
+ <string>Local storage, sometimes also called DOM storage, is like cookies on steroids.</string>
+ </property>
+
+ <item>
+ <property name="text">
+ <string>System default</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Local storage disabled</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Local storage enabled</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+
+ <item row="4" column="1">
+ <widget class="QLabel" name="localStorageLabel">
+ <property name="textFormat">
+ <enum>Qt::RichText</enum>
+ </property>
+ </widget>
+ </item>
+
+ <!-- User agent. -->
+ <item row="5" column="0">
+ <widget class="QLabel">
+ <property name="text">
+ <string>User agent</string>
+ </property>
+ </widget>
+ </item>
+
+ <item row="5" column="1">
+ <widget class="QComboBox" name="userAgentComboBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+
+ <item>
+ <property name="text">
+ <string>System default</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Privacy Browser</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Firefox on Linux</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Chromium on Linux</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Firefox on Windows</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Chrome on Windows</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Edge on Windows</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Safari on macOS</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+
+ <item row="6" column="1">
+ <widget class="QLabel" name="userAgentLabel">
+ <property name="textFormat">
+ <enum>Qt::RichText</enum>
+ </property>
+ </widget>
+ </item>
+
+ <!-- Zoom factor. -->
+ <item row="7" column="0">
+ <widget class="QLabel">
+ <property name="text">
+ <string>Zoom factor</string>
+ </property>
+ </widget>
+ </item>
+
+ <item row="7" column="1">
+ <widget class="QComboBox" name="zoomFactorComboBox">
+ <item>
+ <property name="text">
+ <string>System default</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Custom</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+
+ <item row="8" column="1">
+ <widget class="QDoubleSpinBox" name="customZoomFactorSpinBox">
+ <property name="toolTip">
+ <string>Set the zoom factor between 0.25 and 5.00. The default is 1.00.</string>
+ </property>
+
+ <property name="minimum">
+ <double>0.250000000000000</double>
+ </property>
+
+ <property name="maximum">
+ <double>5.000000000000000</double>
+ </property>
+
+ <property name="singleStep">
+ <double>0.250000000000000</double>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+
+ <!-- Spacer. -->
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </spacer>
+ </item>
+
+ <!-- Dialog buttons. -->
+ <item>
+ <widget class="QDialogButtonBox" name="dialogButtonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Reset | QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+</ui>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
+
+ This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-android>.
+
+ Privacy Browser PC 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.
+
+ Privacy Browser PC 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 Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>. -->
+
+<ui version="4.0">
+ <!-- The name of the generated class. -->
+ <class>GeneralSettings</class>
+
+ <widget class="QWidget">
+ <layout class="QFormLayout">
+ <!-- Homepage. -->
+ <item row="0" column="0">
+ <widget class="QLabel" name="homepageLabel">
+ <property name="text">
+ <string>Homepage</string>
+ </property>
+ </widget>
+ </item>
+
+ <item row="0" column="1">
+ <widget class="KLineEdit" name="kcfg_homepage">
+ <property name="toolTip">
+ <string>The default is https://www.mojeek.com/.</string>
+ </property>
+ </widget>
+ </item>
+
+ <!-- Search engine. -->
+ <item row="1" column="0">
+ <widget class="QLabel">
+ <property name="text">
+ <string>Search engine</string>
+ </property>
+ </widget>
+ </item>
+
+ <item row="1" column="1">
+ <widget class="QComboBox" name="kcfg_searchEngine">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+
+ <property name="toolTip">
+ <string>The default is Mojeek.</string>
+ </property>
+
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+
+ <item>
+ <property name="text">
+ <string>Mojeek</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Monocles</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>MetaGer</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Google</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Bing</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Yahoo</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+
+ <item row="2" column="1">
+ <widget class="QLabel" name="searchEngineLabel">
+ <property name="textInteractionFlags">
+ <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+
+ <!-- Zoom factor. -->
+ <item row="3" column="0">
+ <widget class="QLabel" name="zoomFactorLabel">
+ <property name="text">
+ <string>Zoom factor</string>
+ </property>
+ </widget>
+ </item>
+
+ <item row="3" column="1">
+ <widget class="QDoubleSpinBox" name="kcfg_zoomFactor">
+ <property name="toolTip">
+ <string>Set the zoom factor between 0.25 and 5.00. The default is 1.00.</string>
+ </property>
+
+ <property name="minimum">
+ <double>0.250000000000000</double>
+ </property>
+
+ <property name="maximum">
+ <double>5.000000000000000</double>
+ </property>
+
+ <property name="singleStep">
+ <double>0.250000000000000</double>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+</ui>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
+
+ This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-android>.
+
+ Privacy Browser PC 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.
+
+ Privacy Browser PC 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 Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>. -->
+
+<ui version="4.0">
+ <!-- The name of the generated class. -->
+ <class>PrivacySettings</class>
+
+ <widget class="QWidget">
+ <layout class="QFormLayout">
+ <!-- JavaScript. -->
+ <item row="0" column="1">
+ <widget class="QCheckBox" name="kcfg_javaScript">
+ <property name="text">
+ <string>JavaScript</string>
+ </property>
+
+ <property name="toolTip">
+ <string>JavaScript allows websites to run programs (scripts) on the device. The default is disabled.</string>
+ </property>
+ </widget>
+ </item>
+
+ <!-- Local storage. -->
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="kcfg_localStorage">
+ <property name="text">
+ <string>Local storage</string>
+ </property>
+
+ <property name="toolTip">
+ <string>Local storage, sometimes also called DOM storage, is like cookies on steroids.</string>
+ </property>
+ </widget>
+ </item>
+
+ <!-- User agent. -->
+ <item row="2" column="0">
+ <widget class="QLabel">
+ <property name="text">
+ <string>User agent</string>
+ </property>
+ </widget>
+ </item>
+
+ <item row="2" column="1">
+ <widget class="QComboBox" name="kcfg_userAgent">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+
+ <property name="toolTip">
+ <string>The default is Privacy Browser.</string>
+ </property>
+
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+
+ <item>
+ <property name="text">
+ <string>Privacy Browser</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Firefox Linux</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Chromium Linux</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Firefox Windows</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Chrome Windows</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Edge Windows</string>
+ </property>
+ </item>
+
+ <item>
+ <property name="text">
+ <string>Safari macOS</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+
+ <item row="3" column="1">
+ <widget class="QLabel" name="userAgentLabel">
+ <property name="textInteractionFlags">
+ <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+</ui>
}
}
+ // Set local storage.
+ switch (domainRecord.field(DomainsDatabaseHelper::LOCAL_STORAGE).value().toInt())
+ {
+ case (DomainsDatabaseHelper::SYSTEM_DEFAULT):
+ {
+ // Set the default local storage status.
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, Settings::localStorage());
+
+ break;
+ }
+
+ case (DomainsDatabaseHelper::DISABLED):
+ {
+ // Disable local storage.
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, false);
+
+ break;
+ }
+
+ case (DomainsDatabaseHelper::ENABLED):
+ {
+ // Enable local storage.
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, true);
+
+ break;
+ }
+ }
+
// Set the user agent.
webEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getResultingDomainSettingsUserAgent(domainRecord.field(DomainsDatabaseHelper::USER_AGENT).value().toString()));
// Set the JavaScript status.
webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, Settings::javaScript());
+ // Set local storage.
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, Settings::localStorage());
+
// Set the user agent.
webEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getUserAgentFromDatabaseName(Settings::userAgent()));
// Emit the update actions signals.
emit updateJavaScriptAction(webEngineSettingsPointer->testAttribute(QWebEngineSettings::JavascriptEnabled));
+ emit updateLocalStorageAction(webEngineSettingsPointer->testAttribute(QWebEngineSettings::LocalStorageEnabled));
emit updateUserAgentActions(webEngineProfilePointer->httpUserAgent());
emit updateZoomFactorAction(webEngineViewPointer->zoomFactor());
webEngineViewPointer->reload();
}
+void BrowserView::toggleLocalStorage() const
+{
+ // Toggle local storage.
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, !webEngineSettingsPointer->testAttribute(QWebEngineSettings::LocalStorageEnabled));
+
+ // Update the local storage icon.
+ emit updateLocalStorageAction(webEngineSettingsPointer->testAttribute(QWebEngineSettings::LocalStorageEnabled));
+
+ // Reload the website.
+ webEngineViewPointer->reload();
+}
+
void BrowserView::updateUrl(const QUrl &url) const
{
// Update the URL line edit.
// The public functions.
void applyOnTheFlyZoomFactor(const double &zoomFactor);
void loadInitialWebsite();
+ void toggleJavaScript() const;
+ void toggleLocalStorage() const;
signals:
// The signals.
void updateDomainSettingsIndicator(const bool status) const;
void updateForwardAction(const bool &isEnabled) const;
void updateJavaScriptAction(const bool &isEnabled) const;
+ void updateLocalStorageAction(const bool &isEnabled) const;
void updateSearchEngineActions(const QString &searchEngine) const;
void updateUrlLineEdit(const QString &newUrl) const;
void updateUserAgentActions(const QString &userAgent) const;
void forward() const;
void home() const;
void loadUrlFromLineEdit(QString url) const;
- void toggleJavaScript() const;
void refresh() const;
private Q_SLOTS:
searchEngineYahooActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_yahoo"));
searchEngineCustomActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_custom"));
javaScriptActionPointer = actionCollectionPointer->addAction(QStringLiteral("javascript"));
+ localStorageActionPointer = actionCollectionPointer->addAction(QStringLiteral("local_storage"));
domainSettingsActionPointer = actionCollectionPointer->addAction(QStringLiteral("domain_settings"));
// Create the action groups
searchEngineBingActionPointer->setText(i18nc("Search engine", "Bing"));
searchEngineYahooActionPointer->setText(i18nc("Search engine", "Yahoo"));
javaScriptActionPointer->setText(i18nc("JavaScript button", "JavaScript"));
+ localStorageActionPointer->setText(i18nc("Local Storage Button", "Local Storage"));
domainSettingsActionPointer->setText(i18nc("Domain Settings button", "Domain Settings"));
// Set the action icons.
// Connect the URL toolbar actions.
connect(javaScriptActionPointer, SIGNAL(triggered()), this, SLOT(toggleJavaScript()));
+ connect(localStorageActionPointer, SIGNAL(triggered()), this, SLOT(toggleLocalStorage()));
connect(domainSettingsActionPointer, SIGNAL(triggered()), this, SLOT(openDomainSettings()));
// Update the URL toolbar actions.
connect(browserViewPointer, SIGNAL(updateBackAction(bool)), backActionPointer, SLOT(setEnabled(bool)));
connect(browserViewPointer, SIGNAL(updateForwardAction(bool)), forwardActionPointer, SLOT(setEnabled(bool)));
connect(browserViewPointer, SIGNAL(updateJavaScriptAction(bool)), this, SLOT(updateJavaScriptAction(bool)));
+ connect(browserViewPointer, SIGNAL(updateLocalStorageAction(bool)), this, SLOT(updateLocalStorageAction(bool)));
// Setup the GUI based on the browser_ui.rc file.
setupGUI(StandardWindowOption::Default, ("browser_ui.rc"));
urlLineEditPointer = new KLineEdit();
// Populate the URL toolbar.
- urlToolBarPointer->addWidget(urlLineEditPointer);
- urlToolBarPointer->addAction(javaScriptActionPointer);
- urlToolBarPointer->addAction(domainSettingsActionPointer);
+ urlToolBarPointer->insertWidget(javaScriptActionPointer, urlLineEditPointer);
// Load a new URL from the URL line edit.
connect(urlLineEditPointer, SIGNAL(returnKeyPressed(const QString)), this, SLOT(loadUrlFromLineEdit(const QString)));
progressBarPointer->show();
}
-void BrowserWindow::toggleJavaScript() const
-{
- // Remove the focus from the URL line edit.
- urlLineEditPointer->clearFocus();
-
- // Toggle JavaScript.
- browserViewPointer->toggleJavaScript();
-}
-
QSize BrowserWindow::sizeHint() const
{
// Return the default window size.
}
}
+void BrowserWindow::toggleJavaScript() const
+{
+ // Remove the focus from the URL line edit.
+ urlLineEditPointer->clearFocus();
+
+ // Toggle JavaScript.
+ browserViewPointer->toggleJavaScript();
+}
+
+void BrowserWindow::toggleLocalStorage() const
+{
+ // Remove the focus from the URL line edit.
+ urlLineEditPointer->clearFocus();
+
+ // Toggle JavaScript.
+ browserViewPointer->toggleLocalStorage();
+}
+
void BrowserWindow::updateDomainSettingsIndicator(const bool &status) const
{
// Set the domain palette according to the status.
else javaScriptActionPointer->setIcon(QIcon(":/icons/privacy-mode"));
}
+void BrowserWindow::updateLocalStorageAction(const bool &isEnabled) const
+{
+ // Set the icon according to the status.
+ if (isEnabled) localStorageActionPointer->setIcon(QIcon::fromTheme("disk-quota-low"));
+ else localStorageActionPointer->setIcon(QIcon::fromTheme("disk-quota"));
+}
+
void BrowserWindow::updateSearchEngineActions(const QString &searchEngine) const
{
// Initialize the custom search engine flag.
void settingsConfigure();
void showProgressBar(const int &progress) const;
void toggleJavaScript() const;
+ void toggleLocalStorage() const;
void updateDomainSettingsIndicator(const bool &status) const;
void updateJavaScriptAction(const bool &isEnabled) const;
+ void updateLocalStorageAction(const bool &isEnabled) const;
void updateSearchEngineActions(const QString &searchEngine) const;
void updateUserAgentActions(const QString &userAgent) const;
void updateZoomFactorAction(const double &zoomFactor);
QPalette domainSettingsPalette;
double currentZoomFactor;
QAction *javaScriptActionPointer;
+ QAction *localStorageActionPointer;
QPalette noDomainSettingsPalette;
QProgressBar *progressBarPointer;
QLabel *searchEngineLabelPointer;