Add a dev setting to allow relations to be sent to any message
Add a dev setting to allow relations to be sent to any message using the right click delegate menu. This shouldn't be a main feature, but since it's technically allowed in matrix this will help any future debugging
This commit is contained in:
@@ -189,6 +189,10 @@
|
|||||||
<label>Don't hide any events in the timeline</label>
|
<label>Don't hide any events in the timeline</label>
|
||||||
<default>false</default>
|
<default>false</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry name="RelateAnyEvent" type="bool">
|
||||||
|
<label>Send relations to any event, including state events and events normally hidden.</label>
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
<entry name="AlwaysVerifyDevice" type="bool">
|
<entry name="AlwaysVerifyDevice" type="bool">
|
||||||
<label>Always allow device verification</label>
|
<label>Always allow device verification</label>
|
||||||
<default>false</default>
|
<default>false</default>
|
||||||
|
|||||||
@@ -20,6 +20,13 @@ FormCard.FormCard {
|
|||||||
|
|
||||||
onToggled: NeoChatConfig.showAllEvents = checked
|
onToggled: NeoChatConfig.showAllEvents = checked
|
||||||
}
|
}
|
||||||
|
FormCard.FormCheckDelegate {
|
||||||
|
text: i18nc("@option:check", "Allow sending relations to any event in the timeline")
|
||||||
|
description: i18nc("@info", "This includes state events")
|
||||||
|
checked: NeoChatConfig.relateAnyEvent
|
||||||
|
|
||||||
|
onToggled: NeoChatConfig.relateAnyEvent = checked
|
||||||
|
}
|
||||||
FormCard.FormCheckDelegate {
|
FormCard.FormCheckDelegate {
|
||||||
id: roomAccountDataVisibleCheck
|
id: roomAccountDataVisibleCheck
|
||||||
text: i18nc("@option:check Enable the matrix 'threads' feature", "Always allow device verification")
|
text: i18nc("@option:check Enable the matrix 'threads' feature", "Always allow device verification")
|
||||||
|
|||||||
@@ -71,4 +71,26 @@ RowLayout {
|
|||||||
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
|
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TapHandler {
|
||||||
|
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad | PointerDevice.Stylus
|
||||||
|
acceptedButtons: Qt.RightButton
|
||||||
|
onTapped: _private.showMessageMenu()
|
||||||
|
}
|
||||||
|
TapHandler {
|
||||||
|
acceptedDevices: PointerDevice.TouchScreen
|
||||||
|
acceptedButtons: Qt.LeftButton
|
||||||
|
onLongPressed: _private.showMessageMenu()
|
||||||
|
}
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
id: _private
|
||||||
|
|
||||||
|
function showMessageMenu() {
|
||||||
|
if (!NeoChatConfig.developerTools) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RoomManager.viewEventMenu(root.modelData.eventId, root.Message.room, root.author, "", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,18 +50,18 @@ QQC2.ScrollView {
|
|||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: Timeline.MediaMessageFilterModel.Image
|
roleValue: Timeline.MediaMessageFilterModel.Image
|
||||||
delegate: Timeline.MessageDelegate {
|
delegate: Timeline.MessageDelegate {
|
||||||
|
Timeline.Message.room: root.room
|
||||||
alwaysFillWidth: true
|
alwaysFillWidth: true
|
||||||
cardBackground: false
|
cardBackground: false
|
||||||
room: root.room
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: Timeline.MediaMessageFilterModel.Video
|
roleValue: Timeline.MediaMessageFilterModel.Video
|
||||||
delegate: Timeline.MessageDelegate {
|
delegate: Timeline.MessageDelegate {
|
||||||
|
Timeline.Message.room: root.room
|
||||||
alwaysFillWidth: true
|
alwaysFillWidth: true
|
||||||
cardBackground: false
|
cardBackground: false
|
||||||
room: root.room
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,11 @@ KirigamiComponents.ConvergentContextMenu {
|
|||||||
*/
|
*/
|
||||||
required property var author
|
required property var author
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The delegate type of the message.
|
||||||
|
*/
|
||||||
|
required property int messageComponentType
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The display text of the message as plain text.
|
* @brief The display text of the message as plain text.
|
||||||
*/
|
*/
|
||||||
@@ -79,7 +84,7 @@ KirigamiComponents.ConvergentContextMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
component RemoveMessageAction: Kirigami.Action {
|
component RemoveMessageAction: Kirigami.Action {
|
||||||
visible: author.isLocalMember || currentRoom.canSendState("redact")
|
visible: (author.isLocalMember || currentRoom.canSendState("redact")) && root.messageComponentType !== MessageComponentType.Other
|
||||||
text: i18nc("@action:button", "Remove…")
|
text: i18nc("@action:button", "Remove…")
|
||||||
icon.name: "edit-delete-remove"
|
icon.name: "edit-delete-remove"
|
||||||
icon.color: "red"
|
icon.color: "red"
|
||||||
@@ -99,7 +104,8 @@ KirigamiComponents.ConvergentContextMenu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component ReplyMessageAction: QQC2.Action {
|
component ReplyMessageAction: Kirigami.Action {
|
||||||
|
visible: root.messageComponentType !== MessageComponentType.Other || NeoChatConfig.relateAnyEvent
|
||||||
text: i18n("Reply")
|
text: i18n("Reply")
|
||||||
icon.name: "mail-replied-symbolic"
|
icon.name: "mail-replied-symbolic"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
@@ -109,7 +115,8 @@ KirigamiComponents.ConvergentContextMenu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component ReplyThreadMessageAction: QQC2.Action {
|
component ReplyThreadMessageAction: Kirigami.Action {
|
||||||
|
visible: root.messageComponentType !== MessageComponentType.Other || NeoChatConfig.relateAnyEvent
|
||||||
text: i18nc("@action:button", "Reply in Thread")
|
text: i18nc("@action:button", "Reply in Thread")
|
||||||
icon.name: "dialog-messages"
|
icon.name: "dialog-messages"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
@@ -145,7 +152,7 @@ KirigamiComponents.ConvergentContextMenu {
|
|||||||
component PinMessageAction: Kirigami.Action {
|
component PinMessageAction: Kirigami.Action {
|
||||||
readonly property bool pinned: currentRoom.isEventPinned(root.eventId)
|
readonly property bool pinned: currentRoom.isEventPinned(root.eventId)
|
||||||
|
|
||||||
visible: currentRoom.canSendState("m.room.pinned_events")
|
visible: currentRoom.canSendState("m.room.pinned_events") && root.messageComponentType !== MessageComponentType.Other
|
||||||
text: pinned ? i18nc("@action:button 'Unpin' as in 'Unpin this message'", "Unpin") : i18nc("@action:button 'Pin' as in 'Pin the message in the room'", "Pin")
|
text: pinned ? i18nc("@action:button 'Unpin' as in 'Unpin this message'", "Unpin") : i18nc("@action:button 'Pin' as in 'Pin the message in the room'", "Pin")
|
||||||
icon.name: pinned ? "window-unpin-symbolic" : "pin-symbolic"
|
icon.name: pinned ? "window-unpin-symbolic" : "pin-symbolic"
|
||||||
onTriggered: pinned ? currentRoom.unpinEvent(root.eventId) : currentRoom.pinEvent(root.eventId)
|
onTriggered: pinned ? currentRoom.unpinEvent(root.eventId) : currentRoom.pinEvent(root.eventId)
|
||||||
@@ -185,9 +192,11 @@ KirigamiComponents.ConvergentContextMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
visible: Kirigami.Settings.isMobile
|
id: emojiAction
|
||||||
|
visible: root.messageComponentType === MessageComponentType.Other ? NeoChatConfig.relateAnyEvent : true
|
||||||
|
|
||||||
displayComponent: RowLayout {
|
displayComponent: RowLayout {
|
||||||
|
visible: emojiAction.visible
|
||||||
spacing: 0
|
spacing: 0
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: Kirigami.Units.gridUnit * 2.5
|
Layout.preferredHeight: Kirigami.Units.gridUnit * 2.5
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ DelegateChooser {
|
|||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: DelegateType.State
|
roleValue: DelegateType.State
|
||||||
delegate: StateDelegate {}
|
delegate: StateDelegate {
|
||||||
|
room: root.room
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
|
|||||||
@@ -33,11 +33,6 @@ DelegateContextMenu {
|
|||||||
*/
|
*/
|
||||||
required property var progressInfo
|
required property var progressInfo
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The delegate type of the message.
|
|
||||||
*/
|
|
||||||
required property int messageComponentType
|
|
||||||
|
|
||||||
DelegateContextMenu.ReplyMessageAction {}
|
DelegateContextMenu.ReplyMessageAction {}
|
||||||
|
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
|
|||||||
@@ -27,11 +27,6 @@ import org.kde.neochat
|
|||||||
DelegateContextMenu {
|
DelegateContextMenu {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The delegate type of the message.
|
|
||||||
*/
|
|
||||||
required property int messageComponentType
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The display text of the message as rich text.
|
* @brief The display text of the message as rich text.
|
||||||
*/
|
*/
|
||||||
@@ -52,7 +47,8 @@ DelegateContextMenu {
|
|||||||
|
|
||||||
DelegateContextMenu.ReplyThreadMessageAction {}
|
DelegateContextMenu.ReplyThreadMessageAction {}
|
||||||
|
|
||||||
QQC2.Action {
|
Kirigami.Action {
|
||||||
|
visible: root.messageComponentType !== MessageComponentType.Other
|
||||||
text: i18nc("@action:inmenu As in 'Forward this message'", "Forward…")
|
text: i18nc("@action:inmenu As in 'Forward this message'", "Forward…")
|
||||||
icon.name: "mail-forward-symbolic"
|
icon.name: "mail-forward-symbolic"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
@@ -69,6 +65,7 @@ DelegateContextMenu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
|
visible: root.messageComponentType !== MessageComponentType.Other || NeoChatConfig.relateAnyEvent
|
||||||
separator: true
|
separator: true
|
||||||
}
|
}
|
||||||
DelegateContextMenu.RemoveMessageAction {}
|
DelegateContextMenu.RemoveMessageAction {}
|
||||||
|
|||||||
@@ -18,6 +18,11 @@ import org.kde.neochat
|
|||||||
TimelineDelegate {
|
TimelineDelegate {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The NeoChatRoom the delegate is being displayed in.
|
||||||
|
*/
|
||||||
|
required property NeoChatRoom room
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief List of the first 5 unique authors of the aggregated state event.
|
* @brief List of the first 5 unique authors of the aggregated state event.
|
||||||
*/
|
*/
|
||||||
@@ -63,6 +68,8 @@ TimelineDelegate {
|
|||||||
*/
|
*/
|
||||||
property bool folded: true
|
property bool folded: true
|
||||||
|
|
||||||
|
Message.room: root.room
|
||||||
|
|
||||||
width: parent?.width
|
width: parent?.width
|
||||||
rightPadding: NeoChatConfig.compactLayout && root.ListView.view.width >= Kirigami.Units.gridUnit * 20 ? Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing
|
rightPadding: NeoChatConfig.compactLayout && root.ListView.view.width >= Kirigami.Units.gridUnit * 20 ? Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing
|
||||||
|
|
||||||
|
|||||||
@@ -198,6 +198,7 @@ QVariantList MessageFilterModel::stateEventsList(int sourceRow) const
|
|||||||
QVariantList stateEvents;
|
QVariantList stateEvents;
|
||||||
for (int i = sourceRow; i >= 0; i--) {
|
for (int i = sourceRow; i >= 0; i--) {
|
||||||
auto nextState = QVariantMap{
|
auto nextState = QVariantMap{
|
||||||
|
{u"eventId"_s, sourceModel()->data(sourceModel()->index(i, 0), TimelineMessageModel::EventIdRole)},
|
||||||
{u"author"_s, sourceModel()->data(sourceModel()->index(i, 0), TimelineMessageModel::AuthorRole)},
|
{u"author"_s, sourceModel()->data(sourceModel()->index(i, 0), TimelineMessageModel::AuthorRole)},
|
||||||
{u"authorDisplayName"_s, sourceModel()->data(sourceModel()->index(i, 0), TimelineMessageModel::AuthorDisplayNameRole).toString()},
|
{u"authorDisplayName"_s, sourceModel()->data(sourceModel()->index(i, 0), TimelineMessageModel::AuthorDisplayNameRole).toString()},
|
||||||
{u"text"_s, sourceModel()->data(sourceModel()->index(i, 0), Qt::DisplayRole).toString()},
|
{u"text"_s, sourceModel()->data(sourceModel()->index(i, 0), Qt::DisplayRole).toString()},
|
||||||
|
|||||||
Reference in New Issue
Block a user