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.
This commit is contained in:
@@ -23,42 +23,42 @@ Kirigami.ScrollablePage {
|
|||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
model: AccountRegistry
|
model: AccountRegistry
|
||||||
delegate: Kirigami.SwipeListItem {
|
delegate: Kirigami.BasicListItem {
|
||||||
leftPadding: 0
|
text: model.connection.localUser.displayName
|
||||||
rightPadding: 0
|
labelItem.textFormat: Text.PlainText
|
||||||
Kirigami.BasicListItem {
|
subtitle: model.connection.localUserId
|
||||||
anchors.top: parent.top
|
icon: model.connection.localUser.avatarMediaId ? ("image://mxc/" + model.connection.localUser.avatarMediaId) : "im-user"
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
|
|
||||||
text: model.connection.localUser.displayName
|
onClicked: {
|
||||||
labelItem.textFormat: Text.PlainText
|
Controller.activeConnection = model.connection
|
||||||
subtitle: model.connection.localUserId
|
pageStack.layers.pop()
|
||||||
icon: model.connection.localUser.avatarMediaId ? ("image://mxc/" + model.connection.localUser.avatarMediaId) : "im-user"
|
}
|
||||||
|
|
||||||
onClicked: {
|
trailing: RowLayout {
|
||||||
Controller.activeConnection = model.connection
|
Controls.ToolButton {
|
||||||
pageStack.layers.pop()
|
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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,36 +26,35 @@ Kirigami.ScrollablePage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: Kirigami.SwipeListItem {
|
delegate: Kirigami.BasicListItem {
|
||||||
leftPadding: 0
|
text: model.displayName
|
||||||
rightPadding: 0
|
subtitle: model.id
|
||||||
Kirigami.BasicListItem {
|
icon: "network-connect"
|
||||||
anchors.top: parent.top
|
trailing: RowLayout {
|
||||||
anchors.bottom: parent.bottom
|
Controls.ToolButton {
|
||||||
|
display: Controls.AbstractButton.IconOnly
|
||||||
text: model.displayName
|
action: Kirigami.Action {
|
||||||
subtitle: model.id
|
text: i18n("Edit device name")
|
||||||
icon: "network-connect"
|
iconName: "document-edit"
|
||||||
}
|
onTriggered: {
|
||||||
actions: [
|
renameSheet.index = model.index
|
||||||
Kirigami.Action {
|
renameSheet.name = model.displayName
|
||||||
text: i18n("Edit device name")
|
renameSheet.open()
|
||||||
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()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
Controls.ToolButton {
|
||||||
|
display: Controls.AbstractButton.IconOnly
|
||||||
|
action: Kirigami.Action {
|
||||||
|
text: i18n("Logout device")
|
||||||
|
iconName: "edit-delete-remove"
|
||||||
|
onTriggered: {
|
||||||
|
passwordSheet.index = index
|
||||||
|
passwordSheet.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user