X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserPC.git;a=blobdiff_plain;f=src%2Fwindows%2FBrowserWindow.cpp;h=5960393f1da4b4fb535b4383463ce4ff46f08a3c;hp=716f2e0c58f57dea8d676a00c660ebf697ac58c1;hb=06a69a2d38bf73c0c5219f94c345b19142bb1646;hpb=aa9a6b20db5e2c808b390b62704f28bd649e283c diff --git a/src/windows/BrowserWindow.cpp b/src/windows/BrowserWindow.cpp index 716f2e0..5960393 100644 --- a/src/windows/BrowserWindow.cpp +++ b/src/windows/BrowserWindow.cpp @@ -141,15 +141,18 @@ BrowserWindow::BrowserWindow(bool firstWindow) : KXmlGuiWindow() searchEngineYahooActionPointer->setCheckable(true); searchEngineCustomActionPointer->setCheckable(true); + // Instantiate the user agent helper. + UserAgentHelper *userAgentHelperPointer = new UserAgentHelper(); + // Set the 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); - userAgentChromeWindowsActionPointer->setText(UserAgentHelper::CHROME_WINDOWS_TRANSLATED); - userAgentEdgeWindowsActionPointer->setText(UserAgentHelper::EDGE_WINDOWS_TRANSLATED); - userAgentSafariMacosActionPointer->setText(UserAgentHelper::SAFARI_MACOS_TRANSLATED); + userAgentPrivacyBrowserActionPointer->setText(userAgentHelperPointer->PRIVACY_BROWSER_TRANSLATED); + userAgentWebEngineDefaultActionPointer->setText(userAgentHelperPointer->WEB_ENGINE_DEFAULT_TRANSLATED); + userAgentFirefoxLinuxActionPointer->setText(userAgentHelperPointer->FIREFOX_LINUX_TRANSLATED); + userAgentChromiumLinuxActionPointer->setText(userAgentHelperPointer->CHROMIUM_LINUX_TRANSLATED); + userAgentFirefoxWindowsActionPointer->setText(userAgentHelperPointer->FIREFOX_WINDOWS_TRANSLATED); + userAgentChromeWindowsActionPointer->setText(userAgentHelperPointer->CHROME_WINDOWS_TRANSLATED); + userAgentEdgeWindowsActionPointer->setText(userAgentHelperPointer->EDGE_WINDOWS_TRANSLATED); + userAgentSafariMacosActionPointer->setText(userAgentHelperPointer->SAFARI_MACOS_TRANSLATED); searchEngineMojeekActionPointer->setText(i18nc("Search engine", "Mojeek")); searchEngineMonoclesActionPointer->setText(i18nc("Search engine", "Monocles")); searchEngineMetagerActionPointer->setText(i18nc("Search engine", "MetaGer")); @@ -219,7 +222,7 @@ BrowserWindow::BrowserWindow(bool firstWindow) : KXmlGuiWindow() connect(findCaseSensitiveActionPointer, SIGNAL(triggered()), this, SLOT(toggleFindCaseSensitive())); // Setup the GUI based on the browser_window_ui.rc file. - setupGUI(StandardWindowOption::Default, ("browser_window_ui.rc")); + setupGUI(StandardWindowOption::Default, ("browserwindowui.rc")); // Get lists of the actions' associated widgets. QList userAgentAssociatedWidgetsPointerList = userAgentPrivacyBrowserActionPointer->associatedWidgets(); @@ -351,6 +354,14 @@ BrowserWindow::BrowserWindow(bool firstWindow) : KXmlGuiWindow() connect(f11ShortcutPointer, SIGNAL(activated()), fullScreenActionPointer, SLOT(trigger())); connect(escapeShortcutPointer, SIGNAL(activated()), this, SLOT(escape())); + // Populate the UI. + // This must be done here, because otherwise, if a URL is loaded, like a local file, that does not trigger a call to TabWidget::applyDomainSettings, the UI will not be fully populated. + updateJavaScriptAction(Settings::javaScriptEnabled()); + updateLocalStorageAction(Settings::localStorageEnabled()); + updateDomStorageAction(Settings::domStorageEnabled()); + updateUserAgentActions(UserAgentHelper::getUserAgentFromDatabaseName(Settings::userAgent()), true); + updateZoomFactorAction(Settings::zoomFactor()); + // Load the initial website if this is the first window. if (firstWindow) tabWidgetPointer->loadInitialWebsite(); @@ -1018,6 +1029,7 @@ void BrowserWindow::updateUserAgentActions(const QString &userAgent, const bool } // Update the custom user agent enabled boolean. + // This is not done when the current user agent is a custom one but it is temporarially being changed via on-the-fly settings so that the user can switch back to the custom user agent. if (updateCustomUserAgentStatus) customUserAgentEnabled = customUserAgent;