From b0af82ebc9e8979fe36d10145d4a43954579fba4 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Thu, 17 Jul 2014 15:52:32 +0200 Subject: [PATCH] CMakeProject: Make CMakeLists.txt and *.cmake use different mime types Since we want to treat them differently. Task-number: QTCREATORBUG-12461 Change-Id: Ia72b8045390ceec693fa416f65010a4c4dbecce1 Reviewed-by: Eike Ziller --- .../cmakeprojectmanager/CMakeProjectManager.mimetypes.xml | 6 +++++- src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp | 2 +- src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp | 1 + src/plugins/cmakeprojectmanager/cmakeproject.cpp | 2 +- src/plugins/cmakeprojectmanager/cmakeprojectconstants.h | 1 + src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp | 2 +- src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp | 1 + 7 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/CMakeProjectManager.mimetypes.xml b/src/plugins/cmakeprojectmanager/CMakeProjectManager.mimetypes.xml index 82894649952..832a61732eb 100644 --- a/src/plugins/cmakeprojectmanager/CMakeProjectManager.mimetypes.xml +++ b/src/plugins/cmakeprojectmanager/CMakeProjectManager.mimetypes.xml @@ -3,7 +3,11 @@ CMake Project file - + + + CMake Project file + + diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp index 0222417ece7..d442c52f13f 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -140,7 +140,7 @@ QList CMakeBuildConfigurationFactory::availableBui int CMakeBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const { return (k && Core::MimeDatabase::findByFile(QFileInfo(projectPath)) - .matchesType(QLatin1String(Constants::CMAKEMIMETYPE))) ? 0 : -1; + .matchesType(QLatin1String(Constants::CMAKEPROJECTMIMETYPE))) ? 0 : -1; } QList CMakeBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit *k, diff --git a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp index de86d401b99..74fc4699f2d 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp @@ -51,6 +51,7 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager) setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID); setDisplayName(tr(CMakeProjectManager::Constants::CMAKE_EDITOR_DISPLAY_NAME)); addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE); + addMimeType(CMakeProjectManager::Constants::CMAKEPROJECTMIMETYPE); new TextEditorActionHandler(this, Constants::C_CMAKEEDITOR, TextEditorActionHandler::UnCommentSelection diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index 350ca84cd36..5a96b622707 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -775,7 +775,7 @@ CMakeFile::CMakeFile(CMakeProject *parent, QString fileName) : Core::IDocument(parent), m_project(parent) { setId("Cmake.ProjectFile"); - setMimeType(QLatin1String(Constants::CMAKEMIMETYPE)); + setMimeType(QLatin1String(Constants::CMAKEPROJECTMIMETYPE)); setFilePath(fileName); } diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h index 1fb917480f5..bb91725ee92 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h +++ b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h @@ -35,6 +35,7 @@ namespace Constants { const char PROJECTCONTEXT[] = "CMakeProject.ProjectContext"; const char CMAKEMIMETYPE[] = "text/x-cmake"; +const char CMAKEPROJECTMIMETYPE[] = "text/x-cmake-project"; const char CMAKE_EDITOR_ID[] = "CMakeProject.CMakeEditor"; const char CMAKE_EDITOR_DISPLAY_NAME[] = "CMake Editor"; const char C_CMAKEEDITOR[] = "CMakeProject.Context.CMakeEditor"; diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index 1c4d76e9714..0b2f0a0a7f3 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -135,7 +135,7 @@ ProjectExplorer::Project *CMakeManager::openProject(const QString &fileName, QSt QString CMakeManager::mimeType() const { - return QLatin1String(Constants::CMAKEMIMETYPE); + return QLatin1String(Constants::CMAKEPROJECTMIMETYPE); } QString CMakeManager::cmakeExecutable() const diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp index bbe3a19c20e..a3bb189064d 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp @@ -88,6 +88,7 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString * hf->setProductType(); hf->setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID); hf->addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE); + hf->addMimeType(CMakeProjectManager::Constants::CMAKEPROJECTMIMETYPE); addAutoReleasedObject(hf); return true;