]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/windows/BrowserWindow.cpp
Clear the URL line edit when navigating history. https://redmine.stoutner.com/issues/841
[PrivacyBrowserPC.git] / src / windows / BrowserWindow.cpp
index 44614194b78b1e75621316ed4afc52ff5d541781..3ddba02c9e3809475a6d7393354b5cbc5eae33fb 100644 (file)
@@ -56,6 +56,7 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
 
     // Add the custom actions.
     userAgentPrivacyBrowserActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_privacy_browser"));
+    userAgentWebEngineDefaultActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_webengine_default"));
     userAgentFirefoxLinuxActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_firefox_linux"));
     userAgentChromiumLinuxActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_chromium_linux"));
     userAgentFirefoxWindowsActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_firefox_windows"));
@@ -81,6 +82,7 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
 
     // Add the actions to the groups.
     userAgentActionGroupPointer->addAction(userAgentPrivacyBrowserActionPointer);
+    userAgentActionGroupPointer->addAction(userAgentWebEngineDefaultActionPointer);
     userAgentActionGroupPointer->addAction(userAgentFirefoxLinuxActionPointer);
     userAgentActionGroupPointer->addAction(userAgentChromiumLinuxActionPointer);
     userAgentActionGroupPointer->addAction(userAgentFirefoxWindowsActionPointer);
@@ -98,6 +100,7 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
 
     // Set some actions to be checkable.
     userAgentPrivacyBrowserActionPointer->setCheckable(true);
+    userAgentWebEngineDefaultActionPointer->setCheckable(true);
     userAgentFirefoxLinuxActionPointer->setCheckable(true);
     userAgentChromiumLinuxActionPointer->setCheckable(true);
     userAgentFirefoxWindowsActionPointer->setCheckable(true);
@@ -115,6 +118,7 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
 
     // Set the non-mutable action text.
     userAgentPrivacyBrowserActionPointer->setText(UserAgentHelper::PRIVACY_BROWSER_TRANSLATED);
+    userAgentWebEngineDefaultActionPointer->setText(UserAgentHelper::WEB_ENGINE_DEFAULT_TRANSLATED);
     userAgentFirefoxLinuxActionPointer->setText(UserAgentHelper::FIREFOX_LINUX_TRANSLATED);
     userAgentChromiumLinuxActionPointer->setText(UserAgentHelper::CHROMIUM_LINUX_TRANSLATED);
     userAgentFirefoxWindowsActionPointer->setText(UserAgentHelper::FIREFOX_WINDOWS_TRANSLATED);
@@ -133,6 +137,7 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
 
     // Set the action icons.
     userAgentPrivacyBrowserActionPointer->setIcon(QIcon(":/icons/privacy-mode"));
+    userAgentWebEngineDefaultActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("user-group-properties")));
     userAgentFirefoxLinuxActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("firefox-esr")));
     userAgentChromiumLinuxActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("chromium")));
     userAgentFirefoxWindowsActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("firefox-esr")));
@@ -213,6 +218,9 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
     connect(browserViewPointer, SIGNAL(showProgressBar(const int)), this, SLOT(showProgressBar(const int)));
     connect(browserViewPointer, SIGNAL(hideProgressBar()), progressBarPointer, SLOT(hide()));
 
+    // Clear the URL line edit focus when requested.
+    connect(browserViewPointer, SIGNAL(clearUrlLineEditFocus()), this, SLOT(clearUrlLineEditFocus()));
+
     // Get the URL line edit palettes.
     noDomainSettingsPalette = urlLineEditPointer->palette();
     domainSettingsPalette = urlLineEditPointer->palette();
@@ -269,6 +277,12 @@ void BrowserWindow::back() const
     browserViewPointer->back();
 }
 
+void BrowserWindow::clearUrlLineEditFocus() const
+{
+    // Remove the focus from the URL line edit.
+    urlLineEditPointer->clearFocus();
+}
+
 void BrowserWindow::fileNew() const
 {
     // Display a new instance of Privacy Browser.
@@ -552,6 +566,7 @@ void BrowserWindow::updateUserAgentActions(const QString &userAgent) const
 
     // Check the indicated on-the-fly user agent.
     if (userAgent == UserAgentHelper::PRIVACY_BROWSER_USER_AGENT) userAgentPrivacyBrowserActionPointer->setChecked(true);  // Privacy Browser.
+    else if (userAgent == BrowserView::webEngineDefaultUserAgent) userAgentWebEngineDefaultActionPointer->setChecked(true);  // WebEngine default.
     else if (userAgent == UserAgentHelper::FIREFOX_LINUX_USER_AGENT) userAgentFirefoxLinuxActionPointer->setChecked(true);  // Firefox Linux.
     else if (userAgent == UserAgentHelper::CHROMIUM_LINUX_USER_AGENT) userAgentChromiumLinuxActionPointer->setChecked(true);  // Chromium Linux.
     else if (userAgent == UserAgentHelper::FIREFOX_WINDOWS_USER_AGENT) userAgentFirefoxWindowsActionPointer->setChecked(true);  // Firefox Windows.