Debian Codegraph @

Dekko/stores/Mail/MailStore.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 pragma Singleton
19 import QtQuick 2.4
20 import QuickFlux 1.0
21 import Dekko.Mail 1.0
22 import Dekko.Mail.API 1.0
23
24 /*!
25 *
26 * MailStore API
27 *
28 * MailStore maintains the state and models for all the messages of each account.
29 *
30 * @ingroup qml_stores
31 */
32 BaseMessagingStore {
33 id: mailStore
34
35 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
36 // NOTE: DO NOT CHANGE THESE WITHOUT UPDATING THE FILTER SWITCH IN MESSAGELISTVIEW !!!!
37 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
38 readonly property var defaultFilters: [qsTr("All"), qsTr("Unread"), qsTr("Starred"), qsTr("Replied"), qsTr("Forwarded"), qsTr("Attachments"), qsTr("Calendar")]
39 readonly property var searchFilters: [qsTr("Local")/*, qsTr("Remote")*/] // TODO: Figure out why Remote is flaking. Stick with local search for now;
40
41 property string formFactor
42 property alias msgList: msgList
43 property alias isInSelectionMode: msgList.isInSelectionMode
44 property alias canLoadMore: msgList.canLoadMore
45 property alias msgListKey: msgList.messageKey
46 property alias msgListModel: msgList.model
47 property alias msgListLoading: msgList.loading
48 property alias currentSelectedIndex: msgList.currentSelectedIndex
49 property int currentMessageId: -1
50
51 property alias folderTitle: d.currentFolderName
52
53 property alias disableMsgListUpdates: msgList.disableUpdates
54
55 property MailStoreActions actions: MailStoreActions {}
56
57 MessageList {
58 id: msgList
59 disableUpdates: false
60 disableRemovals: filter === MessageList.Unread
61 sortOrder: Qt.DescendingOrder
62 }
63
64 QtObject {
65 id: d
66 property string currentFolderName: "Inbox"
67
68 property Timer enableUpdatesTimer: Timer {
69 interval: 500
70 repeat: false
71 onTriggered: {
72 msgList.disableUpdates = false;
73 }
74 }
75 }
76
77 Connections {
78 target: Qt.application
79 onStateChanged: {
80 if (Qt.application.state === Qt.ApplicationActive) {
81 if (isRunningOnMir) {
82 d.enableUpdatesTimer.start()
83 }
84 } else {
85 if (isRunningOnMir) {
86 msgList.disableUpdates = true;
87 }
88 }
89 }
90 }
91
92 }