]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/commitdiff
Add controls for local storage. https://redmine.stoutner.com/issues/830
authorSoren Stoutner <soren@stoutner.com>
Fri, 1 Apr 2022 19:38:28 +0000 (12:38 -0700)
committerSoren Stoutner <soren@stoutner.com>
Fri, 1 Apr 2022 19:38:28 +0000 (12:38 -0700)
22 files changed:
src/BrowserView.ui [deleted file]
src/CMakeLists.txt
src/DomainSettingsDialog.ui [deleted file]
src/Settings.kcfg [deleted file]
src/Settings.kcfgc [deleted file]
src/SettingsGeneral.ui [deleted file]
src/SettingsPrivacy.ui [deleted file]
src/dialogs/DomainSettingsDialog.cpp
src/dialogs/DomainSettingsDialog.h
src/helpers/DomainsDatabaseHelper.cpp
src/helpers/DomainsDatabaseHelper.h
src/settings/Settings.kcfg [new file with mode: 0644]
src/settings/Settings.kcfgc [new file with mode: 0644]
src/ui.rc/browser_ui.rc
src/ui/BrowserView.ui [new file with mode: 0644]
src/ui/DomainSettingsDialog.ui [new file with mode: 0644]
src/ui/SettingsGeneral.ui [new file with mode: 0644]
src/ui/SettingsPrivacy.ui [new file with mode: 0644]
src/views/BrowserView.cpp
src/views/BrowserView.h
src/windows/BrowserWindow.cpp
src/windows/BrowserWindow.h

diff --git a/src/BrowserView.ui b/src/BrowserView.ui
deleted file mode 100644 (file)
index 11219fa..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-<?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>
index 709b74ca16e6f9d88746142cce3062097e4bde32..83718228956d13b1c920a0c0fd69ba3845ffe3a5 100644 (file)
@@ -32,14 +32,14 @@ ecm_qt_declare_logging_category(privacy-browser
 )
 
 # 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.
diff --git a/src/DomainSettingsDialog.ui b/src/DomainSettingsDialog.ui
deleted file mode 100644 (file)
index 82d6a0d..0000000
+++ /dev/null
@@ -1,300 +0,0 @@
-<?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>
diff --git a/src/Settings.kcfg b/src/Settings.kcfg
deleted file mode 100644 (file)
index 25b12a8..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<?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>
diff --git a/src/Settings.kcfgc b/src/Settings.kcfgc
deleted file mode 100644 (file)
index 3129834..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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
diff --git a/src/SettingsGeneral.ui b/src/SettingsGeneral.ui
deleted file mode 100644 (file)
index 65b693e..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-<?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>
diff --git a/src/SettingsPrivacy.ui b/src/SettingsPrivacy.ui
deleted file mode 100644 (file)
index 74c7a0f..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-<?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>
index e3745b52b0c870a500b47c6f5d67243a0c604b31..a8960cda3bfcc964053646cc7aa8cb5d252d2aac 100644 (file)
@@ -43,6 +43,8 @@ DomainSettingsDialog::DomainSettingsDialog(QWidget *parent) : QDialog(parent)
     domainNameLineEditPointer = domainSettingsDialogUi.domainNameLineEdit;
     javaScriptComboBoxPointer = domainSettingsDialogUi.javaScriptComboBox;
     javaScriptLabelPointer = domainSettingsDialogUi.javaScriptLabel;
+    localStorageComboBoxPointer = domainSettingsDialogUi.localStorageComboBox;
+    localStorageLabelPointer = domainSettingsDialogUi.localStorageLabel;
     userAgentComboBoxPointer = domainSettingsDialogUi.userAgentComboBox;
     userAgentLabelPointer = domainSettingsDialogUi.userAgentLabel;
     zoomFactorComboBoxPointer = domainSettingsDialogUi.zoomFactorComboBox;
@@ -89,6 +91,7 @@ DomainSettingsDialog::DomainSettingsDialog(QWidget *parent) : QDialog(parent)
     // 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)));
