Init desktop notifications.

This commit is contained in:
Black Hat
2018-07-19 16:04:09 +08:00
parent 43f02c4fa1
commit 7dd9132176
6 changed files with 31 additions and 18 deletions

View File

@@ -15,7 +15,7 @@ Page {
connection: matriqueController.isLogin ? page.connection : undefined
onNewMessage: console.log("New message in room " + room.displayName)
onNewMessage: trayIcon.showMessage("New message", "New message for room " + room.displayName)
}
RowLayout {

View File

@@ -98,6 +98,7 @@ Item {
delegate: MessageDelegate {}
onAtYBeginningChanged: atYBeginning && currentRoom ? currentRoom.getPreviousContent(50) : {}
onAtYEndChanged: atYEnd && currentRoom ? currentRoom.markAllMessagesAsRead() : {}
ScrollBar.vertical: ScrollBar {}

View File

@@ -28,18 +28,18 @@ ApplicationWindow {
property alias token: matriqueController.token
}
// Platform.SystemTrayIcon {
// id: trayIcon
Platform.SystemTrayIcon {
id: trayIcon
// visible: true
// iconSource: "qrc:/asset/img/icon.png"
visible: true
iconSource: "qrc:/asset/img/icon.png"
// onActivated: {
// window.show()
// window.raise()
// window.requestActivate()
// }
// }
onActivated: {
window.show()
window.raise()
window.requestActivate()
}
}
Controller {
id: matriqueController
@@ -163,7 +163,6 @@ ApplicationWindow {
Component.onCompleted: {
imageProvider.connection = matriqueController.connection
console.log(matriqueController.homeserver, matriqueController.userID, matriqueController.token)
if (matriqueController.userID && matriqueController.token) {
console.log("Perform auto-login.");
matriqueController.login();