]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/Alert_pimpl.C
doxygen fixes
[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 FORMS_H_LOCATION
17  
18 #include <algorithm>
19  
20 #include <gettext.h>
21  
22 #include "Alert.h"
23 #include "Alert_pimpl.h" 
24 #include "xforms_helpers.h"
25  
26 using std::pair;
27 using std::make_pair;
28
29 void alert_pimpl(string const & s1, string const & s2, string const & s3)
30 {
31         QMessageBox::warning(0, "LyX", (s1 + "\n" + "\n" + s2 + "\n" + s3).c_str());
32 }
33
34
35 bool askQuestion_pimpl(string const & s1, string const & s2, string const & s3)
36 {
37         return !(QMessageBox::information(0, "LyX", (s1 + "\n" + s2 + "\n" + s3).c_str(),
38                 _("&Yes"), _("&No"), 0, 1));
39 }
40
41
42 int askConfirmation_pimpl(string const & s1, string const & s2, string const & s3)
43 {
44         return (QMessageBox::information(0, "LyX", (s1 + "\n" + s2 + "\n" + s3).c_str(),
45                 _("&Yes"), _("&No"), _("&Cancel"), 0, 2)) + 1;
46 }
47
48
49 pair<bool, string> const askForText_pimpl(string const & msg, string const & dflt)
50 {
51         string title = _("LyX: ");
52         title += msg;
53  
54         QAskForTextDialog d(0, msg.c_str(), true); 
55         // less than ideal !
56         d.askLA->setText((string("&") + msg).c_str());
57         d.askLE->setText(dflt.c_str());
58         int ret = d.exec();
59
60         d.hide();
61  
62         if (ret)
63                 return make_pair<bool, string>(true, d.askLE->text().latin1());
64         else
65                 return make_pair<bool, string>(false, string());
66 }