]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/widgets/PrivacyWebEngineView.cpp
Open new tabs adjacent to the current tab. https://redmine.stoutner.com/issues/1110
[PrivacyBrowserPC.git] / src / widgets / PrivacyWebEngineView.cpp
index 38b03c31fa37c7fa3d8476dc6741897baafc3a4d..05c765925d8aa6da639c4f4f019634ffc3d956f5 100644 (file)
@@ -30,7 +30,7 @@
 #include <QMenu>
 
 // Construct the class.
-PrivacyWebEngineView::PrivacyWebEngineView() : QWebEngineView(nullptr)
+PrivacyWebEngineView::PrivacyWebEngineView(QWidget *parentWidgetPointer) : QWebEngineView(parentWidgetPointer)
 {
     // Create an off-the-record profile (the default when no profile name is specified).
     webEngineProfilePointer = new QWebEngineProfile(QLatin1String(""));
@@ -45,7 +45,7 @@ PrivacyWebEngineView::PrivacyWebEngineView() : QWebEngineView(nullptr)
     webEngineSettingsPointer = webEnginePagePointer->settings();
 
     // Instantiate the URL request interceptor.
-    UrlRequestInterceptor *urlRequestInterceptorPointer = new UrlRequestInterceptor();
+    UrlRequestInterceptor *urlRequestInterceptorPointer = new UrlRequestInterceptor(this);
 
     // Set the URL request interceptor.
     webEngineProfilePointer->setUrlRequestInterceptor(urlRequestInterceptorPointer);
@@ -259,9 +259,9 @@ QWebEngineView* PrivacyWebEngineView::createWindow(QWebEnginePage::WebWindowType
     {
         case QWebEnginePage::WebBrowserTab:
         {
-            // Create the new tab and return the privacy WebEngine view pointer.  `true` removes the focus from the blank URL line edit.
+            // Create the new tab and return the privacy WebEngine view pointer.  `true` removes the focus from the blank URL line edit.  `true` adds the new tab adjacent to the current tab.
             // The new privacy WebEngine view pointer is returned so it can be populated with the link from the context menu.
-            return browserWindowPointer->tabWidgetPointer->addTab(true);
+            return browserWindowPointer->tabWidgetPointer->addTab(true, true);
         }
 
         case QWebEnginePage::WebBrowserWindow:
@@ -278,9 +278,10 @@ QWebEngineView* PrivacyWebEngineView::createWindow(QWebEnginePage::WebWindowType
 
         case QWebEnginePage::WebBrowserBackgroundTab:
         {
-            // Create the new tab and return the privacy WebEngine view pointer.  `false` does not clear the URL line edit.  `true` creates a background tab.
+            // Create the new tab and return the privacy WebEngine view pointer.  `false` does not clear the URL line edit.  `true` adds the new tab adjacent to the current tab.
+            // `true` creates a background tab.
             // The new privacy WebEngine view pointer is returned so it can be populated with the link from the context menu.
-            return browserWindowPointer->tabWidgetPointer->addTab(false, true);
+            return browserWindowPointer->tabWidgetPointer->addTab(false, true, true);
         }
 
         default: