Add JavaScript controls.
authorSoren Stoutner <soren@stoutner.com>
Wed, 2 Feb 2022 23:08:36 +0000 (16:08 -0700)
committerSoren Stoutner <soren@stoutner.com>
Wed, 2 Feb 2022 23:08:36 +0000 (16:08 -0700)
13 files changed:
src/CMakeLists.txt
src/browserwindow.cpp
src/browserwindow.h
src/icons/javascript-warning.svg [new file with mode: 0644]
src/icons/privacy-mode.svg [new file with mode: 0644]
src/mainview.cpp
src/mainview.h
src/mainview.ui
src/resources.qrc
src/settings.kcfg
src/settings.ui [deleted file]
src/settingsgeneral.ui [new file with mode: 0644]
src/settingsprivacy.ui [new file with mode: 0644]

index 1043918135943e9c0b8c46e380b186fed6d08767..c36a84b1d0fe676968140a1c0bc07aaf9a3b094c 100644 (file)
@@ -40,7 +40,8 @@ kconfig_add_kcfg_files(privacy-browser settings.kcfgc)
 # Use KDE Frameworks to handle internationalization of the following UI files.
 ki18n_wrap_ui(privacy-browser
     mainview.ui
-    settings.ui
+    settingsprivacy.ui
+    settingsgeneral.ui
 )
 
 # Link the following libraries.
index d539fedf3f1aedebf8fb38f6bfd8daaed2856235..baf9fe90655ec809e1999c4b4f59b0f5eaca783e 100644 (file)
@@ -19,9 +19,9 @@
 
 // Application headers.
 #include "browserwindow.h"
-#include "mainview.h"
 #include "settings.h"
-#include "ui_settings.h"
+#include "ui_settingsprivacy.h"
+#include "ui_settingsgeneral.h"
 
 // KDE Frameworks headers.
 #include <KActionCollection>
@@ -33,7 +33,7 @@
 BrowserWindow::BrowserWindow() : KXmlGuiWindow()
 {
     // Instantiate the main view pointer.
-    MainView *mainViewPointer = new MainView(this);
+    mainViewPointer = new MainView(this);
 
     // Set the main view as the central widget.
     setCentralWidget(mainViewPointer);
@@ -64,19 +64,23 @@ void BrowserWindow::settingsConfigure()
     // Check to make sure the dialog box isn't already displayed.
     if (!KConfigDialog::exists(QStringLiteral("settings")))
     {
-        // Create a general settings page.
+        // Create the settings widgets.
+        QWidget *privacySettingsWidgetPointer = new QWidget;
         QWidget *generalSettingsWidgetPointer = new QWidget;
 
         // Instantiate the settings UI.
-        Ui::Settings settingsUi;
+        Ui::PrivacySettings privacySettingsUi;
+        Ui::GeneralSettings generalSettingsUi;
 
-        // Setup the UI to display the general settings widget.
-        settingsUi.setupUi(generalSettingsWidgetPointer);
+        // Setup the UI to display the settings widgets.
+        privacySettingsUi.setupUi(privacySettingsWidgetPointer);
+        generalSettingsUi.setupUi(generalSettingsWidgetPointer);
 
         // Instantiate a settings config dialog from the settings.kcfg file.
         KConfigDialog *configDialogPointer = new KConfigDialog(this, QStringLiteral("settings"), Settings::self());
 
-        // Add the general settings widget page.
+        // Add the settings widgets as config dialog pages.
+        configDialogPointer->addPage(privacySettingsWidgetPointer, i18nc("@title:tab", "Privacy"), QStringLiteral("privacy-browser"));
         configDialogPointer->addPage(generalSettingsWidgetPointer, i18nc("@title:tab", "General"), QStringLiteral("breeze-settings"));
 
         // Delete the config dialog when it is closed.
@@ -84,6 +88,10 @@ void BrowserWindow::settingsConfigure()
 
         // Make it so.
         configDialogPointer->show();
+
+        // Apply the settings when they are updated.
+        connect(configDialogPointer, SIGNAL(settingsChanged(QString)), mainViewPointer, SLOT(applyApplicationSettings()));
+        connect(configDialogPointer, SIGNAL(settingsChanged(QString)), mainViewPointer, SLOT(applyDomainSettings()));
     }
 }
 
index 613f2103e0a8c0a993a05f143a583d000d6ef8fc..fc1e53da4de590c33c3dbbbd7c8b0b6d04354f2e 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef BROWSERWINDOW_H
 #define BROWSERWINDOW_H
 
