X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=src%2Fwidgets%2FPrivacyWebEngineView.cpp;h=10a3a47fcf3f7124a194ce4c62f31b273c5eeaac;hb=6acd73c4148bac2a8c2f637e70080a43b12fd14e;hp=10bff6d14554f45a2d922d4a1ae831e935705637;hpb=8292f934246cb283e1b0c32f4388c674f275c7aa;p=PrivacyBrowserPC.git diff --git a/src/widgets/PrivacyWebEngineView.cpp b/src/widgets/PrivacyWebEngineView.cpp index 10bff6d..10a3a47 100644 --- a/src/widgets/PrivacyWebEngineView.cpp +++ b/src/widgets/PrivacyWebEngineView.cpp @@ -41,20 +41,30 @@ void PrivacyWebEngineView::addCookieToList(const QNetworkCookie &cookie) const } 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(); + // Create the new tab and return the privacy WebEngine view pointer. `true` removes the focus from the blank URL line edit. + // 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); + } + + case QWebEnginePage::WebBrowserWindow: { + // Create a new browser window. + BrowserWindow *newBrowserWindowPointer = new BrowserWindow(); + + // Show the new browser window. + newBrowserWindowPointer->show(); + + // The new privacy WebEngine view pointer is returned so it can be populated with the link from the context menu. + return newBrowserWindowPointer->tabWidgetPointer->loadBlankInitialWebsite(); } default: { - // Return an null pointer. + // Return an null pointer for opening a background tab and opening a web dialog. return nullptr; } }