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:
authorClaudio Cambra <claudio.cambra@gmail.com>2022-07-18 17:27:04 +0300
committerClaudio Cambra <claudio.cambra@gmail.com>2022-09-07 16:01:07 +0300
commit7882e224fda50da7b99e402fbfe7dfd70d0c4af9 (patch)
treebc212c24ae3c7dc6e3d99ab39a08df642ae652d0
parent926256df9723acd8eca3179618eaace5e4547836 (diff)
Set UnifiedSearchResultNothingFound visibility less messily
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
-rw-r--r--src/gui/tray/Window.qml23
-rw-r--r--src/gui/tray/unifiedsearchresultslistmodel.cpp13
-rw-r--r--src/gui/tray/unifiedsearchresultslistmodel.h4
3 files changed, 20 insertions, 20 deletions
diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml
index 1061a3c84..f7f88fb87 100644
--- a/src/gui/tray/Window.qml
+++ b/src/gui/tray/Window.qml
@@ -706,7 +706,7 @@ ApplicationWindow {
UnifiedSearchResultNothingFound {
id: unifiedSearchResultNothingFound
- visible: false
+
anchors.top: trayWindowUnifiedSearchInputContainer.bottom
anchors.left: trayWindowMainItem.left
anchors.right: trayWindowMainItem.right
@@ -715,28 +715,11 @@ ApplicationWindow {
text: UserModel.currentUser.unifiedSearchResultsListModel.searchTerm
property bool isSearchRunning: UserModel.currentUser.unifiedSearchResultsListModel.isSearchInProgress
+ property bool waitingForSearchTermEditEnd: UserModel.currentUser.unifiedSearchResultsListModel.waitingForSearchTermEditEnd
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;
- }
- }
+ visible: !isSearchRunning && !waitingForSearchTermEditEnd && nothingFound
}
Loader {
diff --git a/src/gui/tray/unifiedsearchresultslistmodel.cpp b/src/gui/tray/unifiedsearchresultslistmodel.cpp
index 0e9a44fe0..805af8ea4 100644
--- a/src/gui/tray/unifiedsearchresultslistmodel.cpp
+++ b/src/gui/tray/unifiedsearchresultslistmodel.cpp
@@ -194,6 +194,7 @@ Q_LOGGING_CATEGORY(lcUnifiedSearch, "nextcloud.gui.unifiedsearch", QtInfoMsg)
UnifiedSearchResultsListModel::UnifiedSearchResultsListModel(AccountState *accountState, QObject *parent)
: QAbstractListModel(parent)
+ , _waitingForSearchTermEditEnd(false)
, _accountState(accountState)
{
}
@@ -280,6 +281,11 @@ QString UnifiedSearchResultsListModel::currentFetchMoreInProgressProviderId() co
return _currentFetchMoreInProgressProviderId;
}
+bool UnifiedSearchResultsListModel::waitingForSearchTermEditEnd() const
+{
+ return _waitingForSearchTermEditEnd;
+}
+
void UnifiedSearchResultsListModel::setSearchTerm(const QString &term)
{
if (term == _searchTerm) {
@@ -303,6 +309,8 @@ void UnifiedSearchResultsListModel::setSearchTerm(const QString &term)
if (_unifiedSearchTextEditingFinishedTimer.isActive()) {
_unifiedSearchTextEditingFinishedTimer.stop();
+ _waitingForSearchTermEditEnd = false;
+ emit waitingForSearchTermEditEndChanged();
}
if (!_searchTerm.isEmpty()) {
@@ -310,6 +318,8 @@ void UnifiedSearchResultsListModel::setSearchTerm(const QString &term)
connect(&_unifiedSearchTextEditingFinishedTimer, &QTimer::timeout, this,
&UnifiedSearchResultsListModel::slotSearchTermEditingFinished);
_unifiedSearchTextEditingFinishedTimer.start();
+ _waitingForSearchTermEditEnd = true;
+ emit waitingForSearchTermEditEndChanged();
}
if (!_results.isEmpty()) {
@@ -367,6 +377,9 @@ void UnifiedSearchResultsListModel::fetchMoreTriggerClicked(const QString &provi
void UnifiedSearchResultsListModel::slotSearchTermEditingFinished()
{
+ _waitingForSearchTermEditEnd = false;
+ emit waitingForSearchTermEditEndChanged();
+
disconnect(&_unifiedSearchTextEditingFinishedTimer, &QTimer::timeout, this,
&UnifiedSearchResultsListModel::slotSearchTermEditingFinished);
diff --git a/src/gui/tray/unifiedsearchresultslistmodel.h b/src/gui/tray/unifiedsearchresultslistmodel.h
index 7403b2ce9..c69a4ee8a 100644
--- a/src/gui/tray/unifiedsearchresultslistmodel.h
+++ b/src/gui/tray/unifiedsearchresultslistmodel.h
@@ -38,6 +38,7 @@ class UnifiedSearchResultsListModel : public QAbstractListModel
currentFetchMoreInProgressProviderIdChanged)
Q_PROPERTY(QString errorString READ errorString NOTIFY errorStringChanged)
Q_PROPERTY(QString searchTerm READ searchTerm WRITE setSearchTerm NOTIFY searchTermChanged)
+ Q_PROPERTY(bool waitingForSearchTermEditEnd READ waitingForSearchTermEditEnd NOTIFY waitingForSearchTermEditEndChanged)
struct UnifiedSearchProvider
{
@@ -77,6 +78,7 @@ public:
QString currentFetchMoreInProgressProviderId() const;
QString searchTerm() const;
QString errorString() const;
+ bool waitingForSearchTermEditEnd() const;
Q_INVOKABLE void resultClicked(const QString &providerId, const QUrl &resourceUrl) const;
Q_INVOKABLE void fetchMoreTriggerClicked(const QString &providerId);
@@ -106,6 +108,7 @@ signals:
void isSearchInProgressChanged();
void errorStringChanged();
void searchTermChanged();
+ void waitingForSearchTermEditEndChanged();
public slots:
void setSearchTerm(const QString &term);
@@ -121,6 +124,7 @@ private:
QString _searchTerm;
QString _errorString;
+ bool _waitingForSearchTermEditEnd;
QString _currentFetchMoreInProgressProviderId;