I'm planning to commit these after 2.1 is released. If anyone has
comments or would like to see them in 2.1 let me know.

Scott
From 9c290b87fba4317ca974250a442c9ddc5c8e921f Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Wed, 19 Feb 2014 16:58:20 -0500
Subject: [PATCH 1/4] Disable math insert dialogs when read only buffer

---
 src/frontends/qt4/GuiView.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
index 3ba1f0e..90a45cf 100644
--- a/src/frontends/qt4/GuiView.cpp
+++ b/src/frontends/qt4/GuiView.cpp
@@ -1732,7 +1732,10 @@ bool GuiView::getStatus(FuncRequest const & cmd, 
FuncStatus & flag)
                else if (name == "print")
                        enable = doc_buffer->params().isExportable("dvi")
                                && lyxrc.print_command != "none";
-               else if (name == "character" || name == "symbols") {
+               else if (name == "character"
+                               || name == "symbols"
+                               || name == "mathdelimiter"
+                               || name == "mathmatrix") {
                        if (!buf || buf->isReadonly())
                                enable = false;
                        else {
-- 
1.8.3.2

From 2d594c6be3e495b3652474d9a1f8a2aee8586577 Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Wed, 19 Feb 2014 16:58:29 -0500
Subject: [PATCH 2/4] Disable custom insets insert menu if read only

Before, if a document was read only and had no custom insets
defined, the submenu would be enabled.
---
 src/frontends/qt4/Menus.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp
index cc07afc..bf7d1a7 100644
--- a/src/frontends/qt4/Menus.cpp
+++ b/src/frontends/qt4/Menus.cpp
@@ -1215,7 +1215,7 @@ void MenuDefinition::expandFlexInsert(
                }
        }
        // FIXME This is a little clunky.
-       if (items_.empty() && type == InsetLayout::CUSTOM)
+       if (items_.empty() && type == InsetLayout::CUSTOM && !buf->isReadonly())
                add(MenuItem(MenuItem::Help, qt_("No Custom Insets Defined!")));
 }
 
-- 
1.8.3.2

From ca9c99499e80012c1d0e3c4abcf2043221e28578 Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Wed, 19 Feb 2014 16:58:31 -0500
Subject: [PATCH 3/4] Disable branches insert menu if read only

---
 src/frontends/qt4/Menus.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp
index bf7d1a7..dfba0e6 100644
--- a/src/frontends/qt4/Menus.cpp
+++ b/src/frontends/qt4/Menus.cpp
@@ -1393,7 +1393,7 @@ void MenuDefinition::expandToolbars()
 
 void MenuDefinition::expandBranches(Buffer const * buf)
 {
-       if (!buf)
+       if (!buf || buf->isReadonly())
                return;
 
        BufferParams const & master_params = buf->masterBuffer()->params();
-- 
1.8.3.2

From 65a66284b70dfc7d169d9c98f8aa2f8544e68fd0 Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Wed, 19 Feb 2014 16:58:33 -0500
Subject: [PATCH 4/4] Disable insertion of plain text file if read only

---
 src/frontends/qt4/GuiView.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
index 90a45cf..159a32f 100644
--- a/src/frontends/qt4/GuiView.cpp
+++ b/src/frontends/qt4/GuiView.cpp
@@ -1871,7 +1871,9 @@ bool GuiView::getStatus(FuncRequest const & cmd, 
FuncStatus & flag)
 
        case LFUN_FILE_INSERT_PLAINTEXT:
        case LFUN_FILE_INSERT_PLAINTEXT_PARA:
-               enable = documentBufferView() && 
documentBufferView()->cursor().inTexted();
+               enable = documentBufferView()
+                       && documentBufferView()->cursor().inTexted()
+                       && !doc_buffer->isReadonly();
                break;
 
        case LFUN_SPELLING_CONTINUOUSLY:
-- 
1.8.3.2

Reply via email to