]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/commitdiff
Enable setting as the default browser.
authorSoren Stoutner <soren@stoutner.com>
Thu, 3 Feb 2022 23:09:34 +0000 (16:09 -0700)
committerSoren Stoutner <soren@stoutner.com>
Thu, 3 Feb 2022 23:09:34 +0000 (16:09 -0700)
src/CMakeLists.txt
src/com.stoutner.privacybrowser.desktop
src/mainview.cpp
src/mainview.h
src/mainview.ui

index c36a84b1d0fe676968140a1c0bc07aaf9a3b094c..425f0e71e5c22634247e8eeaf5a4468207fdc6da 100644 (file)
@@ -46,15 +46,18 @@ ki18n_wrap_ui(privacy-browser
 
 # Link the following libraries.
 target_link_libraries(privacy-browser
-    KF5::ConfigWidgets
+    Qt5::Core
+    Qt5::Gui
+    Qt5::Widgets
+    Qt5::WebEngineWidgets
     KF5::Completion
+    KF5::ConfigWidgets
     KF5::CoreAddons
     KF5::Crash
     KF5::DBusAddons
+    KF5::DocTools
     KF5::I18n
     KF5::XmlGui
-    Qt5::Widgets
-    Qt5::WebEngineWidgets
 )
 
 # Install Privacy Browser using the default KDE arguments.
index a0e17f9f1b5735de6b2eb951bd7eabc0190c28f2..a7ca9d61b0a7433b8d48efdf3297092a4aa45ed8 100644 (file)
@@ -32,13 +32,14 @@ Categories=Network;WebBrowser;
 # Set the icon.
 Icon=privacy-browser.svg
 
-# Set the executable.
-Exec=privacy-browser
+# Set the executable with the optional URL argument.
+Exec=privacy-browser %u
 
-# TODO.  Check if this is needed.
+# Specify the WM class, which groups windows of the same application together.
 StartupWMClass=privacy-browser
 
 # TODO.  Set the document path.
 X-DocPath=privacybrowser/index.html
 
-# TODO.  Add MIME types.
+# Enumerate the supported MIME types.
+MimeType=text/html;text/xml;application/xhtml+xml;application/xml;x-scheme-handler/http;x-scheme-handler/https;
index 3ebee4c4d02199ba260e47af8fb0262192b31b78..416014b6ba5b92c904816afd8e54a25930027b02 100644 (file)
 #include "mainview.h"
 #include "mouseeventfilter.h"
 #include "settings.h"
-
-// KDE Framework headers.
-#include <KLineEdit>
-
-// Qt headers.
-#include <QWebEngineHistory>
-#include <QWebEngineSettings>
-#include <QWebEngineView>
+#include "ui_mainview.h"
 
 MainView::MainView(QWidget *parent) : QWidget(parent)
 {
@@ -90,8 +83,20 @@ MainView::MainView(QWidget *parent) : QWidget(parent)
     // Set the focus on the WebEngine view.
     webEngineViewPointer->setFocus();
 
-    // Load the homepage.
-    goHome();
+    // 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()
@@ -164,7 +169,7 @@ void MainView::updateInterface()
     if (!urlLineEditPointer->hasFocus())
     {
         // Update the URL line edit.
-        urlLineEditPointer->setUrl(webEngineViewPointer->url().toString());
+        urlLineEditPointer->setText(webEngineViewPointer->url().toString());
     }
 
     // Update the status of the forward and back buttons.
index ee82d79085ec91f1334f68f34626b667bf159123..018594e83e06ab58424317cd8659d10929177b12 100644 (file)
 #ifndef MAINVIEW_H
 #define MAINVIEW_H
 
-// Application headers.
-#include "ui_mainview.h"
+// Qt framework headers.
+#include <QPushButton>
+#include <QWebEngineHistory>
+#include <QWebEngineSettings>
+#include <QWebEngineView>
+
+// KDE Framework headers.
+#include <KLineEdit>
 
 class MainView : public QWidget
 {
index d00087fe2bcc0911622bd62481a30190b2c80594..c7afeb850379167bb43aa3ce430aabc78fd77927 100644 (file)
                     <!-- JavaScript. -->
                     <item>
                         <widget class="QPushButton" name="javaScript">
-                            <property name="icon">
-                                <iconset theme="privacy-mode" />
-                            </property>
-
                             <property name="iconSize">
                                 <size>
                                     <height>24</height>