Warning, /plasma/kdeplasma-addons/applets/keyboardindicator/contents/ui/configAppearance.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  SPDX-FileCopyrightText: 2018 Aleix Pol Gonzalez <aleixpol@kde.org>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 import QtQuick 2.15
0008 import QtQuick.Controls 2.15 as Controls
0009 
0010 import org.kde.kirigami 2.20 as Kirigami
0011 import org.kde.kcmutils as KCM
0012 
0013 KCM.SimpleKCM {
0014     id: root
0015 
0016     signal configurationChanged()
0017 
0018     property var cfg_key: []
0019 
0020     function toggle(name, checked) {
0021         const index = cfg_key.indexOf(name);
0022 
0023         if (checked) {
0024             if (index < 0) {
0025                 cfg_key.push(name);
0026             }
0027         } else if (index >= 0) {
0028             cfg_key.splice(index, 1);
0029         }
0030 
0031         configurationChanged();
0032     }
0033 
0034     Kirigami.FormLayout {
0035 
0036         Controls.CheckBox {
0037             Kirigami.FormData.label: i18nc("@label show keyboard indicator when Caps Lock or Num Lock is activated", "Show when activated:")
0038             readonly property string name: "Caps Lock"
0039             checked: cfg_key.indexOf(name) >= 0
0040             text: i18nc("@option:check", "Caps Lock")
0041             onToggled: root.toggle(name, checked)
0042         }
0043 
0044         Controls.CheckBox {
0045             readonly property string name: "Num Lock"
0046             checked: cfg_key.indexOf(name) >= 0
0047             text: i18nc("@option:check", "Num Lock")
0048             onToggled: root.toggle(name, checked)
0049         }
0050     }
0051 }