/usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami/ToolBarApplicationHeader.qml is in qml-module-org-kde-kirigami 1.1.0-2.
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 | /*
* Copyright 2015 Marco Martin <mart@kde.org>
*
* 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.5
import QtQuick.Controls 1.3 as Controls
import QtQuick.Layouts 1.2
import QtQuick.Controls.Private 1.0
import "private"
import org.kde.kirigami 1.0
/**
*
*/
ApplicationHeader {
id: header
preferredHeight: 34//spacer.height
maximumHeight: preferredHeight
Controls.ToolButton {
id: spacer
iconName: "go-previous"
visible: false
}
//FIXME: needs a property difinition to have its own type in qml
property string _internal: ""
pageDelegate: Item {
id: delegateItem
readonly property Page page: applicationWindow().pageStack.get(modelData)
property ListView view: ListView.view
readonly property bool current: __appWindow.pageStack.currentIndex == index
property Row layout
width: {
//more columns shown?
if (__appWindow.wideScreen) {
if (modelData == 0 && view.x > 0) {
return page.width - Math.max(0, view.x - __appWindow.contentItem.x);
} else {
return page.width;
}
} else {
return Math.min(view.width, delegateRoot.implicitWidth + Units.smallSpacing);
}
}
height: view.height
Component.onCompleted: {
layout = toolbarComponent.createObject(delegateItem)
}
Component {
id: toolbarComponent
Row {
id: layout
x: __appWindow.wideScreen ? (Math.min(delegateItem.width - width, Math.max(0, delegateItem.view.contentX - delegateItem.x))) : 0
Rectangle {
anchors.verticalCenter: parent.verticalCenter
color: Theme.textColor
opacity: 0.3
width: Units.devicePixelRatio
height: parent.height * 0.6
}
Controls.ToolButton {
anchors.verticalCenter: parent.verticalCenter
iconName: page && page.actions && page.actions.main ? page.actions.main.iconName : ""
text: page && page.actions && page.actions.main ? page.actions.main.text : ""
tooltip: page && page.actions && page.actions.main ? page.actions.main.text : ""
checkable: page && page.actions && page.actions.main && page.actions.main.checkable
checked: page && page.actions && page.actions.main && page.actions.main.checked
enabled: page && page.actions && page.actions.main && page.actions.main.enabled
opacity: enabled ? 1 : 0.4
visible: page && page.actions && page.actions.main && page.actions.main.visible
onClicked: page.actions.main.trigger();
}
Controls.ToolButton {
anchors.verticalCenter: parent.verticalCenter
iconName: page && page.actions && page.actions.left ? page.actions.left.iconName : ""
text: page && page.actions && page.actions.left ? page.actions.left.text : ""
tooltip: page && page.actions && page.actions.left ? page.actions.left.text : ""
checkable: page && page.actions && page.actions.left && page.actions.left.checkable
checked: page && page.actions && page.actions.left && page.actions.left.checked
enabled: page && page.actions && page.actions.left && page.actions.left.enabled
opacity: enabled ? 1 : 0.4
visible: page && page.actions && page.actions.left && page.actions.left && page.actions.left.visible
onClicked: page.actions.left.trigger();
}
Controls.ToolButton {
anchors.verticalCenter: parent.verticalCenter
iconName: page && page.actions && page.actions.right ? page.actions.right.iconName : ""
text: page && page.actions && page.actions.right ? page.actions.right.text : ""
tooltip: page && page.actions && page.actions.right ? page.actions.right.text : ""
checkable: page && page.actions && page.actions.right && page.actions.right.checkable
checked: page && page.actions && page.actions.right && page.actions.right.checked
enabled: page && page.actions && page.actions.right && page.actions.right.enabled
opacity: enabled ? 1 : 0.4
visible: page && page.actions && page.actions.right && page.actions.right && page.actions.right.visible
onClicked: page.actions.right.trigger();
}
Rectangle {
anchors.verticalCenter: parent.verticalCenter
color: Theme.textColor
opacity: 0.3
width: Units.devicePixelRatio
height: parent.height * 0.6
}
Repeater {
id: repeater
model: page && page.actions.contextualActions ? page.actions.contextualActions : null
delegate: Controls.ToolButton {
anchors.verticalCenter: parent.verticalCenter
iconName: modelData.iconName
text: modelData.text
tooltip: modelData.text
checkable: modelData.checkable
checked: modelData.checked
enabled: modelData.enabled
opacity: enabled ? 1 : 0.4
visible: modelData.visible && x+layout.x+width*2 < delegateItem.width
onClicked: modelData.trigger();
}
}
}
}
Heading {
x: __appWindow.wideScreen ? (Math.min(delegateItem.width - width, Math.max(0, delegateItem.view.contentX - delegateItem.x))) : 0
anchors.verticalCenter: parent.verticalCenter
visible: layout.width <= 0
opacity: delegateItem.current ? 1 : 0.4
color: Theme.textColor
elide: Text.ElideRight
text: page ? page.title : ""
font.pixelSize: parent.height / 1.6
}
Controls.ToolButton {
id: moreButton
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
}
//TODO: we need a kebab icon
iconName: "application-menu"
visible: menu.visibleChildren > 0
onClicked: page.actions.main
menu: Controls.Menu {
id: menu
property int visibleChildren: 0
Instantiator {
model: page && page.actions.contextualActions ? page.actions.contextualActions : null
delegate: Controls.MenuItem {
text: modelData ? modelData.text : ""
iconName: modelData.iconName
shortcut: modelData.shortcut
onTriggered: modelData.trigger();
//skip the 3 buttons and 2 separators
visible: !layout.children[index+5].visible && modelData.visible
enabled: modelData.enabled
onVisibleChanged: {
if (visible) {
menu.visibleChildren++;
} else {
menu.visibleChildren = Math.max(0, menu.visibleChildren-1);
}
}
}
onObjectAdded: {
menu.insertItem(index, object);
if (object.visible) {
menu.visibleChildren++;
}
}
onObjectRemoved: {
menu.removeItem(object);
if (object.visible) {
menu.visibleChildren = Math.max(0, menu.visibleChildren-1);
}
}
}
}
}
}
}
|