Debian Codegraph @

Dekko/workers/DialogWorker.qml

raw
1 /* Copyright (C) 2016 - 2017 Dan Chapman <[email protected]>
2
3 This file is part of Dekko email client for Ubuntu devices
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License or (at your option) version 3
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 import QtQuick 2.4
19 import Lomiri.Components 1.3
20 import QuickFlux 1.0
21 import Dekko.Mail.API 1.0
22 import Dekko.Mail.Stores.Views 1.0
23
24 AppListener {
25 id: dialogListener
26
27 waitFor: [ViewStore.listenerId]
28 property string name
29 property var dlgTarget
30 property PopupQueue popupQueue: PopupQueue {}
31 property Component noticePopup
32 property Component confirmationPopup
33
34 Filter {
35 type: PopupKeys.showError
36
37 onDispatched: {
38 if (message.key === dialogListener.name) {
39 popupQueue.queue(noticePopup, dialogListener.dlgTarget, {title: qsTr("Error"), text: message.error})
40 }
41 }
42 }
43
44 Filter {
45 type: PopupKeys.showNotice
46 onDispatched: {
47 if (message.key === dialogListener.name) {
48 popupQueue.queue(noticePopup, dialogListener.dlgTarget, {title: qsTr("Notice"), text: message.notice})
49 }
50 }
51 }
52
53 Filter {
54 type: PopupKeys.queueDialog
55 onDispatched: {
56 console.log(message.key)
57 if (message.key === dialogListener.name) {
58 popupQueue.queue(message.dlg, dialogListener.dlgTarget, message.properties)
59 }
60 }
61 }
62
63 Filter {
64 type: PopupKeys.showConfirmationDialog
65 onDispatched: {
66 if (message.key === dialogListener.name) {
67 popupQueue.queue(confirmationPopup, dialogListener.dlgTarget, {id: message.id, title: message.title, text: message.text})
68 }
69 }
70 }
71 }
72