3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
6 * \author John Levon <moz@compsoc.man.ac.uk>
11 #include "QIndexDialog.h"
12 #include "QtLyXView.h"
13 #include "BufferView.h"
21 #include <qlineedit.h>
22 #include <qpushbutton.h>
24 QIndex::QIndex(LyXView *v, Dialogs *d)
25 : dialog_(0), lv_(v), d_(d), inset_(0), h_(0), u_(0), ih_(0)
27 d->showIndex.connect(slot(this, &QIndex::showIndex));
28 d->createIndex.connect(slot(this, &QIndex::createIndex));
38 void QIndex::showIndex(InsetCommand * const inset)
40 // FIXME: when could inset be 0 here ?
45 readonly = lv_->buffer()->isReadonly();
46 //FIXME ih_ = inset_->hide.connect(slot(this,&QIndex::hide));
47 params = inset->params();
53 void QIndex::createIndex(string const & arg)
55 // we could already be showing a URL, clear it out
59 readonly = lv_->buffer()->isReadonly();
60 params.setFromString(arg);
67 dialog_->keywordED->setText(params.getContents().c_str());
70 dialog_->keywordED->setFocusPolicy(QWidget::NoFocus);
71 dialog_->okPB->setEnabled(false);
72 dialog_->cancelPB->setText(_("Close"));
74 dialog_->keywordED->setFocusPolicy(QWidget::StrongFocus);
75 dialog_->keywordED->setFocus();
76 dialog_->okPB->setEnabled(true);
77 dialog_->cancelPB->setText(_("Cancel"));
87 params.setContents(dialog_->keywordED->text().latin1());
90 if (params != inset_->params()) {
91 inset_->setParams(params);
92 lv_->view()->updateInset(inset_, true);
95 lv_->getLyXFunc()->dispatch(LFUN_INDEX_INSERT, params.getAsString().c_str());
102 dialog_ = new QIndexDialog(this, 0, _("LyX: Index"), false);
104 if (!dialog_->isVisible()) {
105 h_ = d_->hideBufferDependent.connect(slot(this, &QIndex::hide));
106 //u_ = d_->updateBufferDependent.connect(slot(this, &QIndex::update));
110 dialog_->setActiveWindow();