From ddc2de207a55b56a9f706ce3ddfc8ddb48bdf2e8 Mon Sep 17 00:00:00 2001 From: Lionel Elie Mamane Date: Sun, 18 Oct 2015 20:54:49 +0200 Subject: reorganise code, no behaviour change intended ... at leat in normal circumstances. assumed that the dialog can only return Yes/No/Cancel if it doesn't, then behaviour change, be more conservative and save only on yes. the order between rController->commitCurrentRecord( ) and GetImpl()->didPrepareClose( true ) is changed, that's on purpose. If commitCurrentRecord( ) throws, then don't do GetImpl()->didPrepareClose( true ) Change-Id: Ieb88c04a27e71b313e7f1386d48f370a1e94c6c2 --- svx/source/form/fmshell.cxx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'svx') diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index 31d9e5543c66..99bcb04f61ba 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -265,7 +265,7 @@ bool FmFormShell::PrepareClose(bool bUI) const svx::ControllerFeatures& rController = GetImpl()->getActiveControllerFeatures(); if ( rController->commitCurrentControl() ) { - bool bModified = rController->isModifiedRow(); + const bool bModified = rController->isModifiedRow(); if ( bModified && bUI ) { @@ -274,19 +274,16 @@ bool FmFormShell::PrepareClose(bool bUI) "svx/ui/savemodifieddialog.ui"); switch (aQry->Execute()) { - case RET_NO: - bModified = false; - // fallthrough to next case case RET_YES: + bResult = rController->commitCurrentRecord( ); + // fallthrough to next case + case RET_NO: GetImpl()->didPrepareClose( true ); break; case RET_CANCEL: return false; } - - if ( bModified ) - bResult = rController->commitCurrentRecord( ); } } } -- cgit