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"
"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);
}

View 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())));
}

View 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