* src/frontends/controllers/Dialog.{cpp,h}:

- new boolean canApplyToReadonly that allows to apply params/update view
	  even if the buffer is readOnly for specific dialogs.

* src/frontends/controllers/ControlPrint.h: 
	- use that (fix bug 3909)
* src/frontends/controllers/ControlViewSource: 
	- dto. (fix bug 3943)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18959 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2007-07-02 13:54:30 +00:00
parent 3a4dd21a65
commit ca339eb199
4 changed files with 13 additions and 2 deletions

View File

@ -40,6 +40,8 @@ public:
/// ///
virtual bool isBufferDependent() const { return true; } virtual bool isBufferDependent() const { return true; }
/// ///
virtual bool canApplyToReadOnly() const { return true; }
///
virtual kb_action getLfun() const { return LFUN_BUFFER_PRINT; } virtual kb_action getLfun() const { return LFUN_BUFFER_PRINT; }
/// Browse for a file /// Browse for a file

View File

@ -37,6 +37,8 @@ public:
virtual bool isBufferDependent() const { return true; } virtual bool isBufferDependent() const { return true; }
/// ///
bool canApply() const { return true; } bool canApply() const { return true; }
///
virtual bool canApplyToReadOnly() const { return true; }
/// The title displayed by the dialog reflects source type. /// The title displayed by the dialog reflects source type.
docstring const title() const; docstring const title() const;

View File

@ -121,7 +121,8 @@ void Dialog::apply()
{ {
if (controller().isBufferDependent()) { if (controller().isBufferDependent()) {
if (!kernel().isBufferAvailable() || if (!kernel().isBufferAvailable() ||
kernel().isBufferReadonly()) (kernel().isBufferReadonly() &&
!controller().canApplyToReadOnly()))
return; return;
} }
@ -188,7 +189,7 @@ void Dialog::checkStatus()
bc().readOnly(readonly); bc().readOnly(readonly);
// refreshReadOnly() is too generous in _enabling_ widgets // refreshReadOnly() is too generous in _enabling_ widgets
// update dialog to disable disabled widgets again // update dialog to disable disabled widgets again
if (!readonly) if (!readonly || controller().canApplyToReadOnly())
view().update(); view().update();
} else } else
bc().readOnly(true); bc().readOnly(true);

View File

@ -161,6 +161,12 @@ public:
*/ */
virtual bool isBufferDependent() const = 0; 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. /** The lfun that is sent for applying the data.
* *
* This method is used by the default implementation of canApply() * This method is used by the default implementation of canApply()