← Back to team overview

kicad-developers team mailing list archive

[Patch] Handle Cvpcb save actions immediately

 

This patch updates Cvpcb to run the save actions immediately when the
buttons are pressed. If they are not run immediately, then the user may see
the handle unsaved changes dialog (which if they clicked on OK is not what
they are expecting), which will allow them to veto the close event. The
event generated by the OK button is non-vetoable though, so showing this
dialog can lead to an assertion.

-Ian
From 648c8661024bdd4015bb5b686ac6f9ab14c7f326 Mon Sep 17 00:00:00 2001
From: Ian McInerney <Ian.S.McInerney@xxxxxxxx>
Date: Mon, 9 Sep 2019 07:02:11 +0200
Subject: [PATCH] cvpcb: Run save action immediately on close using OK

If they are not run immediately, the user could get a dialog
confirming the save, which they could then veto the OK event
(which is not allowed).
---
 cvpcb/cvpcb_mainframe.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp
index 923a943da..0fa48aa68 100644
--- a/cvpcb/cvpcb_mainframe.cpp
+++ b/cvpcb/cvpcb_mainframe.cpp
@@ -248,14 +248,14 @@ void CVPCB_MAINFRAME::setupEventHandlers()
     m_saveAndContinue->Bind( wxEVT_COMMAND_BUTTON_CLICKED,
             [this]( wxCommandEvent& )
             {
-                this->GetToolManager()->RunAction( CVPCB_ACTIONS::saveAssociations );
+                this->GetToolManager()->RunAction( CVPCB_ACTIONS::saveAssociations, true );
             } );
 
     // Connect the handlers for the ok/cancel buttons
     Bind( wxEVT_BUTTON,
             [this]( wxCommandEvent& )
             {
-                this->GetToolManager()->RunAction( CVPCB_ACTIONS::saveAssociations );
+                this->GetToolManager()->RunAction( CVPCB_ACTIONS::saveAssociations, true );
                 Close( true );
             }, wxID_OK );
     Bind( wxEVT_BUTTON,
-- 
2.21.0


Follow ups