Add user agent controls.
authorSoren Stoutner <soren@stoutner.com>
Sat, 5 Feb 2022 04:53:28 +0000 (21:53 -0700)
committerSoren Stoutner <soren@stoutner.com>
Sat, 5 Feb 2022 04:53:28 +0000 (21:53 -0700)
26 files changed:
src/BrowserWindow.cpp [new file with mode: 0644]
src/BrowserWindow.h [new file with mode: 0644]
src/CMakeLists.txt
src/MainView.cpp [new file with mode: 0644]
src/MainView.h [new file with mode: 0644]
src/MainView.ui [new file with mode: 0644]
src/MouseEventFilter.cpp [new file with mode: 0644]
src/MouseEventFilter.h [new file with mode: 0644]
src/Settings.kcfg [new file with mode: 0644]
src/Settings.kcfgc [new file with mode: 0644]
src/SettingsGeneral.ui [new file with mode: 0644]
src/SettingsPrivacy.ui [new file with mode: 0644]
src/UserAgentHelper.cpp [new file with mode: 0644]
src/UserAgentHelper.h [new file with mode: 0644]
src/browserwindow.cpp [deleted file]
src/browserwindow.h [deleted file]
src/main.cpp
src/mainview.cpp [deleted file]
src/mainview.h [deleted file]
src/mainview.ui [deleted file]
src/mouseeventfilter.cpp [deleted file]
src/mouseeventfilter.h [deleted file]
src/settings.kcfg [deleted file]
src/settings.kcfgc [deleted file]
src/settingsgeneral.ui [deleted file]
src/settingsprivacy.ui [deleted file]

