Am 13.01.2011 um 09:40 schrieb Pavel Sanda: > Stephan Witt wrote: >> What I do not understand: >> why depends the call of GuiDialog::updateView() on the result of canApply()? > > these two commits may reveal something > r22049 (younes, 'Factorize general code out of GuiDialog...')
Ah... the original version simply was: DialogView::checkStatus() { updateView(); } So alternatively we may override Dialog::checkStatus() for GuiThesaurus. Possible patch is attached. Stephan PS. I guess this is a general problem with "half-way" transition of dialogs with button controller relicts? Is there any advise how to do the right thing?
Index: src/frontends/qt4/GuiThesaurus.cpp =================================================================== --- src/frontends/qt4/GuiThesaurus.cpp (Revision 37186) +++ src/frontends/qt4/GuiThesaurus.cpp (Arbeitskopie) @@ -86,7 +86,16 @@ 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 @@ if (pos > -1) item = rex.cap(2).trimmed(); replaceED->setText(item); - replacePB->setEnabled(true); + replacePB->setEnabled(!isBufferReadonly()); changed(); } @@ -182,8 +191,9 @@ } 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()) { Index: src/frontends/qt4/GuiThesaurus.h =================================================================== --- src/frontends/qt4/GuiThesaurus.h (Revision 37186) +++ src/frontends/qt4/GuiThesaurus.h (Arbeitskopie) @@ -28,6 +28,8 @@ public: GuiThesaurus(GuiView & lv); + void checkStatus(); + private Q_SLOTS: void change_adaptor(); void entryChanged();