Warning, /plasma/discover/discover/qml/SearchField.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2017 Aleix Pol Gonzalez <aleixpol@blue-systems.com> 0003 * SPDX-FileCopyrightText: 2019 Carl Schwan <carl@carlschwan.eu> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 import QtQuick 0009 import QtQuick.Controls 0010 import org.kde.kirigami as Kirigami 0011 0012 Kirigami.SearchField { 0013 id: root 0014 0015 // for appium tests 0016 objectName: "searchField" 0017 0018 // Search operations are network-intensive, so we can't have search-as-you-type. 0019 // This means we should turn off auto-accept entirely, rather than having it on 0020 // with a delay. The result just isn't good. See Bug 445142. 0021 autoAccept: false 0022 0023 property QtObject page 0024 property string currentSearchText 0025 0026 placeholderText: (!enabled || !page || page.hasOwnProperty("isHome") || window.leftPage.name.length === 0) ? i18n("Search…") : i18n("Search in '%1'…", window.leftPage.name) 0027 0028 onAccepted: { 0029 text = text.replace(/\n/g, ' '); 0030 currentSearchText = text; 0031 } 0032 0033 function clearText() { 0034 text = ""; 0035 accepted(); 0036 } 0037 0038 Connections { 0039 ignoreUnknownSignals: true 0040 target: root.page 0041 0042 function onClearSearch() { 0043 root.clearText(); 0044 } 0045 } 0046 0047 Connections { 0048 target: applicationWindow() 0049 function onCurrentTopLevelChanged() { 0050 if (applicationWindow().currentTopLevel.length > 0) { 0051 root.clearText(); 0052 } 0053 } 0054 } 0055 }