]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QRefDialog.C
namespace grfx -> lyx::graphics
[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 #include "ControlRef.h"
16 #include "debug.h"
17
18 #include "QRef.h"
19 #include "QRefDialog.h"
20
21 #include <qpushbutton.h>
22 #include <qlineedit.h>
23 #include <qcombobox.h>
24 #include <qlistbox.h>
25
26
27 QRefDialog::QRefDialog(QRef * form)
28         : QRefDialogBase(0, 0, false, 0),
29         form_(form)
30 {
31         connect(okPB, SIGNAL(clicked()),
32                 form_, SLOT(slotOK()));
33         connect(applyPB, SIGNAL(clicked()),
34                 form_, SLOT(slotApply()));
35         connect(closePB, SIGNAL(clicked()),
36                 form_, SLOT(slotClose()));
37 }
38
39
40 void QRefDialog::show()
41 {
42         QRefDialogBase::show();
43         refsLB->setFocus();
44 }
45
46
47 void QRefDialog::changed_adaptor()
48 {
49         form_->changed();
50 }
51
52
53 void QRefDialog::gotoClicked()
54 {
55         form_->gotoRef();
56 }
57
58
59 void QRefDialog::refHighlighted(const QString & sel)
60 {
61         if (form_->readOnly())
62                 return;
63
64         referenceED->setText(sel);
65         if (form_->at_ref_)
66                 form_->gotoRef();
67         gotoPB->setEnabled(true);
68         if (form_->typeAllowed())
69                 typeCO->setEnabled(true);
70         if (form_->nameAllowed())
71                 nameED->setEnabled(true);
72 }
73
74
75 void QRefDialog::refSelected(const QString &)
76 {
77         // <enter> or double click, inserts ref and closes dialog
78         form_->slotOK();
79 }
80
81
82 void QRefDialog::sortToggled(bool on)
83 {
84         form_->sort_ = on;
85         form_->redoRefs();
86 }
87
88
89 void QRefDialog::updateClicked()
90 {
91         form_->updateRefs();
92 }
93
94
95 void QRefDialog::closeEvent(QCloseEvent * e)
96 {
97         form_->slotWMHide();
98         e->accept();
99 }