summaryrefslogtreecommitdiff
path: root/src/modlistviewactions.cpp
diff options
context:
space:
mode:
authorJeremy Rimpo <jeremy.rimpo@servermonkey.com>2021-12-24 17:54:55 -0600
committerJeremy Rimpo <jeremy.rimpo@servermonkey.com>2023-09-21 17:24:57 -0500
commitb9f05672b9692c96d39b8ff27e571a30cb82cd44 (patch)
treebc70062f89132142c6d513ed3dffe902f10b3caf /src/modlistviewactions.cpp
parent535623693e63569f485c15984274ea65c4d0c872 (diff)
Allow remapping category from context menu
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
{