Debian Codegraph @

Dekko/stores/Mail/MailStoreActions.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 Dekko.Components 1.0
21 import Dekko.Mail.API 1.0
22
23 /*!
24 *
25 * MailStoreActions API
26 *
27 * MailStoreActions provided as a readonly property of the MailStore.
28 *
29 * @ingroup qml_stores
30 */
31 QtObject {
32
33 property Action selectAll: Action {
34 iconSource: !msgList.canSelectAll ? Paths.actionIconUrl(Paths.NoneSelectedIcon) :
35 Paths.actionIconUrl(Paths.SelectIcon)
36 text: msgList.canSelectAll ? qsTr("Unselect all") : qsTr("Select all")
37 onTriggered: {
38 if (msgList.canSelectAll) {
39 MessageActions.selectAllMessages()
40 } else {
41 MessageActions.unselectAllMessages()
42 }
43 }
44 }
45
46 property Action flagSelected: Action {
47 iconSource: msgList.canMarkSelectionImportant ? Paths.actionIconUrl(Paths.StarredIcon) :
48 Paths.actionIconUrl(Paths.UnStarredIcon)
49 text: msgList.canMarkSelectionImportant ? qsTr("Star") : qsTr("Remove star")
50 onTriggered: {
51 MessageActions.markSelectedMessagesImportant()
52 }
53 }
54
55 property Action deleteSelected: Action {
56 iconSource: Paths.actionIconUrl(Paths.DeleteIcon)
57 text: qsTr("Delete")
58 onTriggered: MessageActions.deleteSelectedMessages()
59 }
60
61 property Action markSelectedReadUnread: Action {
62 text: msgList.canMarkSelectionRead ? qsTr("Mark as un-read") : qsTr("Mark as read")
63 iconSource: !msgList.canMarkSelectionRead ? Paths.actionIconUrl(Paths.MailUnreadIcon) :
64 Paths.actionIconUrl(Paths.MailReadIcon)
65 onTriggered: MessageActions.markSelectedMessagesRead()
66 }
67 }