diff --git a/src/BrowserWindow.cpp b/src/BrowserWindow.cpp
new file mode 100644 (file)
index 0000000..546a951
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * 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/>.
+ */
+
+// Application headers.
+#include "BrowserWindow.h"
+#include "Settings.h"
+#include "ui_SettingsPrivacy.h"
+#include "ui_SettingsGeneral.h"
+
+// KDE Frameworks headers.
+#include <KActionCollection>
+#include <KConfigDialog>
+
+// Qt framework headers.
+#include <QStatusBar>
+
+BrowserWindow::BrowserWindow() : KXmlGuiWindow()
+{
+    // Instantiate the main view pointer.
+    mainViewPointer = new MainView(this);
+
+    // Set the main view as the central widget.
+    setCentralWidget(mainViewPointer);
+
+    // Get a handle for the action collectoin.
+    KActionCollection *actionCollectionPointer = this->actionCollection();
+
+    // Add the standard actions.
+    KStandardAction::openNew(this, SLOT(fileNew()), actionCollectionPointer);
+    KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollectionPointer);
+    KStandardAction::preferences(this, SLOT(settingsConfigure()), actionCollectionPointer);
+
+    // Update the status bar with the URL when a link is hovered.
+    connect(mainViewPointer, SIGNAL(linkHovered(QString)), this, SLOT(updateStatusBar(QString)));
+
+    // Setup the GUI based on the privacybrowserui.rc file.
+    setupGUI();
+}
+
+void BrowserWindow::fileNew()
+{
+    // Display a new instance of Privacy Browser.
+    (new BrowserWindow)->show();
+}
+
+void BrowserWindow::settingsConfigure()
+{
+    // Check to make sure the dialog box isn't already displayed.
+    if (!KConfigDialog::exists(QStringLiteral("settings")))
+    {
+        // Create the settings widgets.
+        QWidget *privacySettingsWidgetPointer = new QWidget;
+        QWidget *generalSettingsWidgetPointer = new QWidget;
+
+        // Instantiate the settings UI.
+        Ui::PrivacySettings privacySettingsUi;
+        Ui::GeneralSettings generalSettingsUi;
+
+        // Setup the UI to display the settings widgets.
+        privacySettingsUi.setupUi(privacySettingsWidgetPointer);
+        generalSettingsUi.setupUi(generalSettingsWidgetPointer);
+
+        // Get handles for the user agent widgets.
+        QComboBox *userAgentComboBoxPointer = privacySettingsUi.kcfg_userAgent;
+        userAgentLabelPointer = privacySettingsUi.userAgentLabel;
+
+        // Instantiate the user agent helper.
+        userAgentHelperPointer = new UserAgentHelper();
+
+        // Display the initial user agent.
+        updateUserAgentLabel(userAgentComboBoxPointer->currentText());
+
+        // Update the user agent when the combo box changes.
+        connect(userAgentComboBoxPointer, SIGNAL(currentTextChanged(QString)), this, SLOT(updateUserAgentLabel(QString)));
+
+        // Instantiate a settings config dialog from the settings.kcfg file.
+        KConfigDialog *configDialogPointer = new KConfigDialog(this, QStringLiteral("settings"), Settings::self());
+
+        // 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.
+        configDialogPointer->setAttribute(Qt::WA_DeleteOnClose);
+
+        // Make it so.
+        configDialogPointer->show();
+
+        // Expand the config dialog.
+        configDialogPointer->resize(1000, 500);
+
+        // Apply the settings when they are updated.
+        connect(configDialogPointer, SIGNAL(settingsChanged(QString)), mainViewPointer, SLOT(applyApplicationSettings()));
+        connect(configDialogPointer, SIGNAL(settingsChanged(QString)), mainViewPointer, SLOT(applyDomainSettingsAndReload()));
+    }
+}
+
+void BrowserWindow::updateStatusBar(const QString &statusBarMessage)
+{
+    // Display the status bar message.
+    statusBar()->showMessage(statusBarMessage);
+}
+
+void BrowserWindow::updateUserAgentLabel(const QString &userAgentName)
+{
+    // Update the user agent label.
+    userAgentLabelPointer->setText(userAgentHelperPointer->getUserAgent(userAgentName));
+}
diff --git a/src/BrowserWindow.h b/src/BrowserWindow.h
new file mode 100644 (file)
index 0000000..31ac510
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * 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/>.
+ */
+
+#ifndef BROWSERWINDOW_H
+#define BROWSERWINDOW_H
+
+// Application headers.
+#include "MainView.h"
+#include "UserAgentHelper.h"
+
+// Qt framework headers.
+#include <QLabel>
+
+// KDE Frameworks headers.
+#include <KXmlGuiWindow>
+
+class BrowserWindow : public KXmlGuiWindow
+{
+    // Include the Q_OBJECT macro.
+    Q_OBJECT
+
+public:
+    // The default constructor.
+    BrowserWindow();
+
+private Q_SLOTS:
+    // Define the private slots.
+    void fileNew();
+    void settingsConfigure();
+    void updateStatusBar(const QString &statusBarMessage);
+    void updateUserAgentLabel(const QString &userAgentName);
+
+private:
+    // Define the private variables.
+    MainView *mainViewPointer;
+    QLabel *userAgentLabelPointer;
+    UserAgentHelper *userAgentHelperPointer;
+};
+#endif
index 425f0e71e5c22634247e8eeaf5a4468207fdc6da..8f184ad26ee8ff6a3f9ade1726e2e36390774ec3 100644 (file)
@@ -21,10 +21,11 @@ add_executable(privacy-browser resources.qrc)
 
 # List the sources to include in the executable.
 target_sources(privacy-browser PRIVATE
-    browserwindow.cpp
+    BrowserWindow.cpp
     main.cpp
-    mainview.cpp
-    mouseeventfilter.cpp
+    MainView.cpp
+    MouseEventFilter.cpp
+    UserAgentHelper.cpp
 )
 
 # Add the Qt logging category.  This will create the `debug.h` header file.
@@ -35,13 +36,13 @@ 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.kcfgc)
 
 # Use KDE Frameworks to handle internationalization of the following UI files.
 ki18n_wrap_ui(privacy-browser
-    mainview.ui
-    settingsprivacy.ui
-    settingsgeneral.ui
+    MainView.ui
+    SettingsPrivacy.ui
+    SettingsGeneral.ui
 )
 
 # Link the following libraries.
