| 1 |
import QtQuick 2.4 |
| 2 |
import Lomiri.Components 1.3 |
| 3 |
|
| 4 |
import "../backend" |
| 5 |
import "../components" as Components |
| 6 |
import "../actions" as FMActions |
| 7 |
|
| 8 |
Page { |
| 9 |
id: root |
| 10 |
|
| 11 |
property FolderListModel folderModel |
| 12 |
|
| 13 |
signal pathClicked() |
| 14 |
|
| 15 |
header: PageHeader { |
| 16 |
title: i18n.tr("Places") |
| 17 |
|
| 18 |
/*trailingActionBar { |
| 19 |
anchors.rightMargin: 0 |
| 20 |
delegate: Components.TextualButtonStyle {} |
| 21 |
actions: Action { |
| 22 |
text: i18n.tr("Edit") |
| 23 |
onTriggered: rootItem.showEditSources() |
| 24 |
} |
| 25 |
}*/ |
| 26 |
|
| 27 |
StyleHints { dividerColor: "transparent" } |
| 28 |
} |
| 29 |
|
| 30 |
ScrollView { |
| 31 |
id: scrollView |
| 32 |
anchors.fill: parent |
| 33 |
anchors.topMargin: root.header.height |
| 34 |
|
| 35 |
ListView { |
| 36 |
anchors.fill: parent |
| 37 |
model: folderModel.places |
| 38 |
|
| 39 |
delegate: ListItem { |
| 40 |
divider.visible: false |
| 41 |
height: units.gu(6) |
| 42 |
|
| 43 |
Rectangle { |
| 44 |
anchors.fill: parent |
| 45 |
color: Qt.rgba(0, 0, 0, 0.2) |
| 46 |
visible: model.path == folderModel.path |
| 47 |
} |
| 48 |
|
| 49 |
ListItemLayout { |
| 50 |
anchors.fill: parent |
| 51 |
title.text: FmUtils.pathTitle(model.path) |
| 52 |
|
| 53 |
Icon { |
| 54 |
SlotsLayout.position: SlotsLayout.Leading |
| 55 |
width: units.gu(4); height: width |
| 56 |
name: folderModel.model.getIcon(model.path) |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
leadingActions: ListItemActions { |
| 61 |
actions: FMActions.Delete { |
| 62 |
visible: enabled |
| 63 |
enabled: !folderModel.places.isDefaultLocation(model.path) |
| 64 |
&& !folderModel.places.isUserMountDirectory(model.path) |
| 65 |
onTriggered: folderModel.places.removeItem(model.index) |
| 66 |
} |
| 67 |
} |
| 68 |
|
| 69 |
onClicked: { |
| 70 |
folderModel.goTo(model.path) |
| 71 |
root.pathClicked() |
| 72 |
} |
| 73 |
} |
| 74 |
} |
| 75 |
} |
| 76 |
} |