]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QBibitem.C
Some string(widget->text()) fixes. Weirdness
[lyx.git] / src / frontends / qt2 / 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 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 #include "support/lstrings.h"
18
19 #include "ControlBibitem.h"
20 #include "gettext.h"
21 #include "debug.h"
22
23 #include <qlineedit.h>
24 #include <qpushbutton.h>
25
26 #include "QBibitemDialog.h"
27 #include "QBibitem.h"
28 #include "Qt2BC.h"
29
30 typedef Qt2CB<ControlBibitem, Qt2DB<QBibitemDialog> > base_class;
31
32
33 QBibitem::QBibitem()
34         : base_class(_("Bibliography Item"))
35 {
36 }
37
38
39 void QBibitem::build_dialog()
40 {
41         dialog_.reset(new QBibitemDialog(this));
42
43         bc().setOK(dialog_->okPB);
44         bc().setCancel(dialog_->closePB);
45         bc().addReadOnly(dialog_->keyED);
46         bc().addReadOnly(dialog_->labelED);
47 }
48
49
50 void QBibitem::update_contents()
51 {
52         dialog_->keyED->setText(controller().params().getContents().c_str());
53         dialog_->labelED->setText(controller().params().getOptions().c_str());
54 }
55
56
57 void QBibitem::apply()
58 {
59         controller().params().setContents(dialog_->keyED->text().latin1());
60         controller().params().setOptions(dialog_->labelED->text().latin1());
61 }
62
63
64 bool QBibitem::isValid()
65 {
66         return !string(dialog_->keyED->text().latin1()).empty();
67 }