diff --git a/src/MainView.cpp b/src/MainView.cpp
new file mode 100644 (file)
index 0000000..cf84ecc
--- /dev/null
@@ -0,0 +1,203 @@
+/*
+ * 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/>.
+ */
+
+// Application headers
+#include "BrowserWindow.h"
+#include "MainView.h"
+#include "MouseEventFilter.h"
+#include "Settings.h"
+#include "ui_MainView.h"
+
+// Qt framework headers.
+#include <QWebEngineProfile>
+
+MainView::MainView(QWidget *parent) : QWidget(parent)
+{
+    // Instantiate the mainview UI.
+    Ui::MainView mainViewUi;
+
+    // Setup the UI.
+    mainViewUi.setupUi(this);
+
+    // Get handles for the views.
+    backButtonPointer = mainViewUi.backButton;
+    forwardButtonPointer = mainViewUi.forwardButton;
+    QPushButton *homeButtonPointer = mainViewUi.homeButton;
+    urlLineEditPointer = mainViewUi.urlLineEdit;
+    javaScriptButtonPointer = mainViewUi.javaScript;
+    webEngineViewPointer = mainViewUi.webEngineView;
+
+    // Get handles for the aspects of the WebEngine.
+    QWebEnginePage *webEnginePagePointer = webEngineViewPointer->page();
+    webEngineHistoryPointer = webEnginePagePointer->history();
+    webEngineProfilePointer = webEnginePagePointer->profile();
+    webEngineSettingsPointer = webEngineViewPointer->settings();
+
+    // Update the webengine view from the URL line edit.
+    connect(urlLineEditPointer, SIGNAL(returnKeyPressed(const QString)), this, SLOT(loadUrl(const QString)));
+
+    // Update the URL line edit form the webengine view.
+    connect(webEngineViewPointer, SIGNAL(loadStarted()), this, SLOT(updateInterface()));
+    connect(webEngineViewPointer, SIGNAL(loadProgress(int)), this, SLOT(updateInterface()));
+    connect(webEngineViewPointer, SIGNAL(loadFinished(bool)), this, SLOT(updateInterface()));
+
+    // Setup the URL bar buttons.
+    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);
+
+    // Install the mouse event filter.
+    qApp->installEventFilter(mouseEventFilterPointer);
+
+    // Listen for hovered link URLs.
+    connect(webEnginePagePointer, SIGNAL(linkHovered(QString)), this, SLOT(pageLinkHovered(QString)));
+
+    // Disable the cache.
+    webEngineProfilePointer->setHttpCacheType(QWebEngineProfile::NoCache);
+
+    // Instantiate the user agent helper.
+    userAgentHelperPointer = new UserAgentHelper();
+
+    // 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.  `false` does not reload the website.
+    applyDomainSettings(false);
+
+    // Set the focus on the WebEngine view.
+    webEngineViewPointer->setFocus();
+
+    // Get the arguments.
+    QStringList argumentsStringList = qApp->arguments();
+
+    // Check to see if the arguments lists contains a URL.
+    if (argumentsStringList.size() > 1)
+    {
+        // Load the URL from the arguments list.
+        webEngineViewPointer->setUrl(QUrl::fromUserInput(argumentsStringList.at(1)));
+    }
+    else
+    {
+        // Load the homepage.
+        goHome();
+    }
+}
+
+void MainView::applyApplicationSettings()
+{
+    // TODO.
+}
+
+void MainView::applyDomainSettingsAndReload()
+{
+    // Apply the domain setings.  `true` reloads the website.
+    applyDomainSettings(true);
+}
+
+void MainView::applyDomainSettings(bool reloadWebsite)
+{
+    // 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"));
+    }
+
+    // Apply the user agent.
+    webEngineProfilePointer->setHttpUserAgent(userAgentHelperPointer->getUserAgent(Settings::userAgent()));
+
+    // Reload the website if requested.
+    if (reloadWebsite)
+    {
+        webEngineViewPointer->reload();
+    }
+}
+
+void MainView::goHome()
+{
+    // Load the homepage.  TODO.  Consider sanitizing the homepage input and adding things like protocols if they are missing.
+    webEngineViewPointer->setUrl(Settings::homepage());
+}
+
+void MainView::loadUrl(const QString &urlFromUser)
+{
+    // Remove the focus from the URL line edit.
+    urlLineEditPointer->clearFocus();
+
+    // Load the URL, adding standard protocol sections if needed.  TODO.  Replace this with logic that prefers HTTPS.
+    webEngineViewPointer->setUrl(QUrl::fromUserInput(urlFromUser));
+}
+
+void MainView::pageLinkHovered(const QString &linkUrl)
+{
+    // Emit a signal so that the browser window can update the status bar.
+    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.
+    if (!urlLineEditPointer->hasFocus())
+    {
+        // Update the URL line edit.
+        urlLineEditPointer->setText(webEngineViewPointer->url().toString());
+    }
+
+    // Update the status of the forward and back buttons.
+    backButtonPointer->setEnabled(webEngineHistoryPointer->canGoBack());
+    forwardButtonPointer->setEnabled(webEngineHistoryPointer->canGoForward());
+
+    // Reapply the zoom factor.  This is a bug in QWebEngineView that resets the zoom with every load.  Hopefully it will be fixed in Qt6.  <https://bugreports.qt.io/browse/QTBUG-51992>
+    webEngineViewPointer->setZoomFactor(Settings::zoomFactor());
+}
diff --git a/src/MainView.h b/src/MainView.h
new file mode 100644 (file)
index 0000000..f08975e
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * 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/>.
+ */
+
+#ifndef MAINVIEW_H
+#define MAINVIEW_H
+
+// Application headers.
+#include "UserAgentHelper.h"
+
+// Qt framework headers.
+#include <QPushButton>
+#include <QWebEngineHistory>
+#include <QWebEngineSettings>
+#include <QWebEngineView>
+
+// KDE Framework headers.
+#include <KLineEdit>
+
+class MainView : public QWidget
+{
+    // Include the Q_OBJECT macro.
+    Q_OBJECT
+
+public:
+    // The primary contructor.
+    explicit MainView(QWidget *parent);
+
+signals:
+    // Define the signals.
+    void linkHovered(const QString &linkUrl);
+
+public Q_SLOTS:
+    // Define the public slots.
+    void applyApplicationSettings();
+    void applyDomainSettingsAndReload();
+
+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;
+    QWebEngineProfile *webEngineProfilePointer;
+    QWebEngineSettings *webEngineSettingsPointer;
+    QWebEngineView *webEngineViewPointer;
+    UserAgentHelper *userAgentHelperPointer;
+
+    // Define the private functions.
+    void applyDomainSettings(bool reloadWebsite);
+};
+#endif
diff --git a/src/MainView.ui b/src/MainView.ui
new file mode 100644 (file)
index 0000000..c7afeb8
--- /dev/null
@@ -0,0 +1,155 @@
+<?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>MainView</class>
+
+    <widget class="QWidget" name="MainView">
+        <!-- TODO.  Make this maximized by default. -->
+        <property name="geometry">
+            <rect>
+                <x>0</x>
+                <y>0</y>
+                <width>315</width>
+                <height>233</height>
+            </rect>
+        </property>
+
+        <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>
+
+            <!-- URL bar. -->
+            <item>
+                <layout class="QHBoxLayout">
+                    <!-- Set the spacing between items to 0. -->
+                    <property name="spacing">
+                        <number>0</number>
+                    </property>
+
+                    <!-- Back button. -->
+                    <item>
+                        <widget class="QPushButton" name="backButton">
+                            <property name="icon">
+                                <iconset theme="arrow-left" />
+                            </property>
+
+                            <property name="iconSize">
+                                <size>
+                                    <height>24</height>
+                                    <width>24</width>
+                                </size>
+                            </property>
+
+                            <property name="flat">
+                                <bool>true</bool>
+                            </property>
+                        </widget>
+                    </item>
+
+                    <!-- Forward button. -->
+                    <item>
+                        <widget class="QPushButton" name="forwardButton">
+                            <property name="icon">
+                                <iconset theme="arrow-right" />
+                            </property>
+
+                            <property name="iconSize">
+                                <size>
+                                    <height>24</height>
+                                    <width>24</width>
+                                </size>
+                            </property>
+
+                            <property name="flat">
+                                <bool>true</bool>
+                            </property>
+                        </widget>
+                    </item>
+
+                    <!-- Home button. -->
+                    <item>
+                        <widget class="QPushButton" name="homeButton">
+                            <property name="icon">
+                                <iconset theme="home" />
+                            </property>
+
+                            <property name="iconSize">
+                                <size>
+                                    <height>24</height>
+                                    <width>24</width>
+                                </size>
+                            </property>
+
+                            <property name="flat">
+                                <bool>true</bool>
+                            </property>
+                        </widget>
+                    </item>
+
+                    <!-- URL line edit. -->
+                    <item>
+                        <widget class="KLineEdit" name="urlLineEdit" />
+                    </item>
+
+                    <!-- JavaScript. -->
+                    <item>
+                        <widget class="QPushButton" name="javaScript">
+                            <property name="iconSize">
+                                <size>
+                                    <height>24</height>
+                                    <width>24</width>
+                                </size>
+                            </property>
+
+                            <property name="flat">
+                                <bool>true</bool>
+                            </property>
+                        </widget>
+                    </item>
+                </layout>
+            </item>
+
+            <!-- WebEngine view. -->
+            <item>
+                <widget class="QWebEngineView" name="webEngineView" />
+            </item>
+        </layout>
+    </widget>
+</ui>
diff --git a/src/MouseEventFilter.cpp b/src/MouseEventFilter.cpp
new file mode 100644 (file)
index 0000000..3454d06
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * 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/>.
+ */
+
+// Application headers.
+#include "MouseEventFilter.h"
+
+// Qt headers.
+#include <QEvent>
+#include <QMouseEvent>
+
+// The primary constructor.
+MouseEventFilter::MouseEventFilter(QWebEngineView *webEngineView) : QObject()
+{
+    // Save a handle to the WebEngine view.
+    webEngineViewPointer = webEngineView;
+};
+
+bool MouseEventFilter::eventFilter(QObject *objectPointer, QEvent *eventPointer)
+{
+    // Only process mouse button press events.
+    if (eventPointer->type() == QEvent::MouseButtonPress)
+    {
+        // Tell the compiler to ignore the unused object pointer.
+        (void)objectPointer;
+
+        // Cast the event to a mouse event.
+        QMouseEvent *mouseEventPointer = static_cast<QMouseEvent *>(eventPointer);
+
+        // Run the command according to the button that was pushed.
+        switch (mouseEventPointer->button())
+        {
+            case (Qt::BackButton):
+                // Tell the WebEngine to go back.
+                webEngineViewPointer->back();
+
+                // Consume the event.
+                return true;
+
+            case (Qt::ForwardButton):
+                // Tell the WebEngine to go forward.
+                webEngineViewPointer->forward();
+
+                // Consume the event.
+                return true;
+
+            default:
+                // Do not consume the event.
+                return false;
+        }
+    }
+
+    // Do not consume the event.
+    return false;
+}
diff --git a/src/MouseEventFilter.h b/src/MouseEventFilter.h
new file mode 100644 (file)
index 0000000..82cee6f
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * 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/>.
+ */
+
+#ifndef MOUSEEVENTFILTER_H
+#define MOUSEEVENTFILTER_H
+
+// Qt headers.
+#include <QObject>
+#include <QWebEngineView>
+
+class MouseEventFilter : public QObject
+{
+    // Include the Q_OBJECT macro.
+    Q_OBJECT
+
+public:
+    // The primary constructor.
+    MouseEventFilter(QWebEngineView *webEngineView);
+
+protected:
+    bool eventFilter(QObject *objectPointer, QEvent *eventPointer) override;
+
+private:
+    // Define the private variables.
+    QWebEngineView *webEngineViewPointer;
+};
+#endif
diff --git a/src/Settings.kcfg b/src/Settings.kcfg
new file mode 100644 (file)
index 0000000..fe9b22d
--- /dev/null
@@ -0,0 +1,49 @@
+<?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>PrivacyBrowser/1.0</default>
+        </entry>
+    </group>
+
+    <group name="General">
+        <entry name="homepage" type="Url">
+            <default>https://www.mojeek.com/</default>
+        </entry>
+
+        <entry name="zoomFactor" type="Double">
+            <default>1.00</default>
+        </entry>
+    </group>
+</kcfg>
diff --git a/src/Settings.kcfgc b/src/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
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..264ac2d
--- /dev/null
@@ -0,0 +1,120 @@
+<?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>UserAgent</string>
+                    </property>
+                </widget>
+            </item>
+
+            <item row="1" column="1">
+                <widget class="QComboBox" name="kcfg_userAgent">
+                    <property name="minimumSize">
+                        <size>
+                            <width>500</width>
+                            <height>0</height>
+                        </size>
+                    </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>
diff --git a/src/UserAgentHelper.cpp b/src/UserAgentHelper.cpp
new file mode 100644 (file)
index 0000000..d1182ef
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * 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/>.
+ */
+
+// Application headers.
+#include "UserAgentHelper.h"
+
+// The default constructor.
+UserAgentHelper::UserAgentHelper() {};
+
+QString UserAgentHelper::getUserAgent(const QString &userAgentName)
+{
+    if (userAgentName == "Privacy Browser")
+    {
+        return "PrivacyBrowser/1.0";
+    }
+    else if (userAgentName == "Firefox Linux")
+    {
+        return "Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0";
+    }
+    else if (userAgentName == "Chromium Linux")
+    {
+        return "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36";
+    }
+    else if (userAgentName == "Firefox Windows")
+    {
+        return "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0";
+    }
+    else if (userAgentName == "Chrome Windows")
+    {
+        return "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36";
+    }
+    else if (userAgentName == "Edge Windows")
+    {
+        return "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.34";
+    }
+    else if (userAgentName == "Safari macOS")
+    {
+        return "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Safari/605.1.15";
+    }
+    else
+    {
+        // Return the custom user agent.
+        return userAgentName;
+    }
+}
diff --git a/src/UserAgentHelper.h b/src/UserAgentHelper.h
new file mode 100644 (file)
index 0000000..8d59e4f
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * 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/>.
+ */
+
+#ifndef USERAGENTHELPER_H
+#define USERAGENTHELPER_H
+
+// Qt framework headers.
+#include <QString>
+
+class UserAgentHelper
+{
+public:
+    // The default constructor.
+    UserAgentHelper();
+
+    // The public functions.
+    QString getUserAgent(const QString &userAgentName);
+};
+#endif
diff --git a/src/browserwindow.cpp b/src/browserwindow.cpp
deleted file mode 100644 (file)
index baf9fe9..0000000
+++ /dev/null
@@ -1,102 +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/>.
- */
-
-// Application headers.
-#include "browserwindow.h"
-#include "settings.h"
-#include "ui_settingsprivacy.h"
-#include "ui_settingsgeneral.h"
-
-// KDE Frameworks headers.
-#include <KActionCollection>
-#include <KConfigDialog>
-
-// Qt framework headers.
-#include <QStatusBar>
-
-BrowserWindow::BrowserWindow() : KXmlGuiWindow()
-{
-    // Instantiate the main view pointer.
-    mainViewPointer = new MainView(this);
-
-    // Set the main view as the central widget.
-    setCentralWidget(mainViewPointer);
-
-    // Get a handle for the action collectoin.
-    KActionCollection *actionCollectionPointer = this->actionCollection();
-
-    // Add the standard actions.
-    KStandardAction::openNew(this, SLOT(fileNew()), actionCollectionPointer);
-    KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollectionPointer);
-    KStandardAction::preferences(this, SLOT(settingsConfigure()), actionCollectionPointer);
-
-    // Update the status bar with the URL when a link is hovered.
-    connect(mainViewPointer, SIGNAL(linkHovered(QString)), this, SLOT(updateStatusBar(QString)));
-
-    // Setup the GUI based on the privacybrowserui.rc file.
-    setupGUI();
-}
-
-void BrowserWindow::fileNew()
-{
-    // Display a new instance of Privacy Browser.
-    (new BrowserWindow)->show();
-}
-
-void BrowserWindow::settingsConfigure()
-{
-    // Check to make sure the dialog box isn't already displayed.
-    if (!KConfigDialog::exists(QStringLiteral("settings")))
-    {
-        // Create the settings widgets.
-        QWidget *privacySettingsWidgetPointer = new QWidget;
-        QWidget *generalSettingsWidgetPointer = new QWidget;
-
-        // Instantiate the settings UI.
-        Ui::PrivacySettings privacySettingsUi;
-        Ui::GeneralSettings generalSettingsUi;
-
-        // 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 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.
-        configDialogPointer->setAttribute(Qt::WA_DeleteOnClose);
-
-        // 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()));
-    }
-}
-
-void BrowserWindow::updateStatusBar(const QString &statusBarMessage)
-{
-    // Display the status bar message.
-    statusBar()->showMessage(statusBarMessage);
-}
diff --git a/src/browserwindow.h b/src/browserwindow.h
deleted file mode 100644 (file)
index fc1e53d..0000000
+++ /dev/null
@@ -1,48 +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/>.
- */
-
-#ifndef BROWSERWINDOW_H
-#define BROWSERWINDOW_H
-
-// Application headers.
-#include "mainview.h"
-
-// KDE Frameworks headers.
-#include <KXmlGuiWindow>
-
-class BrowserWindow : public KXmlGuiWindow
-{
-    // Include the Q_OBJECT macro.
-    Q_OBJECT
-
-public:
-    // The default constructor.
-    BrowserWindow();
-
-private Q_SLOTS:
-    // Define the private slots.
-    void fileNew();
-    void settingsConfigure();
-    void updateStatusBar(const QString &statusBarMessage);
-
-private:
-    // Define the private variables.
-    MainView *mainViewPointer;
-};
-#endif
index 80909e284a603b7b28904abe08118db25cd1a3bc..bf2e23f898fc17f0e744df8f797d626b91554692 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 // Application headers.
-#include "browserwindow.h"
+#include "BrowserWindow.h"
 
 // KDE Frameworks headers.
 #include <KAboutData>