+// Application headers.
+#include "mainview.h"
+
 // KDE Frameworks headers.
 #include <KXmlGuiWindow>
 
@@ -37,5 +40,9 @@ private Q_SLOTS:
     void fileNew();
     void settingsConfigure();
     void updateStatusBar(const QString &statusBarMessage);
+
+private:
+    // Define the private variables.
+    MainView *mainViewPointer;
 };
 #endif
diff --git a/src/icons/javascript-warning.svg b/src/icons/javascript-warning.svg
new file mode 100644 (file)
index 0000000..39245a7
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+
+<!--
+  Copyright © 2016-2017,2021-2022 Soren Stoutner <soren@stoutner.com>.
+
+  This file is derived from `security` and `language`, which are part of the Android Material icon set.  They are released under the Apache License 2.0.  <https://fonts.google.com/icons>
+
+  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/>. -->
+
+<svg
+    xmlns="http://www.w3.org/2000/svg"
+    viewBox="0 0 256 256" >
+
+    <!-- Inner Shield. -->
+    <g transform="translate(0,160)" >
+        <path
+            style="fill:#b71c1c"
+            d="m 128,-147.2 -94.254546,41.89091 0,62.836368 c 0,58.123635 40.215273,112.477091 94.254546,125.672721 54.03928,-13.19563 94.25454,-67.549086 94.25454,-125.672721 l 0,-62.836368 z" />
+    </g>
+
+    <!-- Shield. -->
+    <g transform="translate(0,160)" >
+        <path
+            style="fill:#d32f2f"
+            d="m 128,-160 -104.727273,46.54546 0,69.818182 C 23.272727,20.945459 67.956363,81.338188 128,95.999999 188.04364,81.338188 232.72727,20.945459 232.72727,-43.636358 l 0,-69.818182 L 128,-160 Z m 0,127.883641 81.45454,0 C 203.28728,15.825464 171.28727,58.530919 128,71.912739 l 0,-103.912735 -81.454545,0 0,-66.327272 L 128,-134.51636 l 0,102.400001 z" />
+    </g>
+
+    <!-- Globe. -->
+    <g transform="translate(0,232)" >
+        <path
+            style="fill:#ffffff"
+            d="m 127.92021,-183.78553 c -44.041614,0 -79.705747,35.74391 -79.705747,79.78553 0,44.041617 35.664133,79.785537 79.705747,79.785537 44.1214,0 79.86533,-35.74392 79.86533,-79.785537 0,-44.04162 -35.74393,-79.78553 -79.86533,-79.78553 z m 55.29138,47.87132 -23.53674,0 c -2.55313,-9.9732 -6.22326,-19.54746 -11.0104,-28.40365 14.68055,5.02648 26.88773,15.23903 34.54714,28.40365 z M 128,-167.50929 c 6.6222,9.57427 11.80825,20.18574 15.23903,31.59508 l -30.47807,0 c 3.43078,-11.40934 8.61684,-22.02081 15.23904,-31.59508 z M 66.245993,-88.042889 C 64.969425,-93.149168 64.171571,-98.494798 64.171571,-104 c 0,-5.5052 0.797855,-10.85083 2.074422,-15.95711 l 26.96751,0 c -0.63829,5.26585 -1.117,10.5317 -1.117,15.95711 0,5.425417 0.47872,10.691263 1.117,15.957111 l -26.96751,0 z m 6.542412,15.957108 23.536735,0 c 2.553137,9.973191 6.22327,19.547449 11.0104,28.403644 -14.680534,-5.026482 -26.88772,-15.159254 -34.547135,-28.403644 z m 23.536735,-63.828429 -23.536735,0 c 7.659415,-13.2444 19.866601,-23.37717 34.547135,-28.40365 -4.78713,8.85619 -8.457263,18.43045 -11.0104,28.40365 z M 128,-40.49071 c -6.6222,-9.574268 -11.80826,-20.185747 -15.23904,-31.595071 l 30.47807,0 C 139.80825,-60.676457 134.6222,-50.064978 128,-40.49071 Z m 18.66982,-47.552179 -37.33964,0 c -0.71801,-5.265848 -1.27656,-10.531694 -1.27656,-15.957111 0,-5.42541 0.55854,-10.77105 1.27656,-15.95711 l 37.33964,0 c 0.71811,5.18606 1.27656,10.5317 1.27656,15.95711 0,5.425417 -0.55844,10.691263 -1.27656,15.957111 z m 1.99463,44.360752 c 4.78714,-8.856195 8.45727,-18.430453 11.0104,-28.403644 l 23.53674,0 c -7.65941,13.164605 -19.86659,23.377162 -34.54714,28.403644 z m 14.12204,-44.360752 c 0.63828,-5.265848 1.117,-10.531694 1.117,-15.957111 0,-5.42541 -0.47871,-10.69126 -1.117,-15.95711 l 26.96752,0 c 1.27656,5.10628 2.07441,10.45191 2.07441,15.95711 0,5.505202 -0.79784,10.850832 -2.07441,15.957111 l -26.96752,0 z" />
+    </g>
+</svg>
diff --git a/src/icons/privacy-mode.svg b/src/icons/privacy-mode.svg
new file mode 100644 (file)
index 0000000..428d507
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+
+<!--
+  Copyright © 2016-2017,2021-2022 Soren Stoutner <soren@stoutner.com>.
+
+  This file is derived from `security` and `language`, which are part of the Android Material icon set.  They are released under the Apache License 2.0.  <https://fonts.google.com/icons>
+
+  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/>. -->
+
+<svg
+    xmlns="http://www.w3.org/2000/svg"
+    viewBox="0 0 256 256" >
+
+    <!-- Inner Shield. -->
+    <g transform="translate(0,160)" >
+        <path
+            style="fill:#0d47a1"
+            d="m 128,-147.2 -94.254546,41.89091 v 62.836368 c 0,58.123635 40.215273,112.477091 94.254546,125.672721 54.03928,-13.19563 94.25454,-67.549086 94.25454,-125.672721 v -62.836368 z" />
+    </g>
+
+    <!-- Outer Shield. -->
+    <g transform="translate(0,160)" >
+        <path
+            style="fill:#1976d2"
+            d="m 128,-160 -104.727273,46.54546 v 69.818182 C 23.272727,20.945459 67.956363,81.338188 128,95.999999 188.04364,81.338188 232.72727,20.945459 232.72727,-43.636358 v -69.818182 z m 0,127.883641 h 81.45454 C 203.28728,15.825464 171.28727,58.530919 128,71.912739 V -31.999996 H 46.545455 V -98.327268 L 128,-134.51636 Z" />
+    </g>
+
+    <!-- Globe. -->
+    <g transform="translate(0,232)" >
+        <path
+            style="fill:#ffffff"
+            d="m 127.92021,-183.78553 c -44.041614,0 -79.705747,35.74391 -79.705747,79.78553 0,44.041617 35.664133,79.785537 79.705747,79.785537 44.1214,0 79.86533,-35.74392 79.86533,-79.785537 0,-44.04162 -35.74393,-79.78553 -79.86533,-79.78553 z m 55.29138,47.87132 h -23.53674 c -2.55313,-9.9732 -6.22326,-19.54746 -11.0104,-28.40365 14.68055,5.02648 26.88773,15.23903 34.54714,28.40365 z M 128,-167.50929 c 6.6222,9.57427 11.80825,20.18574 15.23903,31.59508 h -30.47807 c 3.43078,-11.40934 8.61684,-22.02081 15.23904,-31.59508 z M 66.245993,-88.042889 C 64.969425,-93.149168 64.171571,-98.494798 64.171571,-104 c 0,-5.5052 0.797855,-10.85083 2.074422,-15.95711 h 26.96751 c -0.63829,5.26585 -1.117,10.5317 -1.117,15.95711 0,5.425417 0.47872,10.691263 1.117,15.957111 z m 6.542412,15.957108 H 96.32514 c 2.553137,9.973191 6.22327,19.547449 11.0104,28.403644 C 92.655006,-48.708619 80.44782,-58.841391 72.788405,-72.085781 Z M 96.32514,-135.91421 H 72.788405 c 7.659415,-13.2444 19.866601,-23.37717 34.547135,-28.40365 -4.78713,8.85619 -8.457263,18.43045 -11.0104,28.40365 z M 128,-40.49071 c -6.6222,-9.574268 -11.80826,-20.185747 -15.23904,-31.595071 h 30.47807 C 139.80825,-60.676457 134.6222,-50.064978 128,-40.49071 Z m 18.66982,-47.552179 h -37.33964 c -0.71801,-5.265848 -1.27656,-10.531694 -1.27656,-15.957111 0,-5.42541 0.55854,-10.77105 1.27656,-15.95711 h 37.33964 c 0.71811,5.18606 1.27656,10.5317 1.27656,15.95711 0,5.425417 -0.55844,10.691263 -1.27656,15.957111 z m 1.99463,44.360752 c 4.78714,-8.856195 8.45727,-18.430453 11.0104,-28.403644 h 23.53674 c -7.65941,13.164605 -19.86659,23.377162 -34.54714,28.403644 z m 14.12204,-44.360752 c 0.63828,-5.265848 1.117,-10.531694 1.117,-15.957111 0,-5.42541 -0.47871,-10.69126 -1.117,-15.95711 h 26.96752 c 1.27656,5.10628 2.07441,10.45191 2.07441,15.95711 0,5.505202 -0.79784,10.850832 -2.07441,15.957111 z" />
+    </g>
+</svg>
index 25f3b4c5ea0d1b6f39de2439abea2bff200d58f3..3ebee4c4d02199ba260e47af8fb0262192b31b78 100644 (file)
@@ -28,6 +28,7 @@
 
 // Qt headers.
 #include <QWebEngineHistory>
