This file is indexed.

/usr/share/kde4/apps/ktouch/qml/KeyItem.qml is in ktouch-data 4:4.13.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
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
/*
 *  Copyright 2012  Sebastian Gottfried <sebastiangottfried@web.de>
 *
 *  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; either version 2 of
 *  the License, or (at your option) any later version.
 *
 *  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.1
import Effects 1.0
import ktouch 1.0

Item {
    id: item

    property int keyIndex
    property KeyboardLayout keyboardLayout
    property bool isHighlighted: false
    property bool animateHighlight: true
    property bool enabled: true
    property bool pressed: false

    property AbstractKey key: item.keyboardLayout.key(item.keyIndex)
    property AbstractKey referenceKey: keyboardLayout.referenceKey

    function match(data) {
        var eventText = data
        var eventKey = -1
        if (typeof data === "object") {
            eventText = data.text
            eventKey = data.key
        }
        if (typeof data === "number") {
            eventText = ""
            eventKey = data
        }
        switch (key.keyType()) {
        case "key":
            for (var i = 0; i < key.keyCharCount; i++) {
                if (key.keyChar(i).value == eventText.charCodeAt(0)) {
                    return true;
                }
            }
            return false

        case "specialKey":
            switch (key.type) {
            case SpecialKey.Tab:
                return eventKey == Qt.Key_Tab
            case SpecialKey.Capslock:
                return eventKey == Qt.Key_CapsLock
            case SpecialKey.Shift:
                return eventKey == Qt.Key_Shift
            case SpecialKey.Backspace:
                return eventKey == Qt.Key_Backspace
            case SpecialKey.Return:
                return eventKey == Qt.Key_Return
            case SpecialKey.Space:
                return eventKey == Qt.Key_Space || eventText == " "
            }
            return false
        }
        return false;
    }

    function getTint(color) {
        // stupid hack to set alpha because in Qt Quick 1.1 it's impossible to access color components
        color = "#20" + ("" + color).substr(1)
        return color
    }

    property color tint: key && key.keyType() == "key"?
        getTint(preferences.fingerColor(key.fingerIndex)):
        "#00000000"

    x: Math.round(key.left * horizontalScaleFactor)
    y: Math.round(key.top * verticalScaleFactor)
    width: Math.round(key.width * horizontalScaleFactor)
    height: Math.round(key.height * verticalScaleFactor)

    state: enabled? (pressed? "pressed": "normal"): "disabled"

    onIsHighlightedChanged: {
        if (!animateHighlight) {
            shadow.state = isHighlighted? "highlighted1": "normal"
        }
    }

    Rectangle {
        id: shadow

        property int marginSize: 0

        anchors.centerIn: parent
        width: item.width + marginSize
        height: item.height + marginSize
        smooth: true
        radius: body.radius
        effect: DropShadow {
            color: shadow.color
            blurRadius: 5
            xOffset: 0
            yOffset: 0

            Behavior on blurRadius {
                enabled: animateHighlight
                NumberAnimation {
                    duration: 150
                    easing.type: Easing.InOutQuad
                }
            }
        }

        state: "normal"

        states: [
            State {
                name: "normal"
                PropertyChanges {
                    target: shadow
                    color: "#000"
                    marginSize: 0
                }
                PropertyChanges {
                    target: shadow.effect
                    blurRadius: 10
                }
            },
            State {
                name: "highlighted1"
                PropertyChanges {
                    target: shadow
                    color: "#54A7F0"
                    marginSize: 4
                }
                PropertyChanges {
                    target: shadow.effect
                    blurRadius: 15
                }
            },
            State {
                name: "highlighted2"
                PropertyChanges {
                    target: shadow
                    color: "#54A7F0"
                    marginSize: 0
                }
                PropertyChanges {
                    target: shadow.effect
                    blurRadius: 15
                }
            }
        ]

        Behavior on marginSize {
            enabled: animateHighlight
            NumberAnimation {
                duration: 150
                easing.type: Easing.InOutQuad
            }
        }

        Behavior on color {
            enabled: animateHighlight
            ColorAnimation { duration: 150 }
        }


        SequentialAnimation {
            id: pulseAnimation
            loops: Animation.Infinite
            running: isHighlighted && animateHighlight
            onRunningChanged: {
                if (!running)
                    shadow.state = "normal"
            }

            ScriptAction {
                script: shadow.state = "highlighted1"
            }
            PauseAnimation { duration: 850 }
            ScriptAction {
                script: shadow.state = "highlighted2"
            }
            PauseAnimation { duration: 150 }
        }

    }

    Rectangle {
        id: body
        anchors.fill: parent
        radius: Math.max(3, Math.min(referenceKey.height, referenceKey.width) / 10 * Math.min(horizontalScaleFactor, verticalScaleFactor))
        border.width: 1
        border.color: "#000"
        smooth: true

        gradient: Gradient {
            GradientStop { id: gradientStop0; position: 0.0; }
            GradientStop { id: gradientStop1; position: 0.5; }
            GradientStop { id: gradientStop2; position: 1.0; }
        }

        Rectangle {
            id: hapticMarker
            anchors {
                bottom: parent.bottom
                horizontalCenter: parent.horizontalCenter
                bottomMargin: 4
            }
            visible: item.key.keyType() == "key" && item.key.hasHapticMarker
            height: 3
            width: body.width / 3
            radius: 1
            color: topLeftLabel.color
            border {
                width: 1
                color: topLeftLabel.color
            }
        }
    }

    Item {
        anchors.topMargin: Math.max(referenceKey.width / 20, 3 * verticalScaleFactor)
        anchors.bottomMargin: anchors.topMargin
        anchors.leftMargin: Math.max(referenceKey.width / 10, 5 * horizontalScaleFactor)
        anchors.rightMargin: anchors.leftMargin
        anchors.fill: parent
        KeyLabel {
            id: topLeftLabel
            key: item.key
            position: KeyChar.TopLeft
        }
        KeyLabel {
            id: topRightLabel
            anchors.right: parent.right
            key: item.key
            position: KeyChar.TopRight
        }
        KeyLabel {
            id: bottomLeftLabel
            anchors.bottom: parent.bottom
            key: item.key
            position: KeyChar.BottomLeft
        }
        KeyLabel {
            id: bottomRightLabel
            anchors.right: parent.right
            anchors.bottom: parent.bottom
            key: item.key
            position: KeyChar.BottomRight
        }
    }

    states: [
        State {
            name: "normal"
            PropertyChanges {
                target: gradientStop0
                color: Qt.tint("#f0f0f0", item.tint)
            }
            PropertyChanges {
                target: gradientStop1
                color: Qt.tint("#d5d5d5", item.tint)
            }
            PropertyChanges {
                target: gradientStop2
                color: Qt.tint("#ccc", item.tint)
            }
        },
        State {
            name: "pressed"
            PropertyChanges {
                target: gradientStop0
                color: Qt.tint("#666", item.tint)
            }
            PropertyChanges {
                target: gradientStop1
                color: Qt.tint("#888", item.tint)
            }
            PropertyChanges {
                target: gradientStop2
                color: Qt.tint("#999", item.tint)
            }
        },
        State {
            name: "disabled"
            PropertyChanges {
                target: gradientStop0
                color: Qt.tint("#444", item.tint)
            }
            PropertyChanges {
                target: gradientStop1
                color: Qt.tint("#333", item.tint)
            }
            PropertyChanges {
                target: gradientStop2
                color: Qt.tint("#222", item.tint)
            }
        }
    ]
}