lyx_mirror/src/frontends/qt4/GuiBibitem.cpp
Richard Heck 0787ade6c0 This is the first part of a cleanup of how we handle the InsetCommand hierarchy. This part starts to disentangle the type of the inset from the command that a single instance of the inset represents. This involves two sorts of changes:
(i) The file format is changed, so that command insets are represented as:
    \begin_inset CommandInset insetype
    LatexCommand command
    ...
    \end_inset
This involves some lyx2lyx and changes to the readInset() routine in factory.cpp
(ii) The InsetCommand and InsetCommandParams classes also have to be changed, as the command name was used in these classes for various purposes for which the inset type ought really to be used.
Further clean-up to come.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20544 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-27 18:24:18 +00:00

91 lines
1.8 KiB
C++

/**
* \file GuiBibitem.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "GuiBibitem.h"
#include "ControlCommand.h"
#include "qt_helpers.h"
#include <QCloseEvent>
#include <QLineEdit>
#include <QPushButton>
namespace lyx {
namespace frontend {
GuiBibitemDialog::GuiBibitemDialog(LyXView & lv)
: GuiDialog(lv, "bibitem")
{
setupUi(this);
setViewTitle(_("Bibliography Entry Settings"));
setController(new ControlCommand(*this, "bibitem"));
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
connect(keyED, SIGNAL(textChanged(const QString &)),
this, SLOT(change_adaptor()));
connect(labelED, SIGNAL(textChanged(const QString &)),
this, SLOT(change_adaptor()));
bc().setPolicy(ButtonPolicy::OkCancelReadOnlyPolicy);
bc().setOK(okPB);
bc().setCancel(closePB);
bc().addReadOnly(keyED);
bc().addReadOnly(labelED);
}
ControlCommand & GuiBibitemDialog::controller()
{
return static_cast<ControlCommand &>(GuiDialog::controller());
}
void GuiBibitemDialog::change_adaptor()
{
changed();
}
void GuiBibitemDialog::closeEvent(QCloseEvent *e)
{
slotClose();
e->accept();
}
void GuiBibitemDialog::updateContents()
{
keyED->setText(toqstr(controller().params()["key"]));
labelED->setText(toqstr(controller().params()["label"]));
}
void GuiBibitemDialog::applyView()
{
controller().params()["key"] = qstring_to_ucs4(keyED->text());
controller().params()["label"] = qstring_to_ucs4(labelED->text());
}
bool GuiBibitemDialog::isValid()
{
return !keyED->text().isEmpty();
}
} // namespace frontend
} // namespace lyx
#include "GuiBibitem_moc.cpp"