Use platform terminology (and heuristics) for Delete.
(Platforms no longer ask for confirmation when using the Trash.) Fixes https://gitlab.com/kicad/code/kicad/issues/8513
This commit is contained in:
parent
a8f8a3590e
commit
adea5842da
|
@ -132,7 +132,14 @@ void PROJECT_TREE_ITEM::Delete()
|
||||||
|
|
||||||
if( !KIPLATFORM::ENV::MoveToTrash( GetFileName(), errMsg ) )
|
if( !KIPLATFORM::ENV::MoveToTrash( GetFileName(), errMsg ) )
|
||||||
{
|
{
|
||||||
wxString dialogMsg = wxString::Format( _( "Failed to delete '%s'"), GetFileName() );
|
#ifdef __WINDOWS__
|
||||||
|
wxString dialogMsg = wxString::Format( _( "Can not move '%s' to recycle bin."),
|
||||||
|
GetFileName() );
|
||||||
|
#else
|
||||||
|
wxString dialogMsg = wxString::Format( _( "Can not move '%s' to trash."),
|
||||||
|
GetFileName() );
|
||||||
|
#endif
|
||||||
|
|
||||||
DisplayErrorMessage( m_parent, dialogMsg, errMsg );
|
DisplayErrorMessage( m_parent, dialogMsg, errMsg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -786,8 +786,13 @@ void PROJECT_TREE_PANE::onRight( wxTreeEvent& Event )
|
||||||
popup_menu.AppendSeparator();
|
popup_menu.AppendSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
AddMenuItem( &popup_menu, ID_PROJECT_DELETE, _( "Delete" ), help_text,
|
AddMenuItem( &popup_menu, ID_PROJECT_DELETE, _( "Delete" ), help_text,
|
||||||
KiBitmap( BITMAPS::trash ) );
|
KiBitmap( BITMAPS::trash ) );
|
||||||
|
#else
|
||||||
|
AddMenuItem( &popup_menu, ID_PROJECT_DELETE, _( "Move to Trash" ), help_text,
|
||||||
|
KiBitmap( BITMAPS::trash ) );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if( can_print )
|
if( can_print )
|
||||||
|
@ -836,29 +841,9 @@ void PROJECT_TREE_PANE::onOpenSelectedFileWithTextEditor( wxCommandEvent& event
|
||||||
void PROJECT_TREE_PANE::onDeleteFile( wxCommandEvent& event )
|
void PROJECT_TREE_PANE::onDeleteFile( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
std::vector<PROJECT_TREE_ITEM*> tree_data = GetSelectedData();
|
std::vector<PROJECT_TREE_ITEM*> tree_data = GetSelectedData();
|
||||||
wxString msg, caption;
|
|
||||||
|
|
||||||
if( tree_data.size() == 1 )
|
|
||||||
{
|
|
||||||
bool is_directory = wxDirExists( tree_data[0]->GetFileName() );
|
|
||||||
caption = is_directory ? _( "Delete Directory" ) : _( "Delete File" );
|
|
||||||
msg = wxString::Format( _( "Are you sure you want to delete '%s'?" ),
|
|
||||||
tree_data[0]->GetFileName() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg = wxString::Format( _( "Are you sure you want to delete %d items?" ),
|
|
||||||
(int)tree_data.size() );
|
|
||||||
caption = _( "Delete Multiple Items" );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMessageDialog dialog( m_parent, msg, caption, wxYES_NO | wxICON_QUESTION );
|
|
||||||
|
|
||||||
if( dialog.ShowModal() == wxID_YES )
|
|
||||||
{
|
|
||||||
for( PROJECT_TREE_ITEM* item_data : tree_data )
|
for( PROJECT_TREE_ITEM* item_data : tree_data )
|
||||||
item_data->Delete();
|
item_data->Delete();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue