Revert r33852 and try something else. The problem here, which can be

seen in branch, too, is that if you change the style combo and then do
anything else, such as click on an entry, the combo reverts.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33858 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-03-24 15:49:06 +00:00
parent ffd3b5a6a3
commit 869f6d33c6

View File

@ -193,7 +193,8 @@ void GuiCitation::updateControls()
// such as when addPB is pressed, as the list of fields, entries, etc,
// will not have changed. At the moment, however, the division between
// fillStyles() and updateStyle() doesn't lend itself to dividing the
// two methods, though they should be divisible.
// two methods, though they should be divisible. That is, we should
// not have to call fillStyles() every time through here.
void GuiCitation::updateControls(BiblioInfo const & bi)
{
QModelIndex idx = selectionManager->getSelectedIndex();
@ -249,11 +250,16 @@ void GuiCitation::updateStyle()
std::find(styles.begin(), styles.end(), cs.style);
if (cit != styles.end()) {
int const i = int(cit - styles.begin());
citationStyleCO->setCurrentIndex(i);
fulllistCB->setChecked(cs.full);
forceuppercaseCB->setChecked(cs.forceUpperCase);
} else {
// restore the last used natbib style
if (style_ >= 0 && style_ < citationStyleCO->count()) {
// the necessary update will be performed later
citationStyleCO->blockSignals(true);
citationStyleCO->setCurrentIndex(style_);
citationStyleCO->blockSignals(false);
}
fulllistCB->setChecked(false);
forceuppercaseCB->setChecked(false);
}
@ -302,9 +308,6 @@ void GuiCitation::fillStyles(BiblioInfo const & bi)
citationStyleCO->setCurrentIndex(oldIndex);
citationStyleCO->blockSignals(false);
// simulate a change of index to trigger updateFormatting().
on_citationStyleCO_currentIndexChanged(citationStyleCO->currentIndex());
}
@ -528,16 +531,26 @@ void GuiCitation::init()
selectedLV->selectionModel()->select(idx,
QItemSelectionModel::ClearAndSelect);
selectedLV->blockSignals(false);
// set the style combo appropriately
string const & command = params_.getCmdName();
vector<CiteStyle> const & styles = citeStyles_;
CitationStyle const cs = citationStyleFromString(command);
vector<CiteStyle>::const_iterator cit =
std::find(styles.begin(), styles.end(), cs.style);
if (cit != styles.end()) {
int const i = int(cit - styles.begin());
// the necessary update will be performed later
citationStyleCO->blockSignals(true);
citationStyleCO->setCurrentIndex(i);
citationStyleCO->blockSignals(false);
}
} else
availableLV->setFocus();
fillFields(bi);
fillEntries(bi);
updateControls(bi);
// restore the last used natbib style
if (style_ >= 0 && style_ < citationStyleCO->count())
citationStyleCO->setCurrentIndex(style_);
else
citationStyleCO->setCurrentIndex(0);
}