Regarding the following ticket,
http://www.lyx.org/trac/ticket/4398
is this fixed? It seems to work fine for me in trunk.
For example, in the Embedded Objects Manual when I delete the note that says
"Remove the protected space when bug 4398 is fixed!" and the protected space
the document compiles and looks as I would expect it to.

The attached patch fixes the problem of allowing the user to browse for a file
for a Date when no file is needed. It is a little hackish and I don't think it
will be accepted but I wanted to send it on just in case I'm wrong. If in
FileFilter "NOFILE" is specified, then browsePB and the textbox are disabled
for that template. There is a small problem in that if you insert a Date
template and then go back to the dialog (by doing insert > file > external
material again) okPB is disabled when it should be enabled. If this were an
acceptable patch, I would try to resolve this buglette and also add
documentation.

Is a better solution still to move the Date template to InsetInfo?

Any thoughts?

Thanks,

Scott
diff --git a/lib/external_templates b/lib/external_templates
index 4fb505d..4670711 100644
--- a/lib/external_templates
+++ b/lib/external_templates
@@ -347,7 +347,7 @@ Template Date
                Read 'info date' for more information.
        HelpTextEnd
        InputFormat date
-       FileFilter "*"
+       FileFilter "NOFILE"
        AutomaticProduction true
        Preview Off
        Format LaTeX
diff --git a/src/frontends/qt4/GuiExternal.cpp 
b/src/frontends/qt4/GuiExternal.cpp
index d944bc0..659b71b 100644
--- a/src/frontends/qt4/GuiExternal.cpp
+++ b/src/frontends/qt4/GuiExternal.cpp
@@ -503,6 +503,23 @@ void GuiExternal::updateContents()
 
 void GuiExternal::updateTemplate()
 {
+       int const choice =  externalCO->currentIndex();
+       QString const template_name = toqstr(getTemplate(choice).lyxName);
+       external::TemplateManager const & etm =
+               external::TemplateManager::get();
+       external::Template const * const et_ptr =
+               etm.getTemplateByName(fromqstr(template_name));
+       
+       if (et_ptr->fileRegExp == "NOFILE") {
+               fileED->setEnabled(false);
+               fileED->clear();
+               browsePB->setEnabled(false);
+       }
+       else {
+               fileED->setEnabled(true);
+               browsePB->setEnabled(true);
+       }
+
        external::Template templ = getTemplate(externalCO->currentIndex());
        externalTB->setPlainText(qt_(templ.helpText));
 

Reply via email to