Fix issue where trying to rename files by clicking on the tree wasn't working.

This commit is contained in:
David Given
2023-07-27 23:44:33 +02:00
parent 4eca254daf
commit 1927cc7fe1
4 changed files with 11 additions and 10 deletions

View File

@@ -483,6 +483,7 @@ private:
return;
_filesystem->moveFile(oldPath, newPath);
node->newname = "";
auto dirent = _filesystem->getDirent(newPath);
runOnUiThread(

View File

@@ -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 );

View File

@@ -4308,7 +4308,7 @@
<property name="tooltip"></property>
<event name="OnToolClicked">OnBrowserSaveButton</event>
</object>
<object class="tool" expanded="0">
<object class="tool" expanded="1">
<property name="bitmap">Load From Art Provider; wxART_PLUS; wxART_TOOLBAR</property>
<property name="context_menu">1</property>
<property name="id">wxID_ANY</property>
@@ -4318,7 +4318,7 @@
<property name="permission">protected</property>
<property name="statusbar"></property>
<property name="tooltip"></property>
<object class="wxMenu" expanded="0">
<object class="wxMenu" expanded="1">
<property name="label">MyMenu</property>
<property name="name">browserMoreMenu</property>
<property name="permission">protected</property>
@@ -4357,7 +4357,7 @@
<property name="help"></property>
<property name="id">wxID_ANY</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">Move file</property>
<property name="label">Move/Rename file</property>
<property name="name">browserRenameMenuItem</property>
<property name="permission">protected</property>
<property name="shortcut"></property>
@@ -4397,11 +4397,11 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxDataViewCtrl" expanded="0">
<object class="wxDataViewCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
@@ -4426,8 +4426,8 @@
<event name="OnDataViewCtrlItemBeginDrag">OnBrowserBeginDrag</event>
<event name="OnDataViewCtrlItemDrop">OnBrowserDrop</event>
<event name="OnDataViewCtrlItemDropPossible">OnBrowserDropPossible</event>
<event name="OnDataViewCtrlItemEditingDone">OnBrowserFilenameChanged</event>
<event name="OnDataViewCtrlItemExpanding">OnBrowserDirectoryExpanding</event>
<event name="OnDataViewCtrlItemValueChanged">OnBrowserFilenameChanged</event>
<event name="OnDataViewCtrlSelectionChanged">OnBrowserSelectionChanged</event>
<object class="dataViewColumn" expanded="0">
<property name="align">wxALIGN_LEFT</property>

View File

@@ -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(); }