-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgoogle-chat.qml
67 lines (55 loc) · 1.42 KB
/
google-chat.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import QtQuick
import QtQuick.Window
import QtWebEngine
import Qt.labs.platform
Window {
width: 480
height: 960
visible: true
id: mainwindow
onClosing: {
close.accepted = false
mainwindow.hide()
}
Shortcut {
sequence: StandardKey.Quit
context: Qt.ApplicationShortcut
onActivated: Qt.exit(0)
}
WebEngineView {
anchors.fill: parent
url: "https://mail.google.com/chat/u/0"
onLoadingChanged: {}
onLinkHovered: {}
onNewWindowRequested: function(request) {
if (request.userInitiated) {
Qt.openUrlExternally(request.requestedUrl)
}
}
onNavigationRequested: function(request) {
if (request.navigationType === WebEngineNavigationRequest.LinkClickedNavigation) {
Qt.openUrlExternally(request.url)
request.reject()
}
}
}
SystemTrayIcon {
visible: true
icon.name: "google-chat"
onActivated: {
if (mainwindow.visible) {
mainwindow.hide()
} else {
mainwindow.show()
mainwindow.raise()
mainwindow.requestActivate()
}
}
menu: Menu {
MenuItem {
text: qsTr("Quit")
onTriggered: Qt.exit(0)
}
}
}
}