aboutsummaryrefslogtreecommitdiff
path: root/lib/web/profilemanager.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-10-07 13:20:54 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-10-07 18:19:19 +0200
commit2a5ea0269a1f9511c51d661a6c7d7bdc7d0176fa (patch)
tree7649cf4c1c20bbe8c801d642148992eea314d3ec /lib/web/profilemanager.cpp
parentAdd hint on enabling plugins to makepkg (diff)
downloadsmolbote-2a5ea0269a1f9511c51d661a6c7d7bdc7d0176fa.tar.xz
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
Diffstat (limited to 'lib/web/profilemanager.cpp')
-rw-r--r--lib/web/profilemanager.cpp13
1 files changed, 13 insertions, 0 deletions
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;
}