aboutsummaryrefslogtreecommitdiff
path: root/lib/web/profilemanager.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-09-08 15:41:10 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-09-08 17:22:24 +0200
commit5e6920c427b30232e47039d26cbaec7173c837d2 (patch)
tree6daf69335854e8106399bb2bcba27162f999f476 /lib/web/profilemanager.cpp
parentReplace ProfileManager::profileList() with ProfileManager::idList() (diff)
downloadsmolbote-5e6920c427b30232e47039d26cbaec7173c837d2.tar.xz
Save WebProfile config when changed
Diffstat (limited to 'lib/web/profilemanager.cpp')
-rw-r--r--lib/web/profilemanager.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/web/profilemanager.cpp b/lib/web/profilemanager.cpp
index b747bf6..960a03a 100644
--- a/lib/web/profilemanager.cpp
+++ b/lib/web/profilemanager.cpp
@@ -41,19 +41,22 @@ WebProfile *ProfileManager::loadProfile(const QString &path)
ptr->profile = new WebProfile(id, ptr->settings.value("name", id).toString(), nullptr);
}
Q_CHECK_PTR(ptr->profile);
+ connect(ptr->profile, &WebProfile::nameChanged, [this, id](const QString &name) {
+ this->m_profiles.at(id)->settings.setValue("name", name);
+ });
ptr->profile->setSearch(ptr->settings.value("search", defaults.value("profile.search")).toString());
- connect(ptr->profile, &WebProfile::searchChanged, &ptr->settings, [this, id](const QString &url) {
+ connect(ptr->profile, &WebProfile::searchChanged, [this, id](const QString &url) {
this->m_profiles.at(id)->settings.setValue("search", url);
});
ptr->profile->setHomepage(ptr->settings.value("homepage", defaults.value("profile.homepage")).toUrl());
- connect(ptr->profile, &WebProfile::homepageChanged, &ptr->settings, [this, id](const QUrl &url) {
+ connect(ptr->profile, &WebProfile::homepageChanged, [this, id](const QUrl &url) {
this->m_profiles.at(id)->settings.setValue("homepage", url);
});
ptr->profile->setNewtab(ptr->settings.value("newtab", defaults.value("profile.newtab")).toUrl());
- connect(ptr->profile, &WebProfile::newtabChanged, &ptr->settings, [this, id](const QUrl &url) {
+ connect(ptr->profile, &WebProfile::newtabChanged, [this, id](const QUrl &url) {
this->m_profiles.at(id)->settings.setValue("newtab", url);
});
@@ -65,6 +68,9 @@ WebProfile *ProfileManager::loadProfile(const QString &path)
}
}
ptr->settings.endGroup(); // properties
+ connect(ptr->profile, &WebProfile::propertyChanged, [this, id](const QString &property, const QVariant &value) {
+ this->m_profiles.at(id)->settings.setValue("properties/" + property, value);
+ });
ptr->settings.beginGroup("attributes");
{
@@ -76,6 +82,9 @@ WebProfile *ProfileManager::loadProfile(const QString &path)
}
}
ptr->settings.endGroup();
+ connect(ptr->profile, &WebProfile::attributeChanged, [this, id](const QWebEngineSettings::WebAttribute attr, const bool value) {
+ this->m_profiles.at(id)->settings.setValue("attributes/" + QString::number(attr), value);
+ });
m_profiles[id] = std::move(ptr);
return m_profiles.at(id)->profile;