]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QBibitem.C
Lots and lots of little trivial bits.
[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 QBibitem::QBibitem()
33         : base_class(_("Bibliography Item"))
34 {
35 }
36
37
38 void QBibitem::build_dialog()
39 {
40         dialog_.reset(new QBibitemDialog(this));
41
42         bc().setOK(dialog_->okPB);
43         bc().setCancel(dialog_->closePB);
44         bc().addReadOnly(dialog_->keyED);
45         bc().addReadOnly(dialog_->labelED);
46 }
47
48
49 void QBibitem::update_contents()
50 {
51         dialog_->keyED->setText(controller().params().getContents().c_str());
52         dialog_->labelED->setText(controller().params().getOptions().c_str());
53 }
54
55
56 void QBibitem::apply()
57 {
58         controller().params().setContents(dialog_->keyED->text().latin1());
59         controller().params().setOptions(dialog_->labelED->text().latin1());
60 }
61
62
63 bool QBibitem::isValid()
64 {
65         return !string(dialog_->keyED->text().latin1()).empty();
66 }