]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiAlert.cpp
Enable OK/Apply buttons when resetting to class defaults.
[lyx.git] / src / frontends / qt4 / GuiAlert.cpp
index 4e9a8e4c2a6055229c4d331b65b394311125ca13..ef4725c84accbc3173abefa5c174c34d99a12320 100644 (file)
@@ -24,6 +24,7 @@
 #include "support/debug.h"
 #include "support/docstring.h"
 #include "support/lstrings.h"
+#include "support/lassert.h"
 #include "support/ProgressInterface.h"
 
 #include <QApplication>
@@ -68,6 +69,12 @@ void noAppDialog(QString const & title, QString const & msg, QMessageBox::Icon m
 namespace Alert {
 
 
+docstring toPlainText(docstring const & msg)
+{
+       return qstring_to_ucs4(qtHtmlToPlainText(toqstr(msg)));
+}
+
+
 int doPrompt(docstring const & title0, docstring const & question,
                  int default_button, int cancel_button,
                  docstring const & b1, docstring const & b2,
@@ -75,15 +82,15 @@ int doPrompt(docstring const & title0, docstring const & question,
 {
        //lyxerr << "PROMPT" << title0 << "FOCUS: " << qApp->focusWidget() << endl;
        if (!use_gui || lyxerr.debugging()) {
-               lyxerr << title0 << '\n'
+               lyxerr << toPlainText(title0) << '\n'
                       << "----------------------------------------\n"
-                      << question << endl;
+                      << toPlainText(question) << endl;
 
                lyxerr << "Assuming answer is ";
                switch (default_button) {
-               case 0: lyxerr << b1 << endl;
-               case 1: lyxerr << b2 << endl;
-               case 2: lyxerr << b3 << endl;
+               case 0: lyxerr << b1 << endl; break;
+               case 1: lyxerr << b2 << endl; break;
+               case 2: lyxerr << b3 << endl; break;
                case 3: lyxerr << b4 << endl;
                }
                if (!use_gui)
@@ -147,9 +154,9 @@ int prompt(docstring const & title0, docstring const & question,
 void doWarning(docstring const & title0, docstring const & message,
             bool const & askshowagain)
 {
-       lyxerr << "Warning: " << title0 << '\n'
+       lyxerr << "Warning: " << toPlainText(title0) << '\n'
               << "----------------------------------------\n"
-              << message << endl;
+              << toPlainText(message) << endl;
 
        if (!use_gui)
                return;
@@ -189,7 +196,7 @@ void doWarning(docstring const & title0, docstring const & message,
 void warning(docstring const & title0, docstring const & message,
             bool const & askshowagain)
 {
-#ifdef EXPORT_in_THREAD        
+#ifdef EXPORT_in_THREAD
        InGuiThread<void>().call(&doWarning,
 #else
        doWarning(
@@ -197,11 +204,15 @@ void warning(docstring const & title0, docstring const & message,
                                title0, message, askshowagain);
 }
 
-void doError(docstring const & title0, docstring const & message)
+void doError(docstring const & title0, docstring const & message, bool backtrace)
 {
-       lyxerr << "Error: " << title0 << '\n'
+       lyxerr << "Error: " << toPlainText(title0) << '\n'
               << "----------------------------------------\n"
-              << message << endl;
+              << toPlainText(message) << endl;
+
+       QString details;
+       if (backtrace)
+               details = toqstr(printCallStack());
 
        if (!use_gui)
                return;
@@ -223,7 +234,8 @@ void doError(docstring const & title0, docstring const & message)
 
        ProgressInterface::instance()->error(
                toqstr(title),
-               toqstr(message));
+               toqstr(message),
+               details);
 
        qApp->restoreOverrideCursor();
 
@@ -231,22 +243,22 @@ void doError(docstring const & title0, docstring const & message)
                theApp()->startLongOperation();
 }
 
-void error(docstring const & title0, docstring const & message)
+void error(docstring const & title0, docstring const & message, bool backtrace)
 {
 #ifdef EXPORT_in_THREAD
-       InGuiThread<void>().call(&doError, 
+       InGuiThread<void>().call(&doError,
 #else
        doError(
 #endif
-                               title0, message);
+                               title0, message, backtrace);
 }
 
 void doInformation(docstring const & title0, docstring const & message)
 {
        if (!use_gui || lyxerr.debugging())
-               lyxerr << title0 << '\n'
+               lyxerr << toPlainText(title0) << '\n'
                       << "----------------------------------------\n"
-                      << message << endl;
+                      << toPlainText(message) << endl;
 
        if (!use_gui)
                return;
@@ -291,7 +303,7 @@ bool doAskForText(docstring & response, docstring const & msg,
 {
        if (!use_gui || lyxerr.debugging()) {
                lyxerr << "----------------------------------------\n"
-                      << msg << '\n'
+                      << toPlainText(msg) << '\n'
                       << "Assuming answer is " << dflt << '\n'
                       << "----------------------------------------" << endl;
                if (!use_gui) {