]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QRefDialog.C
Minipage is no more (long live the box inset)
[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
15
16 #include "QRef.h"
17 #include "QRefDialog.h"
18
19 #include <qpushbutton.h>
20 #include <qlineedit.h>
21 #include <qcombobox.h>
22 #include <qlistbox.h>
23
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 &)
74 {
75         // <enter> or double click, inserts ref and closes dialog
76         form_->slotOK();
77 }
78
79
80 void QRefDialog::sortToggled(bool on)
81 {
82         form_->sort_ = on;
83         form_->redoRefs();
84 }
85
86
87 void QRefDialog::updateClicked()
88 {
89         form_->updateRefs();
90 }
91
92
93 void QRefDialog::closeEvent(QCloseEvent * e)
94 {
95         form_->slotWMHide();
96         e->accept();
97 }