diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 6452a0ac75a..867e53af13e 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -3323,8 +3323,10 @@ void ProjectExplorerPluginPrivate::updateContextMenuActions() m_diffFileAction->setEnabled(DiffService::instance() && currentNodeIsTextFile && TextEditor::TextDocument::currentTextDocument()); - m_duplicateFileAction->setVisible(supports(DuplicateFile)); - m_duplicateFileAction->setEnabled(supports(DuplicateFile)); + const bool canDuplicate = supports(AddNewFile) + && currentNode->asFileNode()->fileType() != FileType::Project; + m_duplicateFileAction->setVisible(canDuplicate); + m_duplicateFileAction->setEnabled(canDuplicate); EditorManager::populateOpenWithMenu(m_openWithMenu, currentNode->filePath().toString()); diff --git a/src/plugins/projectexplorer/projectnodes.h b/src/plugins/projectexplorer/projectnodes.h index 2795f1a8fbd..e6afdda0384 100644 --- a/src/plugins/projectexplorer/projectnodes.h +++ b/src/plugins/projectexplorer/projectnodes.h @@ -78,7 +78,6 @@ enum ProjectAction { // DeleteFile is a define on windows... EraseFile, Rename, - DuplicateFile, // hides actions that use the path(): Open containing folder, open terminal here and Find in Directory HidePathActions, HideFileActions, diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp index 1716077db00..984be6e96c7 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp @@ -84,7 +84,7 @@ QmakeProFileNode *QmakePriFileNode::proFileNode() const bool QmakePriFileNode::supportsAction(ProjectAction action, const Node *node) const { - if (action == Rename || action == DuplicateFile) { + if (action == Rename) { const FileNode *fileNode = node->asFileNode(); return (fileNode && fileNode->fileType() != FileType::Project) || dynamic_cast(node); diff --git a/src/plugins/resourceeditor/resourcenode.cpp b/src/plugins/resourceeditor/resourcenode.cpp index baf214a2bef..0395c607b43 100644 --- a/src/plugins/resourceeditor/resourcenode.cpp +++ b/src/plugins/resourceeditor/resourcenode.cpp @@ -197,7 +197,6 @@ bool SimpleResourceFolderNode::supportsAction(ProjectAction action, const Node * || action == AddExistingFile || action == AddExistingDirectory || action == RemoveFile - || action == DuplicateFile || action == Rename // Note: only works for the filename, works akwardly for relative file paths || action == InheritedFromParent; // Do not add to list of projects when adding new file } @@ -487,7 +486,6 @@ bool ResourceFolderNode::supportsAction(ProjectAction action, const Node *node) || action == AddExistingFile || action == AddExistingDirectory || action == RemoveFile - || action == DuplicateFile || action == Rename // Note: only works for the filename, works akwardly for relative file paths || action == HidePathActions; // hides open terminal etc. }