Fixes for the FileFormat pane of GuiPrefs.cpp:

- We have to block the signals coming from viewerCO and editorCO, otherwise the signal handlers will clear the customly set viewer or editor.

- A copy-paste error made the custom viewer to be changed when changing the editor combobox.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32143 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-11-22 00:19:50 +00:00
parent 77c771e3b6
commit f1dd63ec24

View File

@ -1685,8 +1685,8 @@ void PrefFileformats::update(LyXRC const & rc)
bool const init = defaultFormatCB->currentText().isEmpty(); bool const init = defaultFormatCB->currentText().isEmpty();
updateView(); updateView();
if (init) { if (init) {
int const pos = defaultFormatCB->findData(toqstr( int const pos =
rc.default_view_format)); defaultFormatCB->findData(toqstr(rc.default_view_format));
defaultFormatCB->setCurrentIndex(pos); defaultFormatCB->setCurrentIndex(pos);
} }
} }
@ -1859,10 +1859,12 @@ namespace {
void PrefFileformats::updateViewers() void PrefFileformats::updateViewers()
{ {
Format const f = currentFormat(); Format const f = currentFormat();
viewerCO->blockSignals(true);
viewerCO->clear(); viewerCO->clear();
viewerCO->addItem(qt_("None"), QString()); viewerCO->addItem(qt_("None"), QString());
updateComboBox(viewer_alternatives, f.name(), viewerCO); updateComboBox(viewer_alternatives, f.name(), viewerCO);
viewerCO->addItem(qt_("Custom"), QString("custom viewer")); viewerCO->addItem(qt_("Custom"), QString("custom viewer"));
viewerCO->blockSignals(false);
int pos = viewerCO->findData(toqstr(f.viewer())); int pos = viewerCO->findData(toqstr(f.viewer()));
if (pos != -1) { if (pos != -1) {
@ -1880,10 +1882,12 @@ void PrefFileformats::updateViewers()
void PrefFileformats::updateEditors() void PrefFileformats::updateEditors()
{ {
Format const f = currentFormat(); Format const f = currentFormat();
editorCO->blockSignals(true);
editorCO->clear(); editorCO->clear();
editorCO->addItem(qt_("None"), QString()); editorCO->addItem(qt_("None"), QString());
updateComboBox(editor_alternatives, f.name(), editorCO); updateComboBox(editor_alternatives, f.name(), editorCO);
editorCO->addItem(qt_("Custom"), QString("custom editor")); editorCO->addItem(qt_("Custom"), QString("custom editor"));
editorCO->blockSignals(false);
int pos = editorCO->findData(toqstr(f.editor())); int pos = editorCO->findData(toqstr(f.editor()));
if (pos != -1) { if (pos != -1) {
@ -1912,7 +1916,7 @@ void PrefFileformats::on_editorCO_currentIndexChanged(int i)
bool const custom = editorCO->itemData(i).toString() == "custom editor"; bool const custom = editorCO->itemData(i).toString() == "custom editor";
editorED->setEnabled(custom); editorED->setEnabled(custom);
if (!custom) if (!custom)
currentFormat().setViewer(fromqstr(editorCO->itemData(i).toString())); currentFormat().setEditor(fromqstr(editorCO->itemData(i).toString()));
} }