]> git.lyx.org Git - features.git/commitdiff
Allow multiple insertion of citation key with qualified citation lists
authorJuergen Spitzmueller <spitz@lyx.org>
Tue, 23 Jul 2019 08:34:33 +0000 (10:34 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Tue, 23 Jul 2019 08:34:33 +0000 (10:34 +0200)
Fixes: #11618
src/frontends/qt/GuiCitation.cpp
src/frontends/qt/GuiSelectionManager.cpp
src/frontends/qt/GuiSelectionManager.h

index 196ec44d2b7b5bb6c26c022353082e03e62edf61..3ef4bb77f3135a4f81c8701553881720849fa821 100644 (file)
@@ -368,6 +368,8 @@ void GuiCitation::updateFormatting(CitationStyle const & currentStyle)
                availableLV->setToolTip(qt_("All references available for citing.\n"
                                            "To add the selected one, hit Add, press Enter or double-click.\n"
                                            "Hit Ctrl-Enter to add and close the dialog."));
+       // With qualified citation lists, it makes sense to add the same key multiple times
+       selectionManager->allowMultiSelection(currentStyle.hasQualifiedList);
 }
 
 
index 9eeb5c96851c76d4b528bebbd6b8dd4e1f273d50..4a735ed2d67d9e448403988cc7cde0ee2b661c29 100644 (file)
@@ -55,7 +55,8 @@ GuiSelectionManager::GuiSelectionManager(QObject * parent,
 : QObject(parent), availableLV(avail), selectedLV(sel),
   addPB(add), deletePB(del), upPB(up), downPB(down),
   availableModel(amod), selectedModel(smod),
-  selectedHasFocus_(false), main_sel_col_(main_sel_col)
+  selectedHasFocus_(false), main_sel_col_(main_sel_col),
+  allow_multi_selection_(false)
 {
        selectedLV->setModel(smod);
        availableLV->setModel(amod);
@@ -144,7 +145,7 @@ void GuiSelectionManager::updateAddPB()
                availableLV->selectionModel()->selectedIndexes();
        addPB->setEnabled(arows > 0 &&
                !availSels.isEmpty() &&
-               !isSelected(availSels.first()));
+               (allow_multi_selection_ || !isSelected(availSels.first())));
 }
 
 
index 9875396864da53701896d58cc226f99cd6cdeceb..926adc589f2a4f4f72656f7495c9b72ceb68963c 100644 (file)
@@ -67,6 +67,8 @@ public:
        /// Returns the selected index. Note that this will depend upon
        /// selectedFocused().
        QModelIndex getSelectedIndex(int const c = 0) const;
+       ///
+       void allowMultiSelection(bool b) { allow_multi_selection_ = b; }
 
 Q_SIGNALS:
        /// Emitted when the list of selected items has changed.
@@ -148,6 +150,8 @@ private:
        bool selectedHasFocus_;
        ///
        int main_sel_col_;
+       ///
+       bool allow_multi_selection_;
 };
 
 } // namespace frontend