Warning, /plasma/plasma-workspace/components/calendar/qml/MonthMenu.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2013 Heena Mahour <heena393@gmail.com>
0003     SPDX-FileCopyrightText: 2013 Martin Klapetek <mklapetek@kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 import QtQuick 2.2
0009 import org.kde.plasma.extras 2.0 as PlasmaExtras
0010 
0011 PlasmaExtras.Menu {
0012     id: testMenu
0013     property int year
0014 
0015     // Needs to be a property since Menu doesn't accept other items than MenuItem
0016     property Instantiator items: Instantiator {
0017         model: 12
0018         PlasmaExtras.MenuItem {
0019             text: capitalizeFirstLetter(Qt.locale(Qt.locale().uiLanguages[0]).standaloneMonthName(index))
0020             onClicked: calendarBackend.displayedDate = new Date(year, index, 1)
0021         }
0022         onObjectAdded: (index, object) => testMenu.addMenuItem(object)
0023     }
0024 
0025     // Because some locales don't have it in standaloneMonthNames,
0026     // but we want our GUI to be pretty and want capitalization always
0027     function capitalizeFirstLetter(monthName) {
0028         return monthName.charAt(0).toUpperCase() + monthName.slice(1);
0029     }
0030 }