Author: vfr
Date: Sun Oct 30 20:52:27 2011
New Revision: 40099
URL: http://www.lyx.org/trac/changeset/40099

Log:
Correctly message that the export is cancelled

Uptil now, it was said that the export was succesful.

Modified:
   lyx-devel/trunk/src/Buffer.cpp
   lyx-devel/trunk/src/Buffer.h
   lyx-devel/trunk/src/frontends/qt4/GuiView.cpp

Modified: lyx-devel/trunk/src/Buffer.cpp
==============================================================================
--- lyx-devel/trunk/src/Buffer.cpp      Sun Oct 30 20:48:17 2011        (r40098)
+++ lyx-devel/trunk/src/Buffer.cpp      Sun Oct 30 20:52:27 2011        (r40099)
@@ -3745,7 +3745,10 @@
 
        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 @@
                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"),

Modified: lyx-devel/trunk/src/Buffer.h
==============================================================================
--- lyx-devel/trunk/src/Buffer.h        Sun Oct 30 20:48:17 2011        (r40098)
+++ lyx-devel/trunk/src/Buffer.h        Sun Oct 30 20:52:27 2011        (r40099)
@@ -125,6 +125,7 @@
        enum ExportStatus {
                // export
                ExportSuccess,
+               ExportCancel,
                ExportError,
                ExportNoPathToFormat,
                ExportTexPathHasSpaces,

Modified: lyx-devel/trunk/src/frontends/qt4/GuiView.cpp
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiView.cpp       Sun Oct 30 20:48:17 
2011        (r40098)
+++ lyx-devel/trunk/src/frontends/qt4/GuiView.cpp       Sun Oct 30 20:52:27 
2011        (r40099)
@@ -534,22 +534,25 @@
        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);
 }
 
 

Reply via email to