make thesaurus usable for readonly documents

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37216 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Stephan Witt 2011-01-15 12:09:23 +00:00
parent ce7a4d2e2b
commit fa632bfd7e
2 changed files with 16 additions and 4 deletions

View File

@ -86,6 +86,15 @@ 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()
{
@ -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()) {

View File

@ -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();