Dekko
Loading...
Searching...
No Matches
MailboxPicker.qml
1/* Copyright (C) 2016 - 2017 Dan Chapman <dpniel@ubuntu.com>
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*/
18import QtQuick 2.4
19import Lomiri.Components 1.3
20import Dekko.Mail 1.0
21import "../delegates"
22import Dekko.Lomiri.Constants 1.0
23
24Item {
25 id: picker
26
27 property alias accountId: folderList.accountId
28 property bool contextActionsEnabled: false
29 signal folderSelected(string folderName, var folderKey)
30 signal folderClicked(int folderId)
31 signal folderTypeClicked(int folderType, int folderId)
32 signal folderPicked(var folder)
33
34 width: parent.width
35 height: parent.height
36
37 FolderList {
38 id: folderList
39 }
40
41 ScrollView {
42 anchors.fill:parent
43 ListView {
44 id: lv
45 anchors.fill: parent
46 add: DekkoAnimation.listViewAddTransition
47 addDisplaced: DekkoAnimation.listViewAddDisplacedTransition
48 remove: DekkoAnimation.listViewRemoveTransition
49 removeDisplaced: DekkoAnimation.listViewRemoveDisplacedTransition
50 highlight: !dekko.isSmallFF ? Style.highlightBar : null
51 highlightFollowsCurrentItem: true
52 highlightMoveDuration: 200
53 currentIndex: -1
54 model: folderList.model
55 delegate: FolderListDelegate {
56 actionsEnabled: picker.contextActionsEnabled
57 folder: model.qtObject
58 onItemClicked: {
59 lv.currentIndex = model.index
60 picker.folderSelected(folder.name, folder.messageKey)
61 picker.folderClicked(folder.folderId)
62 picker.folderTypeClicked(folder.type, folder.folderId)
63 picker.folderPicked(folder)
64 }
65 }
66 }
67 }
68}