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