MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / addFileMenus

Method addFileMenus

src/filetree.cpp:640–697  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

638}
639
640void FileTree::addFileMenus(QMenu& menu, const FileEntry& file, int originID)
641{
642 using namespace spawn;
643
644 addOpenMenus(menu, file);
645
646 menu.addSeparator();
647 menu.setToolTipsVisible(true);
648
649 const QFileInfo target(QString::fromStdWString(file.getFullPath()));
650
651 MenuItem(tr("&Add as Executable"))
652 .callback([&] {
653 addAsExecutable();
654 })
655 .hint(tr("Add this file to the executables list"))
656 .disabledHint(tr("This file is not executable"))
657 .enabled(getFileExecutionType(target) == FileExecutionTypes::Executable)
658 .addTo(menu);
659
660 MenuItem(tr("Reveal in E&xplorer"))
661 .callback([&] {
662 exploreOrigin();
663 })
664 .hint(tr("Opens the file in Explorer"))
665 .disabledHint(tr("This file is in an archive"))
666 .enabled(!file.isFromArchive())
667 .addTo(menu);
668
669 MenuItem(tr("Open &Mod Info"))
670 .callback([&] {
671 openModInfo();
672 })
673 .hint(tr("Opens the Mod Info Window"))
674 .disabledHint(tr("This file is not in a managed mod"))
675 .enabled(originID != 0)
676 .addTo(menu);
677
678 if (isHidden(file)) {
679 MenuItem(tr("&Un-Hide"))
680 .callback([&] {
681 unhide();
682 })
683 .hint(tr("Un-hides the file"))
684 .disabledHint(tr("This file is in an archive"))
685 .enabled(!file.isFromArchive())
686 .addTo(menu);
687 } else {
688 MenuItem(tr("&Hide"))
689 .callback([&] {
690 hide();
691 })
692 .hint(tr("Hides the file"))
693 .disabledHint(tr("This file is in an archive"))
694 .enabled(!file.isFromArchive())
695 .addTo(menu);
696 }
697}

Callers

nothing calls this directly

Calls 7

MenuItemClass · 0.85
getFileExecutionTypeFunction · 0.85
isHiddenFunction · 0.85
getFullPathMethod · 0.80
addToMethod · 0.80
enabledMethod · 0.80
isFromArchiveMethod · 0.45

Tested by

no test coverage detected