aboutsummaryrefslogtreecommitdiff
path: root/lib/web/webprofile.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2019-01-16 16:52:07 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2019-01-16 16:52:07 +0100
commit2a696a57abafb25978aef1af5758fe75b706d1f0 (patch)
tree9c9b3468398b16711a573e0c8b87ae2ad03100b4 /lib/web/webprofile.cpp
parentRewrite lib/urlfilter (diff)
downloadsmolbote-2a696a57abafb25978aef1af5758fe75b706d1f0.tar.xz
Rewrite lib/web to lib/webprofile
- libweb was supposed to be a general QtWebEngine wrapper, but only turned out to do profiles and profile management. The new name should make this more obvious. - Renamed ProfileManager to WebProfileManager, and cut out duplicate code. - Temporary profiles: temporary profiles are not kept after closing the browser.
Diffstat (limited to 'lib/web/webprofile.cpp')
-rw-r--r--lib/web/webprofile.cpp156
1 files changed, 0 insertions, 156 deletions
diff --git a/lib/web/webprofile.cpp b/lib/web/webprofile.cpp
deleted file mode 100644
index 38aa7f0..0000000
--- a/lib/web/webprofile.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * This file is part of smolbote. It's copyrighted by the contributors recorded
- * in the version control history of the file, available from its original
- * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote
- *
- * SPDX-License-Identifier: GPL-3.0
- */
-
-#include "webprofile.h"
-#include <QFileInfo>
-#include <QSettings>
-#include <QWebEngineCookieStore>
-#include <QWebEngineSettings>
-
-WebProfile *WebProfile::profile = nullptr;
-
-WebProfile::WebProfile(const QString &name, QObject *parent)
- : Profile(parent)
-{
- m_name = name;
-
-#ifdef QT_DEBUG
- qDebug("Creating otr profile %s", qUtf8Printable(m_name));
-#endif
-
- connect(this->cookieStore(), &QWebEngineCookieStore::cookieAdded, this, [this](const QNetworkCookie &cookie) {
- m_cookies.append(cookie);
- });
- connect(this->cookieStore(), &QWebEngineCookieStore::cookieRemoved, this, [this](const QNetworkCookie &cookie) {
- m_cookies.removeAll(cookie);
- });
-}
-
-WebProfile::WebProfile(const QString &storageName, const QString &name, QObject *parent)
- : Profile(storageName, parent)
-{
- m_name = name;
-
-#ifdef QT_DEBUG
- qDebug("Creating profile %s", qUtf8Printable(m_name));
-#endif
-
- connect(this->cookieStore(), &QWebEngineCookieStore::cookieAdded, this, [this](const QNetworkCookie &cookie) {
- m_cookies.append(cookie);
- });
- connect(this->cookieStore(), &QWebEngineCookieStore::cookieRemoved, this, [this](const QNetworkCookie &cookie) {
- m_cookies.removeAll(cookie);
- });
-}
-
-const QString WebProfile::name() const
-{
- return m_name;
-}
-
-void WebProfile::setName(const QString &name)
-{
- m_name = name;
- emit nameChanged(name);
-}
-
-QString WebProfile::search() const
-{
- return m_search;
-}
-
-void WebProfile::setSearch(const QString &url)
-{
- m_search = url;
- emit searchChanged(m_search);
-}
-
-QUrl WebProfile::homepage() const
-{
- return m_homepage;
-}
-
-void WebProfile::setHomepage(const QUrl &url)
-{
- m_homepage = url;
- emit homepageChanged(m_homepage);
-}
-
-QUrl WebProfile::newtab() const
-{
- return m_newtab;
-}
-
-void WebProfile::setNewtab(const QUrl &url)
-{
- m_newtab = url;
- emit newtabChanged(m_newtab);
-}
-
-void WebProfile::setCachePath(const QString &path)
-{
- QWebEngineProfile::setCachePath(path);
- emit propertyChanged("cachePath", path);
-}
-
-void WebProfile::setPersistentStoragePath(const QString &path)
-{
- QWebEngineProfile::setPersistentStoragePath(path);
- emit propertyChanged("persistentStoragePath", path);
-}
-
-void WebProfile::setPersistentCookiesPolicy(int policy)
-{
- QWebEngineProfile::setPersistentCookiesPolicy(static_cast<QWebEngineProfile::PersistentCookiesPolicy>(policy));
- emit propertyChanged("persistentCookiesPolicy", policy);
-}
-
-void WebProfile::setHttpAcceptLanguage(const QString &httpAcceptLanguage)
-{
- QWebEngineProfile::setHttpAcceptLanguage(httpAcceptLanguage);
- emit propertyChanged("httpAcceptLanguage", httpAcceptLanguage);
-}
-
-void WebProfile::setHttpCacheMaximumSize(int maxSize)
-{
- QWebEngineProfile::setHttpCacheMaximumSize(maxSize);
- emit propertyChanged("httpCacheMaximumSize", maxSize);
-}
-
-void WebProfile::setHttpCacheType(int type)
-{
- qDebug("set httpCacheType to %i", type);
- QWebEngineProfile::setHttpCacheType(static_cast<QWebEngineProfile::HttpCacheType>(type));
- emit propertyChanged("httpCacheType", type);
-}
-
-void WebProfile::setHttpUserAgent(const QString &userAgent)
-{
- QWebEngineProfile::setHttpUserAgent(userAgent);
- emit propertyChanged("httpUserAgent", userAgent);
-}
-
-void WebProfile::setHttpHeader(const QString& name, const QString& value)
-{
- m_headers[name.toLatin1()] = value.toLatin1();
- emit headerChanged(name, value);
-}
-
-void WebProfile::removeHttpHeader(const QString& name)
-{
- if(m_headers.contains(name.toLatin1())) {
- m_headers.remove(name.toLatin1());
- emit headerRemoved(name);
- }
-}
-
-void WebProfile::setSpellCheckEnabled(bool enable)
-{
- QWebEngineProfile::setSpellCheckEnabled(enable);
- emit propertyChanged("spellCheckEnabed", enable);
-}