The attached is intended to resolve bug 3246: "OK" button disabled when
selecting cross ref with keyboard. A similar problem affected the
TeXInfo dialog, and I have fixed that one, too. My fix is essentially
the same as in the Thesaurus dialog, which did not suffer from this
problem (though it could have). I also fixed some of the widget names in
QTexInfo* to accord with the policy stated in the README file. (See next
patch.)

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/ui/QTexinfoUi.ui
===================================================================
--- frontends/qt4/ui/QTexinfoUi.ui	(revision 17611)
+++ frontends/qt4/ui/QTexinfoUi.ui	(working copy)
@@ -1,7 +1,4 @@
 <ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
  <class>QTexinfoUi</class>
  <widget class="QDialog" name="QTexinfoUi" >
   <property name="geometry" >
@@ -26,7 +23,7 @@
     <number>6</number>
    </property>
    <item row="1" column="0" >
-    <widget class="QListWidget" name="fileList" />
+    <widget class="QListWidget" name="fileListLW" />
    </item>
    <item row="3" column="0" >
     <layout class="QHBoxLayout" >
@@ -122,7 +119,7 @@
       <number>6</number>
      </property>
      <item>
-      <widget class="QComboBox" name="whatStyle" >
+      <widget class="QComboBox" name="whatStyleCO" >
        <property name="toolTip" >
         <string>Selected classes or styles</string>
        </property>
@@ -160,7 +157,7 @@
       </spacer>
      </item>
      <item>
-      <widget class="QCheckBox" name="path" >
+      <widget class="QCheckBox" name="pathCB" >
        <property name="toolTip" >
         <string>Toggles view of the file list</string>
        </property>
@@ -173,18 +170,17 @@
    </item>
   </layout>
  </widget>
- <pixmapfunction></pixmapfunction>
- <includes>
-  <include location="local" >qt_helpers.h</include>
- </includes>
  <tabstops>
-  <tabstop>whatStyle</tabstop>
-  <tabstop>path</tabstop>
-  <tabstop>fileList</tabstop>
+  <tabstop>whatStyleCO</tabstop>
+  <tabstop>pathCB</tabstop>
+  <tabstop>fileListLW</tabstop>
   <tabstop>rescanPB</tabstop>
   <tabstop>viewPB</tabstop>
   <tabstop>closePB</tabstop>
  </tabstops>
+ <includes>
+  <include location="local" >qt_helpers.h</include>
+ </includes>
  <resources/>
  <connections/>
 </ui>
Index: frontends/qt4/QTexinfo.C
===================================================================
--- frontends/qt4/QTexinfo.C	(revision 17611)
+++ frontends/qt4/QTexinfo.C	(working copy)
@@ -48,15 +48,15 @@
 void QTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
 {
 	ContentsType & data = texdata_[whichStyle];
-	bool const withFullPath = dialog_->path->isChecked();
+	bool const withFullPath = dialog_->pathCB->isChecked();
 
 	getTexFileList(whichStyle, data, withFullPath);
 
-	dialog_->fileList->clear();
+	dialog_->fileListLW->clear();
 	ContentsType::const_iterator it  = data.begin();
 	ContentsType::const_iterator end = data.end();
 	for (; it != end; ++it)
-		dialog_->fileList->addItem(toqstr(*it));
+		dialog_->fileListLW->addItem(toqstr(*it));
 
 	activeStyle = whichStyle;
 }
Index: frontends/qt4/QTexinfoDialog.C
===================================================================
--- frontends/qt4/QTexinfoDialog.C	(revision 17611)
+++ frontends/qt4/QTexinfoDialog.C	(working copy)
@@ -34,12 +34,13 @@
 		form, SLOT(slotClose()));
 
     connect( viewPB, SIGNAL( clicked() ), this, SLOT( viewClicked() ) );
