Handle read-only libraries when saving symbol from canvas.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15519
This commit is contained in:
parent
e7233a8dc6
commit
1fd3f4e375
|
@ -119,14 +119,20 @@ bool SYMBOL_EDIT_FRAME::saveCurrentSymbol()
|
|||
}
|
||||
else
|
||||
{
|
||||
LIB_ID libId = GetCurSymbol()->GetLibId();
|
||||
const wxString& libName = libId.GetLibNickname();
|
||||
const wxString& symbolName = libId.GetLibItemName();
|
||||
const wxString& libName = GetCurSymbol()->GetLibId().GetLibNickname();
|
||||
|
||||
if( m_libMgr->FlushSymbol( symbolName, libName ) )
|
||||
if( m_libMgr->IsLibraryReadOnly( libName ) )
|
||||
{
|
||||
m_libMgr->ClearSymbolModified( symbolName, libName );
|
||||
return true;
|
||||
wxString msg = wxString::Format( _( "Symbol library '%s' is not writable." ),
|
||||
libName );
|
||||
wxString msg2 = _( "You must save to a different location." );
|
||||
|
||||
if( OKOrCancelDialog( this, _( "Warning" ), msg, msg2 ) == wxID_OK )
|
||||
return saveLibrary( libName, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
return saveLibrary( libName, false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1200,12 +1206,7 @@ bool SYMBOL_EDIT_FRAME::saveAllLibraries( bool aRequireConfirmation )
|
|||
{
|
||||
// If saving under existing name fails then do a Save As..., and if that
|
||||
// fails then cancel close action.
|
||||
if( !m_libMgr->IsLibraryReadOnly( libNickname ) )
|
||||
{
|
||||
if( saveLibrary( libNickname, false ) )
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if( m_libMgr->IsLibraryReadOnly( libNickname ) )
|
||||
{
|
||||
msg.Printf( _( "Symbol library '%s' is not writable." ), libNickname );
|
||||
msg2 = _( "You must save to a different location." );
|
||||
|
@ -1231,6 +1232,10 @@ bool SYMBOL_EDIT_FRAME::saveAllLibraries( bool aRequireConfirmation )
|
|||
continue;
|
||||
}
|
||||
}
|
||||
else if( saveLibrary( libNickname, false ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !saveLibrary( libNickname, true ) )
|
||||
retv = false;
|
||||
|
|
Loading…
Reference in New Issue