QBibtex/QCitation ui fixes (bug 1146)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7327 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2003-07-21 09:08:14 +00:00
parent 26f64808a2
commit ce044d86c4
5 changed files with 48 additions and 16 deletions

View File

@ -1,3 +1,11 @@
2003-07-21 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* QBibTeXDialog.C:
* QCitationDialog.C:
* ui/QBibTeXAddDialogBase.ui:
* ui/QCitationFindDialogBase.ui:
Allow multiple selections, forbid duplicates (bug 1146)
2003-07-19 John Levon <levon@movementarian.org> 2003-07-19 John Levon <levon@movementarian.org>
* ui/QTabularCreateDialogBase.ui: set a max size (bug 1152) * ui/QTabularCreateDialogBase.ui: set a max size (bug 1152)

View File

@ -119,22 +119,30 @@ void QBibtexDialog::addPressed()
void QBibtexDialog::addDatabase() void QBibtexDialog::addDatabase()
{ {
int const sel = add_->bibLB->currentItem();
QString const file = add_->bibED->text(); QString const file = add_->bibED->text();
if (!file.isNull()) { if (sel < 0 && file.isNull())
string const f = ChangeExtension(fromqstr(file), ""); return;
bool present = false;
for (unsigned int i = 0; i != databaseLB->count(); ++i) {
if (fromqstr(databaseLB->text(i)) == f)
present = true;
// 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 (!present) { }
databaseLB->insertItem(f.c_str());
if (!file.isEmpty()) {
QString const f = toqstr(ChangeExtension(fromqstr(file), ""));
if ((databaseLB->findItem(f)) == 0)
databaseLB->insertItem(f);
}
form_->changed(); form_->changed();
} }
}
}
void QBibtexDialog::deletePressed() void QBibtexDialog::deletePressed()
@ -152,7 +160,7 @@ void QBibtexDialog::databaseChanged()
void QBibtexDialog::availableChanged() void QBibtexDialog::availableChanged()
{ {
add_->bibED->setText(add_->bibLB->currentText()); form_->changed();
} }

View File

@ -132,9 +132,17 @@ void QCitationDialog::addCitation()
if (sel < 0) if (sel < 0)
return; return;
// Add the selected browser_bib key to browser_cite // Add the selected browser_bib keys to browser_cite
selectedLB->insertItem(toqstr(form_->bibkeys[sel])); // multiple selections are possible
form_->citekeys.push_back(form_->bibkeys[sel]); for (unsigned int i = 0; i != add_->availableLB->count(); i++) {
if (add_->availableLB->isSelected(i)) {
// do not allow duplicates
if ((selectedLB->findItem(add_->availableLB->text(i))) == 0) {
selectedLB->insertItem(toqstr(form_->bibkeys[i]));
form_->citekeys.push_back(form_->bibkeys[i]);
}
}
}
int const n = int(form_->citekeys.size()); int const n = int(form_->citekeys.size());
selectedLB->setSelected(n - 1, true); selectedLB->setSelected(n - 1, true);

View File

@ -13,7 +13,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>225</width> <width>221</width>
<height>321</height> <height>321</height>
</rect> </rect>
</property> </property>
@ -98,6 +98,10 @@
<name>hScrollBarMode</name> <name>hScrollBarMode</name>
<enum>AlwaysOff</enum> <enum>AlwaysOff</enum>
</property> </property>
<property stdset="1">
<name>selectionMode</name>
<enum>Extended</enum>
</property>
<property> <property>
<name>toolTip</name> <name>toolTip</name>
<string>Available citation keys</string> <string>Available citation keys</string>

View File

@ -13,7 +13,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>379</width> <width>375</width>
<height>257</height> <height>257</height>
</rect> </rect>
</property> </property>
@ -76,6 +76,10 @@
<name>hScrollBarMode</name> <name>hScrollBarMode</name>
<enum>AlwaysOff</enum> <enum>AlwaysOff</enum>
</property> </property>
<property stdset="1">
<name>selectionMode</name>
<enum>Extended</enum>
</property>
<property> <property>
<name>toolTip</name> <name>toolTip</name>
<string>Available citation keys</string> <string>Available citation keys</string>