]> git.lyx.org Git - features.git/blob - src/frontends/kde/printdlg.C
942c1ebaa1e02fd2fdd6e8d7ef8d7437d58c9814
[features.git] / src / frontends / kde / printdlg.C
1 /**
2  * \file printdlg.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon
7  */
8
9 #include <config.h>
10 #include <gettext.h>
11 #include <cstring>
12
13 #include "support/lstrings.h"
14 #include "support/filetools.h"
15  
16 #include "printdlg.h"
17 #include "dlg/printdlgdata.h"
18
19 #include <qtooltip.h>
20 #include <kfiledialog.h>
21
22 #define Inherited PrintDialogData
23
24 PrintDialog::PrintDialog(FormPrint * f, QWidget * parent, char const * name)
25         : PrintDialogData(parent, name), form_(f)
26 {
27         setCaption(name); 
28         QToolTip::add(radio_allpages, _("Print every page"));
29         QToolTip::add(radio_oddpages, _("Print odd-numbered pages only"));
30         QToolTip::add(radio_evenpages, _("Print even-numbered pages only"));
31         QToolTip::add(line_from, _("Print from page number")); 
32         QToolTip::add(line_to, _("Print to page number")); 
33         QToolTip::add(check_reverse, _("Print in reverse order (last page first)"));
34         QToolTip::add(line_count, _("Number of copies to print"));
35         QToolTip::add(check_sort, _("Collate multiple copies"));
36         QToolTip::add(line_printername, _("Printer name"));
37         QToolTip::add(line_filename, _("Output filename (PostScript)"));
38         QToolTip::add(button_browse, _("Select output filename"));
39 }
40
41
42 PrintDialog::~PrintDialog()
43 {
44 }
45
46
47 void PrintDialog::clickedBrowse()
48 {
49         // FIXME: move into utility class later, accept URLs etc.
50
51         KFileDialog filedlg(OnlyPath(line_filename->text()).c_str(), "*.ps|PostScript Files (*.ps)", this, 0, true, false);
52
53         if (filedlg.exec() == QDialog::Accepted)
54                 line_filename->setText(filedlg.selectedFile().data());
55 }
56
57
58 void PrintDialog::changedCount(char const * text)
59 {
60         if (compare("", text) && strToInt(text) == 0) {
61                 line_count->setText("1");
62                 return;
63         }
64
65         check_sort->setEnabled(strToInt(text) > 1);
66 }