summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorls <lukas.schwerdtfeger@gmail.com>2021-07-16 21:11:39 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-19 18:20:34 +0200
commitfe7bacc2dfb2f83a43c072394a384bf8316c7d80 (patch)
tree390ce2fcbc985ae657a3e5cbabceec0eadb295c0 /Userland/Applications
parent35b930112f1286bf24ef664090953e3d053199a4 (diff)
downloadserenity-fe7bacc2dfb2f83a43c072394a384bf8316c7d80.zip
File Manager: Differentiate between navigation and rename errors
Adds a new on_rename_error handler and renames the old on_error handler to on_directory_change_error in FileSystemModel. The on_rename_error handler creates a MessageDialog with the error message.
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/FileManager/DirectoryView.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp
index 7e2cc35013..6b72bc7bfb 100644
--- a/Userland/Applications/FileManager/DirectoryView.cpp
+++ b/Userland/Applications/FileManager/DirectoryView.cpp
@@ -214,7 +214,7 @@ const GUI::FileSystemModel::Node& DirectoryView::node(const GUI::ModelIndex& ind
void DirectoryView::setup_model()
{
- m_model->on_error = [this](int, const char* error_string) {
+ m_model->on_directory_change_error = [this](int, const char* error_string) {
auto failed_path = m_model->root_path();
auto error_message = String::formatted("Could not read {}:\n{}", failed_path, error_string);
m_error_label->set_text(error_message);
@@ -229,6 +229,10 @@ void DirectoryView::setup_model()
on_path_change(failed_path, false, false);
};
+ m_model->on_rename_error = [this](int, const char* error_string) {
+ GUI::MessageBox::show_error(window(), String::formatted("Unable to rename file: {}", error_string));
+ };
+
m_model->on_complete = [this] {
if (m_table_view)
m_table_view->selection().clear();