Fix minor bug involving overlapping citation strings.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18455 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2007-05-22 15:20:19 +00:00
parent a9a3b79528
commit 9ad8985149

View File

@ -258,22 +258,24 @@ void QCitationDialog::fillStyles()
bool QCitationDialog::isSelected(const QModelIndex & idx) bool QCitationDialog::isSelected(const QModelIndex & idx)
{ {
QString const str = idx.data().toString(); QString const str = idx.data().toString();
return !form_->selected()->stringList().filter(str).isEmpty(); return form_->selected()->stringList().contains(str);
} }
void QCitationDialog::setButtons() void QCitationDialog::setButtons()
{ {
int const arows = availableLV->model()->rowCount(); int const arows = availableLV->model()->rowCount();
addPB->setEnabled(arows>0 && !isSelected(availableLV->currentIndex())); addPB->setEnabled(arows > 0 &&
availableLV->currentIndex().isValid() &&
!isSelected(availableLV->currentIndex()));
int const srows = selectedLV->model()->rowCount(); int const srows = selectedLV->model()->rowCount();
int const sel_nr = selectedLV->currentIndex().row(); int const sel_nr = selectedLV->currentIndex().row();
deletePB->setEnabled(sel_nr >= 0); deletePB->setEnabled(sel_nr >= 0);
upPB->setEnabled(sel_nr > 0); upPB->setEnabled(sel_nr > 0);
downPB->setEnabled(sel_nr >= 0 && sel_nr < srows - 1); downPB->setEnabled(sel_nr >= 0 && sel_nr < srows - 1);
applyPB->setEnabled(srows>0); applyPB->setEnabled(srows > 0);
okPB->setEnabled(srows>0); okPB->setEnabled(srows > 0);
} }