From 51574f5125bb7501c3a53dad4881e3fb624ce9d3 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Thu, 23 Jun 2022 20:04:28 +0200 Subject: [PATCH] Fix actions in ListItems Apparently the combination of SwipeListItem and BasicListItem is evil, so port away from it to ensure that actions show up again. --- imports/NeoChat/Settings/AccountsPage.qml | 64 +++++++++++------------ imports/NeoChat/Settings/DevicesPage.qml | 55 ++++++++++--------- 2 files changed, 59 insertions(+), 60 deletions(-) diff --git a/imports/NeoChat/Settings/AccountsPage.qml b/imports/NeoChat/Settings/AccountsPage.qml index 4d26a7d1f..918a8f8d6 100644 --- a/imports/NeoChat/Settings/AccountsPage.qml +++ b/imports/NeoChat/Settings/AccountsPage.qml @@ -23,42 +23,42 @@ Kirigami.ScrollablePage { ListView { model: AccountRegistry - delegate: Kirigami.SwipeListItem { - leftPadding: 0 - rightPadding: 0 - Kirigami.BasicListItem { - anchors.top: parent.top - anchors.bottom: parent.bottom + delegate: Kirigami.BasicListItem { + text: model.connection.localUser.displayName + labelItem.textFormat: Text.PlainText + subtitle: model.connection.localUserId + icon: model.connection.localUser.avatarMediaId ? ("image://mxc/" + model.connection.localUser.avatarMediaId) : "im-user" - text: model.connection.localUser.displayName - labelItem.textFormat: Text.PlainText - subtitle: model.connection.localUserId - icon: model.connection.localUser.avatarMediaId ? ("image://mxc/" + model.connection.localUser.avatarMediaId) : "im-user" + onClicked: { + Controller.activeConnection = model.connection + pageStack.layers.pop() + } - onClicked: { - Controller.activeConnection = model.connection - pageStack.layers.pop() + trailing: RowLayout { + Controls.ToolButton { + display: Controls.AbstractButton.IconOnly + action: Kirigami.Action { + text: i18n("Edit this account") + iconName: "document-edit" + onTriggered: { + userEditSheet.connection = model.connection + userEditSheet.open() + } + } + } + Controls.ToolButton { + display: Controls.AbstractButton.IconOnly + action: Kirigami.Action { + text: i18n("Logout") + iconName: "im-kick-user" + onTriggered: { + Controller.logout(model.connection, true) + if(Controller.accountCount === 1) + pageStack.layers.pop() + } + } } } - actions: [ - Kirigami.Action { - text: i18n("Edit this account") - iconName: "document-edit" - onTriggered: { - userEditSheet.connection = model.connection - userEditSheet.open() - } - }, - Kirigami.Action { - text: i18n("Logout") - iconName: "im-kick-user" - onTriggered: { - Controller.logout(model.connection, true) - if(Controller.accountCount === 1) - pageStack.layers.pop() - } - } - ] } } diff --git a/imports/NeoChat/Settings/DevicesPage.qml b/imports/NeoChat/Settings/DevicesPage.qml index b6b1eb580..1999dba7b 100644 --- a/imports/NeoChat/Settings/DevicesPage.qml +++ b/imports/NeoChat/Settings/DevicesPage.qml @@ -26,36 +26,35 @@ Kirigami.ScrollablePage { } } - delegate: Kirigami.SwipeListItem { - leftPadding: 0 - rightPadding: 0 - Kirigami.BasicListItem { - anchors.top: parent.top - anchors.bottom: parent.bottom - - text: model.displayName - subtitle: model.id - icon: "network-connect" - } - actions: [ - Kirigami.Action { - text: i18n("Edit device name") - iconName: "document-edit" - onTriggered: { - renameSheet.index = model.index - renameSheet.name = model.displayName - renameSheet.open() - } - }, - Kirigami.Action { - text: i18n("Logout device") - iconName: "edit-delete-remove" - onTriggered: { - passwordSheet.index = index - passwordSheet.open() + delegate: Kirigami.BasicListItem { + text: model.displayName + subtitle: model.id + icon: "network-connect" + trailing: RowLayout { + Controls.ToolButton { + display: Controls.AbstractButton.IconOnly + action: Kirigami.Action { + text: i18n("Edit device name") + iconName: "document-edit" + onTriggered: { + renameSheet.index = model.index + renameSheet.name = model.displayName + renameSheet.open() + } } } - ] + Controls.ToolButton { + display: Controls.AbstractButton.IconOnly + action: Kirigami.Action { + text: i18n("Logout device") + iconName: "edit-delete-remove" + onTriggered: { + passwordSheet.index = index + passwordSheet.open() + } + } + } + } } }