This addresses some bugs involving the mouse in the citation dialog. One was reported as 4121; the other is one I've seen, where clicking in the left pane causes a multi-element selection.

OK to commit?

Richard

--
==================================================================
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==================================================================
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto

Index: frontends/qt4/QCitationDialog.h
===================================================================
--- frontends/qt4/QCitationDialog.h	(revision 19390)
+++ frontends/qt4/QCitationDialog.h	(working copy)
@@ -73,7 +73,6 @@
 	void selectedChanged(const QModelIndex &, const QModelIndex &);
 	void on_availableLV_clicked(const QModelIndex &);
 	void on_availableLV_doubleClicked(const QModelIndex &);
-	void on_availableLV_entered(const QModelIndex &);
 	void availableChanged(const QModelIndex &, const QModelIndex &);
 	virtual void changed();
 	/// check whether key is already selected
Index: frontends/qt4/QCitationDialog.cpp
===================================================================
--- frontends/qt4/QCitationDialog.cpp	(revision 19390)
+++ frontends/qt4/QCitationDialog.cpp	(working copy)
@@ -320,17 +320,19 @@
 void QCitationDialog::setButtons()
 {
 	int const arows = availableLV->model()->rowCount();
+	QModelIndexList const availSels = 
+			availableLV->selectionModel()->selectedIndexes();
 	addPB->setEnabled(arows > 0 &&
-		availableLV->currentIndex().isValid() &&
-		!isSelected(availableLV->currentIndex()));
+			!availSels.isEmpty() &&
+			!isSelected(availSels.first()));
 
 	int const srows = selectedLV->model()->rowCount();
-	int const sel_nr = selectedLV->currentIndex().row();
+	QModelIndexList const selSels = 
+			selectedLV->selectionModel()->selectedIndexes();
+	int const sel_nr = 	selSels.empty() ? -1 : selSels.first().row();
 	deletePB->setEnabled(sel_nr >= 0);
 	upPB->setEnabled(sel_nr > 0);
 	downPB->setEnabled(sel_nr >= 0 && sel_nr < srows - 1);
-	applyPB->setEnabled(srows > 0);
-	okPB->setEnabled(srows > 0);
 }
 
 
@@ -346,7 +348,6 @@
 
 void QCitationDialog::on_selectedLV_clicked(const QModelIndex &)
 {
-	availableLV->selectionModel()->reset();
 	update();
 }
 
@@ -355,15 +356,12 @@
 {
 	if (!idx.isValid())
 		return;
-
-	availableLV->selectionModel()->reset();
 	update();
 }
 
 
 void QCitationDialog::on_availableLV_clicked(const QModelIndex &)
 {
-	selectedLV->selectionModel()->reset();
 	update();
 }
 
@@ -372,8 +370,6 @@
 {
 	if (!idx.isValid())
 		return;
-
-	selectedLV->selectionModel()->reset();
 	update();
 }
 
@@ -382,17 +378,10 @@
 {
 	if (isSelected(idx))
 		return;
-
-	selectedLV->selectionModel()->reset();
 	on_addPB_clicked();
 }
 
 
-void QCitationDialog::on_availableLV_entered(const QModelIndex &)
-{
-}
-
-
 namespace {
 //helper function for next two
 QModelIndex getSelectedIndex(QListView * lv) {
@@ -416,7 +405,6 @@
 	form_->addKey(idxToAdd);
 	if (idx.isValid())
 		selectedLV->setCurrentIndex(idx);
-	selectedLV->selectionModel()->reset();
 	update();
 }
 
@@ -436,7 +424,6 @@
 	if (nrows>1)
 		selectedLV->setCurrentIndex(idx);
 
-	availableLV->selectionModel()->reset();
 	update();
 }
 

Reply via email to