Warning, /network/neochat/src/qml/AccountsPage.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2020 Tobias Fella <tobias.fella@kde.org> 0002 // SPDX-License-Identifier: GPL-2.0-or-later 0003 0004 import QtQuick 0005 import QtQuick.Controls as QQC2 0006 import QtQuick.Layouts 0007 import QtQuick.Window 0008 import Qt.labs.platform 0009 0010 import org.kde.kirigami as Kirigami 0011 import org.kde.kirigamiaddons.formcard as FormCard 0012 import org.kde.kirigamiaddons.labs.components as KirigamiComponents 0013 0014 import org.kde.neochat 0015 import org.kde.neochat.accounts 0016 0017 FormCard.FormCardPage { 0018 id: root 0019 0020 title: i18n("Accounts") 0021 0022 FormCard.FormHeader { 0023 title: i18n("Accounts") 0024 } 0025 FormCard.FormCard { 0026 Repeater { 0027 model: AccountRegistry 0028 delegate: FormCard.AbstractFormDelegate { 0029 id: accountDelegate 0030 required property NeoChatConnection connection 0031 Layout.fillWidth: true 0032 onClicked: pageStack.layers.push("qrc:/org/kde/neochat/qml/AccountEditorPage.qml", { 0033 connection: accountDelegate.connection 0034 }, { 0035 title: i18n("Account editor") 0036 }) 0037 0038 contentItem: RowLayout { 0039 KirigamiComponents.Avatar { 0040 name: accountDelegate.connection.localUser.displayName 0041 source: accountDelegate.connection.localUser.avatarMediaId ? ("image://mxc/" + accountDelegate.connection.localUser.avatarMediaId) : "" 0042 0043 Layout.rightMargin: Kirigami.Units.largeSpacing 0044 implicitWidth: Kirigami.Units.iconSizes.medium 0045 implicitHeight: Kirigami.Units.iconSizes.medium 0046 } 0047 0048 ColumnLayout { 0049 Layout.fillWidth: true 0050 spacing: Kirigami.Units.smallSpacing 0051 0052 QQC2.Label { 0053 Layout.fillWidth: true 0054 text: accountDelegate.connection.localUser.displayName 0055 textFormat: Text.PlainText 0056 elide: Text.ElideRight 0057 wrapMode: Text.Wrap 0058 maximumLineCount: 2 0059 color: Kirigami.Theme.textColor 0060 } 0061 0062 QQC2.Label { 0063 Layout.fillWidth: true 0064 text: accountDelegate.connection.localUserId 0065 color: Kirigami.Theme.disabledTextColor 0066 font: Kirigami.Theme.smallFont 0067 elide: Text.ElideRight 0068 } 0069 } 0070 0071 QQC2.ToolButton { 0072 text: i18n("Logout") 0073 icon.name: "im-kick-user" 0074 onClicked: confirmLogoutDialogComponent.createObject(applicationWindow().overlay).open() 0075 } 0076 0077 Component { 0078 id: confirmLogoutDialogComponent 0079 ConfirmLogoutDialog { 0080 connection: accountDelegate.connection 0081 onAccepted: { 0082 if (AccountRegistry.accountCount === 1) { 0083 root.Window.window.close(); 0084 } 0085 } 0086 } 0087 } 0088 0089 FormCard.FormArrow { 0090 Layout.alignment: Qt.AlignRight | Qt.AlignVCenter 0091 direction: Qt.RightArrow 0092 } 0093 } 0094 } 0095 } 0096 FormCard.FormDelegateSeparator { 0097 below: addAccountDelegate 0098 } 0099 0100 FormCard.FormButtonDelegate { 0101 id: addAccountDelegate 0102 text: i18n("Add Account") 0103 icon.name: "list-add" 0104 onClicked: pageStack.layers.push("qrc:/org/kde/neochat/qml/WelcomePage.qml") 0105 } 0106 } 0107 0108 property Connections connections: Connections { 0109 target: Controller 0110 function onConnectionAdded() { 0111 if (pageStack.layers.depth > 2) { 0112 pageStack.layers.pop(); 0113 } 0114 } 0115 } 0116 }