# 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.
# 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;
#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)
{
// 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()
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.
#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
{
<!-- JavaScript. -->
<item>
<widget class="QPushButton" name="javaScript">
- <property name="icon">
- <iconset theme="privacy-mode" />
- </property>
-
<property name="iconSize">
<size>
<height>24</height>