]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QIndex.C
index dialog, citation fixes, finish about dialog
[lyx.git] / src / frontends / qt2 / QIndex.C
1 /**
2  * \file QIndex.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 "QIndexDialog.h"
12 #include "QtLyXView.h" 
13 #include "BufferView.h"
14
15 #include "Dialogs.h"
16 #include "qt2BC.h"
17 #include "QIndex.h"
18 #include "gettext.h"
19 #include "buffer.h"
20 #include "lyxfunc.h" 
21
22 #include <qlineedit.h>
23 #include <qpushbutton.h>
24
25 typedef Qt2CB<ControlIndex, Qt2DB<QIndexDialog> > base_class;
26  
27 QIndex::QIndex(ControlIndex & c)
28         : base_class(c, _("Index"))
29 {
30 }
31
32
33 QIndex::~QIndex()
34 {
35 }
36
37
38 void QIndex::build()
39 {
40         dialog_.reset(new QIndexDialog(this));
41
42         bc().setOK(dialog_->okPB);
43         bc().setCancel(dialog_->cancelPB);
44         bc().addReadOnly(dialog_->keywordED);
45 }
46
47  
48 void QIndex::update()
49 {
50         dialog_->keywordED->setText(controller().params().getContents().c_str());
51
52         if (readonly) {
53                 dialog_->keywordED->setFocusPolicy(QWidget::NoFocus);
54                 dialog_->okPB->setEnabled(false);
55                 dialog_->cancelPB->setText(_("Close"));
56         } else {
57                 dialog_->keywordED->setFocusPolicy(QWidget::StrongFocus);
58                 dialog_->keywordED->setFocus();
59                 dialog_->okPB->setEnabled(true);
60                 dialog_->cancelPB->setText(_("Cancel"));
61         }
62 }
63
64  
65 void QIndex::apply()
66 {
67         if (readonly)
68                 return;
69
70         controller().params().setContents(dialog_->keywordED->text().latin1());
71 }