From cb583f305c74bce38782207a9c0f2e15beb16b06 Mon Sep 17 00:00:00 2001 From: veeso Date: Tue, 9 Nov 2021 12:36:57 +0100 Subject: [PATCH] If find command doesn't return any result show an info dialog and not an empty explorer --- CHANGELOG.md | 1 + src/ui/activities/filetransfer/update.rs | 6 ++++++ src/ui/activities/filetransfer/view.rs | 9 +++++++++ 3 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b22f991..dc1d06c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ Released on FIXME: - **Enhancements**: - Find feature: - A "wait popup" will now be displayed while searching files + - If find command doesn't return any result show an info dialog and not an empty explorer ## 0.7.0 diff --git a/src/ui/activities/filetransfer/update.rs b/src/ui/activities/filetransfer/update.rs index e3315f2..c34e274 100644 --- a/src/ui/activities/filetransfer/update.rs +++ b/src/ui/activities/filetransfer/update.rs @@ -449,6 +449,12 @@ impl Update for FileTransferActivity { // Mount error self.mount_error(err.as_str()); } + Ok(files) if files.is_empty() => { + // If no file has been found notify user + self.mount_info( + format!(r#"Could not find any file matching "{}""#, input).as_str(), + ); + } Ok(files) => { // Create explorer and load files self.browser.set_found(files); diff --git a/src/ui/activities/filetransfer/view.rs b/src/ui/activities/filetransfer/view.rs index c277067..f6ab723 100644 --- a/src/ui/activities/filetransfer/view.rs +++ b/src/ui/activities/filetransfer/view.rs @@ -400,6 +400,15 @@ impl FileTransferActivity { // -- partials + /// ### mount_info + /// + /// Mount info box + pub(super) fn mount_info(&mut self, text: &str) { + // Mount + let info_color = self.theme().misc_info_dialog; + self.mount_text_dialog(super::COMPONENT_TEXT_ERROR, text, info_color); + } + /// ### mount_error /// /// Mount error box