aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/web/webprofile.cpp63
-rw-r--r--lib/web/webprofile.h9
2 files changed, 0 insertions, 72 deletions
diff --git a/lib/web/webprofile.cpp b/lib/web/webprofile.cpp
index 1613e52..9b16a61 100644
--- a/lib/web/webprofile.cpp
+++ b/lib/web/webprofile.cpp
@@ -13,72 +13,10 @@
#include <QWebEngineSettings>
WebProfile *WebProfile::profile = nullptr;
-QMap<QString, WebProfile *> WebProfile::profiles;
-
-WebProfile* WebProfile::loadProfile(const QString &name, const QHash<QString, QString> &defaults, const QString &path, QObject *parent)
-{
- WebProfile *profile = nullptr;
-#ifdef QT_DEBUG
- qDebug("+ Reading config for profile '%s': %s", qUtf8Printable(name), qUtf8Printable(path));
-#endif
- QSettings config(path, QSettings::IniFormat);
-
- if(name.isEmpty()) {
- // a default otr profile
- profile = new WebProfile(QObject::tr("Off-the-record"), path, parent);
-
- } else if(config.value("otr").toBool()) {
- // a named otr profile
- profile = new WebProfile(config.value("name", name).toString(), path, parent);
-
- } else {
- // a named profile
- profile = new WebProfile(name, config.value("name", name).toString(), path, parent);
- }
-
- Q_CHECK_PTR(profile);
- profiles.insert(name, profile);
-
- profile->setSearch(config.value("search", defaults.value("profile.search")).toString());
- profile->setHomepage(config.value("homepage", defaults.value("profile.homepage")).toUrl());
- profile->setNewtab(config.value("newtab", defaults.value("profile.newtab")).toUrl());
-
- config.beginGroup("properties");
- {
- const auto keys = config.childKeys();
- for(const QString &key : keys) {
-#ifdef QT_DEBUG
- qDebug("- set property %s to %s", qUtf8Printable(key), qUtf8Printable(config.value(key).toString()));
-#endif
- profile->setProperty(qUtf8Printable(key), config.value(key));
- }
- }
- config.endGroup(); // properties
-
- config.beginGroup("attributes");
- {
- const auto keys = config.childKeys();
- auto *settings = profile->settings();
- for(const QString &key : keys) {
-#ifdef QT_DEBUG
- qDebug("- set attribute %s to %s", qUtf8Printable(key), qUtf8Printable(config.value(key).toString()));
-#endif
- auto attribute = static_cast<QWebEngineSettings::WebAttribute>(key.toInt());
- settings->setAttribute(attribute, config.value(key).toBool());
- }
- }
- config.endGroup();
-
- return profile;
-}
WebProfile::WebProfile(const QString &name, const QString &configPath, QObject *parent)
: QWebEngineProfile(parent)
{
- if(configPath.isEmpty())
- m_id = configPath;
- else
- m_id = QFileInfo(configPath).baseName();
m_name = name;
m_configPath = configPath;
@@ -97,7 +35,6 @@ WebProfile::WebProfile(const QString &name, const QString &configPath, QObject *
WebProfile::WebProfile(const QString &storageName, const QString &name, const QString &configPath, QObject *parent)
: QWebEngineProfile(storageName, parent)
{
- m_id = QFileInfo(configPath).baseName();
m_name = name;
m_configPath = configPath;
diff --git a/lib/web/webprofile.h b/lib/web/webprofile.h
index d41625c..5107b8f 100644
--- a/lib/web/webprofile.h
+++ b/lib/web/webprofile.h
@@ -54,13 +54,6 @@ public:
return WebProfile::profile;
}
- static WebProfile* loadProfile(const QString &name, const QHash<QString, QString> &defaults, const QString &path = QString(), QObject *parent = nullptr);
-
- const QString id() const
- {
- return profiles.key(const_cast<WebProfile*>(this), "");
- }
-
QString name() const
{
return m_name;
@@ -112,9 +105,7 @@ signals:
private:
static WebProfile *profile;
- static QMap<QString, WebProfile *> profiles;
- QString m_id;
QString m_configPath;
QString m_name;
QString m_search = QString("about:blank");