diff --git a/src/frontends/controllers/ControlPrint.h b/src/frontends/controllers/ControlPrint.h index f1d0b3c825..f6023ae0df 100644 --- a/src/frontends/controllers/ControlPrint.h +++ b/src/frontends/controllers/ControlPrint.h @@ -40,6 +40,8 @@ public: /// virtual bool isBufferDependent() const { return true; } /// + virtual bool canApplyToReadOnly() const { return true; } + /// virtual kb_action getLfun() const { return LFUN_BUFFER_PRINT; } /// Browse for a file diff --git a/src/frontends/controllers/ControlViewSource.h b/src/frontends/controllers/ControlViewSource.h index 43081f5658..0c2218e5d4 100644 --- a/src/frontends/controllers/ControlViewSource.h +++ b/src/frontends/controllers/ControlViewSource.h @@ -37,6 +37,8 @@ public: virtual bool isBufferDependent() const { return true; } /// bool canApply() const { return true; } + /// + virtual bool canApplyToReadOnly() const { return true; } /// The title displayed by the dialog reflects source type. docstring const title() const; diff --git a/src/frontends/controllers/Dialog.cpp b/src/frontends/controllers/Dialog.cpp index d8591586ee..a46f1b84a3 100644 --- a/src/frontends/controllers/Dialog.cpp +++ b/src/frontends/controllers/Dialog.cpp @@ -121,7 +121,8 @@ void Dialog::apply() { if (controller().isBufferDependent()) { if (!kernel().isBufferAvailable() || - kernel().isBufferReadonly()) + (kernel().isBufferReadonly() && + !controller().canApplyToReadOnly())) return; } @@ -188,7 +189,7 @@ void Dialog::checkStatus() bc().readOnly(readonly); // refreshReadOnly() is too generous in _enabling_ widgets // update dialog to disable disabled widgets again - if (!readonly) + if (!readonly || controller().canApplyToReadOnly()) view().update(); } else bc().readOnly(true); diff --git a/src/frontends/controllers/Dialog.h b/src/frontends/controllers/Dialog.h index 0caa303816..892f69cc88 100644 --- a/src/frontends/controllers/Dialog.h +++ b/src/frontends/controllers/Dialog.h @@ -161,6 +161,12 @@ public: */ virtual bool isBufferDependent() const = 0; + /** \return true if the dialog can apply data also + * for ReadOnly buffers. + * This has to be distinguished from isBufferDependent() + */ + virtual bool canApplyToReadOnly() const { return false; } + /** The lfun that is sent for applying the data. * * This method is used by the default implementation of canApply()