]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QBibitem.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / QBibitem.C
1 /**
2  * \file QBibitem.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 #include "QBibitem.h"
14 #include "QBibitemDialog.h"
15 #include "Qt2BC.h"
16 #include "qt_helpers.h"
17
18 #include "controllers/ControlCommand.h"
19
20 #include <qlineedit.h>
21 #include <qpushbutton.h>
22
23
24 namespace lyx {
25 namespace frontend {
26
27 typedef QController<ControlCommand, QView<QBibitemDialog> > base_class;
28
29
30 QBibitem::QBibitem(Dialog & parent)
31         : base_class(parent, lyx::to_utf8(_("Bibliography Entry Settings")))
32 {
33 }
34
35
36 void QBibitem::build_dialog()
37 {
38         dialog_.reset(new QBibitemDialog(this));
39
40         bcview().setOK(dialog_->okPB);
41         bcview().setCancel(dialog_->closePB);
42         bcview().addReadOnly(dialog_->keyED);
43         bcview().addReadOnly(dialog_->labelED);
44 }
45
46
47 void QBibitem::update_contents()
48 {
49         dialog_->keyED->setText(toqstr(controller().params().getContents()));
50         dialog_->labelED->setText(toqstr(controller().params().getOptions()));
51 }
52
53
54 void QBibitem::apply()
55 {
56         controller().params().setContents(fromqstr(dialog_->keyED->text()));
57         controller().params().setOptions(fromqstr(dialog_->labelED->text()));
58 }
59
60
61 bool QBibitem::isValid()
62 {
63         return !dialog_->keyED->text().isEmpty();
64 }
65
66 } // namespace frontend
67 } // namespace lyx