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

@@ -58,14 +58,18 @@ ColumnLayout {
QQC2.ToolButton { QQC2.ToolButton {
id: cancelAttachmentButton id: cancelAttachmentButton
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
action: Kirigami.Action { text: i18nc("@action:button", "Cancel sending attachment")
text: i18n("Cancel sending attachment") icon.name: "dialog-close"
icon.name: "dialog-close" onClicked: root.attachmentCancelled()
onTriggered: root.attachmentCancelled()
shortcut: "Escape"
}
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
QQC2.ToolTip.visible: hovered QQC2.ToolTip.visible: hovered
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
Kirigami.Action {
shortcut: "Escape"
onTriggered: cancelAttachmentButton.clicked()
}
} }
} }

View File

@@ -120,16 +120,12 @@ Kirigami.Dialog {
} }
QQC2.ToolButton { QQC2.ToolButton {
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
action: Kirigami.Action { text: i18nc("@action:button", "Remove option")
id: removeOptionAction icon.name: "edit-delete-remove"
text: i18nc("@action:button", "Remove option") onClicked: optionModel.remove(optionDelegate.index)
icon.name: "edit-delete-remove" QQC2.ToolTip.text: text
onTriggered: optionModel.remove(optionDelegate.index) QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
} QQC2.ToolTip.visible: hovered
QQC2.ToolTip {
text: removeOptionAction.text
delay: Kirigami.Units.toolTipDelay
}
} }
} }
} }

View File

