This repository has been archived by the owner on Dec 12, 2020. It is now read-only.
forked from cross-platform/icloud-for-linux
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathunofficial-webapp-office.qml
93 lines (79 loc) · 2.55 KB
/
unofficial-webapp-office.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import QtQuick 2.9
import QtQuick.Window 2.3
import QtQuick.Controls 1.0
import QtWebEngine 1.5
Window {
title: Qt.application.arguments[2]
width: 1000
height: 600
visible: true
WebEngineView {
id: windowParent
anchors.fill: parent
zoomFactor: 1.0
Action {
shortcut: "Ctrl+-"
onTriggered: windowParent.zoomFactor -= 0.1;
}
Action {
shortcut: "Ctrl++"
onTriggered: windowParent.zoomFactor += 0.1;
}
Action {
shortcut: "Ctrl+="
onTriggered: windowParent.zoomFactor += 0.1;
}
url: Qt.application.arguments[1]
// This whole section needs to be re-structured into something easier to maintain:
onNewViewRequested: function(request) {
if (request.requestedUrl.toString().includes('live.com')) {
var newWindow = windowComponent.createObject(windowParent);
newWindow.webView.zoomFactor = windowParent.zoomFactor / 0.8;
request.openIn(newWindow.webView);
}
else if (request.requestedUrl.toString().includes('microsoft.com') ||
request.requestedUrl.toString().includes('1drv.ms') ||
request.requestedUrl.toString().includes('office.com') ||
request.requestedUrl.toString().includes('office365.com') ||
request.requestedUrl.toString().includes('outlook.com') ||
request.requestedUrl.toString().includes('bing.com') ||
request.requestedUrl.toString().includes('msn.com') ||
request.requestedUrl.toString().includes('onenote.com') ||
request.requestedUrl.toString().includes('sway.office.com') ||
request.requestedUrl.toString().includes('sharepoint.com')) {
var newWindow = windowComponent.createObject(windowParent);
request.openIn(newWindow.webView);
}
else {
Qt.openUrlExternally(request.requestedUrl)
}
}
profile.onDownloadRequested: function(download) {
download.accept();
}
}
property Component windowComponent: Window {
title: Qt.application.arguments[2]
width: 1000
height: 600
visible: true
onClosing: destroy()
property WebEngineView webView: webView_
WebEngineView {
id: webView_
anchors.fill: parent
Action {
shortcut: "Ctrl+-"
onTriggered: webView_.zoomFactor -= 0.1;
}
Action {
shortcut: "Ctrl++"
onTriggered: webView_.zoomFactor += 0.1;
}
Action {
shortcut: "Ctrl+="
onTriggered: webView_.zoomFactor += 0.1;
}
}
}
}