Lars Gullik Bjønnes wrote: > Add some spaces (++) and I am satisfied: Done (also at some other places in the file -- the method is a modified copy of the browse method, where these issues also apply).
> | +void QBibtexDialog::addPressed() > | +{ > | + QString file = addBibED->text(); > > ^^^^^ > can this be const? Yes. Changed and tested. Thank you. Jürgen. P.S.: I just detected that the browse button for the bst-file is really weird (it inserts duplicates into the combo and doesn't select the browsed file). The fix is easy, but this is minor and can be postponed for 1.3.1
Index: src/frontends/qt2/ChangeLog =================================================================== RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/ChangeLog,v retrieving revision 1.355 diff -u -r1.355 ChangeLog --- src/frontends/qt2/ChangeLog 2002/12/17 02:43:16 1.355 +++ src/frontends/qt2/ChangeLog 2002/12/17 14:36:56 @@ -1,3 +1,9 @@ +2002-12-13 Juergen Spitzmueller <[EMAIL PROTECTED]> + + * QBibtexDialog.[Ch] + * ui/QBibtexDialog.ui: + Add LineEdit for manual *.bib file insertion, ws changes. + 2002-12-17 John Levon <[EMAIL PROTECTED]> * QLPopupMenu.C: add using endl 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/17 14:36:57 @@ -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> @@ -53,7 +54,7 @@ void QBibtexDialog::browsePressed() { - QString file = + QString const file = QFileDialog::getOpenFileName(QString::null, _("BibTeX style files (*.bst)"), this, @@ -66,15 +67,15 @@ } } -void QBibtexDialog::addPressed() +void QBibtexDialog::browseBibPressed() { - QString file = QFileDialog::getOpenFileName(QString::null, + QString const file = QFileDialog::getOpenFileName(QString::null, _("BibTeX database files (*.bib)"), this, 0, _("Select a BibTeX database to add")); 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) + for(unsigned int i = 0; i != databaseLB->count(); ++i) { + if (databaseLB->text(i).latin1() == f) present = true; } @@ -85,6 +86,23 @@ } } +void QBibtexDialog::addPressed() +{ + QString const 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/17 14:36:57 @@ -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/17 14:36:58 @@ -13,8 +13,8 @@ <rect> <x>0</x> <y>0</y> - <width>293</width> - <height>318</height> + <width>285</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,56 @@ <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> + <string>&Add</string> + </property> + <property> + <name>toolTip</name> + <string>Add a BibTeX database file</string> </property> + </widget> + <widget row="1" column="0" > + <class>QLineEdit</class> <property stdset="1"> - <name>autoDefault</name> - <bool>false</bool> + <name>name</name> + <cstring>addBibED</cstring> </property> <property> <name>toolTip</name> - <string>Add a BibTeX database file</string> + <string>Add a BibTeX file manually</string> </property> </widget> - <widget row="5" column="1" > + <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 +117,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 +175,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 +344,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>