@@ -142,107 +142,95 @@ Kirigami.Dialog {
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
visible: root.user.id !== root.connection.localUserId && !!root.user visible: root.user.id !== root.connection.localUserId && !!root.user
action: Kirigami.Action { text: !!root.user && root.connection.isIgnored(root.user.id) ? i18n("Unignore this user") : i18n("Ignore this user")
text: !!root.user && root.connection.isIgnored(root.user.id) ? i18n("Unignore this user") : i18n("Ignore this user") icon.name: "im-invisible-user"
icon.name: "im-invisible-user" onClicked: {
onTriggered: { root.close();
root.close(); root.connection.isIgnored(root.user.id) ? root.connection.removeFromIgnoredUsers(root.user.id) : root.connection.addToIgnoredUsers(root.user.id);
root.connection.isIgnored(root.user.id) ? root.connection.removeFromIgnoredUsers(root.user.id) : root.connection.addToIgnoredUsers(root.user.id);
}
} }
} }
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
visible: root.room && root.user.id !== root.connection.localUserId && room.canSendState("kick") && room.containsUser(root.user.id) && room.memberEffectivePowerLevel(root.user.id) < room.memberEffectivePowerLevel(root.connection.localUserId) visible: root.room && root.user.id !== root.connection.localUserId && room.canSendState("kick") && room.containsUser(root.user.id) && room.memberEffectivePowerLevel(root.user.id) < room.memberEffectivePowerLevel(root.connection.localUserId)
action: Kirigami.Action { text: i18nc("@action:button", "Kick this user")
text: i18n("Kick this user") icon.name: "im-kick-user"
icon.name: "im-kick-user" onClicked: {
onTriggered: { let dialog = (root.QQC2.ApplicationWindow.window as Kirigami.ApplicationWindow).pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ReasonDialog'), {
let dialog = (root.QQC2.ApplicationWindow.window as Kirigami.ApplicationWindow).pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ReasonDialog'), { title: i18nc("@title:dialog", "Kick User"),
title: i18nc("@title:dialog", "Kick User"), placeholder: i18nc("@info:placeholder", "Reason for kicking this user"),
placeholder: i18nc("@info:placeholder", "Reason for kicking this user"), actionText: i18nc("@action:button 'Kick' as in 'Kick this user from the room'", "Kick"),
actionText: i18nc("@action:button 'Kick' as in 'Kick this user from the room'", "Kick"), icon: "im-kick-user"
icon: "im-kick-user" }, {
}, { title: i18nc("@title:dialog", "Kick User"),
title: i18nc("@title:dialog", "Kick User"), width: Kirigami.Units.gridUnit * 25
width: Kirigami.Units.gridUnit * 25 });
}); dialog.accepted.connect(reason => {
dialog.accepted.connect(reason => { root.room.kickMember(root.user.id, reason);
root.room.kickMember(root.user.id, reason); });
}); root.close();
root.close();
}
} }
} }
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
visible: root.room && root.user.id !== root.connection.localUserId && room.canSendState("invite") && !room.containsUser(root.user.id) visible: root.room && root.user.id !== root.connection.localUserId && room.canSendState("invite") && !room.containsUser(root.user.id)
action: Kirigami.Action { enabled: root.room && !root.room.isUserBanned(root.user.id)
enabled: root.room && !root.room.isUserBanned(root.user.id) text: i18nc("@action:button", "Invite this user")
text: i18n("Invite this user") icon.name: "list-add-user"
icon.name: "list-add-user" onClicked: {
onTriggered: { root.room.inviteToRoom(root.user.id);
root.room.inviteToRoom(root.user.id); root.close();
root.close();
}
} }
} }
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
visible: root.room && root.user.id !== root.connection.localUserId && room.canSendState("ban") && !room.isUserBanned(root.user.id) && room.memberEffectivePowerLevel(root.user.id) < room.memberEffectivePowerLevel(root.connection.localUserId) visible: root.room && root.user.id !== root.connection.localUserId && room.canSendState("ban") && !room.isUserBanned(root.user.id) && room.memberEffectivePowerLevel(root.user.id) < room.memberEffectivePowerLevel(root.connection.localUserId)
action: Kirigami.Action { text: i18nc("@action:button", "Ban this user")
text: i18n("Ban this user") icon.name: "im-ban-user"
icon.name: "im-ban-user" icon.color: Kirigami.Theme.negativeTextColor
icon.color: Kirigami.Theme.negativeTextColor onClicked: {
onTriggered: { let dialog = (root.QQC2.ApplicationWindow.window as Kirigami.ApplicationWindow).pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ReasonDialog'), {
let dialog = (root.QQC2.ApplicationWindow.window as Kirigami.ApplicationWindow).pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ReasonDialog'), { title: i18nc("@title:dialog", "Ban User"),
title: i18nc("@title:dialog", "Ban User"), placeholder: i18nc("@info:placeholder", "Reason for banning this user"),
placeholder: i18nc("@info:placeholder", "Reason for banning this user"), actionText: i18nc("@action:button 'Ban' as in 'Ban this user'", "Ban"),
actionText: i18nc("@action:button 'Ban' as in 'Ban this user'", "Ban"), icon: "im-ban-user"
icon: "im-ban-user" }, {
}, { title: i18nc("@title:dialog", "Ban User"),
title: i18nc("@title:dialog", "Ban User"), width: Kirigami.Units.gridUnit * 25
width: Kirigami.Units.gridUnit * 25 });
}); dialog.accepted.connect(reason => {
dialog.accepted.connect(reason => { root.room.ban(root.user.id, reason);
root.room.ban(root.user.id, reason); });
}); root.close();
root.close();
}
} }
} }
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
visible: root.room && root.user.id !== root.connection.localUserId && room.canSendState("ban") && room.isUserBanned(root.user.id) visible: root.room && root.user.id !== root.connection.localUserId && room.canSendState("ban") && room.isUserBanned(root.user.id)
action: Kirigami.Action { text: i18nc("@action:button", "Unban this user")
text: i18n("Unban this user") icon.name: "im-irc"
icon.name: "im-irc" icon.color: Kirigami.Theme.negativeTextColor
icon.color: Kirigami.Theme.negativeTextColor onClicked: {
onTriggered: { root.room.unban(root.user.id);
root.room.unban(root.user.id); root.close();
root.close();
}
} }
} }
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
visible: root.room && root.room.canSendState("m.room.power_levels") visible: root.room && root.room.canSendState("m.room.power_levels")
action: Kirigami.Action { text: i18nc("@action:button", "Set user power level")
text: i18n("Set user power level") icon.name: "visibility"
icon.name: "visibility" onClicked: {
onTriggered: { let dialog = powerLevelDialog.createObject(this, {
let dialog = powerLevelDialog.createObject(this, { room: root.room,
room: root.room, userId: root.user.id,
userId: root.user.id, powerLevel: root.room.memberEffectivePowerLevel(root.user.id)
powerLevel: root.room.memberEffectivePowerLevel(root.user.id) });
}); dialog.open();
dialog.open(); root.close();
root.close();
}
} }
Component { Component {
@@ -256,48 +244,40 @@ Kirigami.Dialog {
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
visible: root.room && (root.user.id === root.connection.localUserId || room.canSendState("redact")) visible: root.room && (root.user.id === root.connection.localUserId || room.canSendState("redact"))
action: Kirigami.Action { text: i18nc("@action:button", "Remove recent messages by this user")
text: i18nc("@action:button", "Remove recent messages by this user") icon.name: "delete"
icon.name: "delete" icon.color: Kirigami.Theme.negativeTextColor
icon.color: Kirigami.Theme.negativeTextColor onClicked: {
onTriggered: { let dialog = pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ReasonDialog'), {
let dialog = pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ReasonDialog'), { title: i18nc("@title:dialog", "Remove Messages"),
title: i18nc("@title:dialog", "Remove Messages"), placeholder: i18nc("@info:placeholder", "Reason for removing this user's recent messages"),
placeholder: i18nc("@info:placeholder", "Reason for removing this user's recent messages"), actionText: i18nc("@action:button 'Remove' as in 'Remove these messages'", "Remove"),
actionText: i18nc("@action:button 'Remove' as in 'Remove these messages'", "Remove"), icon: "delete"
icon: "delete" }, {
}, { title: i18nc("@title", "Remove Messages"),
title: i18nc("@title", "Remove Messages"), width: Kirigami.Units.gridUnit * 25
width: Kirigami.Units.gridUnit * 25 });
}); dialog.accepted.connect(reason => {
dialog.accepted.connect(reason => { root.room.deleteMessagesByUser(root.user.id, reason);
root.room.deleteMessagesByUser(root.user.id, reason); });
}); root.close();
root.close();
}
} }
} }
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
visible: root.user.id !== root.connection.localUserId visible: root.user.id !== root.connection.localUserId
action: Kirigami.Action { text: root.connection.directChatExists(root.user) ? i18nc("%1 is the name of the user.", "Chat with %1", root.room ? root.room.member(root.user.id).htmlSafeDisplayName : QmlUtils.escapeString(root.user.displayName)) : i18n("Invite to private chat")
text: root.connection.directChatExists(root.user) ? i18nc("%1 is the name of the user.", "Chat with %1", root.room ? root.room.member(root.user.id).htmlSafeDisplayName : QmlUtils.escapeString(root.user.displayName)) : i18n("Invite to private chat") icon.name: "document-send"
icon.name: "document-send" onClicked: {
onTriggered: { root.connection.requestDirectChat(root.user.id);
root.connection.requestDirectChat(root.user.id); root.close();
root.close();
}
} }
} }
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
action: Kirigami.Action { text: i18n("Copy link")
text: i18n("Copy link") icon.name: "username-copy"
icon.name: "username-copy" onClicked: Clipboard.saveText("https://matrix.to/#/" + root.user.id)
onTriggered: {
Clipboard.saveText("https://matrix.to/#/" + root.user.id);
}
}
} }
} }
} }

