Warning, /plasma/plasma-workspace/applets/digital-clock/package/contents/ui/configCalendar.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2015 Martin Klapetek <mklapetek@kde.org>
0003     SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk>
0004 
0005     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 import QtQuick
0009 import QtQuick.Controls as QQC2
0010 import QtQuick.Layouts
0011 import org.kde.plasma.plasmoid 2.0
0012 import org.kde.plasma.workspace.calendar 2.0 as PlasmaCalendar
0013 import org.kde.kirigami 2.20 as Kirigami
0014 import org.kde.kcmutils as KCM
0015 
0016 KCM.SimpleKCM {
0017     id: calendarPage
0018 
0019     signal configurationChanged()
0020 
0021     property alias cfg_showWeekNumbers: showWeekNumbers.checked
0022     property int cfg_firstDayOfWeek
0023 
0024     function saveConfig() {
0025         Plasmoid.configuration.enabledCalendarPlugins = eventPluginsManager.enabledPlugins;
0026     }
0027 
0028     Kirigami.FormLayout {
0029         PlasmaCalendar.EventPluginsManager {
0030             id: eventPluginsManager
0031             Component.onCompleted: {
0032                 populateEnabledPluginsList(Plasmoid.configuration.enabledCalendarPlugins);
0033             }
0034         }
0035 
0036         QQC2.CheckBox {
0037             id: showWeekNumbers
0038             Kirigami.FormData.label: i18n("General:")
0039             text: i18n("Show week numbers")
0040         }
0041 
0042         RowLayout {
0043             Layout.fillWidth: true
0044             Kirigami.FormData.label: i18n("First day of week:")
0045 
0046             QQC2.ComboBox {
0047                 id: firstDayOfWeekCombo
0048                 textRole: "text"
0049                 model: [-1, 0, 1, 5, 6].map(day => ({
0050                     day,
0051                     text: day === -1 ? i18n("Use Region Defaults") : Qt.locale().dayName(day),
0052                 }))
0053                 onActivated: cfg_firstDayOfWeek = model[index].day
0054                 currentIndex: model.findIndex(item => item.day === cfg_firstDayOfWeek)
0055             }
0056         }
0057 
0058         Item {
0059             Kirigami.FormData.isSection: true
0060         }
0061 
0062         ColumnLayout {
0063             id: calendarPluginsLayout
0064 
0065             Kirigami.FormData.label: i18n("Available Plugins:")
0066 
0067             Repeater {
0068                 id: calendarPluginsRepeater
0069 
0070                 model: eventPluginsManager.model
0071 
0072                 delegate: QQC2.CheckBox {
0073                     text: model.display
0074                     checked: model.checked
0075 
0076                     Accessible.onPressAction: {
0077                         toggle();
0078                         clicked();
0079                     }
0080 
0081                     onClicked: {
0082                         //needed for model's setData to be called
0083                         model.checked = checked;
0084                         calendarPage.configurationChanged();
0085                     }
0086                 }
0087 
0088                 onItemAdded: (index, item) => {
0089                     if (index === 0) {
0090                         // Set buddy once, for an item in the first row.
0091                         // No, it doesn't work as a binding on children list.
0092                         calendarPluginsLayout.Kirigami.FormData.buddyFor = item;
0093                     }
0094                 }
0095             }
0096         }
0097     }
0098 }