Merge pull request #7512 from nextcloud/bugfix/search-view-on-focus

Pull up the unified search view immediately on unified search field focus
This commit is contained in:
Matthieu Gallien 2024-11-21 10:14:51 +01:00 committed by GitHub
commit 0208ec6b79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 77 additions and 2 deletions

View file

@ -38,6 +38,7 @@
<file>src/gui/tray/UnifiedSearchResultItemSkeletonGradientRectangle.qml</file>
<file>src/gui/tray/UnifiedSearchResultListItem.qml</file>
<file>src/gui/tray/UnifiedSearchResultNothingFound.qml</file>
<file>src/gui/tray/UnifiedSearchPlaceholderView.qml</file>
<file>src/gui/tray/UnifiedSearchResultSectionItem.qml</file>
<file>src/gui/tray/ActivityItemContextMenu.qml</file>
<file>src/gui/tray/ActivityItemActions.qml</file>

View file

@ -229,6 +229,7 @@ ApplicationWindow {
|| unifiedSearchResultNothingFound.visible
|| unifiedSearchResultsErrorLabel.visible
|| unifiedSearchResultsListView.visible
|| trayWindowUnifiedSearchInputContainer.activateSearchFocus
anchors.fill: parent
anchors.margins: Style.trayWindowBorderWidth
@ -237,6 +238,11 @@ ApplicationWindow {
Accessible.role: Accessible.Grouping
Accessible.name: qsTr("Nextcloud desktop main dialog")
MouseArea {
anchors.fill: parent
onClicked: forceActiveFocus()
}
TrayWindowHeader {
id: trayWindowHeader
@ -249,6 +255,8 @@ ApplicationWindow {
UnifiedSearchInputContainer {
id: trayWindowUnifiedSearchInputContainer
property bool activateSearchFocus: activeFocus
anchors.top: trayWindowHeader.bottom
anchors.left: trayWindowMainItem.left
anchors.right: trayWindowMainItem.right
@ -261,6 +269,8 @@ ApplicationWindow {
isSearchInProgress: UserModel.currentUser.unifiedSearchResultsListModel.isSearchInProgress
onTextEdited: { UserModel.currentUser.unifiedSearchResultsListModel.searchTerm = trayWindowUnifiedSearchInputContainer.text }
onClearText: { UserModel.currentUser.unifiedSearchResultsListModel.searchTerm = "" }
onActiveFocusChanged: activateSearchFocus = activeFocus && focusReason !== Qt.TabFocusReason && focusReason !== Qt.BacktabFocusReason
Keys.onEscapePressed: activateSearchFocus = false
}
Rectangle {
@ -286,6 +296,18 @@ ApplicationWindow {
anchors.margins: Style.trayHorizontalMargin
}
UnifiedSearchPlaceholderView {
id: unifiedSearchPlaceholderView
anchors.top: bottomUnifiedSearchInputSeparator.bottom
anchors.left: trayWindowMainItem.left
anchors.right: trayWindowMainItem.right
anchors.bottom: trayWindowMainItem.bottom
anchors.topMargin: Style.trayHorizontalMargin
visible: trayWindowUnifiedSearchInputContainer.activateSearchFocus && !UserModel.currentUser.unifiedSearchResultsListModel.searchTerm
}
UnifiedSearchResultNothingFound {
id: unifiedSearchResultNothingFound

View file

@ -0,0 +1,50 @@
/*
* Copyright (C) 2024 by Claudio Cambra <claudio.cambra@nextcloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
import QtQml
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Style
ColumnLayout {
id: root
spacing: Style.standardSpacing
Item {
Layout.fillWidth: true
Layout.fillHeight: true
}
Image {
source: "image://svgimage-custom-color/magnifying-glass.svg"
sourceSize.width: Style.trayWindowHeaderHeight / 2
sourceSize.height: Style.trayWindowHeaderHeight / 2
Layout.alignment: Qt.AlignHCenter
}
EnforcedPlainTextLabel {
text: qsTr("Start typing to search")
font.pixelSize: Style.unifiedSearchPlaceholderViewSublineFontPixelSize
wrapMode: Text.Wrap
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
}
Item {
Layout.fillWidth: true
Layout.fillHeight: true
}
}

View file

@ -38,7 +38,7 @@ ColumnLayout {
EnforcedPlainTextLabel {
id: unifiedSearchResultsNoResultsLabel
text: qsTr("No results for")
font.pixelSize: Style.subLinePixelSize * 1.25
font.pixelSize: Style.unifiedSearchPlaceholderViewSublineFontPixelSize
wrapMode: Text.Wrap
Layout.fillWidth: true
Layout.preferredHeight: Style.trayWindowHeaderHeight / 2
@ -48,7 +48,7 @@ ColumnLayout {
EnforcedPlainTextLabel {
id: unifiedSearchResultsNoResultsLabelDetails
text: unifiedSearchResultNothingFoundContainer.text
font.pixelSize: Style.topLinePixelSize * 1.25
font.pixelSize: Style.unifiedSearchPlaceholderViewTitleFontPixelSize
wrapMode: Text.Wrap
maximumLineCount: 2
elide: Text.ElideRight

View file

@ -141,6 +141,8 @@ QtObject {
readonly property int unifiedSearchResultSectionItemVerticalPadding: 8
readonly property int unifiedSearchResultNothingFoundHorizontalMargin: 10
readonly property int unifiedSearchInputContainerHeight: 40
readonly property int unifiedSearchPlaceholderViewTitleFontPixelSize: pixelSize * 1.25
readonly property int unifiedSearchPlaceholderViewSublineFontPixelSize: subLinePixelSize * 1.25
readonly property int radioButtonCustomMarginLeftInner: 4
readonly property int radioButtonCustomMarginLeftOuter: 5