If you have bugfixes that you like me to consider for inclusion please 
reply
here. I will appreciate those with bugzilla numbers associated. :-)

Uwe just created the 20th bug report for the listings stuff, so there
will be some small patches.... Actually, I knew some of the problems
but I was hoping that some qt guy would step up and fix all the
problems with this dialog in five minutes. :-)

Attached is the first one, for bug 3642. OK to go in?

Bo
Index: src/frontends/qt4/QListings.h
===================================================================
--- src/frontends/qt4/QListings.h	(revision 18385)
+++ src/frontends/qt4/QListings.h	(working copy)
@@ -34,6 +34,10 @@
 	/// AFAIK, QValidator only works for QLineEdit so 
 	/// I have to validate listingsED (QTextEdit) manually.
 	void validate_listings_params();
+	/// set float on/off when float changes
+	void float_chosen();
+	/// set inline on/off with changes in float
+	void inline_chosen();
 protected:
 	virtual void closeEvent(QCloseEvent * e);
 private:
Index: src/frontends/qt4/QListings.cpp
===================================================================
--- src/frontends/qt4/QListings.cpp	(revision 18385)
+++ src/frontends/qt4/QListings.cpp	(working copy)
@@ -67,7 +67,9 @@
 	
 	connect(languageCO, SIGNAL(currentIndexChanged(int)), this, SLOT(change_adaptor()));
 	connect(inlineCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
+	connect(inlineCB, SIGNAL(clicked()), this, SLOT(inline_chosen()));
 	connect(floatCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
+	connect(floatCB, SIGNAL(clicked()), this, SLOT(float_chosen()));
 	connect(placementLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
 	connect(numberSideCO, SIGNAL(currentIndexChanged(int)), this, SLOT(change_adaptor()));
 	connect(numberStepLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
@@ -103,7 +105,7 @@
 	string language = fromqstr(languageCO->currentText());
 	
 	bool float_ = floatCB->checkState() == Qt::Checked;
-	string placement = fromqstr(placementLE->text());
+	string placement = placementLE->isEnabled() ? fromqstr(placementLE->text()) : string();
 	
 	string numberSide = fromqstr(numberSideCO->currentText());
 	string stepnumber = fromqstr(numberStepLE->text());
@@ -171,6 +173,25 @@
 	}
 }
 
+
+void QListingsDialog::float_chosen()
+{
+	if (floatCB->isChecked()) {
+		inlineCB->setChecked(false);
+		placementLE->setEnabled(true);
+	} else
+		placementLE->setEnabled(false);
+}
+
+
+void QListingsDialog::inline_chosen()
+{
+	if (inlineCB->isChecked()) {
+		floatCB->setChecked(false);
+		placementLE->setEnabled(false);
+	}
+}
+
 /////////////////////////////////////////////////////////////////////
 //
 // QListings
@@ -274,10 +295,11 @@
 
 	// set values from param string
 	InsetListingsParams & params = controller().params();
-	if (params.isInline())
-		dialog_->inlineCB->setChecked(true);
-	else
-		dialog_->inlineCB->setChecked(false);
+	dialog_->inlineCB->setChecked(params.isInline());
+	if (params.isInline()) {
+		dialog_->floatCB->setChecked(false);
+		dialog_->placementLE->setEnabled(false);
+	}
 	// break other parameters and set values
 	vector<string> pars = getVectorFromString(params.separatedParams(), "\n");
 	// process each of them
@@ -294,10 +316,14 @@
 			}
 		} else if (prefixIs(*it, "floatplacement=")) {
 			dialog_->floatCB->setChecked(true);
+			dialog_->placementLE->setEnabled(true);
 			dialog_->placementLE->setText(toqstr(it->substr(15)));
+			dialog_->inlineCB->setChecked(false);
 			*it = "";
 		} else if (prefixIs(*it, "float")) {
 			dialog_->floatCB->setChecked(true);
+			dialog_->inlineCB->setChecked(false);
+			dialog_->placementLE->setEnabled(true);
 			if (prefixIs(*it, "float="))
 				dialog_->placementLE->setText(toqstr(it->substr(6)));
 			*it = "";

Reply via email to