@@ -149,7 +152,6 @@ void DomainSettingsDialog::customZoomFactorChanged(const double &newValue) const
     updateUi();
 }
 
-
 void DomainSettingsDialog::domainNameChanged(const QString &updatedDomainName) const
 {
     // Update the domains table model.
@@ -159,7 +161,6 @@ void DomainSettingsDialog::domainNameChanged(const QString &updatedDomainName) c
     updateUi();
 }
 
-
 void DomainSettingsDialog::domainSelected(const QModelIndex &modelIndex) const
 {
     // Populate the domain name line edit pointer.
@@ -168,6 +169,9 @@ void DomainSettingsDialog::domainSelected(const QModelIndex &modelIndex) const
     // 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();
 
@@ -194,6 +198,7 @@ void DomainSettingsDialog::domainSelected(const QModelIndex &modelIndex) const
 
     // Populate the labels.
     populateJavaScriptLabel();
+    populateLocalStorageLabel();
     populateUserAgentLabel(userAgentComboBoxPointer->currentText());
 
     // Update the UI.
@@ -213,6 +218,18 @@ void DomainSettingsDialog::javaScriptChanged(const int &newIndex) const
     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()
 {
@@ -234,14 +251,40 @@ void DomainSettingsDialog::populateJavaScriptLabel() const
         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;
         }
@@ -249,7 +292,7 @@ void DomainSettingsDialog::populateJavaScriptLabel() const
         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;
         }
@@ -257,7 +300,7 @@ void DomainSettingsDialog::populateJavaScriptLabel() const
         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;
         }
@@ -312,6 +355,7 @@ void DomainSettingsDialog::showAddMessageBox()
         // 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);
index 06941775f47ae07b498df58f08fe57b8e7310315..41438ce0aafa8082b9290036f1895ea94e4aac42 100644 (file)
@@ -49,6 +49,7 @@ private Q_SLOTS:
     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();
@@ -67,6 +68,8 @@ private:
     QSqlTableModel *domainsTableModelPointer;
     QComboBox *javaScriptComboBoxPointer;
     QLabel *javaScriptLabelPointer;
+    QComboBox *localStorageComboBoxPointer;
+    QLabel *localStorageLabelPointer;
     QPushButton *resetButtonPointer;
     QComboBox *userAgentComboBoxPointer;
     QLabel *userAgentLabelPointer;
@@ -74,6 +77,7 @@ private:
 
     // The private functions.
     void populateJavaScriptLabel() const;
+    void populateLocalStorageLabel() const;
     void populateUserAgentLabel(const QString &userAgentName) const;
     void updateUi() const;
 };
index 5b6c4faa4caa8e78227be1dd8e691c94851b7c66..ed62e6a12b787e1ff023535341a922a6558d3d84 100644 (file)
@@ -26,12 +26,13 @@ const QString DomainsDatabaseHelper::CONNECTION_NAME = "domains_database";
 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";
@@ -74,9 +75,6 @@ void DomainsDatabaseHelper::addDatabase()
                         // 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]];
                     }
@@ -97,7 +95,15 @@ void DomainsDatabaseHelper::addDatabase()
                         // 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.
@@ -114,6 +120,7 @@ void DomainsDatabaseHelper::addDatabase()
                 _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)"
index b95988da1fc16e39e2b21a2fb12b6ed0c7acd376..2ec812b480b9bfd01a2309eeb157b77d3ddfd5d6 100644 (file)
@@ -46,6 +46,7 @@ public:
     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;
 
diff --git a/src/settings/Settings.kcfg b/src/settings/Settings.kcfg
new file mode 100644 (file)
index 0000000..c5435fa
--- /dev/null
@@ -0,0 +1,57 @@
+<?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>
diff --git a/src/settings/Settings.kcfgc b/src/settings/Settings.kcfgc
new file mode 100644 (file)
index 0000000..3129834
--- /dev/null
@@ -0,0 +1,26 @@
+# 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
index 3c46ee0a2f3e5000b60bf2faa79ea93745950762..dbbeb317f140e08a83ddc694b464c1f0ade984ac 100644 (file)
@@ -69,5 +69,9 @@
     </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>
