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"
|
2010-02-23 21:24:24 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "qt_helpers.h"
|
2007-10-07 10:31:37 +00:00
|
|
|
|
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
|
|
|
|
2010-02-23 21:24:24 +00:00
|
|
|
GuiBibitem::GuiBibitem(QWidget * parent) : InsetParamsWidget(parent)
|
2007-04-25 08:42:22 +00:00
|
|
|
{
|
|
|
|
setupUi(this);
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2007-10-07 10:31:37 +00:00
|
|
|
connect(keyED, SIGNAL(textChanged(QString)),
|
2010-02-23 21:24:24 +00:00
|
|
|
this, SIGNAL(changed()));
|
2007-10-07 10:31:37 +00:00
|
|
|
connect(labelED, SIGNAL(textChanged(QString)),
|
2010-02-23 21:24:24 +00:00
|
|
|
this, SIGNAL(changed()));
|
2007-04-25 08:42:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-23 21:24:24 +00:00
|
|
|
void GuiBibitem::paramsToDialog(Inset const * inset)
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2010-02-23 21:24:24 +00:00
|
|
|
InsetCommand const * ic = static_cast<InsetCommand const *>(inset);
|
|
|
|
InsetCommandParams const & params = ic->params();
|
|
|
|
keyED->setText(toqstr(params["key"]));
|
|
|
|
labelED->setText(toqstr(params["label"]));
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-23 21:24:24 +00:00
|
|
|
docstring GuiBibitem::dialogToParams() const
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2010-02-23 21:24:24 +00:00
|
|
|
InsetCommandParams params(insetCode());
|
|
|
|
params["key"] = qstring_to_ucs4(keyED->text());
|
|
|
|
params["label"] = qstring_to_ucs4(labelED->text());
|
2010-10-29 00:25:28 +00:00
|
|
|
return from_utf8(InsetCommand::params2string(params));
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-03-30 12:44:11 +00:00
|
|
|
bool GuiBibitem::checkWidgets(bool readonly) const
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2015-03-30 12:44:11 +00:00
|
|
|
keyED->setReadOnly(readonly);
|
|
|
|
labelED->setReadOnly(readonly);
|
2010-02-23 21:24:24 +00:00
|
|
|
if (!InsetParamsWidget::checkWidgets())
|
|
|
|
return false;
|
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
|
|
|
|
2008-11-14 14:28:50 +00:00
|
|
|
#include "moc_GuiBibitem.cpp"
|