2 * \file qt2/Alert_pimpl.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS
14 #pragma implementation
17 #include <qmessagebox.h>
19 #include <qlineedit.h>
20 #include "ui/QAskForTextDialog.h"
27 #include "Alert_pimpl.h"
29 #include "BoostFormat.h"
36 void alert_pimpl(string const & s1, string const & s2, string const & s3)
38 QMessageBox::warning(0, "LyX",
39 (s1 + '\n' + '\n' + s2 + '\n' + s3).c_str());
43 bool askQuestion_pimpl(string const & s1, string const & s2, string const & s3)
45 return !(QMessageBox::information(0, "LyX", (s1 + '\n' + s2 + '\n' + s3).c_str(),
46 _("&Yes"), _("&No"), 0, 1));
50 int askConfirmation_pimpl(string const & s1, string const & s2, string const & s3)
52 return (QMessageBox::information(0, "LyX", (s1 + '\n' + s2 + '\n' + s3).c_str(),
53 _("&Yes"), _("&No"), _("&Cancel"), 0, 2)) + 1;
57 pair<bool, string> const
58 askForText_pimpl(string const & msg, string const & dflt)
61 boost::format fmt(_("LyX: %1$s"));
63 string const title = fmt.str();
65 string const title = _("LyX: ") + msg;
67 QAskForTextDialog d(0, title.c_str(), true);
69 d.askLA->setText(('&' + msg).c_str());
70 d.askLE->setText(dflt.c_str());
77 return make_pair<bool, string>(true, d.askLE->text().latin1());
79 return make_pair<bool, string>(false, string());