From 1927cc7fe1a73c7d47f867523b151309d43db122 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 27 Jul 2023 23:44:33 +0200 Subject: [PATCH] Fix issue where trying to rename files by clicking on the tree wasn't working. --- src/gui/browserpanel.cc | 1 + src/gui/layout.cpp | 6 +++--- src/gui/layout.fbp | 12 ++++++------ src/gui/layout.h | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/gui/browserpanel.cc b/src/gui/browserpanel.cc index 1481c2cc..576409e7 100644 --- a/src/gui/browserpanel.cc +++ b/src/gui/browserpanel.cc @@ -483,6 +483,7 @@ private: return; _filesystem->moveFile(oldPath, newPath); + node->newname = ""; auto dirent = _filesystem->getDirent(newPath); runOnUiThread( diff --git a/src/gui/layout.cpp b/src/gui/layout.cpp index 76ae03b1..e8d495d9 100644 --- a/src/gui/layout.cpp +++ b/src/gui/layout.cpp @@ -768,7 +768,7 @@ BrowserPanelGen::BrowserPanelGen( wxWindow* parent, wxWindowID id, const wxPoint #endif browserMoreMenu->Append( browserNewDirectoryMenuItem ); - browserRenameMenuItem = new wxMenuItem( browserMoreMenu, wxID_ANY, wxString( wxT("Move file") ) , wxEmptyString, wxITEM_NORMAL ); + browserRenameMenuItem = new wxMenuItem( browserMoreMenu, wxID_ANY, wxString( wxT("Move/Rename file") ) , wxEmptyString, wxITEM_NORMAL ); #ifdef __WXMSW__ browserRenameMenuItem->SetBitmaps( wxNullBitmap ); #elif (defined( __WXGTK__ ) || defined( __WXOSX__ )) @@ -842,8 +842,8 @@ BrowserPanelGen::BrowserPanelGen( wxWindow* parent, wxWindowID id, const wxPoint browserTree->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG, wxDataViewEventHandler( BrowserPanelGen::OnBrowserBeginDrag ), NULL, this ); browserTree->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_DROP, wxDataViewEventHandler( BrowserPanelGen::OnBrowserDrop ), NULL, this ); browserTree->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE, wxDataViewEventHandler( BrowserPanelGen::OnBrowserDropPossible ), NULL, this ); - browserTree->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE, wxDataViewEventHandler( BrowserPanelGen::OnBrowserFilenameChanged ), NULL, this ); browserTree->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING, wxDataViewEventHandler( BrowserPanelGen::OnBrowserDirectoryExpanding ), NULL, this ); + browserTree->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( BrowserPanelGen::OnBrowserFilenameChanged ), NULL, this ); browserTree->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( BrowserPanelGen::OnBrowserSelectionChanged ), NULL, this ); browserDiscardButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BrowserPanelGen::OnBrowserDiscardButton ), NULL, this ); browserCommitButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BrowserPanelGen::OnBrowserCommitButton ), NULL, this ); @@ -860,8 +860,8 @@ BrowserPanelGen::~BrowserPanelGen() browserTree->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG, wxDataViewEventHandler( BrowserPanelGen::OnBrowserBeginDrag ), NULL, this ); browserTree->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_DROP, wxDataViewEventHandler( BrowserPanelGen::OnBrowserDrop ), NULL, this ); browserTree->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE, wxDataViewEventHandler( BrowserPanelGen::OnBrowserDropPossible ), NULL, this ); - browserTree->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE, wxDataViewEventHandler( BrowserPanelGen::OnBrowserFilenameChanged ), NULL, this ); browserTree->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING, wxDataViewEventHandler( BrowserPanelGen::OnBrowserDirectoryExpanding ), NULL, this ); + browserTree->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( BrowserPanelGen::OnBrowserFilenameChanged ), NULL, this ); browserTree->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( BrowserPanelGen::OnBrowserSelectionChanged ), NULL, this ); browserDiscardButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BrowserPanelGen::OnBrowserDiscardButton ), NULL, this ); browserCommitButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BrowserPanelGen::OnBrowserCommitButton ), NULL, this ); diff --git a/src/gui/layout.fbp b/src/gui/layout.fbp index 5bb36f61..a176a7d0 100644 --- a/src/gui/layout.fbp +++ b/src/gui/layout.fbp @@ -4308,7 +4308,7 @@ OnBrowserSaveButton - + Load From Art Provider; wxART_PLUS; wxART_TOOLBAR 1 wxID_ANY @@ -4318,7 +4318,7 @@ protected - + MyMenu browserMoreMenu protected @@ -4357,7 +4357,7 @@ wxID_ANY wxITEM_NORMAL - Move file + Move/Rename file browserRenameMenuItem protected @@ -4397,11 +4397,11 @@ - + 5 wxALL|wxEXPAND 0 - + 1 @@ -4426,8 +4426,8 @@ OnBrowserBeginDrag OnBrowserDrop OnBrowserDropPossible - OnBrowserFilenameChanged OnBrowserDirectoryExpanding + OnBrowserFilenameChanged OnBrowserSelectionChanged wxALIGN_LEFT diff --git a/src/gui/layout.h b/src/gui/layout.h index bd918a06..a7f189fe 100644 --- a/src/gui/layout.h +++ b/src/gui/layout.h @@ -413,8 +413,8 @@ class BrowserPanelGen : public wxPanel virtual void OnBrowserBeginDrag( wxDataViewEvent& event ) { event.Skip(); } virtual void OnBrowserDrop( wxDataViewEvent& event ) { event.Skip(); } virtual void OnBrowserDropPossible( wxDataViewEvent& event ) { event.Skip(); } - virtual void OnBrowserFilenameChanged( wxDataViewEvent& event ) { event.Skip(); } virtual void OnBrowserDirectoryExpanding( wxDataViewEvent& event ) { event.Skip(); } + virtual void OnBrowserFilenameChanged( wxDataViewEvent& event ) { event.Skip(); } virtual void OnBrowserSelectionChanged( wxDataViewEvent& event ) { event.Skip(); } virtual void OnBrowserDiscardButton( wxCommandEvent& event ) { event.Skip(); } virtual void OnBrowserCommitButton( wxCommandEvent& event ) { event.Skip(); }