+#include <QWebEngineSettings>
 #include <QWebEngineView>
 
 MainView::MainView(QWidget *parent) : QWidget(parent)
@@ -43,11 +44,13 @@ MainView::MainView(QWidget *parent) : QWidget(parent)
     forwardButtonPointer = mainViewUi.forwardButton;
     QPushButton *homeButtonPointer = mainViewUi.homeButton;
     urlLineEditPointer = mainViewUi.urlLineEdit;
+    javaScriptButtonPointer = mainViewUi.javaScript;
     webEngineViewPointer = mainViewUi.webEngineView;
 
-    // Get handles for the webpage and history.
+    // Get handles for the aspects of the WebEngine.
     QWebEnginePage *webEnginePagePointer = webEngineViewPointer->page();
     webEngineHistoryPointer = webEnginePagePointer->history();
+    webEngineSettingsPointer = webEngineViewPointer->settings();
 
     // Update the webengine view from the URL line edit.
     connect(urlLineEditPointer, SIGNAL(returnKeyPressed(const QString)), this, SLOT(loadUrl(const QString)));
@@ -61,6 +64,7 @@ MainView::MainView(QWidget *parent) : QWidget(parent)
     connect(backButtonPointer, SIGNAL(clicked()), webEngineViewPointer, SLOT(back()));
     connect(forwardButtonPointer, SIGNAL(clicked()), webEngineViewPointer, SLOT(forward()));
     connect(homeButtonPointer, SIGNAL(clicked()), this, SLOT(goHome()));
