]> git.lyx.org Git - lyx.git/commitdiff
QBibtex/QCitation ui fixes (bug 1146)
authorJürgen Spitzmüller <spitz@lyx.org>
Mon, 21 Jul 2003 09:08:14 +0000 (09:08 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Mon, 21 Jul 2003 09:08:14 +0000 (09:08 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7327 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/QBibtexDialog.C
src/frontends/qt2/QCitationDialog.C
src/frontends/qt2/ui/QBibtexAddDialogBase.ui
src/frontends/qt2/ui/QCitationFindDialogBase.ui

index fa09a720d23b43c450e57137147090da490e7f8a..7179fb2571d0d7bd875ba6d96f9577cc49c2554f 100644 (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)
index 326ee65d79dc60692d65dde5a2a848388a7bc054..e4505fe4f567317b07c69af7057c1e22aec41025 100644 (file)
@@ -119,21 +119,29 @@ 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());
-                       form_->changed();
-               }
        }
+
+       if (!file.isEmpty()) {
+               QString const f = toqstr(ChangeExtension(fromqstr(file), ""));
+               if ((databaseLB->findItem(f)) == 0)
+                       databaseLB->insertItem(f);
+       }
+
+       form_->changed();
 }
 
 
@@ -152,7 +160,7 @@ void QBibtexDialog::databaseChanged()
 
 void QBibtexDialog::availableChanged()
 {
-       add_->bibED->setText(add_->bibLB->currentText());
+       form_->changed();
 }
 
 
index 960363b5afba8bd25e6072918ea64a0cc9ad1fb9..4a188b647c4dbc082203f3b701d5c20635c1dc98 100644 (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);
index e134de27eb13a3575552d4134107087b1a50112e..9aed5a6b055a077645f78cfe0cf414b67283c13a 100644 (file)
@@ -13,7 +13,7 @@
         <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>
index b4dc96e296e2331b7825b1cc7b44b97b6cd9d74c..07df2948e30a9ea840284793f02a967d53897821 100644 (file)
@@ -13,7 +13,7 @@
         <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>