aboutsummaryrefslogtreecommitdiff
path: root/src/webengine/webengineprofile.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-01-12 19:57:00 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2017-01-12 19:57:00 +0100
commit8c30d0d5f0ab93c44b6957040fd0a2b3b7749faa (patch)
tree94500815f9734492c3c61d97aca1b0c4bbcddcd3 /src/webengine/webengineprofile.cpp
parentMinor bugfixes (diff)
downloadsmolbote-8c30d0d5f0ab93c44b6957040fd0a2b3b7749faa.tar.xz
Profile config loading and saving
Diffstat (limited to 'src/webengine/webengineprofile.cpp')
-rw-r--r--src/webengine/webengineprofile.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/webengine/webengineprofile.cpp b/src/webengine/webengineprofile.cpp
new file mode 100644
index 0000000..1eb1112
--- /dev/null
+++ b/src/webengine/webengineprofile.cpp
@@ -0,0 +1,31 @@
+#include "webengineprofile.h"
+#include <QSettings>
+
+WebEngineProfile::WebEngineProfile(QObject *parent) :
+ QWebEngineProfile(parent)
+{
+ // Off-the-record constructor
+}
+
+WebEngineProfile::WebEngineProfile(const QString &storageName, QObject *parent) :
+ QWebEngineProfile(storageName, parent)
+{
+ qDebug("Reading WebEngineProfile...");
+ QSettings config(persistentStoragePath() + "/profile.ini", QSettings::IniFormat);
+
+ config.beginGroup("http");
+ setHttpUserAgent(config.value("userAgent").toString());
+ config.endGroup();
+}
+
+WebEngineProfile::~WebEngineProfile()
+{
+ if(!this->isOffTheRecord()) {
+ // save settings
+ QSettings config(persistentStoragePath() + "/profile.ini", QSettings::IniFormat);
+ config.beginGroup("http");
+ config.setValue("userAgent", httpUserAgent());
+ config.endGroup();
+ config.sync();
+ }
+}