X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiNomenclature.cpp;h=3afad18a83e3e25cf7e7a904937e9c9cdf4a8f14;hb=b7f6b979d0f889f08e735f35378bb20ba3788b4b;hp=091537b6cb1e7b8c3d8f32297c1e41ee4a53b2f9;hpb=716cfaea68165601c3b8bfee99ef4f66cf450b27;p=lyx.git diff --git a/src/frontends/qt4/GuiNomenclature.cpp b/src/frontends/qt4/GuiNomenclature.cpp index 091537b6cb..3afad18a83 100644 --- a/src/frontends/qt4/GuiNomenclature.cpp +++ b/src/frontends/qt4/GuiNomenclature.cpp @@ -29,6 +29,8 @@ GuiNomenclature::GuiNomenclature(QWidget * parent) : InsetParamsWidget(parent) this, SIGNAL(changed())); connect(descriptionTE, SIGNAL(textChanged()), this, SIGNAL(changed())); + connect(literalCB, SIGNAL(clicked()), + this, SIGNAL(changed())); setFocusProxy(descriptionTE); } @@ -41,6 +43,7 @@ void GuiNomenclature::paramsToDialog(Inset const * inset) prefixED->setText(toqstr(params["prefix"])); symbolED->setText(toqstr(params["symbol"])); + literalCB->setChecked(params["literal"] == "true"); QString description = toqstr(params["description"]); description.replace("\\\\","\n"); descriptionTE->setPlainText(description); @@ -56,12 +59,26 @@ docstring GuiNomenclature::dialogToParams() const QString description = descriptionTE->toPlainText(); description.replace('\n',"\\\\"); params["description"] = qstring_to_ucs4(description); - return from_ascii(InsetNomencl::params2string("nomenclature", params)); + params["literal"] = literalCB->isChecked() + ? from_ascii("true") : from_ascii("false"); + return from_utf8(InsetNomencl::params2string(params)); +} + + +bool GuiNomenclature::initialiseParams(std::string const & data) +{ + InsetCommandParams p(insetCode()); + if (!InsetCommand::string2params(data, p)) + return false; + symbolED->setText(toqstr(p["symbol"])); + return true; } -bool GuiNomenclature::checkWidgets() const +bool GuiNomenclature::checkWidgets(bool readonly) const { + symbolED->setReadOnly(readonly); + descriptionTE->setReadOnly(readonly); if (!InsetParamsWidget::checkWidgets()) return false; QString const description = descriptionTE->toPlainText();