This file is indexed.

/usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Components/1.3/TabBar.qml is in qml-module-ubuntu-components 1.3.1918+16.04.20160404-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
/*
 * Copyright 2015 Canonical Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import QtQuick 2.4
import Ubuntu.Components 1.3 as Toolkit

/*!
    \qmltype TabBar
    \inqmlmodule Ubuntu.Components 1.1
    \ingroup ubuntu
    \brief Tab bar that will be shown in the header when \l Tabs is active.
        This component does not need to be instantiated by the developer, it is
        automatically created by the \l Tabs.
*/
Toolkit.StyledItem {
    id: tabBar

    /*!
      \deprecated
      The \l Tabs item that tab bar belongs to.
      Will be automatically set by \l Tabs when the TabBar is created.
     */
    // tabsItem is of type Tabs, but using that type would cause an include loop
    property Item tabsItem
    /*! \internal */
    onTabsItemChanged: console.error("tabsItem property is deprecated. TabBar functionality no longer requires it.")

    /*!
      The model containing the tabs to be controlled by the TabBar. The tabs are
      visualized by the style, displaying controlling elements based on the data
      specified by the roles. The default style mandates the existence of either
      the \b title or \b tab role, but different styles may require to have other
      roles (e.g. image, color). The order the role existence is checked is also
      determined by the style component, Default style checks the existence of the
      \b tab role first, and if not defined will use the \b title role.
      */
    property var model: null

    /*!
      The user is interacting with the tab bar.
      Depends on the style pressed property.
     */
    readonly property bool pressed: __styleInstance !== null && __styleInstance.hasOwnProperty("pressed") ?
                                        __styleInstance.pressed : false

    /*!
      An inactive tab bar only displays the currently selected tab,
      and an active tab bar can be interacted with to select a tab.
     */
    property bool selectionMode: true

    /*!
      The property holds the index of the selected Tab item.
      Note: Setting this property is DEPRECATED. Set the selectedIndex of the model instead.
      */
    property int selectedIndex: (model && internal.modelChecked) ? model.selectedIndex : -1

    /*! \internal */
    onSelectedIndexChanged: {
        if (!model) return;
        if (tabBar.selectedIndex !== model.selectedIndex) {
            console.warn("Setting TabBar.selectedIndex is DEPRECATED. Set selectedIndex of the model instead");
            tabBar.selectedIndex = Qt.binding(function() { return (model && internal.modelChecked) ? model.selectedIndex : -1 });
        }
    }

    /*!
      Do not deactivate the tab bar after a specified idle time or when the user selects a new tab.
      Off by default.
     */
    property bool alwaysSelectionMode: false

    /*!
      Automatically activate the tab bar when \l alwaysSelectionMode is set.
     */
    onAlwaysSelectionModeChanged: {
        if (tabBar.alwaysSelectionMode) selectionMode = true;
    }

    /*!
      Show animations when the state changes. Default: true.
      */
    property bool animate: true

    implicitHeight: units.gu(7.5)
    activeFocusOnPress: true
    styleName: "TabBarStyle"

    QtObject {
        id: internal

        property bool modelChecked: true;

        // returns true if the roles are good, false otherwise.
        function checkRoles() {
            if (tabBar.model.count <= 0)
                return false;

            modelChecked = true;
            var f = tabBar.model.get(0);
            if (f.tab === undefined && f.title === undefined) {
                console.error("TabBar model must provide either tab or title role.");
                tabBar.model = null;
                return false;
            }
            if (f.tab !== undefined && f.tab.title === undefined) {
                console.error("TabBar model's tab role must have title property.");
                tabBar.model = null;
                return false;
            }
            return true;
        }
    }

    /*! \internal */
    onModelChanged: {
        internal.modelChecked = true;

        if (!model)
            return;

        if (!model.hasOwnProperty("selectedIndex")) {
            console.error("TabBar model must have selectedIndex property defined.");
            tabBar.model = null;
            return;
        }

        if (!model.hasOwnProperty("count")) {
            console.error("TabBar model must have count property defined.");
            tabBar.model = null;
            return;
        }

        if (!model.hasOwnProperty("get")) {
            console.error("TabBar model must provide get() function.");
            tabBar.model = null;
            return;
        }

        if (model.count > 0) {
            if (internal.checkRoles()) {
                model.selectedIndex = Math.max(Math.min(model.selectedIndex, model.count - 1), 0);
            }
        } else {
            internal.modelChecked = false;
        }
    }

    Connections {
        target: !internal.modelChecked ? tabBar.model : null
        onCountChanged: internal.checkRoles();
    }
}