]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QBibitem.C
No longer pass Controller & or Dialogs & to the View c-tors.
[lyx.git] / src / frontends / qt2 / QBibitem.C
1 /**
2  * \file QBibitem.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon <moz@compsoc.man.ac.uk>
7  */
8
9 #include <config.h>
10
11 #include "support/lstrings.h"
12
13 #include "ControlBibitem.h"
14 #include "gettext.h"
15 #include "debug.h"
16
17 #include <qlineedit.h>
18 #include <qpushbutton.h>
19
20 #include "QBibitemDialog.h"
21 #include "QBibitem.h"
22 #include "Qt2BC.h"
23  
24 typedef Qt2CB<ControlBibitem, Qt2DB<QBibitemDialog> > base_class;
25
26 QBibitem::QBibitem()
27         : base_class(_("Bibliography Item"))
28 {
29 }
30
31
32 void QBibitem::build_dialog()
33 {
34         dialog_.reset(new QBibitemDialog(this));
35
36         bc().setOK(dialog_->okPB);
37         bc().setCancel(dialog_->closePB);
38         bc().addReadOnly(dialog_->keyED);
39         bc().addReadOnly(dialog_->labelED);
40 }
41
42
43 void QBibitem::update_contents()
44 {
45         dialog_->keyED->setText(controller().params().getContents().c_str());
46         dialog_->labelED->setText(controller().params().getOptions().c_str());
47 }
48
49
50 void QBibitem::apply()
51 {
52         controller().params().setContents(dialog_->keyED->text().latin1());
53         controller().params().setOptions(dialog_->labelED->text().latin1());
54 }
55
56
57 bool QBibitem::isValid()
58 {
59         return !string(dialog_->keyED->text().latin1()).empty();
60 }