From 2bc544509cb594df229055c7aac89151921f9861 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Mon, 9 Dec 2019 10:07:11 -0500 Subject: disable run hooked in filetree when mod is disabled --- src/modinfodialogfiletree.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/modinfodialogfiletree.cpp') diff --git a/src/modinfodialogfiletree.cpp b/src/modinfodialogfiletree.cpp index 607d2e5b..c49c767f 100644 --- a/src/modinfodialogfiletree.cpp +++ b/src/modinfodialogfiletree.cpp @@ -453,6 +453,21 @@ void FileTreeTab::onContextMenu(const QPoint &pos) } } + bool enableRunHooked = false; + + if (enableRun || enableOpen) { + if (auto* p=core().currentProfile()) { + if (mod().canBeEnabled()) { + const auto index = ModInfo::getIndex(mod().name()); + if (index == UINT_MAX) { + log::error("mod '{}' not found (filetree)", mod().name()); + } else { + enableRunHooked = p->modEnabled(index); + } + } + } + } + if (enableRun) { m_actions.open->setText(tr("&Execute")); m_actions.runHooked->setText(tr("Execute with &VFS")); @@ -481,7 +496,7 @@ void FileTreeTab::onContextMenu(const QPoint &pos) } } - if (enableOpen || enableRun) { + if (enableRunHooked) { menu.addAction(m_actions.runHooked); } -- cgit v1.3.1