X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FTocWidget.cpp;h=538c04c177cb894dd2f4045301e7db29fb640087;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=e6b85327778ee02c06c40a47ed88f488d8d53a8f;hpb=722d8c757b27e9ee64c2d7a8f087b1f0ab1c068c;p=lyx.git diff --git a/src/frontends/qt4/TocWidget.cpp b/src/frontends/qt4/TocWidget.cpp index e6b8532777..538c04c177 100644 --- a/src/frontends/qt4/TocWidget.cpp +++ b/src/frontends/qt4/TocWidget.cpp @@ -19,6 +19,7 @@ #include "TocModel.h" #include "Buffer.h" +#include "BufferView.h" #include "CutAndPaste.h" #include "FuncRequest.h" #include "FuncStatus.h" @@ -173,6 +174,9 @@ void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd) TocItem const & item = gui_view_.tocModels().currentItem(current_type_, index); + // Start an undo group. + cur.beginUndoGroup(); + switch (cmd.action) { case LFUN_CHANGE_ACCEPT: @@ -201,6 +205,7 @@ void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd) if (inset) inset->dispatch(cur, tmpcmd); } + cur.endUndoGroup(); } @@ -404,7 +409,7 @@ static bool isSortable(QString const & type) void TocWidget::updateView() { - if (!gui_view_.currentBufferView()) { + if (!gui_view_.documentBufferView()) { enableControls(false); typeCO->setEnabled(false); tocTV->setModel(0); @@ -440,7 +445,7 @@ void TocWidget::updateView() persistentCB->setEnabled(can_navigate_); bool controls_enabled = toc_model && toc_model->rowCount() > 0 - && !gui_view_.buffer()->isReadonly(); + && !gui_view_.documentBufferView()->buffer().isReadonly(); enableControls(controls_enabled); depthSL->setMaximum(gui_view_.tocModels().depth(current_type_));