This file is indexed.

/usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Components/ListItems/1.2/Empty.qml is in qml-module-ubuntu-components-gles 1.3.1918+16.04.20160404-0ubuntu3.

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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
/*
 * Copyright 2012, 2013, 2014 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.2

/*!
    \qmltype Empty
    \inqmlmodule Ubuntu.Components.ListItems 1.0
    \ingroup ubuntu-listitems
    \brief A list item with no contents.
    \note \b{The component is deprecated. Use ListItem component instead.}
    The Empty class can be used for generic list items containing other
    components such as buttons. It is selectable and can take mouse clicks.
    It will attempt to detect if a thin dividing line at the bottom of the
    item is suitable, but this behaviour can be overridden (using \l showDivider).
    For specific types of list items, see its subclasses.

    The item will still remain in memory after being removed from the list so it is up to the
    application to destroy it.  This can be handled by the signal \l itemRemoved that is fired
    after all animation is done.

    Examples:
    \qml
        import Ubuntu.Components 1.2
        import Ubuntu.Components.ListItems 1.0 as ListItem

        Item {
            Model {
                id: contactModel

                ListElement {
                    name: "Bill Smith"
                    number: "555 3264"
                }
                ListElement {
                    name: "John Brown"
                    number: "555 8426"
                }
            }

            ListView {
                 width: 180; height: 200
                 model: contactModel

                 delegate: ListItem.Empty {
                    height: units.gu(6)
                    removable: true
                    onItemRemoved: contactModel.remove(index)
                    Text {
                        text: name + " " + number
                        anchors.centerIn: parent
                    }
                }
            }
        }
    \endqml

    See the documentation of the derived classes of Empty for more examples.
*/
AbstractButton {
    id: emptyListItem

    /*!
      Specifies whether the list item is selected.
     */
    property bool selected: false

    /*!
      Highlight the list item when it is pressed.
      This is used to disable the highlighting of the full list item
      when custom highlighting needs to be implemented (for example in
      ListItem.Standard which can have a split).
    */
    property bool highlightWhenPressed: true

    /*!
      Defines if this item can be removed or not.
     */
    property bool removable: false

    /*!
      Defines if the item needs confirmation before removing by swiping.
      \qmlproperty bool confirmRemoval
     */
    property alias confirmRemoval: confirmRemovalDialog.visible

    /*!
      \qmlproperty string swipingState
      The current swiping state ("SwipingRight" or "")
     */
    readonly property alias swipingState: backgroundIndicator.state

    /*!
      \qmlproperty bool waitingConfirmationForRemoval
      Defines if the item is waiting for the user interaction during the swipe to delete
     */
    readonly property alias waitingConfirmationForRemoval: confirmRemovalDialog.waitingForConfirmation

    /*!
      This handler is called when the item is removed from the list
     */
    signal itemRemoved

    /*!
      \internal
      Defines the height of the ListItem, so correct height of this component, including divider
      line is calculated.
     */
    property int __height: units.gu(6)

    /*!
      Set to show or hide the thin bottom divider line (drawn by the \l ThinDivider component).
      This line is shown by default except in cases where this item is the delegate of a ListView.
     */
    property bool showDivider: true

    /*!
      \internal
      Reparent so that the visuals of the children does not
      occlude the bottom divider line.
     */
    default property alias children: body.data

     /*!
      \internal
      Allows derived class to proper add items inside of this element
      */
    property alias __contents: body

    /*!
      \qmlproperty list<Item> backgroundIndicator
      Defines the item background item to be showed during the item swiping
     */
    property alias backgroundIndicator: backgroundIndicator.children

    /*!
      \qmlproperty ThinDivider divider
      Exposes our the bottom line divider.
     */
    property alias divider: bottomDividerLine

    /*! \internal
      The spacing inside the list item.
     */
    property real __contentsMargins: units.gu(2)

    /*!
      Cancel item romoval
     */
    function cancelItemRemoval()
    {
        priv.resetDrag()
        priv.removed = false
    }

    width: parent ? parent.width : units.gu(31)
    implicitHeight: priv.removed ? 0 : __height + bottomDividerLine.height
    __mouseArea.drag.axis: Drag.XAxis

    // Keep compatible with the old version
    height: implicitHeight

    LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
    LayoutMirroring.childrenInherit: true

    /*! \internal */
    QtObject {
        id: priv

        /*! \internal
          Defines the offset used when the item will start to move
         */
        readonly property int mouseMoveOffset: units.gu(1)

        /*! \internal
          Defines the offset limit to consider the item removed
         */
        readonly property int itemMoveOffset: confirmRemoval ?  width * 0.5 : width * 0.3

        /*! \internal
          Defines the initial pressed position
         */
        property int pressedPosition: -1

        /*! \internal
          Defines if the item is moving or not
         */
        property bool held: false

        /*! \internal
          Defines if the item should be removed after the animation or not
         */
        property bool removeItem: false

        /*! \internal
          Defines if the item was removed or not
         */
        property bool removed: false

        /*! \internal
            notify the start of the drag operation
         */
        function startDrag() {
            __mouseArea.drag.target = body
            held = true
            __mouseArea.drag.maximumX = parent.width
            __mouseArea.drag.minimumX = 0
            backgroundIndicator.visible = true
        }

        /*! \internal
            Resets the item dragging state
         */
        function resetDrag() {
            confirmRemovalDialog.waitingForConfirmation = false
            held = false  // before body.x to ensure animation
            __mouseArea.drag.target = null  // stops waitingForConfirmation = true in animation
            body.x = 0
            pressedPosition = -1
            removeItem = false
            backgroundIndicator.opacity = 0.0
            backgroundIndicator.visible = false
        }

        /*! \internal
           Commit the necessary changes to remove or not the item based on the mouse final position
        */
        function commitDrag() {
            if (removeItem) {
                if (!confirmRemoval) {
                    removeItemAnimation.start()
                }
            } else {
                resetDrag()
            }
        }

        /*! \internal
            notify the releaso of the mouse button and the end of the drag operation
        */
        function endDrag() {
            if (Math.abs(body.x) < itemMoveOffset && held == true) {
                held = false
                removeItem = false
                if (body.x == 0) {
                    resetDrag()
                } else {
                    body.x = 0;
                }
            } else if (held == true) {
                held = false
                removeItem = true
                var finalX = body.width
                if (emptyListItem.confirmRemoval) {
                    finalX = itemMoveOffset
                }
                if (body.x > 0) {
                    body.x = finalX
                } else {
                    body.x = -finalX
                }
            }
        }
    }

    Rectangle {
        id: highlight

        z: -1
        visible: !priv.removed && emptyListItem.swipingState === ""
                 ? emptyListItem.selected
                   || (emptyListItem.highlightWhenPressed && emptyListItem.pressed)
                 : false
        anchors {
            left: parent.left
            right: parent.right
            top: parent.top
        }
        height: emptyListItem.height - bottomDividerLine.height
        color: Theme.palette.selected.background
    }

    ThinDivider {
        id: bottomDividerLine
        anchors.bottom: parent.bottom
        visible: showDivider && !priv.removed
    }

    Item {
        id: bodyMargins

        clip: body.x != 0
        visible: body.height > 0
        anchors {
            left: parent.left
            right: parent.right
            top: parent.top
            bottom: parent.bottom
        }

        Item {
            id: body

            anchors {
                top: parent.top
                bottom: parent.bottom
            }

            width: parent.width

            Behavior on x {
                enabled: !priv.held
                SequentialAnimation {
                    UbuntuNumberAnimation {
                    }
                    ScriptAction {
                        script: {
                            if (__mouseArea.drag.target !== null) {  // if not from resetDrag()
                                confirmRemovalDialog.waitingForConfirmation = true
                                priv.commitDrag()
                            }
                        }
                    }
                }
            }

            onXChanged: {
                if (x > 0) {
                    backgroundIndicator.state = "SwipingRight"
                } else {
                    backgroundIndicator.state = ""
                }
            }
        }

        Item {
            id: backgroundIndicator

            opacity: 0.0
            visible: false
            anchors {
                left: parent.left
                right: parent.right
                top: parent.top
                bottom: parent.bottom
            }
            LayoutMirroring.enabled: false
            LayoutMirroring.childrenInherit: true

            Item {
                id: confirmRemovalDialog
                objectName: "confirmRemovalDialog"

                property bool waitingForConfirmation: false

                visible: false
                width: units.gu(15)
                x: body.x - width - units.gu(2)
                anchors {
                    top: parent.top
                    bottom: parent.bottom
                }

                Row {
                    anchors {
                        top: parent.top
                        bottom:  parent.bottom
                        left: parent.left
                        right: parent.right
                        leftMargin: units.gu(2)
                        rightMargin: units.gu(2)
                    }

                    spacing: units.gu(2)
                    Image {
                        source: Qt.resolvedUrl("../../artwork/delete.png")
                        fillMode: Image.Pad
                        anchors {
                            verticalCenter: parent.verticalCenter
                        }
                        width: units.gu(5)
                    }
                    Label {
                        text: i18n.dtr('ubuntu-ui-toolkit', "Delete")
                        verticalAlignment: Text.AlignVCenter
                        anchors {
                            verticalCenter: parent.verticalCenter
                        }
                        width: units.gu(7)
                        fontSize: "medium"
                    }
                }

                MouseArea {
                    visible: confirmRemovalDialog.waitingForConfirmation
                    anchors.fill: parent
                    onClicked: removeItemAnimation.start()
                }
            }


            states: [
                State {
                    name: "SwipingRight"

                    AnchorChanges {
                        target: backgroundIndicator
                        anchors.left: parent.left
                        anchors.right: body.left
                    }

                    PropertyChanges {
                        target: backgroundIndicator
                        opacity: 1.0
                    }

                    PropertyChanges {
                        target: confirmRemovalDialog
                        x: body.x - confirmRemovalDialog.width - units.gu(2)
                    }
                }
            ]
        }
    }

    SequentialAnimation {
        id: removeItemAnimation

        running: false
        UbuntuNumberAnimation {
            target: emptyListItem
            property: "height"
            to: 0
        }
        ScriptAction {
             script: {
                 priv.removed = true
                 itemRemoved()
                 priv.resetDrag()
             }
        }
    }

    Connections {
        target: (emptyListItem.removable) ? __mouseArea : null

        onPressed: {
            priv.pressedPosition = mouse.x
        }

        onMouseXChanged: {
            var mouseOffset = priv.pressedPosition - mouse.x
            if ((priv.pressedPosition != -1) && !priv.held && ( Math.abs(mouseOffset) >= priv.mouseMoveOffset)) {
                priv.startDrag();
            }
        }

        onClicked: {
            if (body.x != 0) {
                priv.resetDrag()
            }
        }

        onReleased: {
            priv.endDrag();
        }

        onCanceled: {
            priv.endDrag();
        }
    }
}