mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-21 12:35:52 +03:00
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:
commit
0208ec6b79
5 changed files with 77 additions and 2 deletions
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
50
src/gui/tray/UnifiedSearchPlaceholderView.qml
Normal file
50
src/gui/tray/UnifiedSearchPlaceholderView.qml
Normal 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
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue