]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QExternalDialog.C
Some string(widget->text()) fixes. Weirdness
[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
31 QExternalDialog::QExternalDialog(QExternal * form)
32         : QExternalDialogBase(0, 0, false, 0),
33         form_(form)
34 {
35         connect(okPB, SIGNAL(clicked()),
36                 form, SLOT(slotOK()));
37         connect(closePB, SIGNAL(clicked()),
38                 form, SLOT(slotClose()));
39 }
40
41
42 void QExternalDialog::show()
43 {
44         QExternalDialogBase::show();
45         fileED->setFocus();
46 }
47
48
49 void QExternalDialog::change_adaptor()
50 {
51         form_->changed();
52 }
53
54
55 void QExternalDialog::closeEvent(QCloseEvent * e)
56 {
57         form_->slotWMHide();
58         e->accept();
59 }
60
61
62 void QExternalDialog::editClicked()
63 {
64         form_->changed();
65         form_->controller().editExternal();
66 }
67
68
69 void QExternalDialog::viewClicked()
70 {
71         form_->changed();
72         form_->controller().viewExternal();
73 }
74
75
76 void QExternalDialog::updateClicked()
77 {
78         form_->changed();
79         form_->controller().updateExternal();
80 }
81
82
83 void QExternalDialog::browseClicked()
84 {
85         QString file =
86                 QFileDialog::getOpenFileName(QString::null,
87                                              _("External material (*)"),
88                                              this, 0,
89                                              _("Select external material"));
90         if (!file.isNull()) {
91                 fileED->setText(file.latin1());
92                 form_->changed();
93         }
94 }
95
96
97 void QExternalDialog::templateChanged()
98 {
99         externalTV->setText(form_->helpText().c_str());
100
101         updatePB->setEnabled(!form_->controller().params().templ.automaticProduction);
102         form_->changed();
103 }