]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt2/QCitationDialog.C
QBibtex/QCitation ui fixes (bug 1146)
[lyx.git] / src / frontends / qt2 / QCitationDialog.C
index bb86b6b99a0f647417557453030ef44fcea0ebc4..4a188b647c4dbc082203f3b701d5c20635c1dc98 100644 (file)
@@ -56,6 +56,7 @@ QCitationDialog::QCitationDialog(QCitation * form)
        connect(add_->availableLB, SIGNAL(selected(QListBoxItem *)), this, SLOT(addCitation()));
        connect(add_->availableLB, SIGNAL(selected(QListBoxItem *)), add_, SLOT(accept()));
        connect(add_->addPB, SIGNAL(clicked()), this, SLOT(addCitation()));
+       connect(selectedLB, SIGNAL(returnPressed(QListBoxItem *)), form, SLOT(slotOK()));
 }
 
 
@@ -131,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);