Implement checks for available modules both in BufferParams and in the gui.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22387 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-01-05 16:56:30 +00:00
parent c03c537a8a
commit 80e98c5b71
3 changed files with 28 additions and 5 deletions

View File

@ -1413,6 +1413,13 @@ void BufferParams::makeTextClass()
endl;
continue;
}
if (!lm->isAvailable()) {
docstring const msg =
bformat(_("The module %1$s requires a package that is\n"
"not available in your LaTeX installation. LaTeX output\n"
"may not be possible.\n"), from_utf8(modName));
frontend::Alert::warning(_("Package not available"), msg);
}
FileName layout_file = libFileSearch("layouts", lm->filename);
textClass_->read(layout_file, TextClass::MODULE);
}

View File

@ -951,8 +951,16 @@ void GuiDocument::updateModuleInfo()
}
pkgdesc += pkgList[i];
}
if (!pkgdesc.empty())
desc += " Requires " + pkgdesc + ".";
if (!pkgdesc.empty()) {
if (!desc.empty())
desc += " ";
desc += ("Requires " + pkgdesc + ".");
}
if (!isModuleAvailable(modName)) {
if (!desc.empty())
desc += "\n";
desc += "WARNING: Some packages are unavailable!";
}
latexModule->infoML->document()->setPlainText(toqstr(desc));
}
}
@ -1689,13 +1697,12 @@ string GuiDocument::getModuleDescription(string const & modName) const
{
LyXModule const * const mod = moduleList[modName];
if (!mod)
return string("Module unavailable!");
return string("Module not found!");
return mod->description;
}
vector<string>
GuiDocument::getPackageList(string const & modName) const
vector<string> GuiDocument::getPackageList(string const & modName) const
{
LyXModule const * const mod = moduleList[modName];
if (!mod)
@ -1704,6 +1711,13 @@ GuiDocument::getPackageList(string const & modName) const
}
bool GuiDocument::isModuleAvailable(string const & modName) const
{
LyXModule * mod = moduleList[modName];
return mod->isAvailable();
}
TextClass const & GuiDocument::textClass() const
{
return textclasslist[bp_.getBaseClass()];

View File

@ -186,6 +186,8 @@ protected:
///
std::vector<std::string> getPackageList(std::string const & modName) const;
///
bool isModuleAvailable(std::string const & modName) const;
///
void setLanguage() const;
///
void saveAsDefault() const;