Warning, /plasma/kdeplasma-addons/plasmacalendarplugins/alternatecalendar/config/qml/AlternateCalendarConfig.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2018 Friedrich W. H. Kossebau <kossebau@kde.org>
0003 SPDX-FileCopyrightText: 2022 Fushan Wen <qydwhotmail@gmail.com>
0004
0005 SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007
0008 import QtQuick 2.15
0009 import QtQuick.Controls 2.15 as QQC2
0010
0011 import org.kde.kcmutils as KCM
0012 import org.kde.kirigami 2.20 as Kirigami
0013
0014 import org.kde.plasmacalendar.alternatecalendarconfig 1.0
0015
0016 KCM.SimpleKCM {
0017 id: configPage
0018
0019 // expected API
0020 signal configurationChanged
0021
0022 // expected API
0023 function saveConfig() {
0024 configStorage.calendarSystem = calendarSystemComboBox.currentValue;
0025 configStorage.dateOffset = dateOffsetSpinBoxLoader.active && dateOffsetSpinBoxLoader.item.value || 0;
0026
0027 configStorage.save();
0028 }
0029
0030 Kirigami.FormLayout {
0031
0032 ConfigStorage {
0033 id: configStorage
0034 }
0035
0036 Row {
0037 Kirigami.FormData.label: i18ndc("plasma_calendar_alternatecalendar", "@label:listbox", "Calendar system:")
0038
0039 QQC2.ComboBox {
0040 id: calendarSystemComboBox
0041 model: configStorage.calendarSystemModel
0042 textRole: "display"
0043 valueRole: "id"
0044 currentIndex: configStorage.currentIndex
0045 onActivated: configPage.configurationChanged();
0046 }
0047
0048 KCM.ContextualHelpButton {
0049 anchors.verticalCenter: calendarSystemComboBox.verticalCenter
0050 visible: calendarSystemComboBox.currentValue === "Islamic"
0051 toolTipText: i18ndc("plasma_calendar_alternatecalendar", "@info:tooltip", "This calendar is based on pure astronomical calculation. It doesn't consider any crescent visibility criteria.")
0052 }
0053 }
0054
0055 Loader {
0056 id: dateOffsetSpinBoxLoader
0057 active: calendarSystemComboBox.currentValue.startsWith("Islamic")
0058 visible: active
0059 Kirigami.FormData.label: i18ndc("plasma_calendar_alternatecalendar", "@label:spinbox", "Date offset:")
0060
0061 sourceComponent: QQC2.SpinBox {
0062 hoverEnabled: true
0063
0064 stepSize: 1
0065 from: -10
0066 to: 10
0067 value: configStorage.dateOffset
0068 onValueChanged: configPage.configurationChanged()
0069
0070 textFromValue: (value, locale) => i18ndp("plasma_calendar_alternatecalendar","%1 day", "%1 days", value)
0071 valueFromText: (text, locale) => parseInt(text)
0072
0073 QQC2.ToolTip.text: i18ndc("plasma_calendar_alternatecalendar", "@info:tooltip", "A positive offset signifies a later date, while a negative offset signifies an earlier date.")
0074 QQC2.ToolTip.visible: hovered
0075 QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0076 }
0077 }
0078 }
0079 }