19
19
import QtQuick.Layouts 1.1
20
20
import DocumentViewer.LibreOffice 1.0 as LibreOffice
22
// TODO: If we'll be planning to reorganise QML components, consider to provide
23
// delegates in some separate documents.
32
35
property bool isWide: width > units.gu(24)
34
37
currentIndex: view.model ? loView.document.currentPart : -1
35
highlightMoveDuration: UbuntuAnimation.SnapDuration
37
delegate: (orientation == ListView.Vertical) ? verticalDelegate : horizontalDelegate
39
// Ensure that items next to current item are always visible (and then
40
// clickable) without the need of extra interaction from the user.
41
// FIXME: If the current item is out the visible area, the 'highlightMove'
42
// animation shouldn't be fully performed, but applied from the first visible
43
// item instead. This actually seems to be a limitation of ListView itself.
44
highlightRangeMode: ListView.ApplyRange
45
highlightMoveDuration: UbuntuAnimation.FastDuration
46
preferredHighlightBegin: internal.isVerticalView ? (view.height - internal.verticalItemHeight) * 0.5
47
: (view.width - internal.horizontalItemWidth) * 0.5
48
preferredHighlightEnd: internal.isVerticalView ? (view.height - internal.verticalItemHeight) * 0.5
49
: (view.width - internal.horizontalItemWidth) * 0.5
51
delegate: internal.isVerticalView ? verticalDelegate : horizontalDelegate
53
Component.onCompleted: {
54
// WORKAROUND: Fix for wrong grid unit size
55
flickDeceleration = 1500 * units.gridUnit / 8
56
maximumFlickVelocity = 2500 * units.gridUnit / 8
40
60
id: verticalDelegate
65
// Defined at the end of this document
66
width: internal.verticalItemWidth
67
height: internal.verticalItemHeight
47
69
color: (loView.document.currentPart === model.index) ? theme.palette.selected.background
101
height: parent.height; width: height
124
// Defined at the end of this document
125
width: internal.horizontalItemWidth
126
height: internal.horizontalItemHeight
103
128
color: (loView.document.currentPart === model.index) ? theme.palette.selected.background
165
readonly property bool isVerticalView: view.orientation == ListView.Vertical
167
// Vertical delegate size
168
readonly property int verticalItemWidth: view.width
169
readonly property int verticalItemHeight: units.gu(16)
171
// Horizontal delegate size
172
readonly property int horizontalItemWidth: horizontalItemHeight
173
readonly property int horizontalItemHeight: view.height
140
175
function delegate_onClicked(index) {
141
176
loView.document.currentPart = index