+    connect(javaScriptButtonPointer, SIGNAL(clicked()), this, SLOT(toggleJavaScript()));
 
     // Instantiate the mouse event pointer.
     MouseEventFilter *mouseEventFilterPointer = new MouseEventFilter(webEngineViewPointer);
@@ -71,9 +75,18 @@ MainView::MainView(QWidget *parent) : QWidget(parent)
     // Listen for hovered link URLs.
     connect(webEnginePagePointer, SIGNAL(linkHovered(QString)), this, SLOT(pageLinkHovered(QString)));
 
+    // Don't allow JavaScript to open windows.
+    webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, false);
+
     // Set the zoom factor.
     webEngineViewPointer->setZoomFactor(Settings::zoomFactor());
 
+    // Apply the application settings.
+    applyApplicationSettings();
+
+    // Apply the domain settings.
+    applyDomainSettings();
+
     // Set the focus on the WebEngine view.
     webEngineViewPointer->setFocus();
 
@@ -81,6 +94,30 @@ MainView::MainView(QWidget *parent) : QWidget(parent)
     goHome();
 }
 
+void MainView::applyApplicationSettings()
+{
+    // TODO.
+}
+
+void MainView::applyDomainSettings()
+{
+    // Set the JavaScript status.
+    webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, Settings::javaScript());
+
+    // Update the JavaScript button.
+    if (Settings::javaScript())
+    {
+        javaScriptButtonPointer->setIcon(QIcon(":/icons/javascript-warning"));
+    }
+    else
+    {
+        javaScriptButtonPointer->setIcon(QIcon(":/icons/privacy-mode"));
+    }
+
+    // Reload the website.
+    webEngineViewPointer->reload();
+}
+
 void MainView::goHome()
 {
     // Load the homepage.  TODO.  Consider sanitizing the homepage input and adding things like protocols if they are missing.
@@ -102,6 +139,25 @@ void MainView::pageLinkHovered(const QString &linkUrl)
     emit linkHovered(linkUrl);
 }
 
