UI: Fix loading app groups' enabled state

This commit is contained in:
Nodir Temirkhodjaev 2023-12-03 12:07:24 +03:00
parent c6cb09a6d1
commit d82394d223
3 changed files with 11 additions and 5 deletions

View File

@ -173,6 +173,12 @@ void FirewallConf::setAppGroupBits(quint32 groupBits)
m_appGroupBits = groupBits;
}
void FirewallConf::setupAppGroupBits(quint32 groupBits)
{
setAppGroupBits(groupBits);
applyAppGroupBits();
}
bool FirewallConf::appGroupWildcard() const
{
for (const AppGroup *appGroup : appGroups()) {
@ -353,8 +359,7 @@ void FirewallConf::copyFlags(const FirewallConf &o)
m_activePeriodFrom = o.activePeriodFrom();
m_activePeriodTo = o.activePeriodTo();
m_appGroupBits = o.appGroupBits();
applyAppGroupBits();
setupAppGroupBits(o.appGroupBits());
}
void FirewallConf::copy(const FirewallConf &o)
@ -433,7 +438,7 @@ void FirewallConf::flagsFromVariant(const QVariant &v)
m_activePeriodFrom = map["activePeriodFrom"].toString();
m_activePeriodTo = map["activePeriodTo"].toString();
m_appGroupBits = map["appGroupBits"].toUInt();
setupAppGroupBits(map["appGroupBits"].toUInt());
}
QVariant FirewallConf::addressesToVariant() const
@ -541,7 +546,6 @@ void FirewallConf::fromVariant(const QVariant &v, bool onlyFlags)
if (flagsEdited()) {
flagsFromVariant(map["flags"]);
applyAppGroupBits();
}
if (iniEdited() || taskEdited()) {

View File

@ -106,6 +106,8 @@ public:
quint32 appGroupBits() const { return m_appGroupBits; }
void setAppGroupBits(quint32 groupBits);
void setupAppGroupBits(quint32 groupBits);
bool appGroupWildcard() const;
bool appGroupEnabled(int groupIndex) const;

View File

@ -334,7 +334,7 @@ void FortSettings::readConfIni(FirewallConf &conf) const
conf.setLogAlertedBlockedIp(iniBool("logAlertedBlockedIp"));
conf.setAppBlockAll(iniBool("appBlockAll", true));
conf.setAppAllowAll(iniBool("appAllowAll"));
conf.setAppGroupBits(iniUInt("appGroupBits", DEFAULT_APP_GROUP_BITS));
conf.setupAppGroupBits(iniUInt("appGroupBits", DEFAULT_APP_GROUP_BITS));
ini()->endGroup();
ini()->beginGroup("stat");