/usr/share/unity8/Dash/DashPageHeader.qml is in unity8-common 8.12+16.04.20160401-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 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | /*
* Copyright (C) 2013,2015 Canonical, Ltd.
*
* 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; version 3.
*
* 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 2.4
import Ubuntu.Components 1.3
import Ubuntu.Components.Themes.Ambiance 1.3
import Ubuntu.Components.ListItems 1.3
import "../Components"
Item {
id: root
objectName: "pageHeader"
implicitHeight: headerContainer.height + signatureLineHeight
readonly property real signatureLineHeight: showSignatureLine ? units.gu(2) : 0
property int activeFiltersCount: 0
property bool scopeHasFilters: false
property bool showBackButton: false
property bool backIsClose: false
property string title
property var extraPanel
property string navigationTag
property bool storeEntryEnabled: false
property bool searchEntryEnabled: false
property bool settingsEnabled: false
property bool favoriteEnabled: false
property bool favorite: false
property ListModel searchHistory
property alias searchQuery: searchTextField.text
property alias searchHint: searchTextField.placeholderText
property bool showSignatureLine: true
property int paginationCount: 0
property int paginationIndex: -1
property var scopeStyle: null
signal clearSearch(bool keepPanelOpen)
signal backClicked()
signal storeClicked()
signal settingsClicked()
signal favoriteClicked()
signal searchTextFieldFocused()
signal showFiltersPopup(var item)
onScopeStyleChanged: refreshLogo()
onSearchQueryChanged: {
// Make sure we are at the search page if the search query changes behind our feet
if (searchQuery) {
headerContainer.showSearch = true;
}
}
onNavigationTagChanged: {
// Make sure we are at the search page if the navigation tag changes behind our feet
if (navigationTag) {
headerContainer.showSearch = true;
}
}
function triggerSearch() {
if (searchEntryEnabled) {
headerContainer.showSearch = true;
searchTextField.forceActiveFocus();
}
}
function closePopup(keepFocus) {
if (extraPanel.visible) {
extraPanel.visible = false;
} else if (!keepFocus) {
unfocus();
}
if (!searchTextField.text && !root.navigationTag && searchHistory.count == 0) {
headerContainer.showSearch = false;
}
}
function resetSearch(keepFocus) {
if (searchHistory) {
searchHistory.addQuery(searchTextField.text);
}
searchTextField.text = "";
closePopup(keepFocus);
}
function unfocus() {
searchTextField.focus = false;
if (!searchTextField.text && !root.navigationTag) {
headerContainer.showSearch = false;
}
}
function openPopup() {
if (openSearchAnimation.running) {
openSearchAnimation.openPopup = true;
} else if (extraPanel.hasContents) {
// Show extraPanel
extraPanel.visible = true;
}
}
function refreshLogo() {
if (root.scopeStyle ? root.scopeStyle.headerLogo != "" : false) {
header.contents = imageComponent.createObject();
} else if (header.contents) {
header.contents.destroy();
header.contents = null;
}
}
Connections {
target: root.scopeStyle
onHeaderLogoChanged: root.refreshLogo()
}
InverseMouseArea {
anchors { fill: parent; margins: units.gu(1); bottomMargin: units.gu(3) + (extraPanel ? extraPanel.height : 0) }
visible: headerContainer.showSearch
onPressed: {
extraPanel.visible = false;
closePopup(/* keepFocus */false);
mouse.accepted = false;
}
}
Flickable {
id: headerContainer
objectName: "headerContainer"
clip: contentY < height
anchors { left: parent.left; top: parent.top; right: parent.right }
height: header.contentHeight
contentHeight: headersColumn.height
interactive: false
contentY: showSearch ? 0 : height
property bool showSearch: false
Background {
id: background
objectName: "headerBackground"
style: scopeStyle.headerBackground
}
Behavior on contentY {
UbuntuNumberAnimation {
id: openSearchAnimation
property bool openPopup: false
onRunningChanged: {
if (!running && openSearchAnimation.openPopup) {
openSearchAnimation.openPopup = false;
root.openPopup();
}
}
}
}
Column {
id: headersColumn
anchors { left: parent.left; right: parent.right }
PageHeadStyle {
// FIXME: Replace PageHeadStyle from the Ambiance theme by the new PageHeader from Ubuntu.Components 1.3.
id: searchHeader
anchors { left: parent.left; right: parent.right }
opacity: headerContainer.clip || headerContainer.showSearch ? 1 : 0 // setting visible false cause column to relayout
__separator_visible: false
// Required to keep PageHeadStyle noise down as it expects the Page's properties around.
property var styledItem: searchHeader
property color dividerColor: "transparent" // Doesn't matter as we don't have PageHeadSections
property color panelColor: background.topColor
panelForegroundColor: config.foregroundColor
backgroundColor: "transparent"
config: PageHeadConfiguration {
foregroundColor: root.scopeStyle ? root.scopeStyle.headerForeground : theme.palette.normal.baseText
}
property var contents: Item {
anchors.fill: parent
TextField {
id: searchTextField
objectName: "searchTextField"
inputMethodHints: Qt.ImhNoPredictiveText
hasClearButton: false
anchors {
top: parent.top
topMargin: units.gu(1)
left: parent.left
bottom: parent.bottom
bottomMargin: units.gu(1)
right: settingsButton.left
rightMargin: settingsButton.visible ? 0 : units.gu(2)
}
primaryItem: Rectangle {
color: "#F5F4F5"
width: root.navigationTag != "" ? tagLabel.width + units.gu(2) : 0
height: root.navigationTag != "" ? tagLabel.height + units.gu(1) : 0
radius: units.gu(0.5)
Label {
id: tagLabel
text: root.navigationTag
anchors.centerIn: parent
color: "#333333"
}
}
secondaryItem: AbstractButton {
id: clearButton
height: searchTextField.height
width: height
enabled: searchTextField.text.length > 0 || root.navigationTag != ""
Image {
objectName: "clearIcon"
anchors.fill: parent
anchors.margins: units.gu(1)
source: "image://theme/clear"
opacity: parent.enabled
visible: opacity > 0
Behavior on opacity {
UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
}
}
onClicked: {
root.clearSearch(true);
}
}
onActiveFocusChanged: {
if (activeFocus) {
root.searchTextFieldFocused();
root.openPopup();
}
}
onTextChanged: {
if (text != "") {
closePopup(/* keepFocus */true);
}
}
}
AbstractButton {
id: settingsButton
objectName: "settingsButton"
width: root.scopeHasFilters ? height : 0
visible: width > 0
anchors {
top: parent.top
right: cancelButton.left
bottom: parent.bottom
rightMargin: units.gu(-1)
}
Icon {
anchors.fill: parent
anchors.margins: units.gu(2)
name: "filters"
color: root.activeFiltersCount > 0 ? UbuntuColors.orange : Qt.rgba(0.0, 0.0, 0.0, 0.0)
}
onClicked: {
root.showFiltersPopup(settingsButton);
}
}
AbstractButton {
id: cancelButton
width: cancelLabel.width + cancelLabel.anchors.rightMargin + cancelLabel.anchors.leftMargin
anchors {
top: parent.top
right: parent.right
bottom: parent.bottom
}
onClicked: {
root.clearSearch(false);
headerContainer.showSearch = false;
}
Label {
id: cancelLabel
text: i18n.tr("Cancel")
color: header.panelForegroundColor
verticalAlignment: Text.AlignVCenter
anchors {
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: units.gu(2)
leftMargin: units.gu(1)
}
}
}
}
}
PageHeadStyle {
// FIXME: Replace PageHeadStyle from the Ambiance theme by the new PageHeader from Ubuntu.Components 1.3.
id: header
objectName: "innerPageHeader"
anchors { left: parent.left; right: parent.right }
height: headerContainer.height
opacity: headerContainer.clip || !headerContainer.showSearch ? 1 : 0 // setting visible false cause column to relayout
__separator_visible: false
property var styledItem: header
property color dividerColor: "transparent" // Doesn't matter as we don't have PageHeadSections
property color panelColor: background.topColor
panelForegroundColor: config.foregroundColor
backgroundColor: "transparent"
config: PageHeadConfiguration {
title: root.title
foregroundColor: root.scopeStyle ? root.scopeStyle.headerForeground : theme.palette.normal.baseText
backAction: Action {
iconName: backIsClose ? "close" : "back"
visible: root.showBackButton
onTriggered: root.backClicked()
}
actions: [
Action {
objectName: "store"
text: i18n.ctr("Button: Open the Ubuntu Store", "Store")
iconName: "ubuntu-store-symbolic"
visible: root.storeEntryEnabled
onTriggered: root.storeClicked();
},
Action {
objectName: "search"
text: i18n.ctr("Button: Start a search in the current dash scope", "Search")
iconName: "search"
visible: root.searchEntryEnabled
onTriggered: {
headerContainer.showSearch = true;
searchTextField.forceActiveFocus();
}
},
Action {
objectName: "settings"
text: i18n.ctr("Button: Show the current dash scope settings", "Settings")
iconName: "settings"
visible: root.settingsEnabled
onTriggered: root.settingsClicked()
},
Action {
objectName: "favorite"
text: root.favorite ? i18n.tr("Remove from Favorites") : i18n.tr("Add to Favorites")
iconName: root.favorite ? "starred" : "non-starred"
visible: root.favoriteEnabled
onTriggered: root.favoriteClicked()
}
]
}
property var contents: null
Component.onCompleted: root.refreshLogo()
Component {
id: imageComponent
Item {
anchors { fill: parent; topMargin: units.gu(1.5); bottomMargin: units.gu(1.5) }
clip: true
Image {
objectName: "titleImage"
anchors.fill: parent
source: root.scopeStyle ? root.scopeStyle.headerLogo : ""
fillMode: Image.PreserveAspectFit
horizontalAlignment: Image.AlignLeft
sourceSize.height: height
}
}
}
}
}
}
Rectangle {
id: bottomBorder
visible: showSignatureLine
anchors {
top: headerContainer.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
}
color: root.scopeStyle ? root.scopeStyle.headerDividerColor : "#e0e0e0"
Rectangle {
anchors {
top: parent.top
left: parent.left
right: parent.right
}
height: units.dp(1)
color: Qt.darker(parent.color, 1.1)
}
}
Row {
visible: bottomBorder.visible
spacing: units.gu(.5)
Repeater {
objectName: "paginationRepeater"
model: root.paginationCount
Image {
objectName: "paginationDots_" + index
height: units.gu(1)
width: height
source: (index == root.paginationIndex) ? "graphics/pagination_dot_on.png" : "graphics/pagination_dot_off.png"
}
}
anchors {
top: headerContainer.bottom
horizontalCenter: headerContainer.horizontalCenter
topMargin: units.gu(.5)
}
}
// FIXME this doesn't work with solid scope backgrounds due to z-ordering
Item {
id: bottomHighlight
visible: bottomBorder.visible
anchors {
top: parent.bottom
left: parent.left
right: parent.right
}
z: 1
height: units.dp(1)
opacity: 0.6
Rectangle {
anchors.fill: parent
color: if (root.scopeStyle) {
Qt.lighter(Qt.rgba(root.scopeStyle.background.r,
root.scopeStyle.background.g,
root.scopeStyle.background.b, 1.0), 1.2);
} else "#CCFFFFFF"
}
}
}
|