]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QExternalDialog.C
Strip trailing whitespace.
[lyx.git] / src / frontends / qt2 / QExternalDialog.C
1 /**
2  * \file QExternalDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13
14 #include "qt_helpers.h"
15 #include "ControlExternal.h"
16
17 #include <qwidget.h>
18 #include <qpushbutton.h>
19 #include <qfiledialog.h>
20 #include <qcombobox.h>
21 #include <qtextview.h>
22 #include <qlineedit.h>
23
24 #include "QExternalDialog.h"
25 #include "QExternal.h"
26
27
28 QExternalDialog::QExternalDialog(QExternal * form)
29         : QExternalDialogBase(0, 0, false, 0),
30         form_(form)
31 {
32         connect(okPB, SIGNAL(clicked()),
33                 form, SLOT(slotOK()));
34         connect(closePB, SIGNAL(clicked()),
35                 form, SLOT(slotClose()));
36 }
37
38
39 void QExternalDialog::show()
40 {
41         QExternalDialogBase::show();
42         fileED->setFocus();
43 }
44
45
46 void QExternalDialog::change_adaptor()
47 {
48         form_->changed();
49 }
50
51
52 void QExternalDialog::closeEvent(QCloseEvent * e)
53 {
54         form_->slotWMHide();
55         e->accept();
56 }
57
58
59 void QExternalDialog::editClicked()
60 {
61         form_->changed();
62         form_->controller().editExternal();
63 }
64
65
66 void QExternalDialog::viewClicked()
67 {
68         form_->changed();
69         form_->controller().viewExternal();
70 }
71
72
73 void QExternalDialog::updateClicked()
74 {
75         form_->changed();
76         form_->controller().updateExternal();
77 }
78
79
80 void QExternalDialog::browseClicked()
81 {
82         QString file =
83                 QFileDialog::getOpenFileName(QString::null,
84                                              qt_("External material (*)"),
85                                              this, 0,
86                                              qt_("Select external material"));
87         if (!file.isNull()) {
88                 fileED->setText(file);
89                 form_->changed();
90         }
91 }
92
93
94 void QExternalDialog::templateChanged()
95 {
96         externalTV->setText(toqstr(form_->helpText()));
97
98         updatePB->setEnabled(!form_->controller().params().templ.automaticProduction);
99         form_->changed();
100 }