diff --git a/desktoppackage/contents/explorer/WidgetExplorer.qml b/desktoppackage/contents/explorer/WidgetExplorer.qml --- a/desktoppackage/contents/explorer/WidgetExplorer.qml +++ b/desktoppackage/contents/explorer/WidgetExplorer.qml @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.2 +import QtQuick 2.7 import QtQuick.Controls 1.1 import org.kde.plasma.components 2.0 as PlasmaComponents @@ -198,6 +198,7 @@ RowLayout { id: topBar + spacing: units.gridUnit * 0.5 anchors { top: parent.top left: parent.left @@ -208,34 +209,16 @@ id: header property bool showingSearch: false Layout.fillWidth: true - Layout.minimumHeight: Math.max(heading.height, searchInput.height) Layout.alignment: Qt.AlignVCenter PlasmaExtras.Title { id: heading anchors.verticalCenter: parent.verticalCenter text: i18nd("plasma_shell_org.kde.plasma.desktop", "Widgets") width: parent.width elide: Text.ElideRight - visible: !header.showingSearch - } - PlasmaComponents.TextField { - id: searchInput - width: parent.width - clearButtonShown: true - anchors.verticalCenter: parent.verticalCenter - placeholderText: i18nd("plasma_shell_org.kde.plasma.desktop", "Search...") - onTextChanged: { - list.positionViewAtBeginning() - list.currentIndex = -1 - widgetExplorer.widgetsModel.searchTerm = text - header.showingSearch = (text != ""); - } - - Component.onCompleted: forceActiveFocus() - visible: header.showingSearch } } - + PlasmaComponents.ToolButton { id: searchButton iconSource: "edit-find" @@ -246,9 +229,13 @@ onCheckedChanged: { if (!checked) { searchInput.text = ""; - } + newSearchRow.height = 0; + widgetExplorer.widgetsModel.searchTerm = ""; + } else { + newSearchRow.height = units.gridUnit * 2 } } + } PlasmaComponents.ToolButton { id: categoryButton @@ -266,6 +253,40 @@ onClicked: main.closed() } } + + RowLayout { + id: newSearchRow + anchors.top: topBar.bottom + Layout.fillWidth: true + Layout.bottomMargin: heading.height + Layout.alignment: Qt.AlignVCenter + + // height: 0 + visible: heading.showingSearch + + Item { + id: searchBarContainer + anchors.top: topBar.bottom + Layout.fillWidth: true + visible: header.showingSearch + + PlasmaComponents.TextField { + id: searchInput + // full width borrowed from panel definition + width: Math.max(heading.paintedWidth, units.iconSizes.enormous * 2 + units.smallSpacing * 4 + units.gridUnit * 2) + + clearButtonShown: true + placeholderText: i18nd("plasma_shell_org.kde.plasma.desktop", "Search...") + onTextChanged: { + list.positionViewAtBeginning() + list.currentIndex = -1 + widgetExplorer.widgetsModel.searchTerm = text + } + + Component.onCompleted: forceActiveFocus() + } + } + } Timer { id: setModelTimer @@ -276,11 +297,12 @@ PlasmaExtras.ScrollArea { anchors { - top: topBar.bottom + top: newSearchRow.bottom left: parent.left right: parent.right bottom: bottomBar.top - topMargin: units.smallSpacing + // prevent top of scroll area from overlapping search bar + topMargin: units.largeSpacing * 1.5 bottomMargin: units.smallSpacing } @@ -386,4 +408,3 @@ */ } } -