Allow multiple insertion of citation key with qualified citation lists

Fixes: #11618
This commit is contained in:
Juergen Spitzmueller 2019-07-23 10:34:33 +02:00
parent 6c2a0c6b37
commit 347800eff3
3 changed files with 9 additions and 2 deletions

View File

@ -368,6 +368,8 @@ void GuiCitation::updateFormatting(CitationStyle const & currentStyle)
availableLV->setToolTip(qt_("All references available for citing.\n" availableLV->setToolTip(qt_("All references available for citing.\n"
"To add the selected one, hit Add, press Enter or double-click.\n" "To add the selected one, hit Add, press Enter or double-click.\n"
"Hit Ctrl-Enter to add and close the dialog.")); "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);
} }

View File

@ -55,7 +55,8 @@ GuiSelectionManager::GuiSelectionManager(QObject * parent,
: QObject(parent), availableLV(avail), selectedLV(sel), : QObject(parent), availableLV(avail), selectedLV(sel),
addPB(add), deletePB(del), upPB(up), downPB(down), addPB(add), deletePB(del), upPB(up), downPB(down),
availableModel(amod), selectedModel(smod), 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); selectedLV->setModel(smod);
availableLV->setModel(amod); availableLV->setModel(amod);
@ -144,7 +145,7 @@ void GuiSelectionManager::updateAddPB()
availableLV->selectionModel()->selectedIndexes(); availableLV->selectionModel()->selectedIndexes();
addPB->setEnabled(arows > 0 && addPB->setEnabled(arows > 0 &&
!availSels.isEmpty() && !availSels.isEmpty() &&
!isSelected(availSels.first())); (allow_multi_selection_ || !isSelected(availSels.first())));
} }

View File

@ -67,6 +67,8 @@ public:
/// Returns the selected index. Note that this will depend upon /// Returns the selected index. Note that this will depend upon
/// selectedFocused(). /// selectedFocused().
QModelIndex getSelectedIndex(int const c = 0) const; QModelIndex getSelectedIndex(int const c = 0) const;
///
void allowMultiSelection(bool b) { allow_multi_selection_ = b; }
Q_SIGNALS: Q_SIGNALS:
/// Emitted when the list of selected items has changed. /// Emitted when the list of selected items has changed.
@ -148,6 +150,8 @@ private:
bool selectedHasFocus_; bool selectedHasFocus_;
/// ///
int main_sel_col_; int main_sel_col_;
///
bool allow_multi_selection_;
}; };
} // namespace frontend } // namespace frontend