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"
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "qt_helpers.h"
|
2007-10-07 10:31:37 +00:00
|
|
|
#include "FuncRequest.h"
|
|
|
|
|
2008-04-20 08:19:26 +00:00
|
|
|
#include "insets/InsetCommand.h"
|
|
|
|
|
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-11-23 09:44:02 +00:00
|
|
|
GuiBibitem::GuiBibitem(GuiView & lv)
|
2008-04-20 08:19:26 +00:00
|
|
|
: GuiDialog(lv, "bibitem", qt_("Bibliography Entry Settings")),
|
|
|
|
params_(insetCode("bibitem"))
|
2007-04-25 08:42:22 +00:00
|
|
|
{
|
|
|
|
setupUi(this);
|
2007-09-05 20:33:29 +00:00
|
|
|
|
|
|
|
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
|
|
|
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
2007-04-25 08:42:22 +00:00
|
|
|
|
2007-10-07 10:31:37 +00:00
|
|
|
connect(keyED, SIGNAL(textChanged(QString)),
|
2007-04-25 08:42:22 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
2007-10-07 10:31:37 +00:00
|
|
|
connect(labelED, SIGNAL(textChanged(QString)),
|
2007-04-25 08:42:22 +00:00
|
|
|
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-10-07 10:31:37 +00:00
|
|
|
void GuiBibitem::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-10-07 10:31:37 +00:00
|
|
|
void GuiBibitem::updateContents()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-07 10:31:37 +00:00
|
|
|
keyED->setText(toqstr(params_["key"]));
|
|
|
|
labelED->setText(toqstr(params_["label"]));
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-07 10:31:37 +00:00
|
|
|
void GuiBibitem::applyView()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-07 10:31:37 +00:00
|
|
|
params_["key"] = qstring_to_ucs4(keyED->text());
|
|
|
|
params_["label"] = qstring_to_ucs4(labelED->text());
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-07 10:31:37 +00:00
|
|
|
bool GuiBibitem::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
|
|
|
}
|
|
|
|
|
2007-10-07 10:31:37 +00:00
|
|
|
|
2008-04-20 08:19:26 +00:00
|
|
|
bool GuiBibitem::initialiseParams(std::string const & data)
|
|
|
|
{
|
|
|
|
// The name passed with LFUN_INSET_APPLY is also the name
|
|
|
|
// used to identify the mailer.
|
|
|
|
InsetCommand::string2params("bibitem", data, params_);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiBibitem::dispatchParams()
|
|
|
|
{
|
|
|
|
std::string const lfun = InsetCommand::params2string("bibitem", params_);
|
|
|
|
dispatch(FuncRequest(getLfun(), lfun));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
Dialog * createGuiBibitem(GuiView & lv) { return new GuiBibitem(lv); }
|
2007-10-07 10:31:37 +00:00
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-04-25 08:42:22 +00:00
|
|
|
|
2008-11-14 14:28:50 +00:00
|
|
|
#include "moc_GuiBibitem.cpp"
|