Fix bug in Preferences>File Formats. Editor box didn't work right.

Looks like c&p errors, mostly.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32113 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2009-11-19 23:37:16 +00:00
parent 603b94966a
commit 0e6b1220de
3 changed files with 15 additions and 2 deletions

View File

@ -246,6 +246,17 @@ void Formats::setViewer(string const & name, string const & command)
}
void Formats::setEditor(string const & name, string const & command)
{
add(name);
FormatList::iterator it =
find_if(formatlist.begin(), formatlist.end(),
FormatNamesEqual(name));
if (it != formatlist.end())
it->setEditor(command);
}
bool Formats::view(Buffer const & buffer, FileName const & filename,
string const & format_name) const
{

View File

@ -142,6 +142,8 @@ public:
///
void setViewer(std::string const & name, std::string const & command);
///
void setEditor(std::string const & name, std::string const & command);
///
bool view(Buffer const & buffer, support::FileName const & filename,
std::string const & format_name) const;
///

View File

@ -1892,7 +1892,7 @@ void PrefFileformats::updateEditors()
editorCO->setCurrentIndex(pos);
} else {
editorED->setEnabled(true);
editorED->setText(toqstr(f.viewer()));
editorED->setText(toqstr(f.editor()));
editorCO->setCurrentIndex(editorCO->findData(toqstr("custom editor")));
}
}
@ -1909,7 +1909,7 @@ void PrefFileformats::on_viewerCO_currentIndexChanged(int i)
void PrefFileformats::on_editorCO_currentIndexChanged(int i)
{
bool const custom = editorCO->itemData(i).toString() == "custom viewer";
bool const custom = editorCO->itemData(i).toString() == "custom editor";
editorED->setEnabled(custom);
if (!custom)
currentFormat().setViewer(fromqstr(editorCO->itemData(i).toString()));