Коммит 09244592 создал по автору Коул Милена Ричардовна's avatar Коул Милена Ричардовна
Просмотр файлов

fix remembering login

владелец 6b7bd559
......@@ -51,6 +51,8 @@
#include "browser.h"
#include "browserwindow.h"
#include <QWebEngineSettings>
Browser::Browser()
{
// Quit application if the download manager window is the only remaining window
......@@ -63,13 +65,15 @@ Browser::Browser()
BrowserWindow *Browser::createWindow(QString vkm_link, bool offTheRecord)
{
if (offTheRecord && !m_otrProfile) {
m_otrProfile.reset(new QWebEngineProfile);
QObject::connect(
m_otrProfile.get(), &QWebEngineProfile::downloadRequested,
&m_downloadManagerWidget, &DownloadManagerWidget::downloadRequested);
if (!offTheRecord && !m_profile) {
m_profile.reset(new QWebEngineProfile(
QString::fromLatin1("mosvkm.%1").arg(qWebEngineChromiumVersion())));
m_profile->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
m_profile->settings()->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, true);
QObject::connect(m_profile.get(), &QWebEngineProfile::downloadRequested,
&m_downloadManagerWidget, &DownloadManagerWidget::downloadRequested);
}
auto profile = offTheRecord ? m_otrProfile.get() : QWebEngineProfile::defaultProfile();
auto profile = !offTheRecord ? m_profile.get() : QWebEngineProfile::defaultProfile();
auto mainWindow = new BrowserWindow(this, profile, vkm_link, false);
m_windows.append(mainWindow);
QObject::connect(mainWindow, &QObject::destroyed, [this, mainWindow]() {
......@@ -81,13 +85,15 @@ BrowserWindow *Browser::createWindow(QString vkm_link, bool offTheRecord)
LinkWindow *Browser::createLinkWindow(bool offTheRecord)
{
if (offTheRecord && !m_otrProfile) {
m_otrProfile.reset(new QWebEngineProfile);
QObject::connect(
m_otrProfile.get(), &QWebEngineProfile::downloadRequested,
&m_downloadManagerWidget, &DownloadManagerWidget::downloadRequested);
if (!offTheRecord && !m_profile) {
m_profile.reset(new QWebEngineProfile(
QString::fromLatin1("mosvkm.%1").arg(qWebEngineChromiumVersion())));
m_profile->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
m_profile->settings()->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, true);
QObject::connect(m_profile.get(), &QWebEngineProfile::downloadRequested,
&m_downloadManagerWidget, &DownloadManagerWidget::downloadRequested);
}
auto profile = offTheRecord ? m_otrProfile.get() : QWebEngineProfile::defaultProfile();
auto profile = !offTheRecord ? m_profile.get() : QWebEngineProfile::defaultProfile();
auto mainWindow = new LinkWindow(this, profile, false);
mainWindow->show();
return mainWindow;
......
......@@ -72,6 +72,6 @@ public:
private:
QVector<BrowserWindow*> m_windows;
DownloadManagerWidget m_downloadManagerWidget;
QScopedPointer<QWebEngineProfile> m_otrProfile;
QScopedPointer<QWebEngineProfile> m_profile;
};
#endif // BROWSER_H
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать