Warning, /plasma/kscreenlocker/greeter/fallbacktheme/AccelButton.qml is written in an unsupported language. File is not indexed.

0001 /*
0002 SPDX-FileCopyrightText: 2011 Aaron Seigo <aseigo@kde.org>
0003 
0004 SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 import QtQuick 2.15
0008 
0009 import org.kde.plasma.core 2.0 as PlasmaCore
0010 import org.kde.plasma.components 2.0 as PlasmaComponents
0011 
0012 PlasmaComponents.Button {
0013     property string label
0014     property string normalLabel
0015     property string accelLabel
0016     property int accelKey: -1
0017 
0018     text: parent.showAccel ? accelLabel : normalLabel
0019 
0020     onLabelChanged: {
0021         const i = label.indexOf('&');
0022         if (i < 0) {
0023             accelLabel = '<u>' + label[0] + '</u>' + label.substring(1, label.length);
0024             accelKey = label[0].toUpperCase().charCodeAt(0);
0025             normalLabel = label
0026         } else {
0027             const stringToReplace = label.substr(i, 2);
0028             accelKey = stringToReplace.toUpperCase().charCodeAt(1);
0029             accelLabel = label.replace(stringToReplace, '<u>' + stringToReplace[1] + '</u>');
0030             normalLabel = label.replace(stringToReplace, stringToReplace[1]);
0031         }
0032     }
0033 }
0034