diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-02-21 16:40:25 +0100 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-02-21 16:40:25 +0100 |
commit | f3b6ecf0983dbb85a61faee21f41160df63cc575 (patch) | |
tree | 8509bb5a6d820ef6f9023cb0ec7bb7db1e2c2bb8 /src/webengine | |
parent | Moved smolbote.qbs (diff) | |
download | smolbote-f3b6ecf0983dbb85a61faee21f41160df63cc575.tar.xz |
Single instance
Diffstat (limited to 'src/webengine')
-rw-r--r-- | src/webengine/webengineprofile.cpp | 23 | ||||
-rw-r--r-- | src/webengine/webengineprofile.h | 1 |
2 files changed, 15 insertions, 9 deletions
diff --git a/src/webengine/webengineprofile.cpp b/src/webengine/webengineprofile.cpp index 826bc44..de806df 100644 --- a/src/webengine/webengineprofile.cpp +++ b/src/webengine/webengineprofile.cpp @@ -30,8 +30,9 @@ WebEngineProfile::WebEngineProfile(QObject *parent) : WebEngineProfile::WebEngineProfile(const QString &storageName, QObject *parent) : QWebEngineProfile(storageName, parent) { - qDebug("Reading WebEngineProfile..."); - QSettings config(persistentStoragePath() + "/profile.ini", QSettings::IniFormat); + QString profilePath = persistentStoragePath() + "/profile.ini"; + qDebug("Reading profile from [%s]", qUtf8Printable(profilePath)); + QSettings config(profilePath, QSettings::IniFormat); config.beginGroup("http"); setHttpUserAgent(config.value("userAgent").toString()); @@ -40,12 +41,16 @@ WebEngineProfile::WebEngineProfile(const QString &storageName, QObject *parent) 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(); + if(!isOffTheRecord()) { + saveProfile(); } } + +void WebEngineProfile::saveProfile() +{ + QSettings config(persistentStoragePath() + "/profile.ini", QSettings::IniFormat); + config.beginGroup("http"); + config.setValue("userAgent", httpUserAgent()); + config.endGroup(); + config.sync(); +} diff --git a/src/webengine/webengineprofile.h b/src/webengine/webengineprofile.h index dc07f4b..1845c99 100644 --- a/src/webengine/webengineprofile.h +++ b/src/webengine/webengineprofile.h @@ -35,6 +35,7 @@ public: signals: public slots: + void saveProfile(); }; #endif // WEBENGINEPROFILE_H |