/*SPDX-FileCopyrightText: 2013-2014 Eike Hein <hein@kde.org>SPDX-License-Identifier: GPL-2.0-or-later*/import QtQuickimport QtQuick.Layoutsimport org.kde.kirigami as Kirigamiimport org.kde.ksvg as KSvgimport org.kde.plasma.components as PlasmaComponents3import org.kde.plasma.plasmoidRowLayout {id: runnerResultsListsignal keyNavigationAtListEndsignal navigateLeftRequestedsignal navigateRightRequestedsignal interactionConcludedrequired property int indexproperty bool hoverEnabled: trueproperty alias currentIndex: runnerMatches.currentIndexproperty alias currentItem: runnerMatches.currentItemproperty alias count: runnerMatches.countproperty alias mainSearchField: runnerMatches.mainSearchFieldproperty alias model: runnerMatches.modelproperty alias listActiveFocus: runnerMatches.activeFocusreadonly property bool isFirstColumn: runnerResultsList.parent.visibleChildren[0] === runnerResultsList// the final visible child is the repeater, so need to subtract 2 to get the proper indexreadonly property bool isLastColumn: runnerResultsList.parent.visibleChildren[runnerResultsList.parent.visibleChildren.length - 2] === runnerResultsListfunction setDefaultCurrentIndex() {if (!runnerMatches.mainSearchField.activeFocus) {return}runnerMatches.currentIndex = isFirstColumn ? 0 : -1}onIsFirstColumnChanged: setDefaultCurrentIndex()Connections {target: runnerResultsList.modelfunction onQueryingChanged() { runnerResultsList.setDefaultCurrentIndex() }}spacing: Kirigami.Units.smallSpacingfunction giveFocus(focusReason): void {runnerMatches.forceActiveFocus(focusReason)}KSvg.SvgItem {id: vertLineLayout.fillHeight: truevisible: !runnerResultsList.isFirstColumnimagePath: "widgets/line"elementId: "vertical-line"}ColumnLayout {id: runnerInnerColumnLayout.fillHeight: trueLayout.fillWidth: trueLayout.minimumWidth: runnerMatches.Layout.minimumWidthLayout.maximumWidth: runnerMatches.Layout.maximumWidthspacing: Kirigami.Units.smallSpacingPlasmaComponents3.Label {id: headerLayout.fillWidth: truehorizontalAlignment: Text.AlignHCenterverticalAlignment: Text.AlignVCentertextFormat: Text.PlainTextwrapMode: Text.NoWrapelide: Text.ElideRightfont.weight: Font.Boldtext: (runnerMatches.model !== null) ? runnerMatches.model.name : ""}Item {Layout.fillHeight: truevisible: Plasmoid.configuration.alignResultsToBottom}ItemListView {id: runnerMatchesLayout.fillHeight: trueLayout.fillWidth: trueLayout.maximumHeight: Plasmoid.configuration.alignResultsToBottom ? contentHeight : -1implicitWidth: Kirigami.Units.gridUnit * 17Layout.minimumWidth: implicitWidthLayout.maximumWidth: implicitWidthinnerRightMargin: (runnerResultsList.isLastColumn && !runnerMatches.PlasmaComponents3.ScrollBar.vertical.visible) ? 0 : Kirigami.Units.smallSpacingAccessible.name: header.texthoverEnabled: runnerResultsList.hoverEnableddynamicResize: falseiconsEnabled: trueshowDescriptionInTooltip: truekeyNavigationWraps: !searchFieldPlaceholder.visibleresetOnExitDelay: 0onNavigateLeftRequested: runnerResultsList.navigateLeftRequested()onNavigateRightRequested: runnerResultsList.navigateRightRequested()onKeyNavigationAtListEnd: mainSearchField.forceActiveFocus(Qt.TabFocusReason)onInteractionConcluded: runnerResultsList.interactionConcluded()}Item {id: searchFieldPlaceholderimplicitHeight: runnerResultsList.mainSearchField.heightLayout.fillWidth: truevisible: runnerResultsList.isFirstColumn}}}