diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-01-16 21:25:25 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2017-01-19 07:01:43 +0000 |
commit | a2ad27a2be429c6d17ef28c28ac5aee66ad8545d (patch) | |
tree | 64ee5565d4bcfcf90d227c811c4ec23c2a70012a /sfx2 | |
parent | 70b05273c91cfec0cd7a9a54ff993c5b7f808d4f (diff) |
tdf#104718: Prompt user to continue on SAXException
Change-Id: Ib0f9a89c670f8d513ebee206a6a1487802f901ff
Reviewed-on: https://gerrit.libreoffice.org/33181
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/doc.hrc | 6 | ||||
-rw-r--r-- | sfx2/source/doc/doc.src | 15 | ||||
-rw-r--r-- | sfx2/source/doc/objmisc.cxx | 20 |
3 files changed, 40 insertions, 1 deletions
diff --git a/sfx2/inc/doc.hrc b/sfx2/inc/doc.hrc index 388cdf621dbf..29e4f667efa9 100644 --- a/sfx2/inc/doc.hrc +++ b/sfx2/inc/doc.hrc @@ -127,8 +127,12 @@ #define STR_MSG_EXPORT_SUCCESS (RID_SFX_DOC_START+170) #define STR_MSG_QUERY_COPY (RID_SFX_DOC_START+171) +#define STR_QMSG_ERROR_OPENING_FILE (RID_SFX_DOC_START+180) +#define STR_QMSG_ERROR_OPENING_FILE_DETAILS (RID_SFX_DOC_START+181) +#define STR_QMSG_ERROR_OPENING_FILE_CONTINUE (RID_SFX_DOC_START+182) + // please update to the last id -#define ACT_SFX_DOC_END STR_MSG_QUERY_COPY +#define ACT_SFX_DOC_END STR_QMSG_ERROR_OPENING_FILE_CONTINUE #if ACT_SFX_DOC_END > RID_SFX_DOC_END #error resource overflow in #line, #file #endif diff --git a/sfx2/source/doc/doc.src b/sfx2/source/doc/doc.src index 978f5e3c5b72..d607087c16f6 100644 --- a/sfx2/source/doc/doc.src +++ b/sfx2/source/doc/doc.src @@ -353,6 +353,21 @@ String STR_QMSG_SEL_TEMPLATE_DELETE Text [ en-US ] = "Do you want to delete the selected templates?"; }; +String STR_QMSG_ERROR_OPENING_FILE +{ + Text [ en-US ] = "An error occured during opening the file. This may be caused by incorrect file contents.\n"; +}; + +String STR_QMSG_ERROR_OPENING_FILE_DETAILS +{ + Text [ en-US ] = "The error details are:\n"; +}; + +String STR_QMSG_ERROR_OPENING_FILE_CONTINUE +{ + Text [ en-US ] = "\nProceeding with import may cause data loss or corruption, and application may become unstable or crash.\n\nDo you want to ignore the error and attempt to continue loading the file?"; +}; + Image IMG_ACTION_SORT { ImageBitmap = Bitmap diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 806228e86a21..36d8fac7098e 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1944,4 +1944,24 @@ void SfxObjectShell::StoreLog() } } +bool SfxObjectShell::IsContinueImportOnFilterExceptions(const OUString& aErrMessage) +{ + if (mbContinueImportOnFilterExceptions == undefined) + { + if (Application::GetDialogCancelMode() == Application::DialogCancelMode::Off) + { + // Ask the user to try to continue or abort loading + OUString aMessage = SfxResId(STR_QMSG_ERROR_OPENING_FILE).toString(); + if (!aErrMessage.isEmpty()) + aMessage += SfxResId(STR_QMSG_ERROR_OPENING_FILE_DETAILS).toString() + aErrMessage; + aMessage += SfxResId(STR_QMSG_ERROR_OPENING_FILE_CONTINUE).toString(); + ScopedVclPtrInstance< MessageDialog > aBox(nullptr, aMessage, VclMessageType::Question, VclButtonsType::YesNo); + mbContinueImportOnFilterExceptions = (aBox->Execute() == RET_YES) ? yes : no; + } + else + mbContinueImportOnFilterExceptions = no; + } + return mbContinueImportOnFilterExceptions == yes; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |