aboutsummaryrefslogtreecommitdiff
path: root/src/browser.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-12-29 14:45:12 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2017-12-29 14:45:12 +0100
commit22f2451697b0dfc0b9d87e64acd55cdb353494b1 (patch)
tree20119fe1e70b842e35648289826981bca0ffdf2e /src/browser.cpp
parentDownload manager fixes (diff)
downloadsmolbote-22f2451697b0dfc0b9d87e64acd55cdb353494b1.tar.xz
Off-the-record profile settings
- all profiles can load configs now - fullscreen requests are no longer ignored
Diffstat (limited to 'src/browser.cpp')
-rw-r--r--src/browser.cpp29
1 files changed, 6 insertions, 23 deletions
diff --git a/src/browser.cpp b/src/browser.cpp
index 1d09951..d7834f4 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -110,30 +110,13 @@ std::shared_ptr<WebEngineProfile> Browser::profile(const QString storageName)
// profile with name storageName has not been loaded
Q_ASSERT(m_config);
- if(storageName.isEmpty()) {
- // construct off-the-record profile
- std::shared_ptr<WebEngineProfile> otr = std::make_shared<WebEngineProfile>(nullptr);
- otr->setRequestInterceptor(m_urlRequestInterceptor.get());
- connect(otr.get(), &WebEngineProfile::downloadRequested, m_downloadManager.get(), &DownloadsWidget::addDownload);
- m_profiles.insert("", otr);
-
- return otr;
- } else {
- // regular profile
- const QString &path = QString::fromStdString(m_config->value<std::string>("profile.path").value());
-
- // Build a profile list from the folders in the profile.path
- QDir profileDir(path);
-
- // set profile parents to nullptr, otherwise both Browser and std::shared_ptr try to free them
- std::shared_ptr<WebEngineProfile> profile = std::make_shared<WebEngineProfile>(storageName, profileDir.absoluteFilePath(storageName), nullptr);
- profile->setRequestInterceptor(m_urlRequestInterceptor.get());
- connect(profile.get(), &WebEngineProfile::downloadRequested, m_downloadManager.get(), &DownloadsWidget::addDownload);
- m_profiles.insert(storageName, profile);
-
- return profile;
- }
+ const QString &path = QString::fromStdString(m_config->value<std::string>("profile.path").value());
+ std::shared_ptr<WebEngineProfile> _profile = std::shared_ptr<WebEngineProfile>(createProfile(storageName, path, nullptr));
+ _profile->setRequestInterceptor(m_urlRequestInterceptor.get());
+ connect(_profile.get(), &WebEngineProfile::downloadRequested, m_downloadManager.get(), &DownloadsWidget::addDownload);
+ m_profiles.insert(storageName, _profile);
+ return _profile;
}
QStringList Browser::profiles() const