commit f02311241afde85253aa7ad1dc631bfda0b96ce1
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Sat Dec 5 19:51:07 2020 +0100

    Make Merge Changes dialog work in read only.
    
    Make LFUN_CHANGES_MERGE active in read-only documents.
    
    Remove dummy call to ButtonController::addReadonly and replace with
    proper code.
---
 src/LyXAction.cpp               |    2 +-
 src/frontends/qt/GuiChanges.cpp |    6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index e1d78a0..7c89000 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -1048,7 +1048,7 @@ void LyXAction::init()
  * \li Origin: Levon, 16 Oct 2002
  * \endvar
  */
-               { LFUN_CHANGES_MERGE, "changes-merge", Noop, Edit },
+               { LFUN_CHANGES_MERGE, "changes-merge", ReadOnly, Edit },
 
 /*!
  * \var lyx::FuncCode lyx::LFUN_CHANGES_OUTPUT
diff --git a/src/frontends/qt/GuiChanges.cpp b/src/frontends/qt/GuiChanges.cpp
index e6363cd..812888f 100644
--- a/src/frontends/qt/GuiChanges.cpp
+++ b/src/frontends/qt/GuiChanges.cpp
@@ -46,8 +46,6 @@ GuiChanges::GuiChanges(GuiView & lv)
 
        bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
        bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
-       bc().addReadOnly(acceptPB);
-       bc().addReadOnly(rejectPB);
 }
 
 
@@ -60,8 +58,8 @@ void GuiChanges::updateContents()
 
        Change const & c = bufferview()->getCurrentChange();
        bool const changePresent = c.type != Change::UNCHANGED;
-       rejectPB->setEnabled(changePresent);
-       acceptPB->setEnabled(changePresent);
+       rejectPB->setEnabled(changePresent && !isBufferReadonly());
+       acceptPB->setEnabled(changePresent && !isBufferReadonly());
        bool const inserted = c.type == Change::INSERTED;
 
        QString text;
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to