]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt2/Alert_pimpl.C
better selection and scrolling behaviour
[lyx.git] / src / frontends / qt2 / Alert_pimpl.C
index ea523bfda886341fc29e45f176e4bb8c4f7f22d5..553bc0b0c50c859e5a9c4fb0b1ca9881cdc1426a 100644 (file)
@@ -26,6 +26,9 @@
 #include "Alert.h"
 #include "Alert_pimpl.h"
 
+#include "BoostFormat.h"
+
+
 using std::pair;
 using std::make_pair;
 
@@ -33,20 +36,20 @@ using std::make_pair;
 void alert_pimpl(string const & s1, string const & s2, string const & s3)
 {
        QMessageBox::warning(0, "LyX",
-                            (s1 + "\n" + "\n" + s2 + "\n" + s3).c_str());
+                            (s1 + '\n' + '\n' + s2 + '\n' + s3).c_str());
 }
 
 
 bool askQuestion_pimpl(string const & s1, string const & s2, string const & s3)
 {
-       return !(QMessageBox::information(0, "LyX", (s1 + "\n" + s2 + "\n" + s3).c_str(),
+       return !(QMessageBox::information(0, "LyX", (s1 + '\n' + s2 + '\n' + s3).c_str(),
                _("&Yes"), _("&No"), 0, 1));
 }
 
 
 int askConfirmation_pimpl(string const & s1, string const & s2, string const & s3)
 {
-       return (QMessageBox::information(0, "LyX", (s1 + "\n" + s2 + "\n" + s3).c_str(),
+       return (QMessageBox::information(0, "LyX", (s1 + '\n' + s2 + '\n' + s3).c_str(),
                _("&Yes"), _("&No"), _("&Cancel"), 0, 2)) + 1;
 }
 
@@ -54,12 +57,16 @@ int askConfirmation_pimpl(string const & s1, string const & s2, string const & s
 pair<bool, string> const
 askForText_pimpl(string const & msg, string const & dflt)
 {
-       string title = _("LyX: ");
-       title += msg;
-
+#if USE_BOOST_FORMAT
+       boost::format fmt(_("LyX: %1$s"));
+       fmt % msg;
+       string const title = fmt.str();
+#else
+       string const title = _("LyX: ") + msg;
+#endif
        QAskForTextDialog d(0, title.c_str(), true);
        // less than ideal !
-       d.askLA->setText((string("&") + msg).c_str());
+       d.askLA->setText(('&' + msg).c_str());
        d.askLE->setText(dflt.c_str());
        d.askLE->setFocus();
        int ret = d.exec();