[calendar] Fix calendar applet not clearing selection when hiding

This removes some old cruft that is not really used and serves
basically only as a bool property for checking if it's null and
wheter it equals the last activated date.

This can be done without it by simply resetting the current selected
date (another property) to "today".

REVIEW: 127455
BUG: 360683
This commit is contained in:
Martin Klapetek 2016-03-30 22:53:34 -04:00
parent 3b7a701c57
commit cff18c2cd2
3 changed files with 3 additions and 18 deletions

View File

@ -46,8 +46,8 @@ MouseArea {
return result
}
readonly property bool selected: {
var current = root.currentDate
var result = true
var current = root.currentDate;
var result = true;
if (dateMatchingPrecision >= Calendar.MatchYear) {
result = result && current.getFullYear() === thisDate.getFullYear()
}
@ -123,10 +123,4 @@ MouseArea {
ColorAnimation { duration: units.shortDuration * 2 }
}
}
Component.onCompleted: {
if (stack.depth === 1 && today) {
root.date = model
}
}
}

View File

@ -279,18 +279,9 @@ Item {
rows: daysCalendar.rows + (daysCalendar.headerModel ? 1 : 0)
spacing: root.borderWidth
property Item selectedItem
property bool containsEventItems: false // FIXME
property bool containsTodoItems: false // FIXME
property QtObject selectedDate: root.date
onSelectedDateChanged: {
// clear the selection if the root.date is null
if (calendarGrid.selectedDate == null) {
calendarGrid.selectedItem = null;
}
}
Repeater {
id: days

View File

@ -91,6 +91,7 @@ PinchArea {
function resetToToday() {
calendarBackend.resetToToday();
root.currentDate = root.today;
stack.pop(null);
}
@ -243,7 +244,6 @@ PinchArea {
onActivated: {
var rowNumber = Math.floor(index / columns);
week = 1 + calendarBackend.weeksModel[rowNumber];
root.date = date
root.currentDate = new Date(date.yearNumber, date.monthNumber - 1, date.dayNumber)
}
}