Enable/Disable the apply/discard buttons
When there are no pending actions, we should not show the user the
ability to apply/discard the pending actions. This uses wxUpdateUI in
the correct manner, limiting it to only the elements being updated and
using the event actions to ensure we don't have a cascade
Fixes https://gitlab.com/kicad/code/kicad/issues/10761
(cherry picked from commit 09a2d50e09
)
This commit is contained in:
parent
40e0d06381
commit
dedbcac3ae
|
@ -131,7 +131,8 @@ DIALOG_PCM::DIALOG_PCM( wxWindow* parent ) : DIALOG_PCM_BASE( parent )
|
|||
{ wxID_CANCEL, _( "Discard Pending Changes" ) } } );
|
||||
|
||||
Bind( wxEVT_CLOSE_WINDOW, &DIALOG_PCM::OnCloseWindow, this );
|
||||
|
||||
m_sdbSizer1Cancel->Bind( wxEVT_UPDATE_UI, &DIALOG_PCM::OnUpdateEventButtons, this );
|
||||
m_sdbSizer1Apply->Bind( wxEVT_UPDATE_UI, &DIALOG_PCM::OnUpdateEventButtons, this );
|
||||
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
KICAD_SETTINGS* app_settings = mgr.GetAppSettings<KICAD_SETTINGS>();
|
||||
|
@ -160,6 +161,12 @@ DIALOG_PCM::~DIALOG_PCM()
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_PCM::OnUpdateEventButtons( wxUpdateUIEvent& event )
|
||||
{
|
||||
event.Enable( !m_pendingActions.empty() );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PCM::OnCloseClicked( wxCommandEvent& event )
|
||||
{
|
||||
if( m_pendingActions.size() == 0
|
||||
|
|
|
@ -67,6 +67,9 @@ public:
|
|||
///< Discards selected pending actions
|
||||
void OnDiscardActionClicked( wxCommandEvent& event ) override;
|
||||
|
||||
///< Handles modification of the buttons' status
|
||||
void OnUpdateEventButtons( wxUpdateUIEvent& event );
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Gets package data from PCM and displays it on repository tab
|
||||
|
|
Loading…
Reference in New Issue