aboutsummaryrefslogtreecommitdiff
path: root/src/webengine/webengineprofile.cpp
blob: 1eb1112a5daeab634ee0ef5c6cf5075e16be626c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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();
    }
}