Verified Commit fe875699 authored by Juraj Oravec's avatar Juraj Oravec
Browse files

Add more Private mode handlings



Signed-off-by: Juraj Oravec's avatarJuraj Oravec <jurajoravec@mailo.com>
parent e1d54dff
Pipeline #241742 skipped
......@@ -240,7 +240,7 @@ void SiteSettingsManager::setImages(const QUrl& url, const int value)
void SiteSettingsManager::setOption(const QString& column, const QUrl& url, const int value)
{
if (column.isEmpty()) {
if (column.isEmpty() || mApp->isPrivate()) {
return;
}
......@@ -278,6 +278,9 @@ SiteSettingsManager::Permission SiteSettingsManager::getPermission(const QString
if (column.isEmpty()) {
return Deny;
}
if (mApp->isPrivate()) {
return Default;
}
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare(QSL("SELECT %1 FROM %2 WHERE server=?").arg(column, sqlTable()));
......@@ -640,6 +643,10 @@ SiteSettingsManager::SiteSettings SiteSettingsManager::getSiteSettings(QUrl& url
void SiteSettingsManager::setSiteSettings(SiteSettingsManager::SiteSettings& siteSettings)
{
if (mApp->isPrivate()) {
return;
}
auto job = new SqlQueryJob(everythingUpdateSql.arg(sqlTable()), this);
for (int i = 0; i < supportedAttribute.size(); ++i) {
......
......@@ -457,11 +457,25 @@ bool WebPage::acceptNavigationRequest(const QUrl &url, QWebEnginePage::Navigatio
const bool isWeb = url.scheme() == QL1S("http") || url.scheme() == QL1S("https") || url.scheme() == QL1S("file");
if (isWeb) {
auto webAttributes = mApp->siteSettingsManager()->getWebAttributes(url);
if (!webAttributes.empty()) {
QHash<QWebEngineSettings::WebAttribute, bool>::iterator it;
for (it = webAttributes.begin(); it != webAttributes.end(); ++it) {
settings()->setAttribute(it.key(), it.value());
if (!mApp->isPrivate()) {
auto webAttributes = mApp->siteSettingsManager()->getWebAttributes(url);
if (!webAttributes.empty()) {
QHash<QWebEngineSettings::WebAttribute, bool>::iterator it;
for (it = webAttributes.begin(); it != webAttributes.end(); ++it) {
settings()->setAttribute(it.key(), it.value());
}
}
else {
auto webAttributes = mApp->siteSettingsManager()->getSupportedAttribute();
for (auto &attribute : qAsConst(webAttributes)) {
settings()->setAttribute(attribute, mApp->webSettings()->testAttribute(attribute));
}
}
}
else {
auto webAttributes = mApp->siteSettingsManager()->getSupportedAttribute();
for (auto &attribute : qAsConst(webAttributes)) {
settings()->setAttribute(attribute, mApp->webSettings()->testAttribute(attribute));
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment