]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/widgets/TabWidget.cpp
Clear the focus of the URL line edit when opening a new tab from the context menu...
[PrivacyBrowserPC.git] / src / widgets / TabWidget.cpp
index 3b0ce087949de5f5b3de0bd38ded94451facc743..9e843ef306da564f362d7c5e434a0589b7dda21d 100644 (file)
@@ -141,7 +141,7 @@ void TabWidget::addFirstTab()
     tabWidgetPointer->currentWidget()->setFocus();
 }
 
-void TabWidget::addTab()
+PrivacyWebEngineView* TabWidget::addTab(const bool focusNewWebEngineView)
 {
     // Create a privacy WebEngine view.
     PrivacyWebEngineView *privacyWebEngineViewPointer = new PrivacyWebEngineView();
@@ -168,7 +168,6 @@ void TabWidget::addTab()
     // Update the URL line edit when the URL changes.
     connect(privacyWebEngineViewPointer, SIGNAL(urlChanged(const QUrl)), this, SLOT(updateUrl(const QUrl)));
 
-
     // Update the progress bar.
     connect(privacyWebEngineViewPointer, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
     connect(privacyWebEngineViewPointer, SIGNAL(loadProgress(const int)), this, SLOT(loadProgress(const int)));
@@ -290,6 +289,13 @@ void TabWidget::addTab()
 
     // Move to the new tab.
     tabWidgetPointer->setCurrentIndex(newTabIndex);
+
+    // Clear the URL line edit focus so that it populates correctly when opening a new tab from the context menu.
+    if (focusNewWebEngineView)
+        emit clearUrlLineEditFocus();
+
+    // Return the privacy WebEngine view pointer.
+    return privacyWebEngineViewPointer;
 }
 
 void TabWidget::applyApplicationSettings()
@@ -449,9 +455,9 @@ void TabWidget::applyDomainSettings(const QString &hostname, const bool reloadWe
         currentWebEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, Settings::javaScriptEnabled());
 
         // Set the local storage status.
-        //currentPrivacyWebEngineViewPointer->localStorageEnabled = Settings::localStorageEnabled();
+        currentPrivacyWebEngineViewPointer->localStorageEnabled = Settings::localStorageEnabled();
 
-        // Set DOM storage.
+        // Set DOM storage.  In QWebEngineSettings it is called Local Storage.
         currentWebEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, Settings::domStorageEnabled());
 
         // Set the user agent.