This file is indexed.

/usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/plasma/workspace/components/BatteryIcon.qml is in plasma-workspace 4:5.8.6-2.1+deb9u1.

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
/*
 *   Copyright 2011 Viranch Mehta <viranch.mehta@gmail.com>
 *   Copyright 2013 Kai Uwe Broulik <kde@privat.broulik.de>
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Library General Public License as
 *   published by the Free Software Foundation; either version 2 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 Library General Public
 *   License along with this program; if not, write to the
 *   Free Software Foundation, Inc.,
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore

Item {
    property bool hasBattery
    property int percent
    property bool pluggedIn
    property string batteryType

    PlasmaCore.Svg {
        id: svg
        imagePath: "icons/battery"
        colorGroup: PlasmaCore.ColorScope.colorGroup
        onRepaintNeeded: { // needed to detect the hint item go away when theme changes
            batterySvg.visible = Qt.binding(function() { return !otherBatteriesSvg.visible && (!svg.hasElement("hint-dont-superimpose-fill") || !hasBattery); })
        }
    }

    PlasmaCore.SvgItem {
        id: batterySvg
        anchors.centerIn: parent
        width: units.roundToIconSize(Math.min(parent.width, parent.height))
        height: width
        svg: svg
        elementId: "Battery"
        visible: !otherBatteriesSvg.visible && (!svg.hasElement("hint-dont-superimpose-fill") || !hasBattery)
    }

    PlasmaCore.SvgItem {
        id: fillSvg
        anchors.fill: batterySvg
        svg: svg
        elementId: hasBattery ? fillElement(percent) : "Unavailable"
        visible: !otherBatteriesSvg.visible
    }

    function fillElement(p) {
        // We switched from having steps of 20 for the battery percentage to a more accurate
        // step of 10. This means we break other and older themes.
        // If the Fill10 element is not found, it is likely that the theme doesn't support
        // that and we use the older method of obtaining the fill element.
        if (!svg.hasElement("Fill10")) {
            print("No Fill10 element found in your theme's battery.svg - Using legacy 20% steps for battery icon");
            if (p >= 90) {
                return "Fill100";
            } else if (p >= 70) {
                return "Fill80";
            } else if (p >= 50) {
                return "Fill60";
            } else if (p > 20) {
                return "Fill40";
            } else if (p >= 10) {
                return "Fill20";
            } else {
                return "Fill0";
            }
        } else {
            if (p >= 95) {
                return "Fill100";
            } else if (p >= 85) {
                return "Fill90";
            } else if (p >= 75) {
                return "Fill80";
            } else if (p >= 65) {
                return "Fill70";
            } else if (p >= 55) {
                return "Fill60";
            } else if (p >= 45) {
                return "Fill50";
            } else if (p >= 35) {
                return "Fill40";
            } else if (p >= 25) {
                return "Fill30";
            } else if (p >= 15) {
                return "Fill20";
            } else if (p > 5) {
                return "Fill10";
            } else {
                return "Fill0";
            }
        }
    }

    PlasmaCore.SvgItem {
        anchors.fill: batterySvg
        svg: svg
        elementId: "AcAdapter"
        visible: pluggedIn && !otherBatteriesSvg.visible
    }

    PlasmaCore.IconItem {
        id: otherBatteriesSvg
        anchors.fill: batterySvg
        source: elementForType(batteryType)
        visible: source !== ""
    }

    function elementForType(t) {
        switch(t) {
            case "Mouse":
                return "input-mouse-battery";
            case "Keyboard":
                return "input-keyboard-battery";
            case "Pda":
                return "phone-battery";
            case "Phone":
                return "phone-battery";
            case "Ups":
                return "battery-ups";
            default:
                return "";
        }
    }
}