Warning, /plasma-mobile/raven/src/contents/ui/accounts/FormTextInputDelegate.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick 2.15
0005 import QtQuick.Layouts 1.15
0006 import QtQuick.Controls 2.15 as Controls
0007 
0008 import org.kde.kirigami 2.19 as Kirigami
0009 import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
0010 
0011 MobileForm.FormButtonDelegate {
0012     id: root
0013     
0014     property string textValue
0015     
0016     signal textSaved(string savedText)
0017     
0018     description: textValue === "" ? i18n("Enter a value…") : textValue
0019     
0020     onClicked: {
0021         textField.text = root.textValue;
0022         dialog.open();
0023         textField.forceActiveFocus();
0024     }
0025     
0026     Kirigami.Dialog {
0027         id: dialog
0028         standardButtons: Kirigami.Dialog.Cancel | Kirigami.Dialog.Apply
0029         title: root.text
0030         
0031         padding: Kirigami.Units.largeSpacing
0032         bottomPadding: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
0033         preferredWidth: Kirigami.Units.gridUnit * 20
0034         
0035         onApplied: {
0036             root.textSaved(textField.text);
0037             dialog.close();
0038         }
0039         
0040         Controls.TextField {
0041             id: textField
0042             text: root.textValue
0043             onAccepted: dialog.applied()
0044         }
0045     }
0046 }