| 1 |
/* |
| 2 |
* Copyright (C) 2013 Canonical Ltd |
| 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 version 3 as |
| 6 |
* published by the Free Software Foundation. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
* |
| 16 |
* Authored by: Arto Jalkanen <[email protected]> |
| 17 |
*/ |
| 18 |
import QtQuick 2.4 |
| 19 |
import Lomiri.Components 1.3 |
| 20 |
import Lomiri.Components.Popups 1.3 |
| 21 |
|
| 22 |
import "../actions" as FMActions |
| 23 |
import "../components" |
| 24 |
|
| 25 |
ScrollView { |
| 26 |
id: folderListView |
| 27 |
|
| 28 |
property var folderListPage |
| 29 |
property var fileOperationDialog |
| 30 |
property var folderModel |
| 31 |
property var openDefault |
| 32 |
|
| 33 |
property alias footer: root.footer |
| 34 |
property alias header: root.header |
| 35 |
|
| 36 |
ListView { |
| 37 |
id: root |
| 38 |
anchors.fill: parent |
| 39 |
model: folderModel.model |
| 40 |
|
| 41 |
PullToRefresh { |
| 42 |
onRefresh: { |
| 43 |
refreshing = true |
| 44 |
folderModel.goTo(folderModel.model.filePath) |
| 45 |
refreshing = false |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
delegate: FolderListDelegate { |
| 50 |
id: delegate |
| 51 |
|
| 52 |
title: model.stylizedFileName |
| 53 |
subtitle: __delegateActions.itemDateAndSize(model) |
| 54 |
summary: folderModel.model.getSearchRecursive() && folderModel.model.getSearchString() ? |
| 55 |
model.filePath.toString().replace(folderModel.model.homePath(), "~") : "" |
| 56 |
iconName: model.iconName |
| 57 |
showProgressionSlot: model.isBrowsable |
| 58 |
isSelected: model.isSelected |
| 59 |
path: model.filePath |
| 60 |
|
| 61 |
property var __delegateActions: FolderDelegateActions { |
| 62 |
folderListPage: folderListView.folderListPage |
| 63 |
folderModel: folderListView.folderModel |
| 64 |
fileOperationDialog: folderListView.fileOperationDialog |
| 65 |
openDefault: folderListView.openDefault |
| 66 |
} |
| 67 |
|
| 68 |
leadingActions: ListItemActions { |
| 69 |
// Children is an alias for 'actions' property, this way we don't get any warning about non-NOTIFYable props |
| 70 |
actions: __delegateActions.leadingActions.children |
| 71 |
} |
| 72 |
|
| 73 |
trailingActions: ListItemActions { |
| 74 |
// Children is an alias for 'actions' property, this way we don't get any warning about non-NOTIFYable props |
| 75 |
actions: __delegateActions.trailingActions.children |
| 76 |
} |
| 77 |
|
| 78 |
onClicked: __delegateActions.itemClicked(model) |
| 79 |
onPressAndHold: { |
| 80 |
folderModel.primSelItem = model |
| 81 |
__delegateActions.listLongPress(model) |
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
section.property: "isDir" |
| 86 |
section.delegate: SectionDivider { |
| 87 |
text: section == "true" ? i18n.tr("Directories") : i18n.tr("Files") |
| 88 |
} |
| 89 |
} |
| 90 |
} |