]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QExternalDialog.C
Lots and lots of little trivial bits.
[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 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 #include "gettext.h"
18 #include "ControlExternal.h"
19  
20 #include <qwidget.h>
21 #include <qpushbutton.h>
22 #include <qfiledialog.h>
23 #include <qcombobox.h>
24 #include <qtextview.h>
25 #include <qlineedit.h>
26
27 #include "QExternalDialog.h"
28 #include "QExternal.h"
29
30 QExternalDialog::QExternalDialog(QExternal * form)
31         : QExternalDialogBase(0, 0, false, 0),
32         form_(form)
33 {
34         connect(okPB, SIGNAL(clicked()),
35                 form, SLOT(slotOK()));
36         connect(closePB, SIGNAL(clicked()),
37                 form, SLOT(slotClose()));
38 }
39
40
41 void QExternalDialog::show()
42 {
43         QExternalDialogBase::show();
44         fileED->setFocus();
45 }
46
47  
48 void QExternalDialog::change_adaptor()
49 {
50         form_->changed();
51 }
52
53
54 void QExternalDialog::closeEvent(QCloseEvent * e)
55 {
56         form_->slotWMHide();
57         e->accept();
58 }
59
60
61 void QExternalDialog::editClicked()
62 {
63         form_->changed();
64         form_->controller().editExternal();
65 }
66
67
68 void QExternalDialog::viewClicked()
69 {
70         form_->changed();
71         form_->controller().viewExternal();
72 }
73
74
75 void QExternalDialog::updateClicked()
76 {
77         form_->changed();
78         form_->controller().updateExternal();
79 }
80
81
82 void QExternalDialog::browseClicked()
83 {
84         QString file = QFileDialog::getOpenFileName(QString::null,
85                 _("External material (*)"), this, 0, _("Select external material"));
86         if (!file.isNull()) {
87                 fileED->setText(file.latin1());
88                 form_->changed();
89         }
90 }
91
92
93 void QExternalDialog::templateChanged()
94 {
95         externalTV->setText(form_->helpText().c_str());
96
97         updatePB->setEnabled(!form_->controller().params().templ.automaticProduction);
98         form_->changed();
99 }