]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt4/GuiInfo.cpp
Cosmetics and constify.
[features.git] / src / frontends / qt4 / GuiInfo.cpp
index 3a9a1433f81c701233d5e2de1b2daf5eafea541c..12672c11caa5c49f9df092d42d2adf81d35e4072 100644 (file)
@@ -87,27 +87,28 @@ void GuiInfo::on_nameLE_textChanged(QString const &)
 
 void GuiInfo::applyView()
 {
-       InsetInfo const * ii = static_cast<InsetInfo const *>(inset(INFO_CODE));
-       if (!ii) {
+       InsetInfo const * ii = dynamic_cast<InsetInfo const *>(inset(INFO_CODE));
+       if (!ii)
                return;
-       }
        
        dialogToParams();
        docstring const argument = qstring_to_ucs4(type_ + ' ' + name_);
        if (!ii->validate(argument))
                return;
 
-       dispatch(FuncRequest(LFUN_INSET_MODIFY, argument));
+       dispatch(FuncRequest(LFUN_NEXT_INSET_MODIFY, argument));
        // FIXME: update the inset contents
-       updateLabels(bufferview()->buffer());
-       bufferview()->updateMetrics();
-       bufferview()->buffer().changed();
+       bufferview()->buffer().updateLabels();
+       BufferView * bv = const_cast<BufferView *>(bufferview());
+       bv->updateMetrics();
+       bv->buffer().changed();
+       bv->buffer().markDirty();
 }
 
 
 void GuiInfo::updateView()
 {
-       InsetInfo const * ii = static_cast<InsetInfo const *>(inset(INFO_CODE));
+       InsetInfo const * ii = dynamic_cast<InsetInfo const *>(inset(INFO_CODE));
        if (!ii) {
                enableView(false);
                return;
@@ -125,7 +126,10 @@ void GuiInfo::paramsToDialog()
        nameLE->blockSignals(true);
        int type = findToken(info_types, fromqstr(type_));
        typeCO->setCurrentIndex(type >= 0 ? type : 0);
-       nameLE->setText(name_);
+       // Without this test, 'math-insert' (name_) will replace 'math-insert '
+       // in nameLE and effectively disallow the input of spaces after a LFUN.
+       if (nameLE->text().trimmed() != name_)
+               nameLE->setText(name_);
        typeCO->blockSignals(false);
        nameLE->blockSignals(false);
 }
@@ -154,4 +158,4 @@ Dialog * createGuiInfo(GuiView & lv) { return new GuiInfo(lv); }
 } // namespace frontend
 } // namespace lyx
 
-#include "GuiInfo_moc.cpp"
+#include "moc_GuiInfo.cpp"