View File

@@ -161,42 +161,45 @@ QQC2.Control {
QQC2.ToolButton { QQC2.ToolButton {
visible: !root.isBusy visible: !root.isBusy
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
action: Kirigami.Action { text: i18nc("@action:button", "Attach an image or file")
text: i18nc("@action:button", "Attach an image or file") icon.name: "mail-attachment"
icon.name: "mail-attachment" onClicked: {
onTriggered: { let dialog = (Clipboard.hasImage ? attachDialog : openFileDialog).createObject(QQC2.Overlay.overlay);
let dialog = (Clipboard.hasImage ? attachDialog : openFileDialog).createObject(QQC2.Overlay.overlay); dialog.chosen.connect(path => root.chatBarCache.attachmentPath = path);
dialog.chosen.connect(path => root.chatBarCache.attachmentPath = path); dialog.open();
dialog.open();
}
} }
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
QQC2.ToolTip.visible: hovered QQC2.ToolTip.visible: hovered
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
} }
QQC2.ToolButton { QQC2.ToolButton {
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
action: Kirigami.Action { text: root.chatBarCache.isEditing ? i18nc("@action:button", "Confirm edit") : i18nc("@action:button", "Post message in thread")
text: root.chatBarCache.isEditing ? i18nc("@action:button", "Confirm edit") : i18nc("@action:button", "Post message in thread") icon.name: "document-send"
icon.name: "document-send" onClicked: _private.post()
onTriggered: {
_private.post();
}
}
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
QQC2.ToolTip.visible: hovered QQC2.ToolTip.visible: hovered
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
} }
QQC2.ToolButton { QQC2.ToolButton {
id: cancelButton
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
action: Kirigami.Action { text: i18nc("@action:button", "Cancel")
text: i18nc("@action:button", "Cancel") icon.name: "dialog-close"
icon.name: "dialog-close" onClicked: {
onTriggered: { root.chatBarCache.clearRelations();
root.chatBarCache.clearRelations(); }
}
Kirigami.Action {
shortcut: "Escape" shortcut: "Escape"
onTriggered: cancelButton.clicked()
} }
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
QQC2.ToolTip.visible: hovered QQC2.ToolTip.visible: hovered
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
} }
} }
} }

