Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralex-z <blackslayer4@gmail.com>2021-09-09 14:33:57 +0300
committeralex-z <blackslayer4@gmail.com>2021-10-25 14:45:05 +0300
commitc1dab7e4cb254bf492b458c8c0c1bab8f55b17b0 (patch)
tree66681ba48f072166942867ee9021a7934d633e6f /src/gui/tray/Window.qml
parentb8e2dc24f3c1d67424dd363af85f9311a702dd78 (diff)
Unified Search via Tray window
Signed-off-by: alex-z <blackslayer4@gmail.com>
Diffstat (limited to 'src/gui/tray/Window.qml')
-rw-r--r--src/gui/tray/Window.qml176
1 files changed, 159 insertions, 17 deletions
diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml
index 5bda9242d..d85615adb 100644
--- a/src/gui/tray/Window.qml
+++ b/src/gui/tray/Window.qml
@@ -1,10 +1,11 @@
import QtQml 2.12
import QtQml.Models 2.1
-import QtQuick 2.9
+import QtQuick 2.15
import QtQuick.Window 2.3
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import QtGraphicalEffects 1.0
+import "../"
// Custom qml modules are in /theme (and included by resources.qrc)
import Style 1.0
@@ -101,6 +102,11 @@ Window {
Rectangle {
id: trayWindowBackground
+ property bool isUnifiedSearchActive: unifiedSearchResultsListViewSkeleton.visible
+ || unifiedSearchResultNothingFound.visible
+ || unifiedSearchResultsErrorLabel.visible
+ || unifiedSearchResultsListView.visible
+
anchors.fill: parent
radius: Systray.useNormalWindow ? 0.0 : Style.trayWindowRadius
border.width: Style.trayWindowBorderWidth
@@ -420,7 +426,7 @@ Window {
visible: UserModel.currentUser.statusMessage !== ""
width: Style.currentAccountLabelWidth
text: UserModel.currentUser.statusMessage !== ""
- ? UserModel.currentUser.statusMessage
+ ? UserModel.currentUser.statusMessage
: UserModel.currentUser.server
elide: Text.ElideRight
color: Style.ncTextColor
@@ -452,20 +458,20 @@ Window {
Item {
Layout.fillWidth: true
}
-
+
RowLayout {
id: openLocalFolderRowLayout
spacing: 0
Layout.preferredWidth: Style.trayWindowHeaderHeight
Layout.preferredHeight: Style.trayWindowHeaderHeight
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
-
+
HeaderButton {
id: openLocalFolderButton
visible: UserModel.currentUser.hasLocalFolder
icon.source: "qrc:///client/theme/white/folder.svg"
onClicked: UserModel.openCurrentAccountLocalFolder()
-
+
Rectangle {
id: folderStateIndicatorBackground
width: Style.folderStateIndicatorSize
@@ -476,7 +482,7 @@ Window {
radius: width*0.5
z: 1
}
-
+
Image {
id: folderStateIndicator
visible: UserModel.currentUser.hasLocalFolder
@@ -484,19 +490,17 @@ Window {
? Style.stateOnlineImageSource
: Style.stateOfflineImageSource
cache: false
-
+
anchors.top: openLocalFolderButton.verticalCenter
- anchors.left: openLocalFolderButton.horizontalCenter
+ anchors.left: openLocalFolderButton.horizontalCenter
sourceSize.width: Style.folderStateIndicatorSize
sourceSize.height: Style.folderStateIndicatorSize
-
+
Accessible.role: Accessible.Indicator
Accessible.name: UserModel.currentUser.isConnected ? qsTr("Connected") : qsTr("Disconnected")
z: 2
}
}
-
-
Accessible.role: Accessible.Button
Accessible.name: qsTr("Open local folder of current account")
@@ -504,11 +508,11 @@ Window {
HeaderButton {
id: trayWindowTalkButton
-
+
visible: UserModel.currentUser.serverHasTalk
icon.source: "qrc:///client/theme/white/talk-app.svg"
onClicked: UserModel.openCurrentAccountTalk()
-
+
Accessible.role: Accessible.Button
Accessible.name: qsTr("Open Nextcloud Talk in browser")
Accessible.onPressAction: trayWindowTalkButton.clicked()
@@ -517,7 +521,7 @@ Window {
HeaderButton {
id: trayWindowAppsButton
icon.source: "qrc:///client/theme/white/more-apps.svg"
-
+
onClicked: {
if(appsMenu.count <= 0) {
UserModel.openCurrentAccountServer()
@@ -566,20 +570,158 @@ Window {
}
} // Rectangle trayWindowHeaderBackground
+ UnifiedSearchInputContainer {
+ id: trayWindowUnifiedSearchInputContainer
+ height: Style.trayWindowHeaderHeight * 0.65
+
+ anchors {
+ top: trayWindowHeaderBackground.bottom
+ left: trayWindowBackground.left
+ right: trayWindowBackground.right
+
+ margins: {
+ top: 10
+ }
+ }
+
+ text: UserModel.currentUser.unifiedSearchResultsListModel.searchTerm
+ readOnly: !UserModel.currentUser.isConnected || UserModel.currentUser.unifiedSearchResultsListModel.currentFetchMoreInProgressProviderId
+ isSearchInProgress: UserModel.currentUser.unifiedSearchResultsListModel.isSearchInProgress
+ onTextEdited: { UserModel.currentUser.unifiedSearchResultsListModel.searchTerm = trayWindowUnifiedSearchInputContainer.text }
+ }
+
+ ErrorBox {
+ id: unifiedSearchResultsErrorLabel
+ visible: UserModel.currentUser.unifiedSearchResultsListModel.errorString && !unifiedSearchResultsListView.visible && ! UserModel.currentUser.unifiedSearchResultsListModel.isSearchInProgress && ! UserModel.currentUser.unifiedSearchResultsListModel.currentFetchMoreInProgressProviderId
+ text: UserModel.currentUser.unifiedSearchResultsListModel.errorString
+ color: Style.errorBoxBackgroundColor
+ backgroundColor: Style.errorBoxTextColor
+ borderColor: "transparent"
+ anchors.top: trayWindowUnifiedSearchInputContainer.bottom
+ anchors.left: trayWindowBackground.left
+ anchors.right: trayWindowBackground.right
+ anchors.margins: 10
+ }
+
+ UnifiedSearchResultNothingFound {
+ id: unifiedSearchResultNothingFound
+ visible: false
+ anchors.top: trayWindowUnifiedSearchInputContainer.bottom
+ anchors.left: trayWindowBackground.left
+ anchors.right: trayWindowBackground.right
+ anchors.topMargin: 10
+
+ text: UserModel.currentUser.unifiedSearchResultsListModel.searchTerm
+
+ property bool isSearchRunning: UserModel.currentUser.unifiedSearchResultsListModel.isSearchInProgress
+ property bool isSearchResultsEmpty: unifiedSearchResultsListView.count === 0
+ property bool nothingFound: text && isSearchResultsEmpty && !UserModel.currentUser.unifiedSearchResultsListModel.errorString
+
+ onIsSearchRunningChanged: {
+ if (unifiedSearchResultNothingFound.isSearchRunning) {
+ visible = false;
+ } else {
+ if (nothingFound) {
+ visible = true;
+ }
+ }
+ }
+
+ onTextChanged: {
+ visible = false;
+ }
+
+ onIsSearchResultsEmptyChanged: {
+ if (!unifiedSearchResultNothingFound.isSearchResultsEmpty) {
+ visible = false;
+ }
+ }
+ }
+
+ UnifiedSearchResultItemSkeletonContainer {
+ id: unifiedSearchResultsListViewSkeleton
+ visible: !unifiedSearchResultNothingFound.visible && !unifiedSearchResultsListView.visible && ! UserModel.currentUser.unifiedSearchResultsListModel.errorString && UserModel.currentUser.unifiedSearchResultsListModel.searchTerm
+ anchors.top: trayWindowUnifiedSearchInputContainer.bottom
+ anchors.left: trayWindowBackground.left
+ anchors.right: trayWindowBackground.right
+ anchors.bottom: trayWindowBackground.bottom
+ textLeftMargin: trayWindowBackground.Style.unifiedSearchResultTextLeftMargin
+ textRightMargin: trayWindowBackground.Style.unifiedSearchResultTextRightMargin
+ iconWidth: trayWindowBackground.Style.unifiedSearchResulIconWidth
+ iconLeftMargin: trayWindowBackground.Style.unifiedSearchResulIconLeftMargin
+ itemHeight: trayWindowBackground.Style.unifiedSearchItemHeight
+ titleFontSize: trayWindowBackground.Style.unifiedSearchResulTitleFontSize
+ sublineFontSize: trayWindowBackground.Style.unifiedSearchResulSublineFontSize
+ titleColor: trayWindowBackground.Style.unifiedSearchResulTitleColor
+ sublineColor: trayWindowBackground.Style.unifiedSearchResulSublineColor
+ iconColor: "#afafaf"
+ }
+
+ ListView {
+ id: unifiedSearchResultsListView
+ anchors.top: trayWindowUnifiedSearchInputContainer.bottom
+ anchors.left: trayWindowBackground.left
+ anchors.right: trayWindowBackground.right
+ anchors.bottom: trayWindowBackground.bottom
+ spacing: 4
+ visible: count > 0
+ clip: true
+ ScrollBar.vertical: ScrollBar {
+ id: unifiedSearchResultsListViewScrollbar
+ }
+
+ keyNavigationEnabled: true
+
+ reuseItems: true
+
+ Accessible.role: Accessible.List
+ Accessible.name: qsTr("Unified search results list")
+
+ model: UserModel.currentUser.unifiedSearchResultsListModel
+
+ delegate: UnifiedSearchResultListItem {
+ width: unifiedSearchResultsListView.width
+ height: trayWindowBackground.Style.unifiedSearchItemHeight
+ isSearchInProgress: unifiedSearchResultsListView.model.isSearchInProgress
+ textLeftMargin: trayWindowBackground.Style.unifiedSearchResultTextLeftMargin
+ textRightMargin: trayWindowBackground.Style.unifiedSearchResultTextRightMargin
+ iconWidth: trayWindowBackground.Style.unifiedSearchResulIconWidth
+ iconLeftMargin: trayWindowBackground.Style.unifiedSearchResulIconLeftMargin
+ titleFontSize: trayWindowBackground.Style.unifiedSearchResulTitleFontSize
+ sublineFontSize: trayWindowBackground.Style.unifiedSearchResulSublineFontSize
+ titleColor: trayWindowBackground.Style.unifiedSearchResulTitleColor
+ sublineColor: trayWindowBackground.Style.unifiedSearchResulSublineColor
+ currentFetchMoreInProgressProviderId: unifiedSearchResultsListView.model.currentFetchMoreInProgressProviderId
+ fetchMoreTriggerClicked: unifiedSearchResultsListView.model.fetchMoreTriggerClicked
+ resultClicked: unifiedSearchResultsListView.model.resultClicked
+ ListView.onPooled: isPooled = true
+ ListView.onReused: isPooled = false
+ }
+
+ section.property: "providerName"
+ section.criteria: ViewSection.FullString
+ section.delegate: UnifiedSearchResultSectionItem {
+ width: unifiedSearchResultsListView.width
+ }
+ }
+
SyncStatus {
id: syncStatus
- anchors.top: trayWindowHeaderBackground.bottom
+ visible: !trayWindowBackground.isUnifiedSearchActive
+
+ anchors.top: trayWindowUnifiedSearchInputContainer.bottom
anchors.left: trayWindowBackground.left
anchors.right: trayWindowBackground.right
}
ActivityList {
+ visible: !trayWindowBackground.isUnifiedSearchActive
anchors.top: syncStatus.bottom
anchors.left: trayWindowBackground.left
anchors.right: trayWindowBackground.right
anchors.bottom: trayWindowBackground.bottom
-
+
model: activityModel
onShowFileActivity: {
openFileActivityDialog(displayPath, absolutePath)
@@ -598,7 +740,7 @@ Window {
function refresh() {
active = true
item.model.load(activityModel.accountState, absolutePath)
- item.show()
+ item.show()
}
active: false