From 6142872620983a2bdd352d4e9e391ddb11c40305 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Mon, 26 Nov 2018 07:51:45 -0600 Subject: Prevent the user from renaming unmanaged and DLC mods --- src/modlist.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/modlist.cpp') diff --git a/src/modlist.cpp b/src/modlist.cpp index 6c04738a..7ca0667a 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -616,17 +616,20 @@ Qt::ItemFlags ModList::flags(const QModelIndex &modelIndex) const } if (modelIndex.isValid()) { ModInfo::Ptr modInfo = ModInfo::getByIndex(modelIndex.row()); + std::vector flags = modInfo->getFlags(); if (modInfo->getFixedPriority() == INT_MIN) { result |= Qt::ItemIsDragEnabled; result |= Qt::ItemIsUserCheckable; - if ((modelIndex.column() == COL_NAME) || - (modelIndex.column() == COL_PRIORITY) || + if ((modelIndex.column() == COL_PRIORITY) || (modelIndex.column() == COL_VERSION) || (modelIndex.column() == COL_MODID)) { result |= Qt::ItemIsEditable; } + if ((modelIndex.column() == COL_NAME) + && (std::find(flags.begin(), flags.end(), ModInfo::FLAG_FOREIGN) == flags.end())) { + result |= Qt::ItemIsEditable; + } } - std::vector flags = modInfo->getFlags(); if (m_DropOnItems && (std::find(flags.begin(), flags.end(), ModInfo::FLAG_OVERWRITE) == flags.end())) { result |= Qt::ItemIsDropEnabled; -- cgit v1.3.1