diff --git a/src/mainview.cpp b/src/mainview.cpp
deleted file mode 100644 (file)
index 416014b..0000000
+++ /dev/null
@@ -1,181 +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/>.
- */
-
-// Application headers
-#include "browserwindow.h"
-#include "mainview.h"
-#include "mouseeventfilter.h"
-#include "settings.h"
-#include "ui_mainview.h"
-
-MainView::MainView(QWidget *parent) : QWidget(parent)
-{
-    // Instantiate the mainview UI.
-    Ui::MainView mainViewUi;
-
-    // Setup the UI.
-    mainViewUi.setupUi(this);
-
-    // Get handles for the views.
-    backButtonPointer = mainViewUi.backButton;
-    forwardButtonPointer = mainViewUi.forwardButton;
-    QPushButton *homeButtonPointer = mainViewUi.homeButton;
-    urlLineEditPointer = mainViewUi.urlLineEdit;
-    javaScriptButtonPointer = mainViewUi.javaScript;
-    webEngineViewPointer = mainViewUi.webEngineView;
-
-    // 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)));
-
-    // Update the URL line edit form the webengine view.
-    connect(webEngineViewPointer, SIGNAL(loadStarted()), this, SLOT(updateInterface()));
-    connect(webEngineViewPointer, SIGNAL(loadProgress(int)), this, SLOT(updateInterface()));
-    connect(webEngineViewPointer, SIGNAL(loadFinished(bool)), this, SLOT(updateInterface()));
-
-    // Setup the URL bar buttons.
-    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);
-
-    // Install the mouse event filter.
-    qApp->installEventFilter(mouseEventFilterPointer);
-
-    // 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();
-
-    // Get the arguments.
-    QStringList argumentsStringList = qApp->arguments();
-
-    // Check to see if the arguments lists contains a URL.
-    if (argumentsStringList.size() > 1)
-    {
-        // Load the URL from the arguments list.
-        webEngineViewPointer->setUrl(QUrl::fromUserInput(argumentsStringList.at(1)));
-    }
-    else
-    {
-        // Load the homepage.
-        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.
-    webEngineViewPointer->setUrl(Settings::homepage());
-}
-
-void MainView::loadUrl(const QString &urlFromUser)
-{
-    // Remove the focus from the URL line edit.
-    urlLineEditPointer->clearFocus();
-
-    // Load the URL, adding standard protocol sections if needed.  TODO.  Replace this with logic that prefers HTTPS.
-    webEngineViewPointer->setUrl(QUrl::fromUserInput(urlFromUser));
-}
-
-void MainView::pageLinkHovered(const QString &linkUrl)
-{
-    // Emit a signal so that the browser window can update the status bar.
-    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.
-    if (!urlLineEditPointer->hasFocus())
-    {
-        // Update the URL line edit.
-        urlLineEditPointer->setText(webEngineViewPointer->url().toString());
-    }
-
-    // Update the status of the forward and back buttons.
-    backButtonPointer->setEnabled(webEngineHistoryPointer->canGoBack());
-    forwardButtonPointer->setEnabled(webEngineHistoryPointer->canGoForward());
-
-    // Reapply the zoom factor.  This is a bug in QWebEngineView that resets the zoom with every load.  Hopefully it will be fixed in Qt6.  <https://bugreports.qt.io/browse/QTBUG-51992>
-    webEngineViewPointer->setZoomFactor(Settings::zoomFactor());
-}
diff --git a/src/mainview.h b/src/mainview.h
deleted file mode 100644 (file)
index 018594e..0000000
+++ /dev/null
@@ -1,68 +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/>.
- */
-
-#ifndef MAINVIEW_H
-#define MAINVIEW_H
-
-// Qt framework headers.
-#include <QPushButton>
-#include <QWebEngineHistory>
-#include <QWebEngineSettings>
-#include <QWebEngineView>
-
-// KDE Framework headers.
-#include <KLineEdit>
-
-class MainView : public QWidget
-{
-    // Include the Q_OBJECT macro.
-    Q_OBJECT
-
-public:
-    // The primary contructor.
-    explicit MainView(QWidget *parent);
-
-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
diff --git a/src/mainview.ui b/src/mainview.ui
deleted file mode 100644 (file)
index c7afeb8..0000000
+++ /dev/null
@@ -1,155 +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>MainView</class>
-
-    <widget class="QWidget" name="MainView">
-        <!-- TODO.  Make this maximized by default. -->
-        <property name="geometry">
-            <rect>
-                <x>0</x>
-                <y>0</y>
-                <width>315</width>
-                <height>233</height>
-            </rect>
-        </property>
-
-        <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>
-
-            <!-- URL bar. -->
-            <item>
-                <layout class="QHBoxLayout">
-                    <!-- Set the spacing between items to 0. -->
-                    <property name="spacing">
-                        <number>0</number>
-                    </property>
-
-                    <!-- Back button. -->
-                    <item>
-                        <widget class="QPushButton" name="backButton">
-                            <property name="icon">
-                                <iconset theme="arrow-left" />
-                            </property>
-
-                            <property name="iconSize">
-                                <size>
-                                    <height>24</height>
-                                    <width>24</width>
-                                </size>
-                            </property>
-
-                            <property name="flat">
-                                <bool>true</bool>
-                            </property>
-                        </widget>
-                    </item>
-
-                    <!-- Forward button. -->
-                    <item>
-                        <widget class="QPushButton" name="forwardButton">
-                            <property name="icon">
-                                <iconset theme="arrow-right" />
-                            </property>
-
-                            <property name="iconSize">
-                                <size>
-                                    <height>24</height>
-                                    <width>24</width>
-                                </size>
-                            </property>
-
-                            <property name="flat">
-                                <bool>true</bool>
-                            </property>
-                        </widget>
-                    </item>
-
-                    <!-- Home button. -->
-                    <item>
-                        <widget class="QPushButton" name="homeButton">
-                            <property name="icon">
-                                <iconset theme="home" />
-                            </property>
-
-                            <property name="iconSize">
-                                <size>
-                                    <height>24</height>
-                                    <width>24</width>
-                                </size>
-                            </property>
-
-                            <property name="flat">
-                                <bool>true</bool>
-                            </property>
-                        </widget>
-                    </item>
-
-                    <!-- URL line edit. -->
-                    <item>
-                        <widget class="KLineEdit" name="urlLineEdit" />
-                    </item>
-
-                    <!-- JavaScript. -->
-                    <item>
-                        <widget class="QPushButton" name="javaScript">
-                            <property name="iconSize">
-                                <size>
-                                    <height>24</height>
-                                    <width>24</width>
-                                </size>
-                            </property>
-
-                            <property name="flat">
-                                <bool>true</bool>
-                            </property>
-                        </widget>
-                    </item>
-                </layout>
-            </item>
-
-            <!-- WebEngine view. -->
-            <item>
-                <widget class="QWebEngineView" name="webEngineView" />
-            </item>
-        </layout>
-    </widget>
-</ui>
diff --git a/src/mouseeventfilter.cpp b/src/mouseeventfilter.cpp
deleted file mode 100644 (file)
index 4f1ec82..0000000
+++ /dev/null
@@ -1,70 +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/>.
- */
-
-// Application headers.
-#include "mouseeventfilter.h"
-
-// Qt headers.
-#include <QEvent>
-#include <QMouseEvent>
-
-// The primary constructor.
-MouseEventFilter::MouseEventFilter(QWebEngineView *webEngineView) : QObject()
-{
-    // Save a handle to the WebEngine view.
-    webEngineViewPointer = webEngineView;
-};
-
-bool MouseEventFilter::eventFilter(QObject *objectPointer, QEvent *eventPointer)
-{
-    // Only process mouse button press events.
-    if (eventPointer->type() == QEvent::MouseButtonPress)
-    {
-        // Tell the compiler to ignore the unused object pointer.
-        (void)objectPointer;
-
-        // Cast the event to a mouse event.
-        QMouseEvent *mouseEventPointer = static_cast<QMouseEvent *>(eventPointer);
-
-        // Run the command according to the button that was pushed.
-        switch (mouseEventPointer->button())
-        {
-            case (Qt::BackButton):
-                // Tell the WebEngine to go back.
-                webEngineViewPointer->back();
-
-                // Consume the event.
-                return true;
-
-            case (Qt::ForwardButton):
-                // Tell the WebEngine to go forward.
-                webEngineViewPointer->forward();
-
-                // Consume the event.
-                return true;
-
-            default:
-                // Do not consume the event.
-                return false;
-        }
-    }
-
-    // Do not consume the event.
-    return false;
-}
diff --git a/src/mouseeventfilter.h b/src/mouseeventfilter.h
deleted file mode 100644 (file)
index 82cee6f..0000000
+++ /dev/null
@@ -1,43 +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/>.
- */
-
-#ifndef MOUSEEVENTFILTER_H
-#define MOUSEEVENTFILTER_H
-
-// Qt headers.
-#include <QObject>
-#include <QWebEngineView>
-
-class MouseEventFilter : public QObject
-{
-    // Include the Q_OBJECT macro.
-    Q_OBJECT
-
-public:
-    // The primary constructor.
-    MouseEventFilter(QWebEngineView *webEngineView);
-
-protected:
-    bool eventFilter(QObject *objectPointer, QEvent *eventPointer) override;
-
-private:
-    // Define the private variables.
-    QWebEngineView *webEngineViewPointer;
-};
-#endif
diff --git a/src/settings.kcfg b/src/settings.kcfg
deleted file mode 100644 (file)
index f739cf6..0000000
+++ /dev/null
@@ -1,45 +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>
-    </group>
-
-    <group name="General">
-        <entry name="homepage" type="Url">
-            <default>https://www.mojeek.com/</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 5304975..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 de42696..0000000
+++ /dev/null
@@ -1,70 +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>
-
-            <!-- 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
deleted file mode 100644 (file)
index 5c80ede..0000000
+++ /dev/null
@@ -1,54 +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">
-            <!-- 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>