summaryrefslogtreecommitdiff
path: root/src/modlistviewactions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modlistviewactions.cpp')
-rw-r--r--src/modlistviewactions.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/modlistviewactions.cpp b/src/modlistviewactions.cpp
index 8d24a8d5..cb212e0b 100644
--- a/src/modlistviewactions.cpp
+++ b/src/modlistviewactions.cpp
@@ -956,7 +956,6 @@ void ModListViewActions::setCategories(const QModelIndexList& selected, const QM
{
ModInfo::Ptr refMod = ModInfo::getByIndex(ref.data(ModList::IndexRole).toInt());
if (selected.size() > 1) {
-
for (auto& idx : selected) {
if (idx.row() != ref.row()) {
setCategoriesIf(
@@ -982,6 +981,23 @@ void ModListViewActions::setCategories(const QModelIndexList& selected, const QM
}
}
+void ModListViewActions::setPrimaryCategory(const QModelIndexList& selected, int category, bool force)
+{
+ for (auto& idx : selected) {
+ ModInfo::Ptr info = ModInfo::getByIndex(idx.data(ModList::IndexRole).toInt());
+ if (force || info->categorySet(category)) {
+ info->setCategory(category, true);
+ info->setPrimaryCategory(category);
+ }
+ }
+
+ // reset the selection manually - still needed
+ auto viewIndices = m_view->indexModelToView(selected);
+ for (auto& idx : viewIndices) {
+ m_view->selectionModel()->select(idx, QItemSelectionModel::Select | QItemSelectionModel::Rows);
+ }
+}
+
void ModListViewActions::openExplorer(const QModelIndexList& index) const
{
for (auto& idx : index) {