tdf#117967 Fixes Save confirmation dialog for user cancel
commit07250a832787acdd432dccd458536de2987a58b2
authorMatt K <mattkse@gmail.com>
Thu, 28 Jul 2022 00:33:50 +0000 (27 19:33 -0500)
committerMike Kaganski <mike.kaganski@collabora.com>
Sat, 30 Jul 2022 04:27:05 +0000 (30 06:27 +0200)
tree09772b10613c9ef04727bf63a628da17e09d1f68
parent45312369331688bde9d1b8c97ad883a69e5982d7
tdf#117967 Fixes Save confirmation dialog for user cancel

The "Confirm save" dialog is launched from SfxMedium::CheckFileDate
via "xHandler->handle( xInteractionRequestImpl );" and if the user
canceled it the error is saved in the SfxMedium via
"SetError(ERRCODE_ABORT);".  Then, control is returned to the
calling function SfxObjectShell::SaveTo_Impl which currently
doesn't handle the cancel error condition, so this change just adds
a check to detect it and return instead of doing more "save"
processing.  This return then goes to the calling function
SfxObjectShell::DoSave_Impl which also does some save processing
after cancel, in particular it updates the timestamps of the
current SfxMedium (which are checked in SfxMedium::CheckFileDate
from above and determines whether the "Confirm save" dialog will be
launched), so this change prevents the updates to the timestamps by
exiting early (i.e. before "DoSaveCompleted();" is called) if the
abort error condition is seen so as to avoid a timestamp comparison
result of equality which would prevent the "Confirm save" dialog
from showing on every subsequent save action from the user.  Now
the behavior is for the timestamp comparison to fail equality (as
would be expected if the file changed underneath the user) so as to
ensure the "Confirm save" dialog continues to show for every
subsequent save action by the user.

Change-Id: I9c4aefc163a06029c80a8a28cdf4a09dff0031a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137540
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
sfx2/source/doc/objstor.cxx