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

Show current default value beside the default option in site info

Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
Juraj Oravec 2022-08-28 03:56:04 +02:00
parent 9f6527ce21
commit 226c1acbd1
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B
4 changed files with 31 additions and 0 deletions

View File

@ -91,6 +91,8 @@ void SiteInfoPermissionItem::setPermission(SiteSettingsManager::Permission permi
qWarning() << "Unknown permission" << permission;
m_ui->radioDefault->setChecked(true);
}
m_ui->labelDefaultPermission->setText(mApp->siteSettingsManager()->getPermissionName(mApp->siteSettingsManager()->getDefaultPermission(m_option)));
}
SiteSettingsManager::Permission SiteInfoPermissionItem::permission() const

View File

@ -33,6 +33,16 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelDefaultPermission">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">

View File

@ -447,3 +447,20 @@ QString SiteSettingsManager::getOptionName(const QWebEnginePage::Feature& featur
{
return getOptionName(optionFromWebEngineFeature(feature));
}
QString SiteSettingsManager::getPermissionName(const SiteSettingsManager::Permission permission)
{
switch (permission) {
case Allow:
return QSL("Allow");
case Ask:
return QSL("ASK");
case Deny:
return QSL("Deny");
case Default:
return QSL("Default");
default:
qWarning() << "Uknown permission" << permission;
return QSL("Unknown");
}
}

View File

@ -112,6 +112,8 @@ public:
QString getOptionName(const SiteSettingsManager::PageOptions &option);
QString getOptionName(const QWebEnginePage::Feature &feature);
QString getPermissionName(const Permission permission);
private:
QString optionToSqlColumn(const PageOptions &option);
bool getDefaultOptionValue(const PageOptions &option);