X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserPC.git;a=blobdiff_plain;f=src%2Fviews%2FBrowserView.cpp;h=74b27cfdb534102dbdabdb354b8fb71cb4597f71;hp=319f9e51b7624ef49776445be3d1c776025dc550;hb=869fdeef7922450fee0e568dac356a8f5f021575;hpb=fb7b0588f2e95260578076aceb22a5644e81f8b6 diff --git a/src/views/BrowserView.cpp b/src/views/BrowserView.cpp index 319f9e5..74b27cf 100644 --- a/src/views/BrowserView.cpp +++ b/src/views/BrowserView.cpp @@ -78,6 +78,18 @@ BrowserView::BrowserView(QWidget *parent) : QWidget(parent) // Don't allow JavaScript to open windows. webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, false); + // Allow keyboard navigation. + webEngineSettingsPointer->setAttribute(QWebEngineSettings::SpatialNavigationEnabled, true); + + // Enable full screen support. + webEngineSettingsPointer->setAttribute(QWebEngineSettings::FullScreenSupportEnabled, true); + + // Require user interaction to play media. + webEngineSettingsPointer->setAttribute(QWebEngineSettings::PlaybackRequiresUserGesture, true); + + // Limit WebRTC to public IP addresses. + webEngineSettingsPointer->setAttribute(QWebEngineSettings::WebRTCPublicInterfacesOnly, true); + // Set the focus on the WebEngine view. webEngineViewPointer->setFocus(); } @@ -255,10 +267,15 @@ void BrowserView::loadInitialWebsite() void BrowserView::loadUrlFromLineEdit(QString url) const { // Decide if the text is more likely to be a URL or a search. - if (url.contains(".")) // The text is likely a URL. + if (url.startsWith("file://")) // The text is likely a file URL. + { + // Load the URL. + webEngineViewPointer->load(QUrl::fromUserInput(url)); + } + else if (url.contains(".")) // The text is likely a URL. { // Check if the URL does not start with a valid protocol. - if (!url.startsWith("http") && !url.startsWith("file://")) + if (!url.startsWith("http")) { // Add `https://` to the beginning of the URL. url = "https://" + url;