]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QRefDialog.C
some tabular fixes for the problems reported by Helge
[lyx.git] / src / frontends / qt2 / QRefDialog.C
1 /**
2  * \file QRefDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Kalle Dalheimer
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "QRefDialog.h"
15 #include "QRef.h"
16
17 #include <qcombobox.h>
18 #include <qlineedit.h>
19 #include <qlistbox.h>
20 #include <qpushbutton.h>
21
22 namespace lyx {
23 namespace frontend {
24
25 QRefDialog::QRefDialog(QRef * form)
26         : QRefDialogBase(0, 0, false, 0),
27         form_(form)
28 {
29         connect(okPB, SIGNAL(clicked()),
30                 form_, SLOT(slotOK()));
31         connect(applyPB, SIGNAL(clicked()),
32                 form_, SLOT(slotApply()));
33         connect(closePB, SIGNAL(clicked()),
34                 form_, SLOT(slotClose()));
35 }
36
37
38 void QRefDialog::show()
39 {
40         QRefDialogBase::show();
41         refsLB->setFocus();
42 }
43
44
45 void QRefDialog::changed_adaptor()
46 {
47         form_->changed();
48 }
49
50
51 void QRefDialog::gotoClicked()
52 {
53         form_->gotoRef();
54 }
55
56
57 void QRefDialog::refHighlighted(const QString & sel)
58 {
59         if (form_->readOnly())
60                 return;
61
62         referenceED->setText(sel);
63         if (form_->at_ref_)
64                 form_->gotoRef();
65         gotoPB->setEnabled(true);
66         if (form_->typeAllowed())
67                 typeCO->setEnabled(true);
68         if (form_->nameAllowed())
69                 nameED->setEnabled(true);
70 }
71
72
73 void QRefDialog::refSelected(const QString & sel)
74 {
75         if (form_->readOnly())
76                 return;
77
78         referenceED->setText(sel);
79         // <enter> or double click, inserts ref and closes dialog
80         form_->slotOK();
81 }
82
83
84 void QRefDialog::sortToggled(bool on)
85 {
86         form_->sort_ = on;
87         form_->redoRefs();
88 }
89
90
91 void QRefDialog::updateClicked()
92 {
93         form_->updateRefs();
94 }
95
96
97 void QRefDialog::closeEvent(QCloseEvent * e)
98 {
99         form_->slotWMHide();
100         e->accept();
101 }
102
103 } // namespace frontend
104 } // namespace lyx