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>
* ui/QTabularCreateDialogBase.ui: set a max size (bug 1152)

View File

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

View File

@ -132,9 +132,17 @@ void QCitationDialog::addCitation()
if (sel < 0)
return;
// Add the selected browser_bib key to browser_cite
selectedLB->insertItem(toqstr(form_->bibkeys[sel]));
form_->citekeys.push_back(form_->bibkeys[sel]);
// Add the selected browser_bib keys to browser_cite
// multiple selections are possible
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());
selectedLB->setSelected(n - 1, true);

View File

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

View File

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