Enable the forward and back mouse buttons.
[PrivacyBrowserPC.git] / src / mainview.cpp
index 75767bb587d7ad876f49f4a8498f0ed19dac16aa..8749760773e6acdd9540a236855ad761d805a6e2 100644 (file)
 // Application headers
 #include "browserwindow.h"
 #include "mainview.h"
+#include "mouseeventfilter.h"
 #include "settings.h"
 
 // KDE Framework headers.
 #include <KLineEdit>
 
-// Qt framework headers.
+// Qt headers.
 #include <QWebEngineHistory>
 #include <QWebEngineView>
 
@@ -59,6 +60,12 @@ MainView::MainView(QWidget *parent) : QWidget(parent)
     connect(backButtonPointer, SIGNAL(clicked()), webEngineViewPointer, SLOT(back()));
     connect(forwardButtonPointer, SIGNAL(clicked()), webEngineViewPointer, SLOT(forward()));
 
+    // 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)));
 
@@ -96,6 +103,7 @@ void MainView::updateInterface()
         urlLineEditPointer->setUrl(webEngineViewPointer->url().toString());
     }
 
+    // Update the status of the forward and back buttons.
     backButtonPointer->setEnabled(webEngineHistoryPointer->canGoBack());
     forwardButtonPointer->setEnabled(webEngineHistoryPointer->canGoForward());