summaryrefslogtreecommitdiff
path: root/src/modlistcontextmenu.cpp
diff options
context:
space:
mode:
authorMikaël Capelle <capelle.mikael@gmail.com>2021-01-16 15:55:56 +0100
committerMikaël Capelle <capelle.mikael@gmail.com>2021-01-16 15:55:56 +0100
commit89a735d6e11b8339b5b350d15ddd8fbfdf7998f5 (patch)
tree364ce83427e503e5c1f07bb48a192c72599d8248 /src/modlistcontextmenu.cpp
parent56d039274776078cfff0565cf66fbb0b4852f90e (diff)
Maintain selection after 'Send to... ' and add send to first conflict.
Diffstat (limited to 'src/modlistcontextmenu.cpp')
-rw-r--r--src/modlistcontextmenu.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/modlistcontextmenu.cpp b/src/modlistcontextmenu.cpp
index cdadbf8a..8bc73e40 100644
--- a/src/modlistcontextmenu.cpp
+++ b/src/modlistcontextmenu.cpp
@@ -247,7 +247,12 @@ void ModListContextMenu::addSendToContextMenu()
ModInfo::EConflictFlag::FLAG_CONFLICT_REDUNDANT
};
- bool overwritten = false;
+ static const std::vector overwrite_flags{
+ ModInfo::EConflictFlag::FLAG_CONFLICT_MIXED,
+ ModInfo::EConflictFlag::FLAG_CONFLICT_OVERWRITE
+ };
+
+ bool overwrite = false, overwritten = false;
for (auto& idx : m_selected) {
auto index = idx.data(ModList::IndexRole);
if (index.isValid()) {
@@ -256,7 +261,10 @@ void ModListContextMenu::addSendToContextMenu()
if (std::find_first_of(flags.begin(), flags.end(),
overwritten_flags.begin(), overwritten_flags.end()) != flags.end()) {
overwritten = true;
- break;
+ }
+ if (std::find_first_of(flags.begin(), flags.end(),
+ overwrite_flags.begin(), overwrite_flags.end()) != flags.end()) {
+ overwrite = true;
}
}
}
@@ -267,6 +275,9 @@ void ModListContextMenu::addSendToContextMenu()
menu->addAction(tr("Highest priority"), [this] { m_actions.sendModsToBottom(m_selected); });
menu->addAction(tr("Priority..."), [this] { m_actions.sendModsToPriority(m_selected); });
menu->addAction(tr("Separator..."), [this] { m_actions.sendModsToSeparator(m_selected); });
+ if (overwrite) {
+ menu->addAction(tr("First conflict"), [this] { m_actions.sendModsToFirstConflict(m_selected); });
+ }
if (overwritten) {
menu->addAction(tr("Last conflict"), [this] { m_actions.sendModsToLastConflict(m_selected); });
}