2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiBibitem.cpp
|
2006-03-05 17:24:44 +00:00
|
|
|
* 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>
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiBibitem.h"
|
2007-09-05 20:33:29 +00:00
|
|
|
#include "ControlCommand.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#include <QCloseEvent>
|
2007-04-25 08:42:22 +00:00
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QPushButton>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-04-25 08:42:22 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
GuiBibitemDialog::GuiBibitemDialog(LyXView & lv)
|
|
|
|
: GuiDialog(lv, "bibitem")
|
2007-04-25 08:42:22 +00:00
|
|
|
{
|
|
|
|
setupUi(this);
|
2007-09-05 20:33:29 +00:00
|
|
|
setViewTitle(_("Bibliography Entry Settings"));
|
|
|
|
setController(new ControlCommand(*this, "bibitem", "bibitem"));
|
|
|
|
|
|
|
|
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
|
|
|
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
2007-04-25 08:42:22 +00:00
|
|
|
|
|
|
|
connect(keyED, SIGNAL(textChanged(const QString &)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
connect(labelED, SIGNAL(textChanged(const QString &)),
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
bc().setPolicy(ButtonPolicy::OkCancelReadOnlyPolicy);
|
|
|
|
bc().setOK(okPB);
|
|
|
|
bc().setCancel(closePB);
|
|
|
|
bc().addReadOnly(keyED);
|
|
|
|
bc().addReadOnly(labelED);
|
2007-04-25 08:42:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-11 18:33:42 +00:00
|
|
|
ControlCommand & GuiBibitemDialog::controller()
|
2007-04-25 08:42:22 +00:00
|
|
|
{
|
2007-09-10 22:32:59 +00:00
|
|
|
return static_cast<ControlCommand &>(GuiDialog::controller());
|
2007-04-25 08:42:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
void GuiBibitemDialog::change_adaptor()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
void GuiBibitemDialog::closeEvent(QCloseEvent *e)
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-09-11 17:06:15 +00:00
|
|
|
slotClose();
|
2007-09-05 20:33:29 +00:00
|
|
|
e->accept();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-11 18:33:42 +00:00
|
|
|
void GuiBibitemDialog::updateContents()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
keyED->setText(toqstr(controller().params()["key"]));
|
|
|
|
labelED->setText(toqstr(controller().params()["label"]));
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
void GuiBibitemDialog::applyView()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
controller().params()["key"] = qstring_to_ucs4(keyED->text());
|
|
|
|
controller().params()["label"] = qstring_to_ucs4(labelED->text());
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
bool GuiBibitemDialog::isValid()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
return !keyED->text().isEmpty();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-04-25 08:42:22 +00:00
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiBibitem_moc.cpp"
|