summaryrefslogtreecommitdiff
path: root/src/modlistviewactions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modlistviewactions.cpp')
-rw-r--r--src/modlistviewactions.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/modlistviewactions.cpp b/src/modlistviewactions.cpp
index 21079f1d..b9d0f419 100644
--- a/src/modlistviewactions.cpp
+++ b/src/modlistviewactions.cpp
@@ -1100,6 +1100,20 @@ void ModListViewActions::willNotEndorsed(const QModelIndexList& indices) const
}
}
+void ModListViewActions::remapCategory(const QModelIndexList& indices) const
+{
+ for (auto& idx : indices) {
+ ModInfo::Ptr modInfo = ModInfo::getByIndex(idx.data(ModList::IndexRole).toInt());
+
+ int downloadIndex = m_core.downloadManager()->getDownloadIndex(modInfo->installationFile());
+ if (downloadIndex >= 0) {
+ auto downloadInfo = m_core.downloadManager()->getFileInfo(downloadIndex);
+ unsigned int categoryIndex = CategoryFactory::instance()->resolveNexusID(downloadInfo->categoryID);
+ modInfo->setPrimaryCategory(CategoryFactory::instance()->getCategoryID(categoryIndex));
+ }
+ }
+}
+
void ModListViewActions::setColor(const QModelIndexList& indices,
const QModelIndex& refIndex) const
{