Add the current month name to the calendar component by default

Currently we have 3 applets using the calendar grid and all of them put
the extra heading to the calendar. We also offer ways to change the
displayed month so we should also show /which/ month is the current one
displayed, implicitly.

REVIEW: 118328
BUG: 334147
This commit is contained in:
Martin Klapetek 2014-05-26 16:25:00 +02:00
parent 819b42932d
commit 12811f1fc4

View File

@ -93,6 +93,40 @@ Item {
return Qt.formatDate(d, "dddd dd MMM yyyy");
}
PlasmaExtras.Heading {
id: monthHeading
anchors {
top: parent.top
left: parent.left
right: parent.right
}
level: 1
text: root.startDate.getFullYear() == new Date().getFullYear() ? root.selectedMonth : root.selectedMonth + ", " + root.selectedYear
elide: Text.ElideRight
Loader {
id: menuLoader
property QtObject monthCalendar: monthView.calendar
}
MouseArea {
id: monthMouse
width: monthHeading.paintedWidth
anchors {
left: parent.left
top: parent.top
bottom: parent.bottom
}
onClicked: {
if (menuLoader.source == "") {
menuLoader.source = "MonthMenu.qml"
}
menuLoader.item.open(0, height);
}
}
}
Calendar {
id: monthCalendar
@ -106,7 +140,10 @@ Item {
id: calendarGrid
anchors {
fill: parent
top: monthHeading.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
leftMargin: borderWidth
}