Warning, /utilities/toad/src/ui/Footer.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 Kirigami.ActionTextField { 0012 id: control 0013 0014 required property TasksModel tasksModel 0015 property bool searching: page.searching 0016 0017 onSearchingChanged: { 0018 if (page.searching) { 0019 forceActiveFocus() 0020 0021 if (text == "/") { 0022 return 0023 } 0024 text = text.length <= 0 ? "/" : `/${text}` 0025 } else { 0026 text = text.slice(1) 0027 } 0028 } 0029 0030 placeholderText: i18n("Type the new task's title hereā¦") 0031 0032 function addTask() { 0033 if (page.searching) { 0034 return 0035 } 0036 if (text.length > 0 && text.trim()) { 0037 control.tasksModel.add(text) 0038 } 0039 text = "" 0040 } 0041 0042 rightActions: Kirigami.Action { 0043 id: rightAction 0044 icon.name: "list-add" 0045 visible: control.text.length > 0 0046 tooltip: i18n("Add Task") 0047 onTriggered: control.addTask() 0048 } 0049 onAccepted: control.addTask() 0050 onTextChanged: { 0051 if (text.startsWith("/")) { 0052 page.searching = true 0053 rightAction.visible = false 0054 page.currentSearchText = text 0055 } else { 0056 page.searching = false 0057 rightAction.visible = true 0058 } 0059 } 0060 0061 background: Rectangle { 0062 Kirigami.Theme.inherit: false 0063 Kirigami.Theme.colorSet: Kirigami.Theme.View 0064 color: Kirigami.Theme.backgroundColor 0065 Kirigami.Separator { 0066 anchors { 0067 top: parent.top 0068 left: parent.left 0069 right: parent.right 0070 } 0071 } 0072 } 0073 }