diff options
| author | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2021-12-24 17:54:55 -0600 |
|---|---|---|
| committer | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2023-09-21 17:24:57 -0500 |
| commit | b9f05672b9692c96d39b8ff27e571a30cb82cd44 (patch) | |
| tree | bc70062f89132142c6d513ed3dffe902f10b3caf /src/modlistviewactions.cpp | |
| parent | 535623693e63569f485c15984274ea65c4d0c872 (diff) | |
Allow remapping category from context menu
Diffstat (limited to 'src/modlistviewactions.cpp')
| -rw-r--r-- | src/modlistviewactions.cpp | 14 |
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 { |
