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:
@@ -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
|
||||
|
||||
|
||||
@@ -163,6 +163,7 @@ Kirigami.Page {
|
||||
connection: root.connection
|
||||
collapsed: root.collapsed
|
||||
highlighted: RoomManager.currentRoom === currentRoom
|
||||
openOnDrag: true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user