From 22f2451697b0dfc0b9d87e64acd55cdb353494b1 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Fri, 29 Dec 2017 14:45:12 +0100 Subject: Off-the-record profile settings - all profiles can load configs now - fullscreen requests are no longer ignored --- src/browser.cpp | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) (limited to 'src/browser.cpp') 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 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 otr = std::make_shared(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("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 profile = std::make_shared(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("profile.path").value()); + std::shared_ptr _profile = std::shared_ptr(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 -- cgit v1.2.1