View File

@@ -370,15 +370,17 @@ Video {
id: maximizeButton id: maximizeButton
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
action: Kirigami.Action { text: i18nc("@action:button", "Maximize")
text: i18n("Maximize") icon.name: "view-fullscreen"
icon.name: "view-fullscreen" onClicked: {
onTriggered: { root.Message.timeline.interactive = false;
root.Message.timeline.interactive = false; root.pause();
root.pause(); RoomManager.maximizeMedia(root.eventId);
RoomManager.maximizeMedia(root.eventId);
}
} }
QQC2.ToolTip.text: text
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
QQC2.ToolTip.visible: hovered
} }
} }
background: Kirigami.ShadowedRectangle { background: Kirigami.ShadowedRectangle {

View File

@@ -56,14 +56,12 @@ RowLayout {
Accessible.onPressAction: menuButton.action.trigger() Accessible.onPressAction: menuButton.action.trigger()
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
checkable: true checkable: true
action: QQC2.Action { text: i18nc("@action:button", "Show Menu")
text: i18nc("@action:button", "Show Menu") icon.name: "application-menu-symbolic"
icon.name: "application-menu-symbolic" onClicked: {
onTriggered: { const item = menu.createObject(menuButton);
const item = menu.createObject(menuButton); item.closed.connect(menuButton.toggle);
item.closed.connect(menuButton.toggle); item.open();
item.open();
}
} }
QQC2.ToolTip.visible: hovered QQC2.ToolTip.visible: hovered
@@ -87,13 +85,15 @@ RowLayout {
QQC2.MenuItem { QQC2.MenuItem {
text: i18n("Create a Room") text: i18n("Create a Room")
icon.name: "system-users-symbolic" icon.name: "system-users-symbolic"
action: QQC2.Action { onTriggered: {
Qt.createComponent('org.kde.neochat', 'CreateRoomDialog').createObject(root, {
connection: root.connection
}).open();
}
Kirigami.Action {
shortcut: StandardKey.New shortcut: StandardKey.New
onTriggered: { onTriggered: parent.trigger()
Qt.createComponent('org.kde.neochat', 'CreateRoomDialog').createObject(root, {
connection: root.connection
}).open();
}
} }
} }

View File

@@ -138,32 +138,33 @@ Kirigami.NavigationTabBar {
ColumnLayout { ColumnLayout {
spacing: 0 spacing: 0
Delegates.RoundedItemDelegate { Delegates.RoundedItemDelegate {
id: createRoomButton
Layout.fillWidth: true Layout.fillWidth: true
action: Kirigami.Action { text: i18nc("@action:button", "Create a Room")
text: i18n("Create a Room") icon.name: "system-users-symbolic"
icon.name: "system-users-symbolic" onClicked: {
onTriggered: { pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'CreateRoomPage'), {
pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'CreateRoomPage'), { connection: root.connection
connection: root.connection }, {
}, { title: i18nc("@title", "Create a Room")
title: i18nc("@title", "Create a Room") });
}); explorePopup.close();
explorePopup.close(); }
}
Kirigami.Action {
shortcut: StandardKey.New shortcut: StandardKey.New
onTriggered: createRoomButton.clicked()
} }
} }
Delegates.RoundedItemDelegate { Delegates.RoundedItemDelegate {
Layout.fillWidth: true Layout.fillWidth: true
action: Kirigami.Action { text: i18nc("@action:button", "Create a Space")
text: i18n("Create a Space") icon.name: "list-add"
icon.name: "list-add" onClicked: {
onTriggered: { Qt.createComponent('org.kde.neochat', 'CreateSpaceDialog').createObject(root, {
Qt.createComponent('org.kde.neochat', 'CreateSpaceDialog').createObject(root, { connection: root.connection
connection: root.connection }).open();
}).open(); explorePopup.close();
explorePopup.close();
}
} }
} }
} }

View File

@@ -91,13 +91,9 @@ RowLayout {
} }
QQC2.ToolButton { QQC2.ToolButton {
display: QQC2.Button.IconOnly display: QQC2.Button.IconOnly
action: Kirigami.Action { text: i18nc("@action:button", "Open Settings")
text: i18nc("@action:button", "Open Settings") icon.name: "settings-configure-symbolic"
icon.name: "settings-configure-symbolic" onClicked: NeoChatSettingsView.open()
onTriggered: {
NeoChatSettingsView.open();
}
}
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
QQC2.ToolTip.visible: hovered QQC2.ToolTip.visible: hovered

View File

@@ -86,32 +86,23 @@ FormCard.AbstractFormDelegate {
} }
QQC2.ToolButton { QQC2.ToolButton {
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
action: Kirigami.Action { text: i18nc("@action:button", "Edit device name")
id: editDeviceAction icon.name: "document-edit"
text: i18n("Edit device name") onClicked: root.editDeviceName = true
icon.name: "document-edit" QQC2.ToolTip.text: text
onTriggered: root.editDeviceName = true QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
} QQC2.ToolTip.visible: hovered
QQC2.ToolTip {
text: editDeviceAction.text
delay: Kirigami.Units.toolTipDelay
}
} }
QQC2.ToolButton { QQC2.ToolButton {
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
visible: root.showVerifyButton && (root.type !== DevicesModel.Verified || NeoChatConfig.alwaysVerifyDevice) visible: root.showVerifyButton && (root.type !== DevicesModel.Verified || NeoChatConfig.alwaysVerifyDevice)
action: Kirigami.Action { text: i18nc("@action:button", "Verify device")
id: verifyDeviceAction icon.name: "security-low-symbolic"
text: i18n("Verify device") onClicked: devicesModel.connection.startKeyVerificationSession(devicesModel.connection.localUserId, root.id)
icon.name: "security-low-symbolic"
onTriggered: { QQC2.ToolTip.text: text
devicesModel.connection.startKeyVerificationSession(devicesModel.connection.localUserId, root.id); QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
} QQC2.ToolTip.visible: hovered
}
QQC2.ToolTip {
text: verifyDeviceAction.text
delay: Kirigami.Units.toolTipDelay
}
} }
Kirigami.Icon { Kirigami.Icon {
visible: root.showVerifyButton && root.type === DevicesModel.Verified visible: root.showVerifyButton && root.type === DevicesModel.Verified
@@ -130,19 +121,16 @@ FormCard.AbstractFormDelegate {
} }
QQC2.ToolButton { QQC2.ToolButton {
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
action: Kirigami.Action { text: i18nc("@action:button", "Logout device")
id: logoutDeviceAction icon.name: "edit-delete-remove"
text: i18n("Logout device") onClicked: {
icon.name: "edit-delete-remove" passwordSheet.deviceId = root.id;
onTriggered: { passwordSheet.open();
passwordSheet.deviceId = root.id;
passwordSheet.open();
}
}
QQC2.ToolTip {
text: logoutDeviceAction.text
delay: Kirigami.Units.toolTipDelay
} }
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 { onClicked: {
id: editPowerLevelAction userListSearchPopup.close();
onTriggered: { let dialog = powerLevelDialog.createObject(root.QQC2.Overlay.overlay, {
userListSearchPopup.close(); room: root.room,
let dialog = powerLevelDialog.createObject(root.QQC2.Overlay.overlay, { userId: userListItem.userId,
room: root.room, powerLevel: userListItem.powerLevel
userId: userListItem.userId, });
powerLevel: userListItem.powerLevel dialog.open();
});
dialog.open();
}
} }
Component { Component {

View File

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

View File

@@ -214,23 +214,22 @@ QQC2.ScrollView {
padding: Kirigami.Units.largeSpacing padding: Kirigami.Units.largeSpacing
z: 2 z: 2
visible: (!_private.room?.partiallyReadStats.empty()) visible: !_private.room?.partiallyReadStats.empty()
text: _private.room.readMarkerLoaded ? i18n("Jump to first unread message") : i18n("Jump to oldest loaded message") text: _private.room.readMarkerLoaded ? i18nc("@action:button", "Jump to first unread message") : i18nc("@action:button", "Jump to oldest loaded message")
action: Kirigami.Action { icon.name: "go-up"
onTriggered: { onClicked: {
goReadMarkerFab.textChanged() goReadMarkerFab.textChanged()
root.goToEvent(_private.room.lastFullyReadEventId); root.goToEvent(_private.room.lastFullyReadEventId);
} }
icon.name: "go-up" Kirigami.Action {
shortcut: "Shift+PgUp" shortcut: "Shift+PgUp"
onTriggered: goReadMarkerFab.clicked()
} }
QQC2.ToolTip { QQC2.ToolTip.text: goReadMarkerFab.text
text: goReadMarkerFab.text QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
delay: Kirigami.Units.toolTipDelay QQC2.ToolTip.visible: goReadMarkerFab.hovered
visible: goReadMarkerFab.hovered
}
} }
KirigamiComponents.FloatingButton { KirigamiComponents.FloatingButton {
id: goMarkAsReadFab id: goMarkAsReadFab
@@ -248,21 +247,22 @@ QQC2.ScrollView {
z: 2 z: 2
visible: !messageListView.atYEnd visible: !messageListView.atYEnd
text: i18n("Jump to latest message") text: i18nc("@action:button", "Jump to latest message")
action: Kirigami.Action {
onTriggered: { onClicked: {
messageListView.positionViewAtBeginning(); messageListView.positionViewAtBeginning();
_private.room.markAllMessagesAsRead(); _private.room.markAllMessagesAsRead();
}
icon.name: "go-down"
shortcut: "Shift+PgDown"
} }
QQC2.ToolTip { icon.name: "go-down"
text: goMarkAsReadFab.text Kirigami.Action {
delay: Kirigami.Units.toolTipDelay shortcut: "Shift+PgDown"
visible: goMarkAsReadFab.hovered onTriggered: goMarkAsReadFab.clicked()
} }
QQC2.ToolTip.text: goMarkAsReadFab.text
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
QQC2.ToolTip.visible: goMarkAsReadFab.hovered
} }
DropArea { DropArea {