Warning, /network/kaccounts-integration/src/kcm/ui/RenameAccountDialog.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   SPDX-FileCopyrightText: 2020 Dan Leinir Turthra Jensen <admin@leinir.dk>
0003  *
0004  *   SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 import QtQuick
0008 import QtQuick.Controls as Controls
0009 import QtQuick.Layouts
0010 
0011 import org.kde.kirigami as Kirigami
0012 
0013 import org.kde.kaccounts as KAccounts
0014 
0015 MessageBoxSheet {
0016     id: component
0017     title: i18ndc("kaccounts-integration", "The title for a dialog which lets you set the human-readable name of an account", "Rename Account")
0018     property int accountId
0019     property string currentDisplayName
0020     signal accountRenamed()
0021     onVisibleChanged: {
0022         if (sheetOpen === true) {
0023             newAccountDisplayName.text = currentDisplayName;
0024         }
0025     }
0026     contentItem: Kirigami.FormLayout {
0027         Layout.preferredWidth: Kirigami.Units.gridUnit * 10
0028         Layout.margins: Kirigami.Units.largeSpacing
0029         Controls.TextField {
0030             id: newAccountDisplayName
0031             Kirigami.FormData.label: i18ndc("kaccounts-integration", "Label for the text field used to enter a new human-readable name for an account", "Enter new name:")
0032         }
0033     }
0034     Component {
0035         id: accountDisplayNameJob
0036         KAccounts.ChangeAccountDisplayNameJob {
0037             onFinished: component.accountRenamed()
0038         }
0039     }
0040     actions: [
0041         Kirigami.Action {
0042             enabled: newAccountDisplayName.text.length > 0 && newAccountDisplayName.text !== component.currentDisplayName
0043             text: i18ndc("kaccounts-integration", "Text of a button which will cause the human-readable name of an account to be set to a text specified by the user", "Set Account Name")
0044             onTriggered: {
0045                 var job = accountDisplayNameJob.createObject(component, { "accountId": component.accountId, "displayName": newAccountDisplayName.text })
0046                 job.start();
0047             }
0048         }
0049     ]
0050 }