+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)
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());
- form_->changed();
- }
}
+
+ if (!file.isEmpty()) {
+ QString const f = toqstr(ChangeExtension(fromqstr(file), ""));
+ if ((databaseLB->findItem(f)) == 0)
+ databaseLB->insertItem(f);
+ }
+
+ form_->changed();
}
void QBibtexDialog::availableChanged()
{
- add_->bibED->setText(add_->bibLB->currentText());
+ form_->changed();
}
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);
<rect>
<x>0</x>
<y>0</y>
- <width>225</width>
+ <width>221</width>
<height>321</height>
</rect>
</property>
<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>
<rect>
<x>0</x>
<y>0</y>
- <width>379</width>
+ <width>375</width>
<height>257</height>
</rect>
</property>
<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>