1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

Update loops in getSiteSettings method

Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
Juraj Oravec 2022-09-24 11:25:15 +02:00
parent 5e0a779d53
commit 90181a0606
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B
2 changed files with 9 additions and 10 deletions

View File

@ -529,7 +529,7 @@ QList<QWebEnginePage::Feature> SiteSettingsManager::getSupportedFeatures() const
SiteSettingsManager::SiteSettings SiteSettingsManager::getSiteSettings(QUrl& url, bool privateMode) SiteSettingsManager::SiteSettings SiteSettingsManager::getSiteSettings(QUrl& url, bool privateMode)
{ {
SiteSettings siteSettings; SiteSettings siteSettings;
int i; int index = 0;
QSqlQuery query(SqlDatabase::instance()->database()); QSqlQuery query(SqlDatabase::instance()->database());
query.prepare(everythingSql.arg(sqlTable(privateMode))); query.prepare(everythingSql.arg(sqlTable(privateMode)));
@ -538,17 +538,16 @@ SiteSettingsManager::SiteSettings SiteSettingsManager::getSiteSettings(QUrl& url
if (query.next()) { if (query.next()) {
Permission perm; Permission perm;
for (i = 0; i < supportedAttribute.size(); ++i) { for (int i = 0; i < supportedAttribute.size(); ++i, ++index) {
perm = intToPermission(query.value(i).toInt()); perm = intToPermission(query.value(index).toInt());
siteSettings.attributes[supportedAttribute[i]] = perm; siteSettings.attributes[supportedAttribute[i]] = perm;
} }
for (i = 0; i < supportedFeatures.size(); ++i) { for (int i = 0; i < supportedFeatures.size(); ++i, ++index) {
perm = intToPermission(query.value(i + supportedAttribute.size()).toInt()); perm = intToPermission(query.value(index).toInt());
siteSettings.features[supportedFeatures[i]] = perm; siteSettings.features[supportedFeatures[i]] = perm;
} }
perm = intToPermission(query.value(supportedAttribute.size() + supportedFeatures.size()).toInt()); siteSettings.AllowCookies = intToPermission(query.value(index++).toInt());
siteSettings.AllowCookies = perm; siteSettings.ZoomLevel = query.value(index++).toInt();
siteSettings.ZoomLevel = query.value(supportedAttribute.size() + supportedFeatures.size() + 1).toInt();
} }
return siteSettings; return siteSettings;

View File

@ -47,8 +47,8 @@ public:
struct SiteSettings struct SiteSettings
{ {
Permission AllowCookies; Permission AllowCookies = Default;
int ZoomLevel; int ZoomLevel = -1;
QMap<QWebEngineSettings::WebAttribute, Permission> attributes; /* Enable disable soem feature eg. Javascript, Images etc */ QMap<QWebEngineSettings::WebAttribute, Permission> attributes; /* Enable disable soem feature eg. Javascript, Images etc */
QMap<QWebEnginePage::Feature, Permission> features; /* HTML permissions */ QMap<QWebEnginePage::Feature, Permission> features; /* HTML permissions */
QString server; QString server;