From b516206c4d278640374cbfe244a5510e5ac70b54 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Mon, 26 Sep 2022 10:11:11 -0700 Subject: [PATCH] Populate the UI when the initial URL is a local file. https://redmine.stoutner.com/issues/908 --- src/widgets/TabWidget.cpp | 3 +++ src/windows/BrowserWindow.cpp | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/src/widgets/TabWidget.cpp b/src/widgets/TabWidget.cpp index 3a1b54f..ff8563c 100644 --- a/src/widgets/TabWidget.cpp +++ b/src/widgets/TabWidget.cpp @@ -334,6 +334,9 @@ PrivacyWebEngineView* TabWidget::addTab(const bool focusNewWebEngineView) // Set the spell check language. webEngineProfilePointer->setSpellCheckLanguages({QStringLiteral("en_US")}); + // Populate the zoom factor. This is necessary if a URL is being loaded, like a local URL, that does not trigger `applyDomainSettings()`. + privacyWebEngineViewPointer->setZoomFactor(Settings::zoomFactor()); + // Move to the new tab. tabWidgetPointer->setCurrentIndex(newTabIndex); diff --git a/src/windows/BrowserWindow.cpp b/src/windows/BrowserWindow.cpp index 716f2e0..6df64f3 100644 --- a/src/windows/BrowserWindow.cpp +++ b/src/windows/BrowserWindow.cpp @@ -351,6 +351,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 +1026,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; -- 2.45.2