Cleanup buttons

Mostly removing the usage of the action property, since there's no point in using it. Also add some translation contexts and some other minor cleanup
This commit is contained in:
Tobias Fella
2025-08-13 17:34:08 +02:00
committed by Tobias Fella
parent 9b763daf52
commit 45b02ae34e
12 changed files with 235 additions and 271 deletions

View File

@@ -86,32 +86,23 @@ FormCard.AbstractFormDelegate {
}
QQC2.ToolButton {
display: QQC2.AbstractButton.IconOnly
action: Kirigami.Action {
id: editDeviceAction
text: i18n("Edit device name")
icon.name: "document-edit"
onTriggered: root.editDeviceName = true
}
QQC2.ToolTip {
text: editDeviceAction.text
delay: Kirigami.Units.toolTipDelay
}
text: i18nc("@action:button", "Edit device name")
icon.name: "document-edit"
onClicked: root.editDeviceName = true
QQC2.ToolTip.text: text
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
QQC2.ToolTip.visible: hovered
}
QQC2.ToolButton {
display: QQC2.AbstractButton.IconOnly
visible: root.showVerifyButton && (root.type !== DevicesModel.Verified || NeoChatConfig.alwaysVerifyDevice)
action: Kirigami.Action {
id: verifyDeviceAction
text: i18n("Verify device")
icon.name: "security-low-symbolic"
onTriggered: {
devicesModel.connection.startKeyVerificationSession(devicesModel.connection.localUserId, root.id);
}
}
QQC2.ToolTip {
text: verifyDeviceAction.text
delay: Kirigami.Units.toolTipDelay
}
text: i18nc("@action:button", "Verify device")
icon.name: "security-low-symbolic"
onClicked: devicesModel.connection.startKeyVerificationSession(devicesModel.connection.localUserId, root.id)
QQC2.ToolTip.text: text
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
QQC2.ToolTip.visible: hovered
}
Kirigami.Icon {
visible: root.showVerifyButton && root.type === DevicesModel.Verified
@@ -130,19 +121,16 @@ FormCard.AbstractFormDelegate {
}
QQC2.ToolButton {
display: QQC2.AbstractButton.IconOnly
action: Kirigami.Action {
id: logoutDeviceAction
text: i18n("Logout device")
icon.name: "edit-delete-remove"
onTriggered: {
passwordSheet.deviceId = root.id;
passwordSheet.open();
}
}
QQC2.ToolTip {
text: logoutDeviceAction.text
delay: Kirigami.Units.toolTipDelay
text: i18nc("@action:button", "Logout device")
icon.name: "edit-delete-remove"
onClicked: {
passwordSheet.deviceId = root.id;
passwordSheet.open();
}
QQC2.ToolTip.text: text
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
QQC2.ToolTip.visible: hovered
}
}
}

View File

@@ -205,17 +205,14 @@ FormCard.FormCardPage {
}
}
action: Kirigami.Action {
id: editPowerLevelAction
onTriggered: {
userListSearchPopup.close();
let dialog = powerLevelDialog.createObject(root.QQC2.Overlay.overlay, {
room: root.room,
userId: userListItem.userId,
powerLevel: userListItem.powerLevel
});
dialog.open();
}
onClicked: {
userListSearchPopup.close();
let dialog = powerLevelDialog.createObject(root.QQC2.Overlay.overlay, {
room: root.room,
userId: userListItem.userId,
powerLevel: userListItem.powerLevel
});
dialog.open();
}
Component {

View File

@@ -271,16 +271,13 @@ FormCard.FormCardPage {
QQC2.ToolButton {
visible: root.room.canSendState("m.space.parent") && root.room.canonicalParent !== officalParentDelegate.modelData
display: QQC2.AbstractButton.IconOnly
action: Kirigami.Action {
id: canonicalParentAction
text: i18n("Make canonical parent")
icon.name: "checkmark"
onTriggered: root.room.canonicalParent = officalParentDelegate.modelData
}
QQC2.ToolTip {
text: canonicalParentAction.text
delay: Kirigami.Units.toolTipDelay
}
text: i18nc("@action:button", "Make canonical parent")
icon.name: "checkmark"
onClicked: root.room.canonicalParent = officalParentDelegate.modelData
QQC2.ToolTip.text: text
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
QQC2.ToolTip.visible: hovered
}
QQC2.ToolButton {
visible: officalParentDelegate?.space.canSendState("m.space.child") && root.room.canSendState("m.space.parent")