This file is indexed.

/usr/share/unity8/Dash/DashContent.qml is in unity8-common 8.12+16.04.20160401-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
/*
 * Copyright (C) 2013, 2014 Canonical, Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import QtQuick 2.4
import Ubuntu.Components 1.3
import Unity 0.2
import Utils 0.1
import "../Components"

Item {
    id: dashContent

    property bool forceNonInteractive: false
    property alias scopes: dashContentList.model
    property alias currentIndex: dashContentList.currentIndex
    property int workaroundRestoreIndex: -1
    readonly property string currentScopeId: dashContentList.currentItem ? dashContentList.currentItem.scopeId : ""
    readonly property var currentScope: dashContentList.currentItem ? dashContentList.currentItem.theScope : null
    readonly property bool subPageShown: dashContentList.currentItem && dashContentList.currentItem.item ?
                                            dashContentList.currentItem.item.subPageShown : false
    readonly property bool processing: dashContentList.currentItem && dashContentList.currentItem.item
                                       && dashContentList.currentItem.item.processing || false
    readonly property bool pageHeaderTotallyVisible: dashContentList.currentItem && dashContentList.currentItem.item
                                       && dashContentList.currentItem.item.pageHeaderTotallyVisible || false

    signal scopeLoaded(string scopeId)
    signal gotoScope(string scopeId)
    signal openScope(var scope)
    signal closePreview()

    // If we set the current scope index before the scopes have been added,
    // then we need to wait until the loaded signals gets emitted from the scopes
    property var set_current_index: undefined
    Connections {
        target: scopes
        onLoadedChanged: {
            if (scopes.loaded && set_current_index != undefined) {
                setCurrentScopeAtIndex(set_current_index[0], set_current_index[1], set_current_index[2]);
                set_current_index = undefined;
            }
        }
        onRowsMoved: {
            // FIXME This is to workaround a Qt bug with the model moving the current item
            // when the list is ListView.SnapOneItem and ListView.StrictlyEnforceRange
            // together with the code in Dash.qml
            if (row == dashContentList.currentIndex || start == dashContentList.currentIndex) {
                dashContent.workaroundRestoreIndex = dashContentList.currentIndex;
                dashContentList.currentIndex = -1;
            }
        }
    }

    function setCurrentScopeAtIndex(index, animate, reset) {
        // if the scopes haven't loaded yet, then wait until they are.
        if (!scopes.loaded) {
            set_current_index = [ index, animate, reset ]
            return;
        }

        var storedMoveDuration = dashContentList.highlightMoveDuration
        var storedMoveSpeed = dashContentList.highlightMoveVelocity
        if (!animate) {
            dashContentList.highlightMoveVelocity = units.gu(4167)
            dashContentList.highlightMoveDuration = 0
        }

        set_current_index = undefined;

        if (dashContentList.count > index) {
            dashContentList.currentIndex = index

            if (reset) {
                dashContentList.currentItem.item.positionAtBeginning()
                dashContentList.currentItem.item.resetSearch()
            }
        }

        if (!animate) {
            dashContentList.highlightMoveDuration = storedMoveDuration
            dashContentList.highlightMoveVelocity = storedMoveSpeed
        }
    }

    Item {
        id: dashContentListHolder

        anchors.fill: parent

        DashBackground {
            anchors.fill: parent
        }

        ListView {
            id: dashContentList
            objectName: "dashContentList"

            interactive: !dashContent.forceNonInteractive && dashContent.scopes.loaded && currentItem
                         && !currentItem.moving && !currentItem.subPageShown && !currentItem.extraPanelShown
            anchors.fill: parent
            orientation: ListView.Horizontal
            boundsBehavior: Flickable.DragAndOvershootBounds
            flickDeceleration: units.gu(625)
            maximumFlickVelocity: width * 5
            snapMode: ListView.SnapOneItem
            highlightMoveDuration: 250
            highlightRangeMode: ListView.StrictlyEnforceRange
            // TODO Investigate if we can switch to a smaller cache buffer when/if UbuntuShape gets more performant
            // 1073741823 is s^30 -1. A quite big number so that you have "infinite" cache, but not so
            // big so that if you add if with itself you're outside the 2^31 int range
            cacheBuffer: 1073741823
            onMovementStarted: currentItem.item.showHeader();
            clip: parent.x != 0

            // TODO QTBUG-40846 and QTBUG-40848
            // The remove transition doesn't happen when removing the last item
            // And can't work around it because index is reset to -1 regardless of
            // ListView.delayRemove

            remove: Transition {
                SequentialAnimation {
                    PropertyAction { property: "layer.enabled"; value: true }
                    PropertyAction { property: "ListView.delayRemove"; value: true }
                    ParallelAnimation {
                        PropertyAnimation { properties: "scale"; to: 0.25; duration: UbuntuAnimation.SnapDuration }
                        PropertyAnimation { properties: "y"; to: dashContent.height; duration: UbuntuAnimation.SnapDuration }
                    }
                    PropertyAction { property: "ListView.delayRemove"; value: false }
                }
            }
            removeDisplaced: Transition {
                PropertyAnimation { property: "x"; duration: UbuntuAnimation.SnapDecision }
            }

            // If the number of items is less than the current index, then need to reset to another item.
            onCountChanged: {
                if (count > 0) {
                    if (currentIndex >= count) {
                        dashContent.setCurrentScopeAtIndex(count-1, true, true)
                    } else if (currentIndex < 0) {
                        // setting currentIndex directly, cause we don't want to loose set_current_index
                        dashContentList.currentIndex = 0
                    }
                }
            }

            delegate:
                Loader {
                    id: loader
                    width: ListView.view.width
                    height: ListView.view.height
                    opacity: { // hide delegate if offscreen
                        var xPositionRelativetoView = ListView.view.contentX - x
                        return (xPositionRelativetoView > -width && xPositionRelativetoView < width) ? 1 : 0
                    }
                    asynchronous: true
                    source: "GenericScopeView.qml"
                    objectName: "scopeLoader" + index

                    readonly property bool moving: item ? item.moving : false
                    readonly property bool extraPanelShown: item ? item.extraPanelShown : false
                    readonly property bool subPageShown: item ? item.subPageShown : false
                    readonly property var categoryView: item ? item.categoryView : null
                    readonly property var theScope: scope

                    // these are needed for autopilot tests
                    readonly property string scopeId: scope.id
                    readonly property bool isCurrent: ListView.isCurrentItem
                    readonly property bool isLoaded: status == Loader.Ready

                    onLoaded: {
                        item.objectName = scope.id
                        item.scope = Qt.binding(function() { return scope })
                        item.isCurrent = Qt.binding(function() { return visible && ListView.isCurrentItem })
                        dashContent.scopeLoaded(item.scope.id)
                        item.paginationCount = Qt.binding(function() { return dashContentList.count } )
                        item.paginationIndex = Qt.binding(function() { return dashContentList.currentIndex } )
                        item.visibleToParent = Qt.binding(function() { return loader.opacity != 0 });
                        item.holdingList = dashContentList;
                        item.forceNonInteractive = Qt.binding(function() { return dashContent.forceNonInteractive } )
                    }
                    Connections {
                        target: isCurrent ? scope : null
                        onGotoScope: {
                            // Note here scopeId is the signal parameter and not the loader property
                            dashContent.gotoScope(scopeId);
                        }
                        onOpenScope: {
                            dashContent.openScope(scope);
                        }
                    }
                    Connections {
                        target: dashContent
                        onClosePreview: if (item) item.closePreview()
                    }

                    Component.onDestruction: active = false
                }
        }
    }
}