From 5cdcc4f7ef71f01b06666a520e8a2b3deb2c282a Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Sun, 30 Oct 2011 19:52:27 +0000 Subject: [PATCH] Correctly message that the export is cancelled Uptil now, it was said that the export was succesful. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40099 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Buffer.cpp | 18 +++++++++++++----- src/Buffer.h | 1 + src/frontends/qt4/GuiView.cpp | 13 ++++++++----- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 6f4bf30aff..504bacdb9a 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -3745,7 +3745,10 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir if (status == CANCEL) { message(_("Document export cancelled.")); - } else if (tmp_result_file.exists()) { + return ExportCancel; + } + + if (tmp_result_file.exists()) { // Finally copy the main file use_force = use_gui ? lyxrc.export_overwrite != NO_FILES : force_overwrite != NO_FILES; @@ -3754,10 +3757,15 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir status = copyFile(format, tmp_result_file, FileName(result_file), result_file, status == FORCE); - message(bformat(_("Document exported as %1$s " - "to file `%2$s'"), - formats.prettyName(format), - makeDisplayPath(result_file))); + if (status == CANCEL) { + message(_("Document export cancelled.")); + return ExportCancel; + } else { + message(bformat(_("Document exported as %1$s " + "to file `%2$s'"), + formats.prettyName(format), + makeDisplayPath(result_file))); + } } else { // This must be a dummy converter like fax (bug 1888) message(bformat(_("Document exported as %1$s"), diff --git a/src/Buffer.h b/src/Buffer.h index 781279b008..bf2a9ead6b 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -125,6 +125,7 @@ public: enum ExportStatus { // export ExportSuccess, + ExportCancel, ExportError, ExportNoPathToFormat, ExportTexPathHasSpaces, diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 6a201daa16..b72ab9c1ba 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -534,22 +534,25 @@ static void handleExportStatus(GuiView * view, Buffer::ExportStatus status, docstring msg; switch (status) { case Buffer::ExportSuccess: - msg = _("Successful export to format: %1$s"); + msg = bformat(_("Successful export to format: %1$s"), from_utf8(format)); + break; + case Buffer::ExportCancel: + msg = _("Document export cancelled."); break; case Buffer::ExportError: case Buffer::ExportNoPathToFormat: case Buffer::ExportTexPathHasSpaces: case Buffer::ExportConverterError: - msg = _("Error while exporting format: %1$s"); + msg = bformat(_("Error while exporting format: %1$s"), from_utf8(format)); break; case Buffer::PreviewSuccess: - msg = _("Successful preview of format: %1$s"); + msg = bformat(_("Successful preview of format: %1$s"), from_utf8(format)); break; case Buffer::PreviewError: - msg = _("Error while previewing format: %1$s"); + msg = bformat(_("Error while previewing format: %1$s"), from_utf8(format)); break; } - view->message(bformat(msg, from_utf8(format))); + view->message(msg); } -- 2.39.2