summaryrefslogtreecommitdiffstats
path: root/framework/qml/FocusComposer.qml
diff options
context:
space:
mode:
Diffstat (limited to 'framework/qml/FocusComposer.qml')
-rw-r--r--framework/qml/FocusComposer.qml252
1 files changed, 252 insertions, 0 deletions
diff --git a/framework/qml/FocusComposer.qml b/framework/qml/FocusComposer.qml
new file mode 100644
index 00000000..902309a8
--- /dev/null
+++ b/framework/qml/FocusComposer.qml
@@ -0,0 +1,252 @@
1/*
2 * Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19import QtQuick 2.4
20import QtQuick.Layouts 1.1
21import QtQuick.Controls 2.0 as Controls2
22
23import org.kde.kirigami 1.0 as Kirigami
24
25import org.kube.framework.domain 1.0 as KubeFramework
26
27Controls2.Popup {
28 id: root
29
30 //Controller
31 KubeFramework.ComposerController {
32 id: composerController
33 onDone: {
34 clear();
35 root.close()
36 }
37 }
38
39 //actions
40 property variant sendAction: composerController.sendAction
41 property variant saveAsDraftAction: composerController.saveAsDraftAction
42
43 //BEGIN functions
44 function loadMessage(message, loadAsDraft) {
45 composerController.loadMessage(message, loadAsDraft)
46 }
47 //END functions
48
49 modal: true
50 focus: true
51 closePolicy: Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutsideParent
52
53 Item {
54
55 height: parent.height
56 width: parent.width
57
58 ColumnLayout {
59
60 anchors {
61 fill: parent
62 margins: Kirigami.Units.largeSpacing
63 }
64
65 ColumnLayout {
66
67 anchors.fill: parent
68
69 GridLayout {
70
71 columns: 2
72
73 Controls2.Label {
74 Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
75 text: "To"
76 }
77
78 AutocompleteLineEdit {
79 id: to
80
81 Layout.fillWidth: true
82
83 text: composerController.to
84 onTextChanged: {
85 composerController.to = text;
86 }
87
88 model: composerController.recipientCompleter.model
89 onSearchTermChanged: {
90 composerController.recipientCompleter.searchString = searchTerm
91 }
92 }
93
94
95 Controls2.Label {
96 Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
97 text: "Cc"
98 visible: cc.visible
99 }
100
101 AutocompleteLineEdit {
102 id: cc
103
104 Layout.fillWidth: true
105
106 visible: false
107
108 text: composerController.cc
109
110 onTextChanged: {
111 composerController.cc = text;
112 }
113
114 model: composerController.recipientCompleter.model
115 onSearchTermChanged: {
116 composerController.recipientCompleter.searchString = searchTerm
117 }
118 }
119
120 Controls2.Label {
121 Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
122 text: "Bcc"
123 visible: bcc.visible
124 }
125
126 AutocompleteLineEdit {
127 id: bcc
128
129 Layout.fillWidth: true
130
131 visible : false
132
133 text: composerController.bcc
134
135 onTextChanged: {
136 composerController.bcc = text;
137 }
138
139 model: composerController.recipientCompleter.model
140 onSearchTermChanged: {
141 composerController.recipientCompleter.searchString = searchTerm
142 }
143 }
144
145 Controls2.Label {
146 text: "From"
147 }
148
149 RowLayout {
150
151 Controls2.ComboBox {
152 id: identityCombo
153 model: composerController.identitySelector.model
154 textRole: "displayName"
155
156 Layout.fillWidth: true
157
158 onCurrentIndexChanged: {
159 composerController.identitySelector.currentIndex = currentIndex
160 }
161 }
162
163 Controls2.Button {
164 id: ccButton
165
166 text: "Cc"
167 onClicked: {
168 cc.visible = true
169 ccButton.visible = false
170 }
171 }
172
173 Controls2.Button {
174 id: bccButton
175
176 text: "Bcc"
177
178 onClicked: {
179 bcc.visible = true
180 bccButton.visible = false
181 }
182 }
183 }
184 }
185
186 Controls2.TextField {
187 id: subject
188
189 Layout.fillWidth: true
190
191 placeholderText: "Enter Subject..."
192
193 text: composerController.subject
194
195 onTextChanged: {
196 composerController.subject = text;
197 }
198 }
199
200 Controls2.TextArea {
201 id: content
202
203 text: composerController.body
204
205 onTextChanged: {
206 composerController.body = text;
207 }
208
209 Layout.fillWidth: true
210 Layout.fillHeight: true
211 }
212
213 RowLayout {
214 id: bottomBar
215
216 width: parent.width
217
218 Controls2.Button {
219 text: "Discard"
220
221 onClicked: {
222 root.close()
223 }
224 }
225
226 Item {
227 Layout.fillWidth: true
228 }
229
230
231 Controls2.Button {
232 text: "Save as Draft"
233
234 enabled: saveAsDraftAction.enabled
235 onClicked: {
236 saveAsDraftAction.execute()
237 }
238 }
239
240 Controls2.Button {
241 text: "Send"
242
243 enabled: sendAction.enabled
244 onClicked: {
245 sendAction.execute()
246 }
247 }
248 }
249 }
250 }
251 }
252}