UI: FirewallConf::loadGroupPeriodBits: Process only enabled groups

This commit is contained in:
Nodir Temirkhodjaev 2024-10-14 15:24:44 +05:00
parent bc72af5a82
commit 9a7b82dbbb
2 changed files with 4 additions and 6 deletions

View File

@ -167,7 +167,7 @@ void AppGroup::setPeriodTo(const QString &periodTo)
bool AppGroup::isTimeInPeriod(QTime time) const bool AppGroup::isTimeInPeriod(QTime time) const
{ {
if (m_periodFrom.isNull()) { if (m_periodFromTime.isNull()) {
m_periodFromTime = DateUtil::parseTime(m_periodFrom); m_periodFromTime = DateUtil::parseTime(m_periodFrom);
m_periodToTime = DateUtil::parseTime(m_periodTo); m_periodToTime = DateUtil::parseTime(m_periodTo);
} }

View File

@ -198,7 +198,7 @@ void FirewallConf::loadGroupPeriodBits()
m_groupActivePeriodBits = quint32(-1); m_groupActivePeriodBits = quint32(-1);
int groupIndex = 0; int groupIndex = 0;
for (AppGroup *appGroup : appGroups()) { for (AppGroup *appGroup : appGroups()) {
if (appGroup->periodEnabled()) { if (appGroup->enabled() && appGroup->periodEnabled()) {
m_anyGroupPeriodEnabled = true; m_anyGroupPeriodEnabled = true;
if (!appGroup->isTimeInPeriod(now)) { if (!appGroup->isTimeInPeriod(now)) {
@ -266,11 +266,9 @@ void FirewallConf::afterSaved()
ini().clear(); ini().clear();
} }
bool FirewallConf::updateGroupPeriods(bool onlyFlags) bool FirewallConf::updateGroupPeriods(bool /*onlyFlags*/)
{ {
if (!onlyFlags) {
loadGroupPeriodBits(); loadGroupPeriodBits();
}
return m_anyGroupPeriodEnabled; return m_anyGroupPeriodEnabled;
} }