]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QIndex.C
Minimal fix needed to give Qt a label dialog again.
[lyx.git] / src / frontends / qt2 / QIndex.C
1 /**
2  * \file QIndex.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
14 #include "ControlIndex.h"
15 #include "qt_helpers.h"
16
17 #include "QIndexDialog.h"
18 #include "QIndex.h"
19 #include "Qt2BC.h"
20 #include <qlabel.h>
21 #include <qlineedit.h>
22 #include <qpushbutton.h>
23
24 typedef QController<ControlCommand, QView<QIndexDialog> > base_class;
25
26
27 QIndex::QIndex(Dialog & parent, QString const & title, QString const & label)
28         : base_class(parent, title), label_(label)
29 {
30 }
31
32
33 void QIndex::build_dialog()
34 {
35         dialog_.reset(new QIndexDialog(this));
36
37         dialog_->keywordLA->setText(label_);
38
39         bc().setOK(dialog_->okPB);
40         bc().setCancel(dialog_->closePB);
41         bc().addReadOnly(dialog_->keywordED);
42 }
43
44
45 void QIndex::update_contents()
46 {
47         string const contents = controller().params().getContents();
48         dialog_->keywordED->setText(toqstr(contents));
49
50         bc().valid(!contents.empty());
51 }
52
53
54 void QIndex::apply()
55 {
56         controller().params().setContents(fromqstr(dialog_->keywordED->text()));
57 }
58
59
60 bool QIndex::isValid()
61 {
62         return !dialog_->keywordED->text().isEmpty();
63 }