-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMailView.qml
176 lines (123 loc) · 4.57 KB
/
MailView.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
import Material 0.2
import Material.Extras 0.1
import Material.ListItems 0.1 as ListItem
import QtWebEngine 1.2
Item{
id: mailView
// visible: selectedMailIndex >= 0
visible: true
property string attachmentColor: Palette.colors["blue"]["200"]
// property alias unreadButton: markAsUnreadButton
// property alias replyButton: replyButton
function loadHtml(content){
mailWebView.loadHtml(content)
console.log("in function loadHtml:"+content )
}
ColumnLayout{
spacing: Units.dp(8)
anchors.fill: parent
anchors.margins: Units.dp(10)
anchors.topMargin: 0
RowLayout{
id : mailViewToolBar
height: Units.dp(60)
spacing: 0
anchors.top : parent.top
anchors.right: parent.right
Layout.fillWidth : true
MyButton{
id : markAsUnreadButton
label : "Mark As Unread"
source: "/icons/mail_unread"
Layout.preferredWidth: Units.dp(label.length*8 + 60)
}
MyButton{
id : replyButton
label: "Reply"
source: "/icons/reply"
Layout.preferredWidth: Units.dp(label.length*8 + 60)
onClicked: pageLoader.newMail()
}
MyButton{
id : replyAllButton
label: "Reply All"
source: "/icons/reply_all"
Layout.preferredWidth: Units.dp(label.length*8 + 60)
}
}
ProgressBar{
Layout.fillWidth: true
value: mailWebView.loadProgress/100.0
}
RowLayout{
id: mailHeaderView
height: mailViewToolBar.height
spacing: Units.dp(10)
Rectangle{
height: parent.height / 2
width: height
radius: height/2
color: theme.accentColor
Label{
anchors.centerIn: parent
text: mailHeaderSender.text.charAt(0)
}
}
ColumnLayout{
spacing: Units.dp(2)
Label {
id : mailHeaderSender
text : mailListModel.getSender(selectedMailIndex)
font.bold: true
font.pixelSize: Units.dp(20)
}
Label {
id : mailHeaderDatetime
text : mailListModel.getDateTime(selectedMailIndex)
font.pixelSize: Units.dp(13)
}
}
}
Label {
text : mailListModel.getSubject(selectedMailIndex);
}
Label{
text : mailListModel.getRecipients(selectedMailIndex);
}
RowLayout{
id: attachmentsRow
Layout.fillWidth: true
height: Units.dp(50)
visible: attachmentsRepeater.count > 0
Repeater{
id: attachmentsRepeater
model: mailListModel.getAttachments(selectedMailIndex)
delegate: Component{
MyButton{
source: "/icons/file"
backgroundColor: attachmentColor
height: parent.height
label: model.modelData
onClicked: {
mailListModel.downloadAttach(selectedMailIndex, index, ".");
// console.log( "selectedMailIndex" + selectedMailIndex )
// console.log(" index" + index)
}
}
}
}
}
WebEngineView{
id: mailWebView
Layout.fillHeight: true
Layout.fillWidth: true
url: "https://www.baidu.com/"
// url: ""
onLoadProgressChanged: console.log(mailWebView.loadProgress)
}
}
}