X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserPC.git;a=blobdiff_plain;f=src%2Fwidgets%2FPrivacyWebEngineView.cpp;fp=src%2Fwidgets%2FPrivacyWebEngineView.cpp;h=10bff6d14554f45a2d922d4a1ae831e935705637;hp=28fb66da18f32d7b66420a3cf361b960b873f0d9;hb=8292f934246cb283e1b0c32f4388c674f275c7aa;hpb=54a0c11dd3ded081bbdabbe9fa26e27172d05e8f diff --git a/src/widgets/PrivacyWebEngineView.cpp b/src/widgets/PrivacyWebEngineView.cpp index 28fb66d..10bff6d 100644 --- a/src/widgets/PrivacyWebEngineView.cpp +++ b/src/widgets/PrivacyWebEngineView.cpp @@ -20,6 +20,7 @@ // Application headers. #include "PrivacyWebEngineView.h" #include "databases/CookiesDatabase.h" +#include "windows/BrowserWindow.h" // Construct the class. PrivacyWebEngineView::PrivacyWebEngineView() : QWebEngineView(nullptr) {} @@ -39,6 +40,26 @@ void PrivacyWebEngineView::addCookieToList(const QNetworkCookie &cookie) const emit updateCookiesAction(cookieListPointer->size()); } +QWebEngineView* PrivacyWebEngineView::createWindow(QWebEnginePage::WebWindowType webWindowType) { + qDebug().noquote().nospace() << "Web window type: " << webWindowType; + + // Get a handle for the browser window. + BrowserWindow *browserWindowPointer = qobject_cast(window()); + + // Create the requsted window type. + switch (webWindowType) { + case QWebEnginePage::WebBrowserTab: { + // Create the new tab and return the privacy WebEngine view pointer. It will then be populated with the link from the context menu. + return browserWindowPointer->tabWidgetPointer->addTab(); + } + + default: { + // Return an null pointer. + return nullptr; + } + } +} + void PrivacyWebEngineView::removeCookieFromList(const QNetworkCookie &cookie) const { //qDebug() << "Remove cookie: " << cookie.toRawForm();