Warning, /utilities/kclock/src/plasmoid/KClock_1x2/package/contents/ui/configGeneral.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2021 Devin Lin <espidev@gmail.com>
0003     SPDX-License-Identifier: GPL-3.0-or-later
0004 */
0005 
0006 import QtQuick
0007 import QtQuick.Controls
0008 import QtQuick.Layouts
0009 import org.kde.kirigami as Kirigami
0010 import org.kde.kcmutils as KCM
0011 
0012 KCM.SimpleKCM {
0013     property alias cfg_twelveHourTime: twelveHourTime.checked
0014     property alias cfg_showDate: showDate.checked
0015     property alias cfg_showAlarms: showAlarms.checked
0016     property string cfg_textAlignment
0017 
0018     Kirigami.FormLayout {
0019         CheckBox {
0020             id: twelveHourTime
0021             text: i18n("Use 12 hour time")
0022         }
0023         CheckBox {
0024             id: showDate
0025             text: i18n("Show date")
0026         }
0027         CheckBox {
0028             id: showAlarms
0029             text: i18n("Show alarms")
0030         }
0031         ComboBox {
0032             id: textAlignment
0033             Kirigami.FormData.label: i18n("Text alignment:")
0034             textRole: 'label'
0035             model: [
0036                 {
0037                     'label': i18n("Left"),
0038                     'name': "Left",
0039                 },
0040                 {
0041                     'label': i18n("Center"),
0042                     'name': "Center",
0043                 },
0044                 {
0045                     'label': i18n("Right"),
0046                     'name': "Right",
0047                 }
0048             ]
0049             onCurrentIndexChanged: cfg_textAlignment = model[currentIndex]["name"]
0050             Component.onCompleted: {
0051                 if (plasmoid.configuration.textAlignment == "") {
0052                     plasmoid.configuration.textAlignment = "Center";
0053                 }
0054                 for (var i = 0; i < model.length; i++) {
0055                     if (model[i]["name"] === plasmoid.configuration.textAlignment) {
0056                         textAlignment.currentIndex = i;
0057                     }
0058                 }
0059             }
0060         }
0061     }
0062 }