Warning, /network/kaccounts-integration/src/kcm/ui/AccountDetails.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de> 0003 * SPDX-FileCopyrightText: 2020 Dan Leinir Turthra Jensen <admin@leinir.dk> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 import QtQuick 0009 import QtQuick.Controls as Controls 0010 import QtQuick.Layouts 0011 0012 import org.kde.kirigami as Kirigami 0013 import org.kde.kcmutils as KCM 0014 0015 import org.kde.kaccounts as KAccounts 0016 0017 KCM.ScrollViewKCM { 0018 id: component; 0019 0020 title: i18nd("kaccounts-integration", "Account Details") 0021 0022 property alias model: servicesList.model 0023 0024 RemoveAccountDialog { 0025 id: accountRemover 0026 parent: component 0027 accountId: servicesList.model.accountId 0028 displayName: servicesList.model.accountDisplayName 0029 providerName: servicesList.model.accountProviderName 0030 onAccountRemoved: kcm.pop() 0031 } 0032 0033 RenameAccountDialog { 0034 id: accountRenamer 0035 parent: component 0036 accountId: servicesList.model.accountId 0037 currentDisplayName: servicesList.model.accountDisplayName 0038 } 0039 0040 Component { 0041 id: serviceToggleJob 0042 KAccounts.AccountServiceToggleJob { } 0043 } 0044 0045 header: ColumnLayout { 0046 RowLayout { 0047 Layout.fillWidth: true 0048 Layout.margins: Kirigami.Units.smallSpacing 0049 spacing: Kirigami.Units.smallSpacing 0050 Kirigami.Icon { 0051 source: model.accountIconName 0052 Layout.preferredWidth: Kirigami.Units.iconSizes.large 0053 Layout.preferredHeight: Kirigami.Units.iconSizes.large 0054 } 0055 Controls.Label { 0056 Layout.fillWidth: true 0057 text: { 0058 if (model.accountDisplayName.length > 0 && model.accountProviderName.length > 0) { 0059 return i18nd("kaccounts-integration", "%1 (%2)", model.accountDisplayName, model.accountProviderName) 0060 } else if (model.accountDisplayName.length > 0) { 0061 return model.accountDisplayName 0062 } else { 0063 return i18nd("kaccounts-integration", "%1 account", model.accountProviderName) 0064 } 0065 } 0066 } 0067 Controls.ToolButton { 0068 icon.name: "edit-entry" 0069 Layout.preferredHeight: Kirigami.Units.iconSizes.large 0070 Layout.preferredWidth: Kirigami.Units.iconSizes.large 0071 onClicked: accountRenamer.open(); 0072 Controls.ToolTip { 0073 text: i18ndc("kaccounts-integration", "Button which spawns a dialog allowing the user to change the displayed account's human-readable name", "Change Account Display Name") 0074 } 0075 } 0076 } 0077 Kirigami.Heading { 0078 leftPadding: Kirigami.Units.smallSpacing 0079 visible: servicesList.count > 0 0080 level: 3 0081 text: i18ndc("kaccounts-integration", "Heading for a list of services available with this account", "Use This Account For") 0082 } 0083 } 0084 0085 footer: RowLayout { 0086 Controls.Button { 0087 Layout.alignment: Qt.AlignRight 0088 text: i18nd("kaccounts-integration", "Remove This Account") 0089 icon.name: "edit-delete-remove" 0090 onClicked: accountRemover.open(); 0091 } 0092 } 0093 0094 view: ListView { 0095 id: servicesList 0096 0097 clip: true 0098 0099 ColumnLayout { 0100 anchors.fill: parent 0101 spacing: Kirigami.Units.smallSpacing 0102 Controls.Label { 0103 visible: servicesList.count === 0 0104 Layout.fillWidth: true 0105 Layout.minimumHeight: component.height / 3 0106 enabled: false 0107 verticalAlignment: Text.AlignVCenter 0108 horizontalAlignment: Text.AlignHCenter 0109 wrapMode: Text.Wrap 0110 text: i18ndc("kaccounts-integration", "A text shown when an account has no configurable services", "There are no configurable services available for this account. You can still change its display name by clicking the edit icon above.") 0111 } 0112 } 0113 0114 delegate: Kirigami.CheckSubtitleDelegate { 0115 width: ListView.view.width 0116 text: model.displayName 0117 checked: model.enabled 0118 subtitle: model.description 0119 icon.width: 0 0120 0121 action: Controls.Action { 0122 onTriggered: { 0123 checked = !checked; 0124 const job = serviceToggleJob.createObject(component, { "accountId": servicesList.model.accountId, "serviceId": model.name, "serviceEnabled": !model.enabled }); 0125 job.start(); 0126 } 0127 } 0128 } 0129 } 0130 }