Introduce the ActionsHandler
This commit is contained in:
21
qml/main.qml
21
qml/main.qml
@@ -54,10 +54,19 @@ Kirigami.ApplicationWindow {
|
||||
|
||||
/**
|
||||
* Manage opening and close rooms
|
||||
* TODO this should probably be moved to C++
|
||||
*/
|
||||
QtObject {
|
||||
id: roomManager
|
||||
|
||||
property var actionsHandler: ActionsHandler {
|
||||
room: roomManager.currentRoom
|
||||
connection: Controller.activeConnection
|
||||
onRoomJoined: {
|
||||
roomManager.enterRoom(Controller.activeConnection.room(roomName))
|
||||
}
|
||||
}
|
||||
|
||||
property var currentRoom: null
|
||||
property alias pageStack: root.pageStack
|
||||
property bool invitationOpen: false
|
||||
@@ -262,6 +271,11 @@ Kirigami.ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
function onRoomJoined(roomId) {
|
||||
const room = Controller.activeConnection.room(roomId);
|
||||
return roomManager.enterRoom(room);
|
||||
}
|
||||
|
||||
function onConnectionDropped() {
|
||||
if (Controller.accountCount === 0) {
|
||||
pageStack.clear();
|
||||
@@ -287,6 +301,13 @@ Kirigami.ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Controller.activeConnection
|
||||
onDirectChatAvailable: {
|
||||
roomManager.enterRoom(Controller.activeConnection.room(directChat.id));
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.OverlaySheet {
|
||||
id: consentSheet
|
||||
|
||||
|
||||
Reference in New Issue
Block a user