--- /dev/null
+<?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>
#include "mainview.h"
#include "settings.h"
+// KDE Framework headers.
+#include <KLineEdit>
+
// Qt framework headers.
#include <QWebEngineView>
MainView::MainView(QWidget *parent) : QWidget(parent)
{
+ // Instantiate the mainview UI.
+ Ui::MainView mainViewUi;
+
// Setup the UI.
mainViewUi.setupUi(this);
- // Get a handle for the web engine view.
- QWebEngineView *webEngineViewPointer = mainViewUi.webEngineView;
+ // Get handles for the views.
+ urlLineEditPointer = mainViewUi.urlLineEdit;
+ webEngineViewPointer = mainViewUi.webEngineView;
+
+ // 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(updateUrlLineEdit()));
+ connect(webEngineViewPointer, SIGNAL(loadProgress(int)), this, SLOT(updateUrlLineEdit()));
+ connect(webEngineViewPointer, SIGNAL(loadFinished(bool)), this, SLOT(updateUrlLineEdit()));
// Load a website.
webEngineViewPointer->setUrl(QUrl(QStringLiteral("https://www.stoutner.com/")));
}
+
+void MainView::loadUrl(const QString &urlFromUser)
+{
+ // Load the URL, adding standard protocol sections if needed. TODO. Replace this with logic that prefers HTTPS.
+ webEngineViewPointer->setUrl(QUrl::fromUserInput(urlFromUser));
+}
+
+void MainView::updateUrlLineEdit()
+{
+ // Update the URL line edit.
+ urlLineEditPointer->setText(webEngineViewPointer->url().toString());
+}
// Get a handle for the action collectoin.
KActionCollection *actionCollectionPointer = this->actionCollection();
- // Create a switch colorsaction pointer.
- QAction *switchColorsActionPointer;
-
- // Populate the switch colors action pointer.
- switchColorsActionPointer = actionCollectionPointer->addAction(QStringLiteral("switch_action"));
- switchColorsActionPointer->setText(i18nc("@action", "Switch Colors"));
- switchColorsActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("fill-color")));
-
- // Connect the signals to the slots.
- connect(switchColorsActionPointer, &QAction::triggered, mainViewPointer, &MainView::switchColors);
-
// Add the standard actions.
KStandardAction::openNew(this, SLOT(fileNew()), actionCollectionPointer);
KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollectionPointer);