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

Bring back support for setting AcceptLanguage header

This commit is contained in:
David Rosca 2015-10-05 22:21:14 +02:00
parent 3d8b09653f
commit 8778ddc2dd
4 changed files with 18 additions and 0 deletions

View File

@ -924,6 +924,7 @@ void MainApplication::loadSettings()
} }
qzSettings->loadSettings(); qzSettings->loadSettings();
networkManager()->loadSettings();
userAgentManager()->loadSettings(); userAgentManager()->loadSettings();
} }

View File

@ -18,7 +18,9 @@
#include "networkmanager.h" #include "networkmanager.h"
#include "autofill.h" #include "autofill.h"
#include "qztools.h" #include "qztools.h"
#include "settings.h"
#include "cookiejar.h" #include "cookiejar.h"
#include "acceptlanguage.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "passwordmanager.h" #include "passwordmanager.h"
#include "sslerrordialog.h" #include "sslerrordialog.h"
@ -226,3 +228,13 @@ void NetworkManager::removeUrlInterceptor(UrlInterceptor *interceptor)
{ {
m_urlInterceptor->removeUrlInterceptor(interceptor); m_urlInterceptor->removeUrlInterceptor(interceptor);
} }
void NetworkManager::loadSettings()
{
Settings settings;
settings.beginGroup("Language");
QStringList langs = settings.value("acceptLanguage", AcceptLanguage::defaultLanguage()).toStringList();
settings.endGroup();
mApp->webProfile()->setHttpAcceptLanguage(AcceptLanguage::generateHeader(langs));
}

View File

@ -40,6 +40,8 @@ public:
void installUrlInterceptor(UrlInterceptor *interceptor); void installUrlInterceptor(UrlInterceptor *interceptor);
void removeUrlInterceptor(UrlInterceptor *interceptor); void removeUrlInterceptor(UrlInterceptor *interceptor);
void loadSettings();
private: private:
NetworkUrlInterceptor *m_urlInterceptor; NetworkUrlInterceptor *m_urlInterceptor;
QHash<QString, QWebEngineCertificateError::Error> m_ignoredSslErrors; QHash<QString, QWebEngineCertificateError::Error> m_ignoredSslErrors;

View File

@ -37,6 +37,7 @@
#include "ui_acceptlanguage.h" #include "ui_acceptlanguage.h"
#include "ui_addacceptlanguage.h" #include "ui_addacceptlanguage.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "networkmanager.h"
#include "settings.h" #include "settings.h"
QStringList AcceptLanguage::defaultLanguage() QStringList AcceptLanguage::defaultLanguage()
@ -216,6 +217,8 @@ void AcceptLanguage::accept()
settings.beginGroup("Language"); settings.beginGroup("Language");
settings.setValue("acceptLanguage", langs); settings.setValue("acceptLanguage", langs);
mApp->networkManager()->loadSettings();
QDialog::close(); QDialog::close();
} }