Commit af4d75d2 authored by Glen Ditchfield's avatar Glen Ditchfield 🐛 Committed by Glen Ditchfield

Display a warning for invalid recurrence end-on dates

If the end-on date of a recurring incidence is invalid, display a visible
warning in the GUI, and focus on the field.
parent e7967bea
Pipeline #39849 failed with stage
in 16 minutes and 13 seconds
......@@ -398,6 +398,18 @@ bool IncidenceRecurrence::isDirty() const
return false;
}
void IncidenceRecurrence::focusInvalidField()
{
KCalendarCore::Incidence::Ptr incidence(mLoadedIncidence->clone());
writeToIncidence(incidence);
if (incidence->recurs()) {
if (mUi->mRecurrenceEndCombo->currentIndex() == RecurrenceEndOn
&& !mUi->mRecurrenceEndDate->date().isValid()) {
mUi->mRecurrenceEndDate->setFocus();
}
}
}
bool IncidenceRecurrence::isValid() const
{
mLastErrorString.clear();
......@@ -435,7 +447,8 @@ bool IncidenceRecurrence::isValid() const
if (mUi->mRecurrenceEndCombo->currentIndex() == RecurrenceEndOn
&& !mUi->mRecurrenceEndDate->date().isValid()) {
qCWarning(INCIDENCEEDITOR_LOG) << "Recurrence end date is invalid."; // TODO: strings after freeze
mLastErrorString = i18nc("@info", "The recurrence end date is invalid.");
qCDebug(INCIDENCEEDITOR_LOG) << mLastErrorString;
return false;
}
}
......
......@@ -44,6 +44,8 @@ public:
Q_REQUIRED_RESULT bool isDirty() const override;
Q_REQUIRED_RESULT bool isValid() const override;
void focusInvalidField() override;
Q_REQUIRED_RESULT RecurrenceType currentRecurrenceType() const;
Q_SIGNALS:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment