Commit 957eb8f0 authored by Natalie Clarius's avatar Natalie Clarius Committed by Vlad Zahorodnii
Browse files

kcms/nightcolor: fix checks for manual timing errors

parent 05f21f51
Pipeline #224612 passed with stage
in 8 minutes and 42 seconds
......@@ -340,29 +340,23 @@ KCM.SimpleKCM {
}
QQC2.Label {
id: manualTimingsError1
visible: evenBeginManField.getNormedDate() - mornBeginManField.getNormedDate() <= 0
font.italic: true
text: i18n("Error: Morning is before evening.")
}
QQC2.Label {
id: manualTimingsError2
id: manualTimingsError
visible: {
if (manualTimingsError1.visible) {
return false;
}
var trTime = transTimeField.backend * 60 * 1000;
var day = 86400000;
var trTime = transTimeField.value * 60 * 1000;
var mor = mornBeginManField.getNormedDate();
var eve = evenBeginManField.getNormedDate();
return eve - mor <= trTime || eve - mor >= 86400000 - trTime;
var diffMorEve = eve > mor ? eve - mor : mor - eve;
var diffMin = Math.min(diffMorEve, day - diffMorEve);
return diffMin <= trTime;
}
font.italic: true
text: i18n("Error: Transition time overlaps.")
}
}
// Show location chooser in manual location mode
LocationsFixedView {
visible: kcm.nightColorSettings.mode === NightColorMode.Location
......
Supports Markdown
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