From 2a5ea0269a1f9511c51d661a6c7d7bdc7d0176fa Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 7 Oct 2018 13:20:54 +0200 Subject: Expand HTTP header settings #4 - add doc/Usage/Filter.asciidoc to explain the usage of the filter headers - add HTTP headers to Profile (section "headers") - Use request interceptor to apply filter headers, then profile headers - add insert/delete actions to ProfileEditor --- lib/web/profilemanager.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/web/profilemanager.cpp') diff --git a/lib/web/profilemanager.cpp b/lib/web/profilemanager.cpp index 74ddc75..17435e8 100644 --- a/lib/web/profilemanager.cpp +++ b/lib/web/profilemanager.cpp @@ -73,6 +73,19 @@ WebProfile *ProfileManager::loadProfile(const QString &path) this->m_profiles.at(id)->settings.setValue("attributes/" + QString::number(attr), value); }); + // headers + ptr->settings.beginGroup("headers"); + for(const QString &key : ptr->settings.childKeys()) { + ptr->profile->setHttpHeader(key.toLatin1(), ptr->settings.value(key).toString().toLatin1()); + } + ptr->settings.endGroup(); + connect(ptr->profile, &WebProfile::headerChanged, ptr->profile, [this, id](const QString &name, const QString &value) { + this->m_profiles.at(id)->settings.setValue("headers/" + name, value); + }); + connect(ptr->profile, &WebProfile::headerRemoved, ptr->profile, [this, id](const QString &name) { + this->m_profiles.at(id)->settings.remove("headers/" + name); + }); + m_profiles[id] = std::move(ptr); return m_profiles.at(id)->profile; } -- cgit v1.2.1