]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/mainview.cpp
Enable setting as the default browser.
[PrivacyBrowserPC.git] / src / mainview.cpp
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.