This file is indexed.

/usr/share/unity-2d/shell/dash/LensBar.qml is in unity-2d-shell 5.10.0-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
/*
 * This file is part of unity-2d
 *
 * Copyright 2011 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 1.0
import Unity2d 1.0
import "../common/utils.js" as Utils

FocusScope {
    id: lensBar

    /* declare width & spacing of icons as required for layout calculations */
    property int iconWidth: 24
    property int iconSpacing: 36

    property variant visibleLenses: SortFilterProxyModel {
        model: dash.lenses
        dynamicSortFilter: true

        filterRole: Lenses.RoleVisible
        filterRegExp: RegExp("^true$")
    }

    Rectangle {
        id: background

        anchors.fill: parent
        color: "black"
        opacity: 0.22
    }

    /* LensBar contains a row of LensButtons */
    Row {
        id: lensContainer

        anchors.horizontalCenter: background.horizontalCenter
        anchors.top: background.top
        anchors.bottom: background.bottom

        focus: true
        onActiveFocusChanged: if (activeFocus) selectChild(currentIndex)

        Keys.onPressed: if (handleKeyPress(event.key)) event.accepted = true

        /* The Home lens is unfortunately not supplied by the "lenses" list
           This causes the keyboard navigation logic to be messy */
        property int currentIndex: 0

        function selectChild(index) {
            var child = lensContainer.childFromIndex(index)
            if (child != undefined) {
                child.focus = true
                currentIndex = index
                return true
            } else {
                return false
            }
        }

        function handleKeyPress(key) {
            switch (Utils.switchLeftRightKeys(key)) {
            case Qt.Key_Right:
                return selectChild(currentIndex+1)
            case Qt.Key_Left:
                return selectChild(currentIndex-1)
            }
        }

        function childFromIndex(index) {
            var indexInChildren = 0
            for(var i=0; i<children.length; i++) {
                if (children[i] != repeater) {
                    if (indexInChildren == index) return children[i]
                    indexInChildren++
                }
            }
            return undefined
        }

        /* Now fetch all other lenses and display */
        Repeater{
            id: repeater

            model: visibleLenses
            delegate: LensButton {
                Accessible.name: u2d.tr(item.name)
                objectName: item.name

                /* Heuristic: if iconHint does not contain a '/' then it is an icon name */
                icon: {
                    if (item.id == "home.lens") {
                        return "artwork/lens-nav-home.svg"
                    }
                    item.iconHint.indexOf("/") == -1 ? "image://icons/" + item.iconHint : item.iconHint
                }
                active: {
                    /* we need this in order to activate the arrow when using a custom shortcuts file */
                    if (item.id == "home.lens" && shellManager.dashActiveLens == "") {
                        return true
                    }
                    return item.viewType == Lens.LensView
                }
                onClicked: {
                    if (item.id == "home.lens") {
                        dash.activateHome()
                    } else {
                        dash.activateLens(item.id)
                    }
                }
                iconWidth: lensBar.iconWidth
                iconSpacing: lensBar.iconSpacing
                width: iconWidth+iconSpacing
                height: lensContainer.height
            }
        }
    }
}