This file is indexed.

/usr/share/peruse/qml/PeruseContextDrawer.qml is in peruse-common 1.2+dfsg-2ubuntu1.

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
/*
 *   Copyright 2016 Dan Leinir Turthra Jensen <admin@leinir.dk>
 *
 *   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 Library 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.1
import QtQuick.Layouts 1.2
import QtQuick.Controls 1.4 as QtControls
import org.kde.kirigami 1.0

// Modified version of the ContextDrawer component found in the Plasma Components
// In addition to the original drawer, this will allow you to optionally insert an item
// at the top of the menu, which can be any item, but originally designed for the thumbnail
// navigation system for comic book pages found in Peruse.
OverlayDrawer {
    id: root

    /**
     * title: string
     * A title for the action list that will be shown to the user when opens the drawer
     */
    property string title: typeof i18n !== "undefined" ? i18n("Actions") : "Actions"

    // This can be any list of objects which can be a child of a column
    property Item topContent: pageStack.currentItem && pageStack.currentItem.contextualTopItems ? pageStack.currentItem.contextualTopItems : null;

    /**
     * actions: list<Action>
     * This can be any type of object that a ListView can accept as model. 
     * It expects items compatible with either QAction or Kirigami Action
     */
    property var actions: pageStack.currentItem ? pageStack.currentItem.contextualActions : null
    enabled: actions !== undefined && actions.length > 0;
    edge: Qt.RightEdge

    handleVisible: applicationWindow() ? applicationWindow().controlsVisible : true

    Connections {
        target: pageStack
        onCurrentItemChanged: {
            actions = pageStack.currentItem.contextualActions
        }
    }

    contentItem: QtControls.StackView {
        id: sidebarStack;
        implicitWidth: Units.gridUnit * 20
        initialItem: sidebarPage;
    }
    Component {
        id: sidebarPage;
        Item {
            id: localRoot;
            implicitWidth: Units.gridUnit * 20
            property Item topContent: root.topContent;
            property var actions: root.actions;
            property int level: 0
            Item {
                id: topContainer;
                anchors {
                    top: parent.top;
                    left: parent.left;
                    right: parent.right;
                    bottom: menu.top;
                }
                children: localRoot.topContent;
            }
            Column {
                id: menu
                anchors {
                    left: parent.left;
                    right: parent.right;
                    bottom: parent.bottom;
                }
                height: childrenRect.height;
                Item {
                    height: localRoot.level === 0 ? heading.height : 0;
                    visible: height > 0;
                    width: menu.width
                    Heading {
                        id: heading
                        anchors {
                            left: parent.left
                            right: parent.right
                            margins: Units.largeSpacing
                        }
                        elide: Text.ElideRight
                        level: 2
                        text: root.title
                    }
                }
                Repeater {
                    model: localRoot.actions;
                    delegate: Item {
                        width: menu.width;
                        height: listItemHeader.visible ? listItemHeader.height : (listItem.visible ? listItem.height : (modelData.trigger === undefined ? Units.largeSpacing : 0));
                        Item {
                            id: listItemHeader;
                            anchors { top: parent.top; left: parent.left; }
                            visible: modelData.trigger === undefined && heading.text !== "";
                            width: menu.width
                            height: heading.height;
                            Heading {
                                id: heading
                                anchors {
                                    left: parent.left
                                    right: parent.right
                                    margins: Units.largeSpacing
                                }
                                elide: Text.ElideRight
                                level: 2
                                text: model && model.text ? model.text : (modelData.text ? modelData.text : "")
                            }
                        }
                        BasicListItem {
                            id: listItem;
                            width: parent.width;
                            anchors { top: parent.top; left: parent.left; }
                            property Item drawerRoot: root;
                            checked: modelData.checked ? modelData.checked : false;
                            icon: modelData.iconName
                            supportsMouseEvents: true
                            label: model && model.text ? model.text : (modelData.text ? modelData.text : "")
                            // this looks very silly - model.enabled /can/ be undefined, but enabled (and visible) only take bools, so...
                            enabled: model ? (model.enabled ? model.enabled : false) : (modelData.enabled ? modelData.enabled : true)
                            visible: (model ? (model.visible ? model.visible : false) : (modelData.visible ? modelData.visible : true)) && !listItemHeader.visible && text !== "";
                            opacity: enabled ? 1.0 : 0.6
                            Icon {
                                anchors {
                                    verticalCenter: parent.verticalCenter
                                    right: parent.right
                                }
                                height: Units.iconSizes.smallMedium
                                selected: listItem.checked || listItem.pressed
                                width: height
                                source: "go-next"
                                visible: modelData.children!==undefined && modelData.children.length > 0
                            }
                            onClicked: {
                                if (modelData.children!==undefined && modelData.children.length > 0) {
                                    sidebarStack.push(sidebarPage, { actions: modelData.children, "level": level + 1, topContent: null });
                                } else if (modelData && modelData.trigger !== undefined) {
                                    modelData.trigger();
                                } else {
                                    console.warning("Don't know how to trigger the action")
                                }
                            }
                        }
                    }
                }
                BasicListItem {
                    visible: level > 0
                    supportsMouseEvents: true
                    icon: "go-previous"
                    label: typeof i18n !== "undefined" ? i18n("Back") : "Back"
                    onClicked: sidebarStack.pop()
                }
            }
        }
    }
}