]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QIndex.C
Strip trailing whitespace.
[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 <qlineedit.h>
21 #include <qpushbutton.h>
22
23 typedef Qt2CB<ControlIndex, Qt2DB<QIndexDialog> > base_class;
24
25
26 QIndex::QIndex()
27         : base_class(qt_("LyX: Insert Index Entry"))
28 {
29 }
30
31
32 void QIndex::build_dialog()
33 {
34         dialog_.reset(new QIndexDialog(this));
35
36         bc().setOK(dialog_->okPB);
37         bc().setCancel(dialog_->closePB);
38         bc().addReadOnly(dialog_->keywordED);
39 }
40
41
42 void QIndex::update_contents()
43 {
44         string const contents = controller().params().getContents();
45         dialog_->keywordED->setText(toqstr(contents));
46
47         bc().valid(!contents.empty());
48 }
49
50
51 void QIndex::apply()
52 {
53         controller().params().setContents(fromqstr(dialog_->keywordED->text()));
54 }
55
56
57 bool QIndex::isValid()
58 {
59         return !dialog_->keywordED->text().isEmpty();
60 }