Skip to content

Commit

Permalink
mythfrontend: Prevent inactive override rules
Browse files Browse the repository at this point in the history
When a user creates an override for an episode, there
is an option to set it inactive. If the user sets
it inactive, the override is ignored by the scheduler.

If there is an inactive override, the user interface
shows an option to create an override. If they try
to create another override, saving the override fails
dues to a database duplicate error, and the error is
not reflected back to the user. The user assumes the
override was successful but it fact it was lost.

On the other hand, when there is an active override,
the user interface shows options to modify or delete
the override, and there is no danger of creating a
duplicate.

I solve this by disabling the ability to set overrides
as inactive. Aside from creating this potential error,
there seems no legitimate use for an inactive override.

Note: you can still make an inactive override by applying
an inactive template to an override. This fix does not
address that possibility.
  • Loading branch information
bennettpeter committed Jul 8, 2023
1 parent 5f9c323 commit 093dafa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion mythtv/programs/mythfrontend/scheduleeditor.cpp
Expand Up @@ -2088,10 +2088,15 @@ void SchedOptMixin::Load(void)
m_inputList->SetValueByData(m_rule->m_prefInput);
}

bool isOverride = (m_rule->m_type != kNotRecording &&
m_rule->m_type != kDontRecord &&
m_rule->m_type != kOverrideRecord);

// Active/Disabled
if (m_ruleactiveCheck)
{
m_ruleactiveCheck->SetCheckState(!m_rule->m_isInactive);
m_ruleactiveCheck->SetEnabled(isOverride);
}

// Record new and repeat
Expand Down Expand Up @@ -2183,8 +2188,11 @@ void SchedOptMixin::RuleChanged(void)
m_rule->m_dupMethod != kDupCheckNone);
if (m_inputList)
m_inputList->SetEnabled(isScheduled);
bool isOverride = (m_rule->m_type != kNotRecording &&
m_rule->m_type != kDontRecord &&
m_rule->m_type != kOverrideRecord);
if (m_ruleactiveCheck)
m_ruleactiveCheck->SetEnabled(isScheduled);
m_ruleactiveCheck->SetEnabled(isOverride);
if (m_newrepeatList)
m_newrepeatList->SetEnabled(isScheduled && !isSingle && m_haveRepeats);
}
Expand Down

0 comments on commit 093dafa

Please sign in to comment.