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
|
else
|
||||||
{
|
{
|
||||||
LIB_ID libId = GetCurSymbol()->GetLibId();
|
const wxString& libName = GetCurSymbol()->GetLibId().GetLibNickname();
|
||||||
const wxString& libName = libId.GetLibNickname();
|
|
||||||
const wxString& symbolName = libId.GetLibItemName();
|
|
||||||
|
|
||||||
if( m_libMgr->FlushSymbol( symbolName, libName ) )
|
if( m_libMgr->IsLibraryReadOnly( libName ) )
|
||||||
{
|
{
|
||||||
m_libMgr->ClearSymbolModified( symbolName, libName );
|
wxString msg = wxString::Format( _( "Symbol library '%s' is not writable." ),
|
||||||
return true;
|
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
|
// If saving under existing name fails then do a Save As..., and if that
|
||||||
// fails then cancel close action.
|
// fails then cancel close action.
|
||||||
if( !m_libMgr->IsLibraryReadOnly( libNickname ) )
|
if( m_libMgr->IsLibraryReadOnly( libNickname ) )
|
||||||
{
|
|
||||||
if( saveLibrary( libNickname, false ) )
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Symbol library '%s' is not writable." ), libNickname );
|
msg.Printf( _( "Symbol library '%s' is not writable." ), libNickname );
|
||||||
msg2 = _( "You must save to a different location." );
|
msg2 = _( "You must save to a different location." );
|
||||||
|
@ -1231,6 +1232,10 @@ bool SYMBOL_EDIT_FRAME::saveAllLibraries( bool aRequireConfirmation )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if( saveLibrary( libNickname, false ) )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if( !saveLibrary( libNickname, true ) )
|
if( !saveLibrary( libNickname, true ) )
|
||||||
retv = false;
|
retv = false;
|
||||||
|
|
Loading…
Reference in New Issue