The attached patch fixes that bug, but I'm not sure it is the right approach.

The problem is that bibkeysInfo_ is not cleared. This used to happen in 
ControlCitation::clearParams() that is called from Dialog::hide().

However, seems that Dialog::hide() as well as Dialog::OKButton() etc. are not 
triggered anymore, but that the qt4 dialogs are doing their own thing. Abdel, 
I guess this is intentional? 

The patch hence calls ControlCitation::clearParams() directly from within 
QCitationDialog. I wonder, however, if similar problems are not to be found 
the other dialogs, since clearParams() is implemented there as well and 
should certainly be triggered.

Opinions?

Jürgen
Index: src/frontends/qt4/QCitationDialog.C
===================================================================
--- src/frontends/qt4/QCitationDialog.C	(Revision 16546)
+++ src/frontends/qt4/QCitationDialog.C	(Arbeitskopie)
@@ -26,6 +26,8 @@
 #include <vector>
 #include <string>
 
+#include <QCloseEvent>
+
 using std::vector;
 using std::string;
 
@@ -47,17 +49,17 @@
  	selectedLV->setModel(form_->selected());
 	availableLV->setModel(form_->available());
 
-    connect(citationStyleCO, SIGNAL(activated(int)),
+	connect(citationStyleCO, SIGNAL(activated(int)),
 		this, SLOT(changed()));
-    connect(fulllistCB, SIGNAL(clicked()),
+	connect(fulllistCB, SIGNAL(clicked()),
 		this, SLOT(changed()));
-    connect(forceuppercaseCB, SIGNAL(clicked()),
+	connect(forceuppercaseCB, SIGNAL(clicked()),
 		this, SLOT(changed()));
-    connect(textBeforeED, SIGNAL(textChanged(const QString&)),
+	connect(textBeforeED, SIGNAL(textChanged(const QString&)),
 		this, SLOT(changed()));
-    connect(textAfterED, SIGNAL(textChanged(const QString&)),
+	connect(textAfterED, SIGNAL(textChanged(const QString&)),
 		this, SLOT(changed()));
-    connect(clearPB, SIGNAL(clicked()),
+	connect(clearPB, SIGNAL(clicked()),
 		findLE, SLOT(clear()));
 	connect(availableLV->selectionModel(),
 		SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
@@ -73,6 +75,14 @@
 }
 
 
+void QCitationDialog::closeEvent(QCloseEvent * e)
+{
+	form_->clearSelection();
+	form_->clearParams();
+	e->accept();
+}
+
+
 void QCitationDialog::apply()
 {
 	int  const choice = std::max(0, citationStyleCO->currentIndex());
@@ -89,6 +99,7 @@
 
 void QCitationDialog::hide()
 {
+	form_->clearParams();
 	accept();
 }
 
@@ -109,14 +120,14 @@
 {
 	apply();
 	form_->clearSelection();
-	accept();
+	hide();
 }
 
 
 void QCitationDialog::on_cancelPB_clicked()
 {
 	form_->clearSelection();
-	accept();
+	hide();
 }
 
 
Index: src/frontends/qt4/QCitationDialog.h
===================================================================
--- src/frontends/qt4/QCitationDialog.h	(Revision 16546)
+++ src/frontends/qt4/QCitationDialog.h	(Arbeitskopie)
@@ -15,6 +15,8 @@
 #include "Dialog.h"
 #include "ui/QCitationUi.h"
 
+#include <QCloseEvent>
+
 namespace lyx {
 namespace frontend {
 
@@ -45,6 +47,9 @@
 	/// \return true if the dialog is visible.
 	bool isVisible() const;
 
+protected:
+	void closeEvent (QCloseEvent * e);
+
 protected Q_SLOTS:
 
 	void on_okPB_clicked();

Reply via email to