]> git.lyx.org Git - features.git/commitdiff
Correctly message that the export is cancelled
authorVincent van Ravesteijn <vfr@lyx.org>
Sun, 30 Oct 2011 19:52:27 +0000 (19:52 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Sun, 30 Oct 2011 19:52:27 +0000 (19:52 +0000)
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
src/Buffer.h
src/frontends/qt4/GuiView.cpp

index 6f4bf30aff9b6767bfd3d49c79b406bbdadcee92..504bacdb9a4e1eee96d77f6463baafe2ab0e3578 100644 (file)
@@ -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"),
index 781279b0081c50ed8d19afdd2ce1fc7a8205fef4..bf2a9ead6baf380f954f6f4575e2d8ad4abeb2a0 100644 (file)
@@ -125,6 +125,7 @@ public:
        enum ExportStatus {
                // export
                ExportSuccess,
+               ExportCancel,
                ExportError,
                ExportNoPathToFormat,
                ExportTexPathHasSpaces,
index 6a201daa16d85032fbf9044f38bb2914eb8fa86d..b72ab9c1ba8c294a4d77984c8aaf5fed0d2131be 100644 (file)
@@ -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);
 }