Add an (unimplemented) rename operation.

This commit is contained in:
David Given
2022-09-04 22:47:25 +02:00
parent 64689cf59d
commit 39b761ea16
6 changed files with 28 additions and 2 deletions

View File

@@ -115,6 +115,11 @@ void Filesystem::deleteFile(const Path& path)
throw UnimplementedFilesystemException();
}
void Filesystem::moveFile(const Path& oldName, const Path& newName)
{
throw UnimplementedFilesystemException();
}
bool Filesystem::needsFlushing()
{
return _sectors->needsFlushing();

View File

@@ -125,6 +125,7 @@ public:
OP_GETFSDATA = 0b0000000100000000,
OP_PUTFSDATA = 0b0000001000000000,
OP_PUTATTRS = 0b0000010000000000,
OP_MOVE = 0b0000100000000000,
};
public:
@@ -167,6 +168,9 @@ public:
/* Deletes a file or non-empty directory. */
virtual void deleteFile(const Path& path);
/* Moves a file (including renaming it). */
virtual void moveFile(const Path& oldName, const Path& newName);
/* Does this filesystem need flushing? */
bool needsFlushing();

View File

@@ -286,6 +286,8 @@ MainWindowGen::MainWindowGen( wxWindow* parent, wxWindowID id, const wxString& t
browserNewDirectoryTool = browserToolbar->AddTool( wxID_ANY, wxT("New directory"), wxArtProvider::GetBitmap( wxART_NEW_DIR, wxART_TOOLBAR ), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL );
browserRenameTool = browserToolbar->AddTool( wxID_ANY, wxT("Rename"), wxArtProvider::GetBitmap( wxART_COPY, wxART_TOOLBAR ), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL );
browserDeleteTool = browserToolbar->AddTool( wxID_ANY, wxT("Delete"), wxArtProvider::GetBitmap( wxART_DELETE, wxART_TOOLBAR ), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL );
browserToolbar->AddSeparator();

View File

@@ -47,7 +47,7 @@
<property name="minimum_size"></property>
<property name="name">MainWindowGen</property>
<property name="pos"></property>
<property name="size">592,607</property>
<property name="size">616,607</property>
<property name="style">wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">; ; forward_declare</property>
<property name="title">FluxEngine</property>
@@ -2375,6 +2375,17 @@
<property name="tooltip"></property>
<event name="OnToolClicked">OnBrowserNewDirectoryButton</event>
</object>
<object class="tool" expanded="1">
<property name="bitmap">Load From Art Provider; wxART_COPY; wxART_TOOLBAR</property>
<property name="context_menu">0</property>
<property name="id">wxID_ANY</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">Rename</property>
<property name="name">browserRenameTool</property>
<property name="permission">protected</property>
<property name="statusbar"></property>
<property name="tooltip"></property>
</object>
<object class="tool" expanded="1">
<property name="bitmap">Load From Art Provider; wxART_DELETE; wxART_TOOLBAR</property>
<property name="context_menu">0</property>

View File

@@ -90,6 +90,7 @@ class MainWindowGen : public wxFrame
wxToolBarToolBase* browserSaveTool;
wxToolBarToolBase* browserNewTool;
wxToolBarToolBase* browserNewDirectoryTool;
wxToolBarToolBase* browserRenameTool;
wxToolBarToolBase* browserDeleteTool;
wxToolBarToolBase* browserFormatTool;
wxDataViewCtrl* browserTree;
@@ -129,7 +130,7 @@ class MainWindowGen : public wxFrame
public:
MainWindowGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("FluxEngine"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 592,607 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL );
MainWindowGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("FluxEngine"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 616,607 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL );
~MainWindowGen();

View File

@@ -928,6 +928,9 @@ public:
browserToolbar->EnableTool(browserNewDirectoryTool->GetId(),
(capabilities & Filesystem::OP_CREATEDIR) &&
(selection.size() <= 1));
browserToolbar->EnableTool(browserRenameTool->GetId(),
(capabilities & Filesystem::OP_MOVE) &&
(selection.size() == 1));
browserToolbar->EnableTool(browserDeleteTool->GetId(),
(capabilities & Filesystem::OP_DELETE) &&
(selection.size() >= 1));