diff --git a/src/ui/BrowserView.ui b/src/ui/BrowserView.ui
new file mode 100644 (file)
index 0000000..11219fa
--- /dev/null
@@ -0,0 +1,55 @@
+<?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>
diff --git a/src/ui/DomainSettingsDialog.ui b/src/ui/DomainSettingsDialog.ui
new file mode 100644 (file)
index 0000000..0b2f56f
--- /dev/null
@@ -0,0 +1,343 @@
+<?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>
diff --git a/src/ui/SettingsGeneral.ui b/src/ui/SettingsGeneral.ui
new file mode 100644 (file)
index 0000000..65b693e
--- /dev/null
@@ -0,0 +1,146 @@
+<?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>
diff --git a/src/ui/SettingsPrivacy.ui b/src/ui/SettingsPrivacy.ui
new file mode 100644 (file)
index 0000000..a1445b6
--- /dev/null
@@ -0,0 +1,132 @@
+<?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>
index 21e1493aaa63c7482314936ac664e85f889d8825..933a300816208a1ad3528b29fb429f8cab742564 100644 (file)
@@ -162,6 +162,34 @@ void BrowserView::applyDomainSettings(const QString &hostname, const bool reload
             }
         }
 
+        // 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()));
 
@@ -188,6 +216,9 @@ void BrowserView::applyDomainSettings(const QString &hostname, const bool reload
         // 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()));
 
@@ -203,6 +234,7 @@ void BrowserView::applyDomainSettings(const QString &hostname, const bool reload
 
     // 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());
 
@@ -358,6 +390,18 @@ void BrowserView::toggleJavaScript() const
     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.
index 143db41d166d1c3e50a22394114fcaca41a86148..140146808befc2e35fa667384dfb8c08a7aa8838 100644 (file)
@@ -41,6 +41,8 @@ public:
     // The public functions.
     void applyOnTheFlyZoomFactor(const double &zoomFactor);
     void loadInitialWebsite();
+    void toggleJavaScript() const;
+    void toggleLocalStorage() const;
 
 signals:
     // The signals.
@@ -51,6 +53,7 @@ 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;
@@ -67,7 +70,6 @@ public Q_SLOTS:
     void forward() const;
     void home() const;
     void loadUrlFromLineEdit(QString url) const;
-    void toggleJavaScript() const;
     void refresh() const;
 
 private Q_SLOTS:
index 03ababcb877893de2941c9cd409d92bd4d8d45e3..13f470e039dfd5d617b66690783beca80b410a8e 100644 (file)
@@ -72,6 +72,7 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
     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
@@ -127,6 +128,7 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
     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.
@@ -162,12 +164,14 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
 
     // 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"));
@@ -179,9 +183,7 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
     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)));
@@ -324,15 +326,6 @@ void BrowserWindow::showProgressBar(const int &progress) const
     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.
@@ -414,6 +407,24 @@ void BrowserWindow::settingsConfigure()
     }
 }
 
+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.
@@ -428,6 +439,13 @@ void BrowserWindow::updateJavaScriptAction(const bool &isEnabled) const
     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.
index 02978d45add29c8cee51e4bc49cec670ee387e3b..b3630db54e3459fb0f97baf450018cf16e3e4fd9 100644 (file)
@@ -56,8 +56,10 @@ private Q_SLOTS:
     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);
@@ -73,6 +75,7 @@ private:
     QPalette domainSettingsPalette;
     double currentZoomFactor;
     QAction *javaScriptActionPointer;
+    QAction *localStorageActionPointer;
     QPalette noDomainSettingsPalette;
     QProgressBar *progressBarPointer;
     QLabel *searchEngineLabelPointer;