RoomList: Change room on drag enter

With a delay. Allows to drag a file to NeoChat and switch rooms.

In the future we might want to allow dropping a file onto a
room to send it.
This commit is contained in:
Kai Uwe Broulik
2025-04-26 21:15:23 +02:00
parent 41d6233f78
commit 85f3d3b633
2 changed files with 21 additions and 0 deletions

View File

@@ -26,12 +26,15 @@ Delegates.RoundedItemDelegate {
required property string displayName
property bool openOnClick: true
property bool openOnDrag: false
property bool showConfigure: true
property bool collapsed: false
readonly property bool hasNotifications: contextNotificationCount > 0
dropAreaHovered: dropArea.containsDrag
Accessible.name: root.displayName
Accessible.onPressAction: clicked()
@@ -57,6 +60,23 @@ Delegates.RoundedItemDelegate {
onLongPressed: root.createRoomListContextMenu()
}
DropArea {
id: dropArea
enabled: root.openOnDrag
anchors.fill: parent
}
Timer {
id: dragOpenTimer
running: dropArea.containsDrag
interval: Application.styleHints.mousePressAndHoldInterval
repeat: false
onTriggered: {
RoomManager.resolveResource(currentRoom.id);
pageStack.currentIndex = 1;
}
}
contentItem: RowLayout {
spacing: Kirigami.Units.largeSpacing

View File

@@ -163,6 +163,7 @@ Kirigami.Page {
connection: root.connection
collapsed: root.collapsed
highlighted: RoomManager.currentRoom === currentRoom
openOnDrag: true
}
}