Title: qt4: remove (2nd) add dialog in add bib tex ref dialog

i personally think this is more convenient.

comments, opinions?

patch attached.

edwin

Index: Makefile.dialogs
===================================================================
--- Makefile.dialogs	(revision 13415)
+++ Makefile.dialogs	(working copy)
@@ -16,7 +16,6 @@
 	QAskForTextUi.ui \
 	QBibitemUi.ui \
 	QBibtexUi.ui \
-	QBibtexAddUi.ui \
 	QBoxUi.ui \
 	QBranchUi.ui \
 	QChangesUi.ui \
Index: QBibtexDialog.C
===================================================================
--- QBibtexDialog.C	(revision 13415)
+++ QBibtexDialog.C	(working copy)
@@ -47,43 +47,14 @@
 		form, SLOT(slotOK()));
 	connect(closePB, SIGNAL(clicked()),
 		form, SLOT(slotClose()));
+	connect( addBibPB, SIGNAL( clicked() ), this, SLOT( browseBibPressed() ) );
+	connect( deletePB, SIGNAL( clicked() ), this, SLOT( deletePressed() ) );
+	connect( stylePB, SIGNAL( clicked() ), this, SLOT( browsePressed() ) );
+	connect( styleCB, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
+	connect( databaseLW, SIGNAL( selectionChanged() ), this, SLOT( databaseChanged() ) );
+	connect( bibtocCB, SIGNAL( toggled(bool) ), this, SLOT( change_adaptor() ) );
+	connect( btPrintCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
 
-    connect( stylePB, SIGNAL( clicked() ), this, SLOT( browsePressed() ) );
-    connect( deletePB, SIGNAL( clicked() ), this, SLOT( deletePressed() ) );
-    connect( styleCB, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
-    connect( databaseLB, SIGNAL( selectionChanged() ), this, SLOT( databaseChanged() ) );
-    connect( bibtocCB, SIGNAL( toggled(bool) ), this, SLOT( change_adaptor() ) );
-    connect( btPrintCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
-    connect( addBibPB, SIGNAL( clicked() ), this, SLOT( addPressed() ) );
-
-	add_ = new UiDialog<Ui::QBibtexAddUi>(this, true);
-
-	Qt2BC * bcview = new Qt2BC(add_bc_);
-	add_bc_.view(bcview);
-	add_bc_.bp(new OkCancelPolicy);
-
-	bcview->setOK(add_->addPB);
-	bcview->setCancel(add_->closePB);
-
-	add_->bibED->setValidator(new PathValidator(false, add_->bibED));
-	addCheckedLineEdit(add_bc_.view(), add_->bibED, 0);
-
-	connect(add_->bibED, SIGNAL(textChanged(const QString&)),
-		this, SLOT(bibEDChanged()));
-	connect(add_->addPB, SIGNAL(clicked()),
-		this, SLOT(addDatabase()));
-	connect(add_->bibLB, SIGNAL(selected(Q3ListBoxItem *)),
-		this, SLOT(addDatabase()));
-	connect(add_->bibLB, SIGNAL(selected(Q3ListBoxItem *)),
-		add_, SLOT(accept()));
-	connect(add_->bibLB, SIGNAL(currentChanged(Q3ListBoxItem *)),
-		this, SLOT(availableChanged()));
-	connect(add_->browsePB, SIGNAL(clicked()),
-		this, SLOT(browseBibPressed()));
-
-    connect( add_->addPB, SIGNAL( clicked() ), this, SLOT( accept() ) );
-    connect( add_->closePB, SIGNAL( clicked() ), this, SLOT( reject() ) );
-
 }
 
 
@@ -91,15 +62,6 @@
 {}
 
 
-void QBibtexDialog::bibEDChanged()
-{
-	// Indicate to the button controller that the contents have
-	// changed. The actual test of validity is carried out by
-	// the checkedLineEdit.
-	add_bc_.valid(true);
-}
-
-
 void QBibtexDialog::change_adaptor()
 {
 	form_->changed();
@@ -139,66 +101,29 @@
 		string const f = ChangeExtension(file, "");
 		bool present = false;
 
-		for (unsigned int i = 0; i != add_->bibLB->count(); i++) {
-			if (fromqstr(add_->bibLB->text(i)) == f)
+		for (unsigned int i = 0; i != databaseLW->count(); i++) {
+			if (fromqstr(databaseLW->item(i)->text()) == f)
 				present = true;
 		}
 
 		if (!present) {
-			add_->bibLB->insertItem(toqstr(f));
+			databaseLW->addItem(toqstr(f));
 			form_->changed();
 		}
-
-		add_->bibED->setText(toqstr(f));
 	}
 }
 
 
-void QBibtexDialog::addPressed()
-{
-	add_->exec();
-	add_bc_.valid(false);
-}
-
-
-void QBibtexDialog::addDatabase()
-{
-	int const sel = add_->bibLB->currentItem();
-	string const file = trim(fromqstr(add_->bibED->text()));
-
-	if (sel < 0 && file.empty())
-		return;
-
-	// Add the selected browser_bib keys to browser_database
-	// multiple selections are possible
-	for (unsigned int i = 0; i != add_->bibLB->count(); i++) {
-		if (add_->bibLB->isSelected(i)) {
-			// do not allow duplicates
-			if ((databaseLB->findItem(add_->bibLB->text(i))) == 0)
-				databaseLB->insertItem(add_->bibLB->text(i));
-		}
-	}
-
-	if (!file.empty()) {
-		QString const f = toqstr(ChangeExtension(file, ""));
-		if ((databaseLB->findItem(f)) == 0)
-			databaseLB->insertItem(f);
-	}
-
-	form_->changed();
-}
-
-
 void QBibtexDialog::deletePressed()
 {
-	databaseLB->removeItem(databaseLB->currentItem());
+	delete databaseLW->takeItem(databaseLW->currentRow());
 }
 
 
 
 void QBibtexDialog::databaseChanged()
 {
-	deletePB->setEnabled(!form_->readOnly() && databaseLB->currentItem() != -1);
+	deletePB->setEnabled(!form_->readOnly() && databaseLW->currentRow() != -1);
 }
 
 
Index: QBibtexDialog.h
===================================================================
--- QBibtexDialog.h	(revision 13415)
+++ QBibtexDialog.h	(working copy)
@@ -13,7 +13,6 @@
 #define QBIBTEXDIALOG_H
 
 #include "ui/QBibtexUi.h"
-#include "ui/QBibtexAddUi.h"
 
 #include "ButtonController.h"
 #include "QBibtex.h"
@@ -24,18 +23,6 @@
 namespace lyx {
 namespace frontend {
 
-template<class UI>
-	class UiDialog: public QDialog, public UI
-	{
-	public:
-		UiDialog(QWidget * parent=0, bool modal=false, Qt::WFlags f=0)
-			: QDialog(parent, f)
-		{
-			UI::setupUi(this);
-			QDialog::setModal(modal);
-		}
-	};
-
 class QBibtexDialog : public QDialog, public Ui::QBibtexUi {
 	Q_OBJECT
 
@@ -43,25 +30,20 @@
 	QBibtexDialog(QBibtex * form);
 	~QBibtexDialog();
 
-	UiDialog<Ui::QBibtexAddUi> * add_;
 
 protected slots:
 	virtual void change_adaptor();
 	virtual void browsePressed();
 	virtual void browseBibPressed();
-	virtual void addPressed();
-	virtual void addDatabase();
 	virtual void deletePressed();
 	virtual void databaseChanged();
 	virtual void availableChanged();
-	void bibEDChanged();
 
 protected:
 	virtual void closeEvent(QCloseEvent * e);
 
 private:
 	QBibtex * form_;
-	ButtonController add_bc_;
 };
 
 } // namespace frontend
Index: ui/QBibtexUi.ui
===================================================================
--- ui/QBibtexUi.ui	(revision 13415)
+++ ui/QBibtexUi.ui	(working copy)
@@ -1,280 +1,274 @@
-<ui version="4.0" stdsetdef="1" >
-  <author></author>
-  <comment></comment>
-  <exportmacro></exportmacro>
-  <class>QBibtexUi</class>
-  <widget class="QDialog" name="QBibtex" >
-    <property name="geometry" >
-      <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>352</width>
-        <height>313</height>
-      </rect>
-    </property>
-    <property name="windowTitle" >
-      <string/>
-    </property>
-    <property name="sizeGripEnabled" >
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>QBibtexUi</class>
+ <widget class="QDialog" name="QBibtexUi" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>352</width>
+    <height>313</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string/>
+  </property>
+  <property name="sizeGripEnabled" >
+   <bool>true</bool>
+  </property>
+  <layout class="QGridLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item rowspan="3" row="1" column="0" colspan="2" >
+    <widget class="QListWidget" name="databaseLW" />
+   </item>
+   <item row="5" column="0" colspan="2" >
+    <widget class="QComboBox" name="styleCB" >
+     <property name="toolTip" >
+      <string>Choose a style file</string>
+     </property>
+     <property name="editable" >
       <bool>true</bool>
-    </property>
-    <layout class="QGridLayout" >
-      <property name="margin" >
-        <number>11</number>
+     </property>
+     <property name="autoCompletion" >
+      <bool>true</bool>
+     </property>
+     <property name="duplicatesEnabled" >
+      <bool>false</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="7" column="0" colspan="2" >
+    <widget class="QCheckBox" name="bibtocCB" >
+     <property name="toolTip" >
+      <string>Add bibliography to the table of contents</string>
+     </property>
+     <property name="text" >
+      <string>Add bibliography to &amp;TOC</string>
+     </property>
+    </widget>
+   </item>
+   <item row="6" column="0" >
+    <widget class="QLabel" name="btPrintLA" >
+     <property name="sizePolicy" >
+      <sizepolicy>
+       <hsizetype>1</hsizetype>
+       <vsizetype>0</vsizetype>
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="toolTip" >
+      <string>This bibliography section contains...</string>
+     </property>
+     <property name="text" >
+      <string>&amp;Content:</string>
+     </property>
+     <property name="buddy" >
+      <cstring>styleCB</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="6" column="1" >
+    <widget class="QComboBox" name="btPrintCO" >
+     <property name="toolTip" >
+      <string>This bibliography section contains...</string>
+     </property>
+     <item>
+      <property name="text" >
+       <string>all cited references</string>
       </property>
-      <property name="spacing" >
-        <number>6</number>
+     </item>
+     <item>
+      <property name="text" >
+       <string>all uncited references</string>
       </property>
-      <item rowspan="1" row="4" column="0" colspan="2" >
-        <widget class="QLabel" name="styleLA" >
-          <property name="sizePolicy" >
-            <sizepolicy>
-              <hsizetype>1</hsizetype>
-              <vsizetype>0</vsizetype>
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-            </sizepolicy>
-          </property>
-          <property name="text" >
-            <string>St&amp;yle</string>
-          </property>
-          <property name="buddy" >
-            <cstring>styleCB</cstring>
-          </property>
-          <property name="toolTip" >
-            <string>The BibTeX style</string>
-          </property>
-        </widget>
-      </item>
-      <item rowspan="1" row="8" column="0" colspan="3" >
-        <layout class="QHBoxLayout" >
-          <property name="margin" >
-            <number>0</number>
-          </property>
-          <property name="spacing" >
-            <number>6</number>
-          </property>
-          <item>
-            <spacer name="Spacer1" >
-              <property name="sizeHint" >
-                <size>
-                  <width>20</width>
-                  <height>20</height>
-                </size>
-              </property>
-              <property name="sizeType" >
-                <enum>Expanding</enum>
-              </property>
-              <property name="orientation" >
-                <enum>Horizontal</enum>
-              </property>
-            </spacer>
-          </item>
-          <item>
-            <widget class="QPushButton" name="okPB" >
-              <property name="text" >
-                <string>&amp;OK</string>
-              </property>
-              <property name="autoDefault" >
-                <bool>false</bool>
-              </property>
-              <property name="default" >
-                <bool>true</bool>
-              </property>
-            </widget>
-          </item>
-          <item>
-            <widget class="QPushButton" name="closePB" >
-              <property name="text" >
-                <string>Cancel</string>
-              </property>
-              <property name="autoDefault" >
-                <bool>false</bool>
-              </property>
-            </widget>
-          </item>
-        </layout>
-      </item>
-      <item rowspan="1" row="0" column="0" colspan="3" >
-        <widget class="QLabel" name="databaseLA" >
-          <property name="sizePolicy" >
-            <sizepolicy>
-              <hsizetype>1</hsizetype>
-              <vsizetype>0</vsizetype>
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-            </sizepolicy>
-          </property>
-          <property name="text" >
-            <string>Databa&amp;ses</string>
-          </property>
-          <property name="alignment" >
-            <set>Qt::AlignTop|Qt::AlignLeft</set>
-          </property>
-          <property name="buddy" >
-            <cstring>databaseLB</cstring>
-          </property>
-          <property name="toolTip" >
-            <string>BibTeX database to use</string>
-          </property>
-        </widget>
-      </item>
-      <item rowspan="3" row="1" column="0" colspan="2" >
-        <widget class="Q3ListBox" name="databaseLB" >
-          <property name="enabled" >
-            <bool>true</bool>
-          </property>
-          <property name="toolTip" >
-            <string>Selected BibTeX databases</string>
-          </property>
-        </widget>
-      </item>
-      <item row="1" column="2" >
-        <widget class="QPushButton" name="addBibPB" >
-          <property name="text" >
-            <string>&amp;Add...</string>
-          </property>
-          <property name="toolTip" >
-            <string>Add a BibTeX database file</string>
-          </property>
-        </widget>
-      </item>
-      <item row="2" column="2" >
-        <widget class="QPushButton" name="deletePB" >
-          <property name="text" >
-            <string>&amp;Delete</string>
-          </property>
-          <property name="toolTip" >
-            <string>Remove the selected database</string>
-          </property>
-        </widget>
-      </item>
-      <item rowspan="2" row="3" column="2" colspan="1" >
-        <spacer name="Spacer5" >
-          <property name="sizeHint" >
-            <size>
-              <width>20</width>
-              <height>20</height>
-            </size>
-          </property>
-          <property name="sizeType" >
-            <enum>Expanding</enum>
-          </property>
-          <property name="orientation" >
-            <enum>Vertical</enum>
-          </property>
-        </spacer>
-      </item>
-      <item rowspan="1" row="5" column="0" colspan="2" >
-        <widget class="QComboBox" name="styleCB" >
-          <property name="editable" >
-            <bool>true</bool>
-          </property>
-          <property name="autoCompletion" >
-            <bool>true</bool>
-          </property>
-          <property name="duplicatesEnabled" >
-            <bool>false</bool>
-          </property>
-          <property name="toolTip" >
-            <string>Choose a style file</string>
-          </property>
-        </widget>
-      </item>
-      <item row="5" column="2" >
-        <widget class="QPushButton" name="stylePB" >
-          <property name="text" >
-            <string>&amp;Browse...</string>
-          </property>
-          <property name="autoDefault" >
-            <bool>false</bool>
-          </property>
-          <property name="toolTip" >
-            <string>Choose a style file</string>
-          </property>
-        </widget>
-      </item>
-      <item rowspan="2" row="6" column="2" colspan="1" >
-        <spacer name="Spacer6" >
-          <property name="sizeHint" >
-            <size>
-              <width>20</width>
-              <height>20</height>
-            </size>
-          </property>
-          <property name="sizeType" >
-            <enum>Expanding</enum>
-          </property>
-          <property name="orientation" >
-            <enum>Vertical</enum>
-          </property>
-        </spacer>
-      </item>
-      <item row="6" column="1" >
-        <widget class="QComboBox" name="btPrintCO" >
-          <property name="toolTip" >
-            <string>This bibliography section contains...</string>
-          </property>
-          <item>
-            <property name="text" >
-              <string>all cited references</string>
-            </property>
-          </item>
-          <item>
-            <property name="text" >
-              <string>all uncited references</string>
-            </property>
-          </item>
-          <item>
-            <property name="text" >
-              <string>all references</string>
-            </property>
-          </item>
-        </widget>
-      </item>
-      <item row="6" column="0" >
-        <widget class="QLabel" name="btPrintLA" >
-          <property name="sizePolicy" >
-            <sizepolicy>
-              <hsizetype>1</hsizetype>
-              <vsizetype>0</vsizetype>
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-            </sizepolicy>
-          </property>
-          <property name="text" >
-            <string>&amp;Content:</string>
-          </property>
-          <property name="buddy" >
-            <cstring>styleCB</cstring>
-          </property>
-          <property name="toolTip" >
-            <string>This bibliography section contains...</string>
-          </property>
-        </widget>
-      </item>
-      <item rowspan="1" row="7" column="0" colspan="2" >
-        <widget class="QCheckBox" name="bibtocCB" >
-          <property name="text" >
-            <string>Add bibliography to &amp;TOC</string>
-          </property>
-          <property name="toolTip" >
-            <string>Add bibliography to the table of contents</string>
-          </property>
-        </widget>
-      </item>
+     </item>
+     <item>
+      <property name="text" >
+       <string>all references</string>
+      </property>
+     </item>
+    </widget>
+   </item>
+   <item rowspan="2" row="6" column="2" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::Expanding</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="5" column="2" >
+    <widget class="QPushButton" name="stylePB" >
+     <property name="toolTip" >
+      <string>Choose a style file</string>
+     </property>
+     <property name="text" >
+      <string>&amp;Browse...</string>
+     </property>
+     <property name="autoDefault" >
+      <bool>false</bool>
+     </property>
+    </widget>
+   </item>
+   <item rowspan="2" row="3" column="2" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::Expanding</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="2" column="2" >
+    <widget class="QPushButton" name="deletePB" >
+     <property name="toolTip" >
+      <string>Remove the selected database</string>
+     </property>
+     <property name="text" >
+      <string>&amp;Delete</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="2" >
+    <widget class="QPushButton" name="addBibPB" >
+     <property name="toolTip" >
+      <string>Add a BibTeX database file</string>
+     </property>
+     <property name="text" >
+      <string>&amp;Add...</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="0" colspan="3" >
+    <widget class="QLabel" name="databaseLA" >
+     <property name="sizePolicy" >
+      <sizepolicy>
+       <hsizetype>1</hsizetype>
+       <vsizetype>0</vsizetype>
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="toolTip" >
+      <string>BibTeX database to use</string>
+     </property>
+     <property name="text" >
+      <string>Databa&amp;ses</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+     </property>
+     <property name="buddy" >
+      <cstring>databaseLW</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="8" column="0" colspan="3" >
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType" >
+        <enum>QSizePolicy::Expanding</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>20</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="okPB" >
+       <property name="text" >
+        <string>&amp;OK</string>
+       </property>
+       <property name="autoDefault" >
+        <bool>false</bool>
+       </property>
+       <property name="default" >
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="closePB" >
+       <property name="text" >
+        <string>Cancel</string>
+       </property>
+       <property name="autoDefault" >
+        <bool>false</bool>
+       </property>
+      </widget>
+     </item>
     </layout>
-  </widget>
-  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
-  <tabstops>
-    <tabstop>databaseLB</tabstop>
-    <tabstop>addBibPB</tabstop>
-    <tabstop>deletePB</tabstop>
-    <tabstop>styleCB</tabstop>
-    <tabstop>stylePB</tabstop>
-    <tabstop>bibtocCB</tabstop>
-    <tabstop>btPrintCO</tabstop>
-    <tabstop>okPB</tabstop>
-    <tabstop>closePB</tabstop>
-  </tabstops>
+   </item>
+   <item row="4" column="0" colspan="2" >
+    <widget class="QLabel" name="styleLA" >
+     <property name="sizePolicy" >
+      <sizepolicy>
+       <hsizetype>1</hsizetype>
+       <vsizetype>0</vsizetype>
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="toolTip" >
+      <string>The BibTeX style</string>
+     </property>
+     <property name="text" >
+      <string>St&amp;yle</string>
+     </property>
+     <property name="buddy" >
+      <cstring>styleCB</cstring>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <tabstops>
+  <tabstop>addBibPB</tabstop>
+  <tabstop>deletePB</tabstop>
+  <tabstop>styleCB</tabstop>
+  <tabstop>stylePB</tabstop>
+  <tabstop>bibtocCB</tabstop>
+  <tabstop>btPrintCO</tabstop>
+  <tabstop>okPB</tabstop>
+  <tabstop>closePB</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
 </ui>
Index: ui/QBibtexAddUi.ui
===================================================================
--- ui/QBibtexAddUi.ui	(revision 13415)
+++ ui/QBibtexAddUi.ui	(working copy)
@@ -1,159 +0,0 @@
-<ui version="4.0" stdsetdef="1" >
-  <author></author>
-  <comment></comment>
-  <exportmacro></exportmacro>
-  <class>QBibtexAddUi</class>
-  <widget class="QDialog" name="QBibtexAdd" >
-    <property name="geometry" >
-      <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>221</width>
-        <height>321</height>
-      </rect>
-    </property>
-    <property name="sizePolicy" >
-      <sizepolicy>
-        <hsizetype>1</hsizetype>
-        <vsizetype>1</vsizetype>
-        <horstretch>0</horstretch>
-        <verstretch>0</verstretch>
-      </sizepolicy>
-    </property>
-    <property name="windowTitle" >
-      <string>LyX: Add BibTeX Database</string>
-    </property>
-    <property name="sizeGripEnabled" >
-      <bool>true</bool>
-    </property>
-    <layout class="QGridLayout" >
-      <property name="margin" >
-        <number>11</number>
-      </property>
-      <property name="spacing" >
-        <number>6</number>
-      </property>
-      <item row="2" column="0" >
-        <widget class="QPushButton" name="browsePB" >
-          <property name="text" >
-            <string>&amp;Browse...</string>
-          </property>
-          <property name="autoDefault" >
-            <bool>false</bool>
-          </property>
-          <property name="default" >
-            <bool>true</bool>
-          </property>
-        </widget>
-      </item>
-      <item rowspan="1" row="1" column="0" colspan="2" >
-        <widget class="QLineEdit" name="bibED" >
-          <property name="sizePolicy" >
-            <sizepolicy>
-              <hsizetype>7</hsizetype>
-              <vsizetype>0</vsizetype>
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-            </sizepolicy>
-          </property>
-          <property name="toolTip" >
-            <string>Enter BibTeX database name</string>
-          </property>
-        </widget>
-      </item>
-      <item rowspan="1" row="0" column="0" colspan="2" >
-        <widget class="Q3ListBox" name="bibLB" >
-          <property name="vScrollBarMode" >
-            <enum>Q3ScrollView::AlwaysOn</enum>
-          </property>
-          <property name="hScrollBarMode" >
-            <enum>Q3ScrollView::AlwaysOff</enum>
-          </property>
-          <property name="selectionMode" >
-            <enum>Q3ListBox::Extended</enum>
-          </property>
-          <property name="toolTip" >
-            <string>Available BibTeX databases</string>
-          </property>
-          <item>
-            <property name="text" >
-              <string>New Item</string>
-            </property>
-          </item>
-        </widget>
-      </item>
-      <item row="2" column="1" >
-        <spacer name="Spacer3" >
-          <property name="sizeHint" >
-            <size>
-              <width>20</width>
-              <height>20</height>
-            </size>
-          </property>
-          <property name="sizeType" >
-            <enum>Expanding</enum>
-          </property>
-          <property name="orientation" >
-            <enum>Horizontal</enum>
-          </property>
-        </spacer>
-      </item>
-      <item rowspan="1" row="3" column="0" colspan="2" >
-        <layout class="QHBoxLayout" >
-          <property name="margin" >
-            <number>0</number>
-          </property>
-          <property name="spacing" >
-            <number>6</number>
-          </property>
-          <item>
-            <spacer name="Spacer4" >
-              <property name="sizeHint" >
-                <size>
-                  <width>20</width>
-                  <height>20</height>
-                </size>
-              </property>
-              <property name="sizeType" >
-                <enum>Expanding</enum>
-              </property>
-              <property name="orientation" >
-                <enum>Horizontal</enum>
-              </property>
-            </spacer>
-          </item>
-          <item>
-            <widget class="QPushButton" name="addPB" >
-              <property name="text" >
-                <string>&amp;Add</string>
-              </property>
-              <property name="autoDefault" >
-                <bool>false</bool>
-              </property>
-              <property name="default" >
-                <bool>true</bool>
-              </property>
-            </widget>
-          </item>
-          <item>
-            <widget class="QPushButton" name="closePB" >
-              <property name="text" >
-                <string>Cancel</string>
-              </property>
-              <property name="autoDefault" >
-                <bool>false</bool>
-              </property>
-            </widget>
-          </item>
-        </layout>
-      </item>
-    </layout>
-  </widget>
-  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
-  <tabstops>
-    <tabstop>bibLB</tabstop>
-    <tabstop>bibED</tabstop>
-    <tabstop>addPB</tabstop>
-    <tabstop>closePB</tabstop>
-  </tabstops>
-</ui>
Index: QBibtex.C
===================================================================
--- QBibtex.C	(revision 13415)
+++ QBibtex.C	(working copy)
@@ -14,7 +14,6 @@
 
 #include "QBibtex.h"
 #include "QBibtexDialog.h"
-#include "ui/QBibtexAddUi.h"
 #include "Qt2BC.h"
 #include "qt_helpers.h"
 #include "validators.h"
@@ -27,7 +26,7 @@
 #include "support/lstrings.h"
 
 #include <qpushbutton.h>
-#include <q3listbox.h>
+#include <qlistwidget.h>
 #include <qcheckbox.h>
 
 
@@ -57,7 +56,7 @@
 
 	bcview().setOK(dialog_->okPB);
 	bcview().setCancel(dialog_->closePB);
-	bcview().addReadOnly(dialog_->databaseLB);
+	bcview().addReadOnly(dialog_->databaseLW);
 	bcview().addReadOnly(dialog_->stylePB);
 	bcview().addReadOnly(dialog_->styleCB);
 	bcview().addReadOnly(dialog_->bibtocCB);
@@ -68,14 +67,9 @@
 
 void QBibtex::update_contents()
 {
-	PathValidator * path_validator =
-		getPathValidator(dialog_->add_->bibED);
-	if (path_validator)
-		path_validator->setChecker(kernel().docType(), lyxrc);
-
 	bool bibtopic = controller().usingBibtopic();
 
-	dialog_->databaseLB->clear();
+	dialog_->databaseLW->clear();
 
 	string bibs(controller().params().getContents());
 	string bib;
@@ -84,19 +78,9 @@
 		bibs = split(bibs, bib, ',');
 		bib = trim(bib);
 		if (!bib.empty())
-			dialog_->databaseLB->insertItem(toqstr(bib));
+			dialog_->databaseLW->addItem(toqstr(bib));
 	}
 
-	dialog_->add_->bibLB->clear();
-
-	vector<string> bib_str;
-	controller().getBibFiles(bib_str);
-	for (vector<string>::const_iterator it = bib_str.begin();
-		it != bib_str.end(); ++it) {
-		string bibItem(ChangeExtension(*it, ""));
-		dialog_->add_->bibLB->insertItem(toqstr(bibItem));
-	}
-
 	string bibtotoc = "bibtotoc";
 	string bibstyle(controller().params().getOptions());
 
@@ -154,12 +138,12 @@
 
 void QBibtex::apply()
 {
-	string dbs(fromqstr(dialog_->databaseLB->text(0)));
+	string dbs(fromqstr(dialog_->databaseLW->item(0)->text()));
 
-	unsigned int maxCount = dialog_->databaseLB->count();
+	unsigned int maxCount = dialog_->databaseLW->count();
 	for (unsigned int i = 1; i < maxCount; i++) {
 		dbs += ',';
-		dbs += fromqstr(dialog_->databaseLB->text(i));
+		dbs += fromqstr(dialog_->databaseLW->item(i)->text());
 	}
 
 	controller().params().setContents(dbs);
@@ -205,7 +189,7 @@
 
 bool QBibtex::isValid()
 {
-	return dialog_->databaseLB->count() != 0;
+	return dialog_->databaseLW->count() != 0;
 }
 
 } // namespace frontend

Reply via email to