-    connect( whatStyle, SIGNAL( activated(const QString&) ), this, SLOT( enableViewPB() ) );
-    connect( whatStyle, SIGNAL( activated(int) ), this, SLOT( update() ) );
-    connect( path, SIGNAL( stateChanged(int) ), this, SLOT( update() ) );
+    connect( whatStyleCO, SIGNAL( activated(const QString&) ), this, SLOT( enableViewPB() ) );
+    connect( whatStyleCO, SIGNAL( activated(int) ), this, SLOT( update() ) );
+    connect( pathCB, SIGNAL( stateChanged(int) ), this, SLOT( update() ) );
     connect( rescanPB, SIGNAL( clicked() ), this, SLOT( enableViewPB() ) );
     connect( rescanPB, SIGNAL( clicked() ), this, SLOT( rescanClicked() ) );
-    connect( fileList, SIGNAL( itemClicked(QListWidgetItem*) ), this, SLOT( enableViewPB() ) );
+    connect( fileListLW, SIGNAL( itemClicked(QListWidgetItem*) ), this, SLOT( enableViewPB() ) );
+    connect( fileListLW, SIGNAL( itemSelectionChanged() ), this, SLOT( enableViewPB() ) );
 }
 
 
@@ -67,10 +68,10 @@
 
 void QTexinfoDialog::viewClicked()
 {
-	vector<string>::size_type const fitem = fileList->currentRow();
+	vector<string>::size_type const fitem = fileListLW->currentRow();
 	vector<string> const & data = form_->texdata_[form_->activeStyle];
 	string file = data[fitem];
-	if (!path->isChecked())
+	if (!pathCB->isChecked())
 		file = getTexFileFromList(data[fitem],
 			form_->controller().getFileType(form_->activeStyle));
 	form_->controller().viewFile(file);
@@ -79,7 +80,7 @@
 
 void QTexinfoDialog::update()
 {
-	switch (whatStyle->currentIndex()) {
+	switch (whatStyleCO->currentIndex()) {
 	case 0:
 		form_->updateStyles(ControlTexinfo::cls);
 		break;
@@ -99,7 +100,7 @@
 
 void QTexinfoDialog::enableViewPB()
 {
-	viewPB->setEnabled(fileList->currentRow() > -1);
+	viewPB->setEnabled(fileListLW->currentRow() > -1);
 }
 
 } // namespace frontend
Index: frontends/qt4/QRefDialog.C
===================================================================
--- frontends/qt4/QRefDialog.C	(revision 17611)
+++ frontends/qt4/QRefDialog.C	(working copy)
@@ -42,6 +42,8 @@
 		this, SLOT( changed_adaptor() ) );
 	connect( refsLW, SIGNAL(  itemClicked(QListWidgetItem *) ), 
 		this, SLOT( refHighlighted(QListWidgetItem *) ) );
+	connect( refsLW, SIGNAL(  itemSelectionChanged() ),
+		this, SLOT( selectionChanged() ) );
 	connect( refsLW, SIGNAL(  itemActivated(QListWidgetItem *) ), 
 		this, SLOT( refSelected(QListWidgetItem *) ) );
 	connect( sortCB, SIGNAL( clicked(bool) ),
@@ -73,6 +75,18 @@
 	form_->gotoRef();
 }
 
+void QRefDialog::selectionChanged()
+{
+	if (form_->readOnly())
+		return;
+	
+	QList<QListWidgetItem *> selections = refsLW->selectedItems();
+	if (selections.isEmpty())
+		return;
+	QListWidgetItem * sel = selections.first();
+	refHighlighted(sel);
+	return;
+}
 
 void QRefDialog::refHighlighted(QListWidgetItem * sel)
 {
Index: frontends/qt4/QRefDialog.h
===================================================================
--- frontends/qt4/QRefDialog.h	(revision 17611)
+++ frontends/qt4/QRefDialog.h	(working copy)
@@ -36,6 +36,7 @@
 	void changed_adaptor();
 	void gotoClicked();
 	void refHighlighted(QListWidgetItem *);
+	void selectionChanged();
 	void refSelected(QListWidgetItem *);
 	void sortToggled(bool);
 	void updateClicked();
Index: frontends/qt4/QViewSourceDialog.C

Reply via email to