Let month menu navigate in current year
Rather than jumping back to the current year unconditionally, just navigate inside the current year. BUG: 342327 REVIEW: 121774
This commit is contained in:
parent
6f58ddc05d
commit
94ecb4ff43
@ -17,62 +17,21 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.2
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
|
||||||
PlasmaComponents.Menu {
|
PlasmaComponents.Menu {
|
||||||
id: testMenu
|
id: testMenu
|
||||||
property date today: new Date()
|
property int year
|
||||||
|
|
||||||
PlasmaComponents.MenuItem {
|
// Needs to be a property since Menu doesn't accept other items than MenuItem
|
||||||
text: capitalizeFirstLetter(Qt.locale().standaloneMonthName(0))
|
property Instantiator items: Instantiator {
|
||||||
onClicked: calendarBackend.displayedDate = new Date(today.getFullYear(), 0, 1)
|
model: 12
|
||||||
}
|
PlasmaComponents.MenuItem {
|
||||||
|
text: capitalizeFirstLetter(Qt.locale().standaloneMonthName(index))
|
||||||
PlasmaComponents.MenuItem {
|
onClicked: calendarBackend.displayedDate = new Date(year, index, 1)
|
||||||
text: capitalizeFirstLetter(Qt.locale().standaloneMonthName(1))
|
}
|
||||||
onClicked: calendarBackend.displayedDate = new Date(today.getFullYear(), 1, 1)
|
onObjectAdded: testMenu.addMenuItem(object)
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaComponents.MenuItem {
|
|
||||||
text: capitalizeFirstLetter(Qt.locale().standaloneMonthName(2))
|
|
||||||
onClicked: calendarBackend.displayedDate = new Date(today.getFullYear(), 2, 1)
|
|
||||||
}
|
|
||||||
PlasmaComponents.MenuItem {
|
|
||||||
text: capitalizeFirstLetter(Qt.locale().standaloneMonthName(3))
|
|
||||||
onClicked: calendarBackend.displayedDate = new Date(today.getFullYear(), 3, 1)
|
|
||||||
}
|
|
||||||
PlasmaComponents.MenuItem {
|
|
||||||
text: capitalizeFirstLetter(Qt.locale().standaloneMonthName(4))
|
|
||||||
onClicked: calendarBackend.displayedDate = new Date(today.getFullYear(), 4, 1)
|
|
||||||
}
|
|
||||||
PlasmaComponents.MenuItem {
|
|
||||||
text: capitalizeFirstLetter(Qt.locale().standaloneMonthName(5))
|
|
||||||
onClicked: calendarBackend.displayedDate = new Date(today.getFullYear(), 5, 1)
|
|
||||||
}
|
|
||||||
PlasmaComponents.MenuItem {
|
|
||||||
text: capitalizeFirstLetter(Qt.locale().standaloneMonthName(6))
|
|
||||||
onClicked: calendarBackend.displayedDate = new Date(today.getFullYear(), 6, 1)
|
|
||||||
}
|
|
||||||
PlasmaComponents.MenuItem {
|
|
||||||
text: capitalizeFirstLetter(Qt.locale().standaloneMonthName(7))
|
|
||||||
onClicked: calendarBackend.displayedDate = new Date(today.getFullYear(), 7, 1)
|
|
||||||
}
|
|
||||||
PlasmaComponents.MenuItem {
|
|
||||||
text: capitalizeFirstLetter(Qt.locale().standaloneMonthName(8))
|
|
||||||
onClicked: calendarBackend.displayedDate = new Date(today.getFullYear(), 8, 1)
|
|
||||||
}
|
|
||||||
PlasmaComponents.MenuItem {
|
|
||||||
text: capitalizeFirstLetter(Qt.locale().standaloneMonthName(9))
|
|
||||||
onClicked: calendarBackend.displayedDate = new Date(today.getFullYear(), 9, 1)
|
|
||||||
}
|
|
||||||
PlasmaComponents.MenuItem {
|
|
||||||
text: capitalizeFirstLetter(Qt.locale().standaloneMonthName(10))
|
|
||||||
onClicked: calendarBackend.displayedDate = new Date(today.getFullYear(), 10, 1)
|
|
||||||
}
|
|
||||||
PlasmaComponents.MenuItem {
|
|
||||||
text: capitalizeFirstLetter(Qt.locale().standaloneMonthName(11))
|
|
||||||
onClicked: calendarBackend.displayedDate = new Date(today.getFullYear(), 11, 1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Because some locales don't have it in standaloneMonthNames,
|
// Because some locales don't have it in standaloneMonthNames,
|
||||||
|
@ -119,6 +119,7 @@ Item {
|
|||||||
if (menuLoader.source == "") {
|
if (menuLoader.source == "") {
|
||||||
menuLoader.source = "MonthMenu.qml"
|
menuLoader.source = "MonthMenu.qml"
|
||||||
}
|
}
|
||||||
|
menuLoader.item.year = selectedYear
|
||||||
menuLoader.item.open(0, height);
|
menuLoader.item.open(0, height);
|
||||||
}
|
}
|
||||||
onExited: previousPixelDelta = 0
|
onExited: previousPixelDelta = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user