Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull up the unified search view immediately on unified search field focus #7512

Merged
merged 8 commits into from
Nov 21, 2024
1 change: 1 addition & 0 deletions resources.qrc
Original file line number Diff line number Diff line change
@@ -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>
22 changes: 22 additions & 0 deletions src/gui/tray/MainWindow.qml
Original file line number Diff line number Diff line change
@@ -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 changes: 50 additions & 0 deletions src/gui/tray/UnifiedSearchPlaceholderView.qml
Original file line number Diff line number Diff line change
@@ -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
}
}
4 changes: 2 additions & 2 deletions src/gui/tray/UnifiedSearchResultNothingFound.qml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions theme/Style/Style.qml
Original file line number Diff line number Diff line change
@@ -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