+void MainView::toggleJavaScript()
+{
+    // Toggle JavaScript.
+    webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, !webEngineSettingsPointer->testAttribute(QWebEngineSettings::JavascriptEnabled));
+
+    // Update the JavaScript button.
+    if (webEngineSettingsPointer->testAttribute(QWebEngineSettings::JavascriptEnabled))
+    {
+        javaScriptButtonPointer->setIcon(QIcon(":/icons/javascript-warning"));
+    }
+    else
+    {
+        javaScriptButtonPointer->setIcon(QIcon(":/icons/privacy-mode"));
+    }
+
+    // Reload the website.
+    webEngineViewPointer->reload();
+}
+
 void MainView::updateInterface()
 {
     // Update the URL line edit if it does not have focus.
index 76d0bbad7d85584dda6d6a728d8e702da5d05b40..ee82d79085ec91f1334f68f34626b667bf159123 100644 (file)
@@ -36,19 +36,27 @@ signals:
     // Define the signals.
     void linkHovered(const QString &linkUrl);
 
+public Q_SLOTS:
+    // Define the public slots.
+    void applyApplicationSettings();
+    void applyDomainSettings();
+
 private Q_SLOTS:
     // Define the private slots.
     void goHome();
     void loadUrl(const QString &urlFromUser);
     void pageLinkHovered(const QString &linkUrl);
+    void toggleJavaScript();
     void updateInterface();
 
 private:
     // Define the private variables.
     QPushButton *backButtonPointer;
     QPushButton *forwardButtonPointer;
+    QPushButton *javaScriptButtonPointer;
     KLineEdit *urlLineEditPointer;
     QWebEngineHistory *webEngineHistoryPointer;
+    QWebEngineSettings *webEngineSettingsPointer;
     QWebEngineView *webEngineViewPointer;
 };
 #endif
index 03b60b9cabc81883e8d8cf8e30cef200880b3740..d00087fe2bcc0911622bd62481a30190b2c80594 100644 (file)
@@ -55,6 +55,7 @@
                 <number>0</number>
             </property>
 
+            <!-- URL bar. -->
             <item>
                 <layout class="QHBoxLayout">
                     <!-- Set the spacing between items to 0. -->
@@ -62,7 +63,7 @@
                         <number>0</number>
                     </property>
 
-                    <!-- The back button. -->
+                    <!-- Back button. -->
                     <item>
                         <widget class="QPushButton" name="backButton">
                             <property name="icon">
@@ -82,7 +83,7 @@
                         </widget>
                     </item>
 
-                    <!-- The forward button. -->
+                    <!-- Forward button. -->
                     <item>
                         <widget class="QPushButton" name="forwardButton">
                             <property name="icon">
                         </widget>
                     </item>
 
-                    <!-- The home button. -->
+                    <!-- Home button. -->
                     <item>
                         <widget class="QPushButton" name="homeButton">
                             <property name="icon">
                         </widget>
                     </item>
 
-                    <!-- The URL line edit.-->
+                    <!-- URL line edit. -->
                     <item>
                         <widget class="KLineEdit" name="urlLineEdit" />
                     </item>
+
+                    <!-- JavaScript. -->
+                    <item>
+                        <widget class="QPushButton" name="javaScript">
+                            <property name="icon">
+                                <iconset theme="privacy-mode" />
+                            </property>
+
+                            <property name="iconSize">
+                                <size>
+                                    <height>24</height>
+                                    <width>24</width>
+                                </size>
+                            </property>
+
+                            <property name="flat">
+                                <bool>true</bool>
+                            </property>
+                        </widget>
+                    </item>
                 </layout>
             </item>
 
-            <!-- The WebEngine view. -->
+            <!-- WebEngine view. -->
             <item>
                 <widget class="QWebEngineView" name="webEngineView" />
             </item>
index 5ac9f4c0381a5951dc769af005176947358619cd..cfa6f792ba5ffb28989605ecb2ed2f8579d989f4 100644 (file)
@@ -19,6 +19,8 @@
 <!DOCTYPE RCC>
 <RCC version="1.0">
     <qresource>
+        <file>icons/javascript-warning.svg</file>
+        <file>icons/privacy-mode.svg</file>
         <file>icons/sc-apps-privacy-browser.svg</file>
         <file>licenses/GPLv3+.txt</file>
     </qresource>
index 8497069364958bd50a72616300804c408ba92bfc..f739cf695b415c5e7f7db6d40d22ffdff2c67663 100644 (file)
@@ -18,7 +18,7 @@
   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 displayed at <https://api.kde.org/frameworks/kconfig/html/classKConfigSkeleton.html>. -->
+  <!-- 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"
     <!-- 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>
+    </group>
+
     <group name="General">
         <entry name="homepage" type="Url">
             <default>https://www.mojeek.com/</default>
diff --git a/src/settings.ui b/src/settings.ui
deleted file mode 100644 (file)
index a6c876f..0000000
+++ /dev/null
@@ -1,105 +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>Settings</class>
-
-    <widget class="QWidget" name="Settings">
-        <property name="geometry">
-            <rect>
-                <x>0</x>
-                <y>0</y>
-                <width>374</width>
-                <height>200</height>
-            </rect>
-        </property>
-
-        <layout class="QFormLayout">
-            <item row="0" column="0">
-                <widget class="QLabel" name="homepageLabel">
-                    <property name="text">
-                        <string>Homepage</string>
-                    </property>
-
-                    <property name="toolTip">
-                        <string>Set the hompage.</string>
-                    </property>
-
-                    <property name="whatsThis">
-                        <string>Set the homepage.  The default is https://www.mojeek.com/.</string>
-                    </property>
-                </widget>
-            </item>
-
-            <item row="0" column="1">
-                <widget class="KLineEdit" name="kcfg_homepage">
-                    <property name="toolTip">
-                        <string>Set the hompage.</string>
-                    </property>
-
-                    <property name="whatsThis">
-                        <string>Set the homepage.  The default is https://www.mojeek.com/.</string>
-                    </property>
-                </widget>
-            </item>
-
-
-            <item row="1" column="0">
-                <widget class="QLabel" name="zoomFactorLabel">
-                    <property name="text">
-                        <string>Zoom factor</string>
-                    </property>
-
-                    <property name="toolTip">
-                        <string>Set the zoom factor between 0.25 and 5.00.</string>
-                    </property>
-
-                    <property name="whatsThis">
-                        <string>Set the zoom factor between 0.25 and 5.00.  The default is 1.00.</string>
-                    </property>
-                </widget>
-            </item>
-
-            <item row="1" column="1">
-                <widget class="QDoubleSpinBox" name="kcfg_zoomFactor">
-                    <property name="toolTip">
-                        <string>Set the zoom factor between 0.25 and 5.00.</string>
-                    </property>
-
-                    <property name="whatsThis">
-                        <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>
-                </widget>
-            </item>
-        </layout>
-    </widget>
-
-    <resources/>
-
-    <connections/>
-</ui>
diff --git a/src/settingsgeneral.ui b/src/settingsgeneral.ui
new file mode 100644 (file)
index 0000000..de42696
--- /dev/null
@@ -0,0 +1,70 @@
+<?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>
+
+            <!-- Zoom factor. -->
+            <item row="1" column="0">
+                <widget class="QLabel" name="zoomFactorLabel">
+                    <property name="text">
+                        <string>Zoom factor</string>
+                    </property>
+                </widget>
+            </item>
+
+            <item row="1" 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>
+                </widget>
+            </item>
+        </layout>
+    </widget>
+</ui>
diff --git a/src/settingsprivacy.ui b/src/settingsprivacy.ui
new file mode 100644 (file)
index 0000000..5c80ede
--- /dev/null
@@ -0,0 +1,54 @@
+<?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">
+            <!-- Set the spacing between items to 0. -->
+            <property name="spacing">
+                <number>0</number>
+            </property>
+
+            <!-- JavaScript. -->
+            <item row="0" column="0">
+                <widget class="QCheckBox" name="kcfg_javaScript">
+                    <property name="sizePolicy">
+                        <sizepolicy hsizetype="Preferred" vsizetype="Preferred" />
+                    </property>
+
+                    <property name="toolTip">
+                        <string>JavaScript allows websites to run programs (scripts) on the device.  The default is disabled.</string>
+                    </property>
+                </widget>
+            </item>
+
+            <item row="0" column="1">
+                <widget class="QLabel" name="javaScriptLabel">
+                    <property name="text">
+                        <string>JavaScript</string>
+                    </property>
+                </widget>
+            </item>
+        </layout>
+    </widget>
+</ui>