diff --git a/src/ui/form/prog/programeditdialog.cpp b/src/ui/form/prog/programeditdialog.cpp index 4f67fa78..bbaaf71b 100644 --- a/src/ui/form/prog/programeditdialog.cpp +++ b/src/ui/form/prog/programeditdialog.cpp @@ -115,6 +115,8 @@ void ProgramEditDialog::initialize(const AppRow &appRow, const QVector & m_scScheduleIn->spinBox()->setValue(30); m_dteScheduleAt->setDateTime(appRow.scheduleTime); m_dteScheduleAt->setMinimumDateTime(DateUtil::now()); + + initializeFocus(); } void ProgramEditDialog::initializePathNameFields() @@ -124,8 +126,6 @@ void ProgramEditDialog::initializePathNameFields() initializePathField(isSingleSelection, isPathEditable); initializeNameField(isSingleSelection, isPathEditable); - - initializeFocus(); } void ProgramEditDialog::initializePathField(bool isSingleSelection, bool isPathEditable) @@ -167,7 +167,7 @@ void ProgramEditDialog::initializeNameField(bool isSingleSelection, bool isPathE void ProgramEditDialog::initializeFocus() { if (!isEmpty()) { - m_rbAllowApp->setFocus(); + m_btgActions->checkedButton()->setFocus(); } else if (isWildcard()) { m_editWildcard->setFocus(); } else { @@ -294,6 +294,8 @@ void ProgramEditDialog::setupUi() // Allow/Block/etc Actions Layout auto actionsLayout = setupActionsLayout(); + setupActionsGroup(); + // Advanced Options setupAdvancedOptions(); @@ -435,13 +437,16 @@ void ProgramEditDialog::setupComboAppGroups() QLayout *ProgramEditDialog::setupActionsLayout() { + // Allow m_rbAllowApp = new QRadioButton(); m_rbAllowApp->setIcon(IconCache::icon(":/icons/accept.png")); m_rbAllowApp->setChecked(true); + // Block m_rbBlockApp = new QRadioButton(); m_rbBlockApp->setIcon(IconCache::icon(":/icons/deny.png")); + // Kill Process m_rbKillProcess = new QRadioButton(); m_rbKillProcess->setIcon(IconCache::icon(":/icons/scull.png")); @@ -454,6 +459,16 @@ QLayout *ProgramEditDialog::setupActionsLayout() return layout; } +void ProgramEditDialog::setupActionsGroup() +{ + m_btgActions = new QButtonGroup(this); + m_btgActions->setExclusive(true); + + m_btgActions->addButton(m_rbAllowApp); + m_btgActions->addButton(m_rbBlockApp); + m_btgActions->addButton(m_rbKillProcess); +} + void ProgramEditDialog::setupAdvancedOptions() { // Use Group Perm. diff --git a/src/ui/form/prog/programeditdialog.h b/src/ui/form/prog/programeditdialog.h index b9052560..b3eac7af 100644 --- a/src/ui/form/prog/programeditdialog.h +++ b/src/ui/form/prog/programeditdialog.h @@ -4,6 +4,7 @@ #include #include +QT_FORWARD_DECLARE_CLASS(QButtonGroup) QT_FORWARD_DECLARE_CLASS(QCheckBox) QT_FORWARD_DECLARE_CLASS(QComboBox) QT_FORWARD_DECLARE_CLASS(QDateTimeEdit) @@ -72,6 +73,7 @@ private: QLayout *setupNotesLayout(); void setupComboAppGroups(); QLayout *setupActionsLayout(); + void setupActionsGroup(); void setupAdvancedOptions(); QLayout *setupChildLayout(); QLayout *setupLogLayout(); @@ -113,6 +115,7 @@ private: QRadioButton *m_rbAllowApp = nullptr; QRadioButton *m_rbBlockApp = nullptr; QRadioButton *m_rbKillProcess = nullptr; + QButtonGroup *m_btgActions = nullptr; QCheckBox *m_cbUseGroupPerm = nullptr; QCheckBox *m_cbApplyChild = nullptr; QCheckBox *m_cbKillChild = nullptr;