diff --git a/src/BufferView.cpp b/src/BufferView.cpp index ba89032b1a..2820b7e46f 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -1059,7 +1059,6 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag) case LFUN_WORD_FIND: case LFUN_WORD_FIND_FORWARD: case LFUN_WORD_FIND_BACKWARD: - case LFUN_WORD_FINDADV: case LFUN_WORD_REPLACE: case LFUN_MARK_OFF: case LFUN_MARK_ON: @@ -1077,6 +1076,14 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag) flag.setEnabled(true); break; + case LFUN_WORD_FINDADV: { + FindAndReplaceOptions opt; + istringstream iss(to_utf8(cmd.argument())); + iss >> opt; + flag.setEnabled(opt.repl_buf_name.empty() + || !buffer_.isReadonly()); + } + case LFUN_LABEL_GOTO: { flag.setEnabled(!cmd.argument().empty() || getInsetByCode(cur, REF_CODE)); diff --git a/src/frontends/qt4/FindAndReplace.cpp b/src/frontends/qt4/FindAndReplace.cpp index d83132ebe0..49753a639f 100644 --- a/src/frontends/qt4/FindAndReplace.cpp +++ b/src/frontends/qt4/FindAndReplace.cpp @@ -67,6 +67,11 @@ FindAndReplaceWidget::FindAndReplaceWidget(GuiView & view) bool FindAndReplaceWidget::eventFilter(QObject * obj, QEvent * event) { + bool replace_enabled = view_.documentBufferView() && !view_.documentBufferView()->buffer().isReadonly(); + replace_work_area_->setEnabled(replace_enabled); + replacePB->setEnabled(replace_enabled); + replaceallPB->setEnabled(replace_enabled); + if (event->type() != QEvent::KeyPress || (obj != find_work_area_ && obj != replace_work_area_)) return QWidget::eventFilter(obj, event);