This file is indexed.

/usr/share/kde4/apps/knetwalk/qml/logic.js is in knetwalk 4:4.12.4-1.

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
/*
    Copyright 2013 Ashwin Rajeev <ashwin_rajeev@hotmail.com>

    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/>.
*/

var border = 40
var cellComponent = Qt.createComponent("Cell.qml");
var cableComponent = Qt.createComponent("Cable.qml");
var canvasComponent = Qt.createComponent("CanvasItem.qml");
var cells = []

function overlaySize() {
    size = (width > height)? height - border : width - border;
    return (size > 0)? size : 0;
}

function gridWidth() {
    var widthRatio = (width - border) / grid.columns;
    var heightRatio = (height - border) / grid.rows;
    var gWidth = grid.columns * Math.min(widthRatio, heightRatio);
    return (gWidth > 0)? gWidth : 0;
}

function gridHeight() {
    var widthRatio = (width - border) / grid.columns;
    var heightRatio = (height - border) / grid.rows;
    var gHeight = grid.rows * Math.min(widthRatio, heightRatio);
    return (gHeight > 0)? gHeight : 0;
}

function addCell(cable, type) {
    var cell = cellComponent.createObject(grid);
    cell.sprite = cable;
    cell.index = cells.length;
    cell.type = type
    if(cable != "") {
        cableComponent.createObject(cell);
        createNode(type, cell)
    }
    cells.push(cell);
}

function createNode(type, cell) {
    if(type != "none") {
        var node = canvasComponent.createObject(cell);
        node.spriteKey = function() { return cell.type };
        node.anchors.fill = cell;
        node.anchors.margins = function() { return cell.width / 10 };
    }
}

function reset(width, height) {
    selected = 0
    state = "running"
    while(cells.length > 0) {
        var cell = cells.pop();
        cell.visible = false;
        cell.destroy();
    }
    rows = height;
    columns = width;
}

function setSprite(index, cable, type) {
    cells[index].angle = 0;
    cells[index].sprite = cable;
    if (type != "none"){
        cells[index].type = type;
    }
}

function rotate(direction) {
    if(cells[selected].locked || cells[selected].sprite == "") {
        clicked(-1); //invalid click
    }
    else if(state == "running") {
        cells[selected].angle += (direction == "clockwise")? 90 : -90;
        clicked(selected);
    }
}

function unlockAll() {
    for(var i = 0; i < cells.length; i++) {
        cells[i].locked = false;
    }
}