From 79145ed9a15efed7f910946303533655c53a3aec Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Mon, 23 Sep 2024 13:57:53 +0500 Subject: [PATCH] UI: ProgramEdit: Disable blocked Zones/Rules row --- src/ui/form/prog/programeditdialog.cpp | 13 ++++++++++++- src/ui/form/prog/programeditdialog.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ui/form/prog/programeditdialog.cpp b/src/ui/form/prog/programeditdialog.cpp index 79486371..f8ea249a 100644 --- a/src/ui/form/prog/programeditdialog.cpp +++ b/src/ui/form/prog/programeditdialog.cpp @@ -369,7 +369,7 @@ QLayout *ProgramEditDialog::setupMainLayout() setupActionsGroup(); - // Zones + // Zones/Rules auto zonesRulesLayout = setupZonesRuleLayout(); // Schedule @@ -535,6 +535,8 @@ void ProgramEditDialog::setupActionsGroup() m_btgActions->addButton(m_rbAllow); m_btgActions->addButton(m_rbBlock); m_btgActions->addButton(m_rbKillProcess); + + connect(m_rbAllow, &QRadioButton::toggled, this, &ProgramEditDialog::updateZonesRulesLayout); } void ProgramEditDialog::setupAdvancedOptions() @@ -744,6 +746,15 @@ QLayout *ProgramEditDialog::setupButtonsLayout() return layout; } +void ProgramEditDialog::updateZonesRulesLayout() +{ + const bool enabled = m_rbAllow->isChecked(); + + m_cbLanOnly->setEnabled(enabled); + m_btZones->setEnabled(enabled); + m_btSelectRule->setEnabled(enabled); +} + void ProgramEditDialog::updateApplyChild() { const ApplyChildType type = m_appRow.applyParent ? ApplyChildType::FromParent diff --git a/src/ui/form/prog/programeditdialog.h b/src/ui/form/prog/programeditdialog.h index dd898150..16c3a60a 100644 --- a/src/ui/form/prog/programeditdialog.h +++ b/src/ui/form/prog/programeditdialog.h @@ -87,6 +87,7 @@ private: void setupComboScheduleType(); QLayout *setupButtonsLayout(); + void updateZonesRulesLayout(); void updateApplyChild(); void fillEditName();