]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QPrintDialog.C
add print dialog back
[lyx.git] / src / frontends / qt2 / QPrintDialog.C
1 /**
2  * \file QPrintDialog.C
3  * Copyright 2001 LyX Team
4  * see the file COPYING
5  *
6  * \author John Levon, moz@compsoc.man.ac.uk
7  * \author Edwin Leuven, leuven@fee.uva.nl
8  */
9
10 #include <qfiledialog.h>
11 #include <qcheckbox.h>
12 #include <qlabel.h>
13 #include <qlineedit.h>
14 #include <qpushbutton.h>
15 #include <qradiobutton.h>
16 #include <qspinbox.h>
17
18 #include "QPrintDialog.h"
19 #include "QPrint.h"
20
21 #include <config.h>
22
23 #include "support/filetools.h"
24 #include "support/lstrings.h"
25
26 #include <gettext.h>
27
28
29 QPrintDialog::QPrintDialog(QPrint * f)
30         : QPrintDialogBase(0, 0, false, 0),
31         form_(f)
32 {
33         connect(printPB, SIGNAL(clicked()),
34                 form_, SLOT(slotOK()));
35         connect(closePB, SIGNAL(clicked()),
36                 form_, SLOT(slotClose()));
37 }
38
39 void QPrintDialog::change_adaptor()
40 {
41         form_->changed();
42 }
43  
44  
45 void QPrintDialog::browseClicked()
46 {
47         QString file = QFileDialog::getOpenFileName(QString::null, 
48                 _("PostScript files (*.ps)"), this, 0, _("Select a file to print to"));
49         if (!file.isNull()) {
50                 fileED->setText(file);
51                 form_->changed();
52         }
53 }
54
55  
56 void QPrintDialog::fileChanged()
57 {
58         if (!fileED->text().isEmpty())
59                 fileRB->setChecked(true);
60         form_->changed();
61 }
62
63  
64 void QPrintDialog::copiesChanged(int i)
65 {
66         collateCB->setEnabled(i != 1);
67         form_->changed();
68 }
69
70  
71 void QPrintDialog::printerChanged()
72 {
73         printerRB->setChecked(true);
74         form_->changed();
75 }
76
77  
78 void QPrintDialog::pagerangeChanged()
79 {
80         int from = strToUnsignedInt(fromED->text().latin1());
81         int to = strToUnsignedInt(toED->text().latin1());
82  
83         if (!toED->text().isEmpty() && from > to)
84                 fromED->setText(toED->text());
85  
86         form_->changed();
87 }