diff --git a/src/frontends/qt4/GuiThesaurus.cpp b/src/frontends/qt4/GuiThesaurus.cpp index 494c525788..86ed9598ab 100644 --- a/src/frontends/qt4/GuiThesaurus.cpp +++ b/src/frontends/qt4/GuiThesaurus.cpp @@ -86,7 +86,16 @@ GuiThesaurus::GuiThesaurus(GuiView & lv) bc().setPolicy(ButtonPolicy::OkApplyCancelReadOnlyPolicy); } - +void GuiThesaurus::checkStatus() +{ + if (!isBufferAvailable()) { + // deactivate the thesaurus if we have no buffer + enableView(false); + return; + } + updateView(); +} + void GuiThesaurus::change_adaptor() { changed(); @@ -119,7 +128,7 @@ void GuiThesaurus::selectionChanged() if (pos > -1) item = rex.cap(2).trimmed(); replaceED->setText(item); - replacePB->setEnabled(true); + replacePB->setEnabled(!isBufferReadonly()); changed(); } @@ -182,8 +191,9 @@ void GuiThesaurus::updateLists() } meaningsTV->setEnabled(true); lookupPB->setEnabled(true); - replaceED->setEnabled(true); - replacePB->setEnabled(true); + bool const readonly = isBufferReadonly(); + replaceED->setEnabled(!readonly); + replacePB->setEnabled(!readonly); } if (meanings.empty()) { diff --git a/src/frontends/qt4/GuiThesaurus.h b/src/frontends/qt4/GuiThesaurus.h index 57544a6b3e..17f9ebf179 100644 --- a/src/frontends/qt4/GuiThesaurus.h +++ b/src/frontends/qt4/GuiThesaurus.h @@ -28,6 +28,8 @@ class GuiThesaurus : public GuiDialog, public Ui::ThesaurusUi public: GuiThesaurus(GuiView & lv); + void checkStatus(); + private Q_SLOTS: void change_adaptor(); void entryChanged();