]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/Alert_pimpl.C
remove xforms check from qt config
[lyx.git] / src / frontends / qt2 / Alert_pimpl.C
1 /**
2  * \file qt2/Alert_pimpl.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon <moz@compsoc.man.ac.uk>
7  */
8
9 #include <config.h>
10
11 #include <qmessagebox.h>
12 #include <qlabel.h>
13 #include <qlineedit.h>
14 #include "ui/QAskForTextDialog.h"
15
16 #include <algorithm>
17
18 #include <gettext.h>
19
20 #include "Alert.h"
21 #include "Alert_pimpl.h"
22
23 using std::pair;
24 using std::make_pair;
25
26 void alert_pimpl(string const & s1, string const & s2, string const & s3)
27 {
28         QMessageBox::warning(0, "LyX", (s1 + "\n" + "\n" + s2 + "\n" + s3).c_str());
29 }
30
31
32 bool askQuestion_pimpl(string const & s1, string const & s2, string const & s3)
33 {
34         return !(QMessageBox::information(0, "LyX", (s1 + "\n" + s2 + "\n" + s3).c_str(),
35                 _("&Yes"), _("&No"), 0, 1));
36 }
37
38
39 int askConfirmation_pimpl(string const & s1, string const & s2, string const & s3)
40 {
41         return (QMessageBox::information(0, "LyX", (s1 + "\n" + s2 + "\n" + s3).c_str(),
42                 _("&Yes"), _("&No"), _("&Cancel"), 0, 2)) + 1;
43 }
44
45
46 pair<bool, string> const askForText_pimpl(string const & msg, string const & dflt)
47 {
48         string title = _("LyX: ");
49         title += msg;
50
51         QAskForTextDialog d(0, msg.c_str(), true);
52         // less than ideal !
53         d.askLA->setText((string("&") + msg).c_str());
54         d.askLE->setText(dflt.c_str());
55         int ret = d.exec();
56
57         d.hide();
58
59         if (ret)
60                 return make_pair<bool, string>(true, d.askLE->text().latin1());
61         else
62                 return make_pair<bool, string>(false, string());
63 }