John Levon wrote: > > Currently, I don't have the time for doing a patch. > maybe someone else can
I did. Jürgen.
Index: src/frontends/qt2/ChangeLog =================================================================== RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/ChangeLog,v retrieving revision 1.352 diff -u -r1.352 ChangeLog --- src/frontends/qt2/ChangeLog 2002/12/12 21:07:20 1.352 +++ src/frontends/qt2/ChangeLog 2002/12/13 08:19:49 @@ -1,3 +1,9 @@ +2002-12-13 Juergen Spitzmueller <[EMAIL PROTECTED]> + + * QBibtexDialog.[Ch] + * ui/QBibtexDialog.ui: + Add LineEdit for manual *.bib file insertion + 2002-12-12 John Levon <[EMAIL PROTECTED]> * QSpellcheckerDialog.h: Index: src/frontends/qt2/QBibtexDialog.C =================================================================== RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/QBibtexDialog.C,v retrieving revision 1.12 diff -u -r1.12 QBibtexDialog.C --- src/frontends/qt2/QBibtexDialog.C 2002/10/20 01:48:27 1.12 +++ src/frontends/qt2/QBibtexDialog.C 2002/12/13 08:19:50 @@ -24,6 +24,7 @@ #include <qwidget.h> #include <qpushbutton.h> #include <qcombobox.h> +#include <qlineedit.h> #include <qlistbox.h> #include <qcheckbox.h> #include <qfiledialog.h> @@ -66,7 +67,7 @@ } } -void QBibtexDialog::addPressed() +void QBibtexDialog::browseBibPressed() { QString file = QFileDialog::getOpenFileName(QString::null, _("BibTeX database files (*.bib)"), this, 0, _("Select a BibTeX database to add")); @@ -85,6 +86,23 @@ } } +void QBibtexDialog::addPressed() +{ + QString file = addBibED->text(); + if (!file.isNull()) { + string const f = ChangeExtension(file.latin1(), ""); + bool present = false; + for(unsigned int i = 0; i!=databaseLB->count(); i++) { + if (databaseLB->text(i).latin1()==f) + present = true; + + } + if (!present) { + databaseLB->insertItem(f.c_str()); + form_->changed(); + } + } +} void QBibtexDialog::deletePressed() { Index: src/frontends/qt2/QBibtexDialog.h =================================================================== RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/QBibtexDialog.h,v retrieving revision 1.6 diff -u -r1.6 QBibtexDialog.h --- src/frontends/qt2/QBibtexDialog.h 2002/10/20 01:48:27 1.6 +++ src/frontends/qt2/QBibtexDialog.h 2002/12/13 08:19:50 @@ -27,6 +27,7 @@ protected slots: virtual void change_adaptor(); virtual void browsePressed(); + virtual void browseBibPressed(); virtual void addPressed(); virtual void deletePressed(); virtual void styleChanged(const QString &); Index: src/frontends/qt2/ui/QBibtexDialog.ui =================================================================== RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/ui/QBibtexDialog.ui,v retrieving revision 1.7 diff -u -r1.7 QBibtexDialog.ui --- src/frontends/qt2/ui/QBibtexDialog.ui 2002/11/13 01:34:29 1.7 +++ src/frontends/qt2/ui/QBibtexDialog.ui 2002/12/13 08:19:51 @@ -13,8 +13,8 @@ <rect> <x>0</x> <y>0</y> - <width>293</width> - <height>318</height> + <width>289</width> + <height>333</height> </rect> </property> <property stdset="1"> @@ -34,70 +34,6 @@ <name>spacing</name> <number>6</number> </property> - <widget row="8" column="0" rowspan="1" colspan="2" > - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout8</cstring> - </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <spacer> - <property> - <name>name</name> - <cstring>Spacer1</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>okPB</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>OK</string> - </property> - <property stdset="1"> - <name>default</name> - <bool>true</bool> - </property> - </widget> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>closePB</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Cancel</string> - </property> - </widget> - </hbox> - </widget> <widget row="0" column="0" rowspan="1" colspan="2" > <class>QLabel</class> <property stdset="1"> @@ -124,34 +60,52 @@ <name>vAlign</name> </property> </widget> + <widget row="2" column="0" rowspan="3" colspan="1" > + <class>QListBox</class> + <property stdset="1"> + <name>name</name> + <cstring>databaseLB</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>true</bool> + </property> + <property> + <name>toolTip</name> + <string>Available BibTeX databases</string> + </property> + </widget> <widget row="1" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> - <cstring>databasePB</cstring> + <cstring>addBibPB</cstring> </property> <property stdset="1"> <name>text</name> - <string>&Add...</string> - </property> - <property stdset="1"> - <name>autoDefault</name> - <bool>false</bool> + <string>&Add</string> </property> <property> <name>toolTip</name> <string>Add a BibTeX database file</string> </property> </widget> - <widget row="5" column="1" > + <widget row="1" column="0" > + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>addBibED</cstring> + </property> + </widget> + <widget row="2" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> - <cstring>stylePB</cstring> + <cstring>databasePB</cstring> </property> <property stdset="1"> <name>text</name> - <string>&Browse...</string> + <string>Bro&wse...</string> </property> <property stdset="1"> <name>autoDefault</name> @@ -159,29 +113,46 @@ </property> <property> <name>toolTip</name> - <string>Choose a style file</string> + <string>Browse for a BibTeX database file</string> </property> </widget> - <widget row="6" column="1" > + <widget row="3" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> - <cstring>styleListPB</cstring> + <cstring>deletePB</cstring> </property> <property stdset="1"> <name>text</name> - <string>&Update</string> - </property> - <property stdset="1"> - <name>autoDefault</name> - <bool>false</bool> + <string>&Delete</string> </property> <property> <name>toolTip</name> - <string>Update style list</string> + <string>Remove the selected database</string> </property> </widget> - <widget row="5" column="0" > + <spacer row="4" column="1" > + <property> + <name>name</name> + <cstring>Spacer4</cstring> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Vertical</enum> + </property> + <property stdset="1"> + <name>sizeType</name> + <enum>Expanding</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget row="6" column="0" > <class>QComboBox</class> <property stdset="1"> <name>name</name> @@ -200,113 +171,152 @@ <bool>false</bool> </property> </widget> - <widget row="7" column="0" > - <class>QCheckBox</class> + <widget row="5" column="0" > + <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>bibtocCB</cstring> + <cstring>styleLA</cstring> </property> <property stdset="1"> <name>text</name> - <string>Add bibliography to &TOC</string> + <string>St&yle</string> + </property> + <property> + <name>buddy</name> + <cstring>styleCB</cstring> </property> <property> <name>toolTip</name> - <string>Add bibliography to the table of contents</string> + <string>The BibTeX style</string> </property> </widget> - <widget row="2" column="1" > + <widget row="6" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> - <cstring>deletePB</cstring> + <cstring>stylePB</cstring> </property> <property stdset="1"> <name>text</name> - <string>&Delete</string> + <string>&Browse...</string> </property> + <property stdset="1"> + <name>autoDefault</name> + <bool>false</bool> + </property> <property> <name>toolTip</name> - <string>Remove the selected database</string> + <string>Choose a style file</string> </property> </widget> - <widget row="1" column="0" rowspan="3" colspan="1" > - <class>QListBox</class> + <widget row="7" column="1" > + <class>QPushButton</class> <property stdset="1"> <name>name</name> - <cstring>databaseLB</cstring> + <cstring>styleListPB</cstring> </property> <property stdset="1"> - <name>enabled</name> - <bool>true</bool> + <name>text</name> + <string>&Update</string> + </property> + <property stdset="1"> + <name>autoDefault</name> + <bool>false</bool> </property> <property> <name>toolTip</name> - <string>Available BibTeX databases</string> + <string>Update style list</string> </property> </widget> - <spacer row="3" column="1" > - <property> - <name>name</name> - <cstring>Spacer4</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> + <widget row="9" column="0" rowspan="1" colspan="2" > + <class>QLayoutWidget</class> <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> + <name>name</name> + <cstring>Layout8</cstring> </property> - </spacer> - <widget row="4" column="0" > - <class>QLabel</class> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <spacer> + <property> + <name>name</name> + <cstring>Spacer1</cstring> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Horizontal</enum> + </property> + <property stdset="1"> + <name>sizeType</name> + <enum>Expanding</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>okPB</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>OK</string> + </property> + <property stdset="1"> + <name>default</name> + <bool>true</bool> + </property> + </widget> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>closePB</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Cancel</string> + </property> + </widget> + </hbox> + </widget> + <widget row="8" column="0" > + <class>QCheckBox</class> <property stdset="1"> <name>name</name> - <cstring>styleLA</cstring> + <cstring>bibtocCB</cstring> </property> <property stdset="1"> <name>text</name> - <string>St&yle</string> - </property> - <property> - <name>buddy</name> - <cstring>styleCB</cstring> + <string>Add bibliography to &TOC</string> </property> <property> <name>toolTip</name> - <string>The BibTeX style</string> + <string>Add bibliography to the table of contents</string> </property> </widget> </grid> </widget> <connections> <connection> - <sender>databasePB</sender> - <signal>clicked()</signal> - <receiver>QBibtexDialogBase</receiver> - <slot>addPressed()</slot> - </connection> - <connection> <sender>stylePB</sender> <signal>clicked()</signal> <receiver>QBibtexDialogBase</receiver> <slot>browsePressed()</slot> </connection> <connection> - <sender>bibtocCB</sender> - <signal>toggled(bool)</signal> - <receiver>QBibtexDialogBase</receiver> - <slot>change_adaptor()</slot> - </connection> - <connection> <sender>deletePB</sender> <signal>clicked()</signal> <receiver>QBibtexDialogBase</receiver> @@ -330,11 +340,30 @@ <receiver>QBibtexDialogBase</receiver> <slot>change_adaptor()</slot> </connection> + <connection> + <sender>bibtocCB</sender> + <signal>toggled(bool)</signal> + <receiver>QBibtexDialogBase</receiver> + <slot>change_adaptor()</slot> + </connection> + <connection> + <sender>databasePB</sender> + <signal>clicked()</signal> + <receiver>QBibtexDialogBase</receiver> + <slot>browseBibPressed()</slot> + </connection> + <connection> + <sender>addBibPB</sender> + <signal>clicked()</signal> + <receiver>QBibtexDialogBase</receiver> + <slot>addPressed()</slot> + </connection> <slot access="public">addPressed()</slot> <slot access="public">browsePressed()</slot> <slot access="public">change_adaptor()</slot> - <slot access="public">deletePressed()</slot> <slot access="public">databaseChanged()</slot> + <slot access="public">deletePressed()</slot> + <slot access="public">browseBibPressed()</slot> <slot access="public">styleChanged(const QString &)</slot> </connections> <tabstops>