Warning, /utilities/toad/src/ui/PageHeader.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2022 Felipe Kinoshita <kinofhek@gmail.com>
0002 // SPDX-License-Identifier: GPL-3.0-or-later
0003
0004 import QtQuick 2.15
0005 import QtQuick.Controls 2.15 as QQC2
0006 import QtQuick.Layouts 1.15
0007 import org.kde.kirigami 2.19 as Kirigami
0008
0009 import org.kde.tasks 1.0
0010
0011 RowLayout {
0012 id: pageHeader
0013
0014 required property TasksModel tasksModel
0015
0016 Layout.fillWidth: true
0017 spacing: 0
0018
0019 QQC2.Label {
0020 Layout.alignment: Qt.AlignLeft
0021 Layout.leftMargin: Kirigami.Units.largeSpacing
0022 text: {
0023 if (list.count == 0) {
0024 return ""
0025 } else {
0026 return page.searching ? i18np("1 result", "%1 results", list.count) : i18np("1 task", "%1 tasks", list.count)
0027 }
0028 }
0029
0030 HoverHandler {
0031 id: hoverHandler
0032 }
0033
0034 QQC2.ToolTip.visible: hoverHandler.hovered && pageHeader.tasksModel.completedTasks > 0
0035 QQC2.ToolTip.text: i18np("1 task completed", "%1 tasks completed", pageHeader.tasksModel.completedTasks)
0036 QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0037 }
0038
0039 Item {
0040 Layout.fillWidth: true
0041 }
0042
0043 QQC2.ToolButton {
0044 text: i18n("Clear All")
0045 icon.name: "edit-clear-all"
0046 onClicked: pageHeader.tasksModel.clear()
0047 enabled: list.count > 0
0048 }
0049
0050 QQC2.ToolButton {
0051 display: QQC2.AbstractButton.IconOnly
0052 action: Kirigami.Action {
0053 text: i18n("Search")
0054 icon.name: "search"
0055 checked: page.searching
0056 onTriggered: page.searching = !page.searching
0057 enabled: pageStack.layers.depth <= 1
0058 }
0059
0060 QQC2.ToolTip.visible: hovered
0061 QQC2.ToolTip.text: text
0062 QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0063 }
0064
0065 QQC2.ToolButton {
0066 display: QQC2.AbstractButton.IconOnly
0067 action: Kirigami.Action {
0068 text: i18n("About Tasks")
0069 icon.name: "help-about"
0070 shortcut: StandardKey.HelpContents
0071 onTriggered: pageStack.layers.push("About.qml")
0072 enabled: pageStack.layers.depth <= 1
0073 }
0074
0075 QQC2.ToolTip.visible: hovered
0076 QQC2.ToolTip.text: text
0077 QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0078 }
0079 }