1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-19 18:26:34 +01:00

SiteInfo: Fix ForceDarkMode update after a change

Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
Juraj Oravec 2024-06-23 23:16:58 +02:00
parent 7816ea95b7
commit 9da1243ca6
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B

View File

@ -379,14 +379,26 @@ void SiteInfo::saveSiteSettings()
siteSettings.server = m_baseUrl.host();
if (!(siteSettings == mApp->siteSettingsManager()->getSiteSettings(m_baseUrl))) {
auto storedSiteSettings = mApp->siteSettingsManager()->getSiteSettings(m_baseUrl);
if (!(siteSettings == storedSiteSettings)) {
mApp->siteSettingsManager()->setSiteSettings(siteSettings);
#if QTWEBENGINECORE_VERSION >= QT_VERSION_CHECK(6, 7, 0)
m_view->page()->settings()->setAttribute(
QWebEngineSettings::ForceDarkMode,
siteSettings.attributes[QWebEngineSettings::ForceDarkMode]
);
if (siteSettings.attributes[QWebEngineSettings::ForceDarkMode] != storedSiteSettings.attributes[QWebEngineSettings::ForceDarkMode]) {
bool enableForceDarkMode = false;
if (siteSettings.attributes[QWebEngineSettings::ForceDarkMode] == SiteSettingsManager::Default) {
enableForceDarkMode = mApp->siteSettingsManager()->getDefaultPermission(QWebEngineSettings::ForceDarkMode) == SiteSettingsManager::Allow;
}
else {
enableForceDarkMode = siteSettings.attributes[QWebEngineSettings::ForceDarkMode] == SiteSettingsManager::Allow;
}
m_view->page()->settings()->setAttribute(
QWebEngineSettings::ForceDarkMode,
enableForceDarkMode
);
}
#endif
}
}