]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QPrintDialog.C
The initial merge of the Qt frontend, and the necessary compile fixes.
[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 <config.h>
11  
12 #include <gettext.h>
13 #include "support/filetools.h"
14 #include "support/lstrings.h"
15
16 #include "QPrint.h"
17 #include "QPrintDialog.h"
18
19 #include <qfiledialog.h>
20 #include <qcheckbox.h>
21 #include <qlabel.h>
22 #include <qlineedit.h>
23 #include <qpushbutton.h>
24 #include <qradiobutton.h>
25 #include <qspinbox.h>
26
27 QPrintDialog::QPrintDialog(QPrint * f)
28         : QPrintDialogBase(0, 0, false, 0),
29         form_(f)
30 {
31         connect(printPB, SIGNAL(clicked()),
32                 form_, SLOT(slotOK()));
33         connect(closePB, SIGNAL(clicked()),
34                 form_, SLOT(slotClose()));
35 }
36
37 void QPrintDialog::change_adaptor()
38 {
39         form_->changed();
40 }
41
42
43 void QPrintDialog::browseClicked()
44 {
45         QString file = QFileDialog::getOpenFileName(QString::null,
46                 _("PostScript files (*.ps)"), this, 0, _("Select a file to print to"));
47         if (!file.isNull()) {
48                 fileED->setText(file);
49                 form_->changed();
50         }
51 }
52
53
54 void QPrintDialog::fileChanged()
55 {
56         if (!fileED->text().isEmpty())
57                 fileRB->setChecked(true);
58         form_->changed();
59 }
60
61
62 void QPrintDialog::copiesChanged(int i)
63 {
64         collateCB->setEnabled(i != 1);
65         form_->changed();
66 }
67
68
69 void QPrintDialog::printerChanged()
70 {
71         printerRB->setChecked(true);
72         form_->changed();
73 }
74
75
76 void QPrintDialog::pagerangeChanged()
77 {
78         int from = strToUnsignedInt(fromED->text().latin1());
79         int to = strToUnsignedInt(toED->text().latin1());
80
81         if (!toED->text().isEmpty() && from > to)
82                 fromED->setText(toED->text());
83
84         form_->changed();
85 }