Skip to content
Snippets Groups Projects
Commit 9ba5a81e authored by con's avatar con
Browse files

Switch header source between .h and .mm files.

parent e33508b2
No related branches found
No related tags found
No related merge requests found
......@@ -23,4 +23,4 @@ SOURCES += cppplugin.cpp \
cppclasswizard.cpp
RESOURCES += cppeditor.qrc
OTHER_FILES += CppEditor.pluginspec
OTHER_FILES += CppEditor.pluginspec CppEditor.mimetypes.xml
......@@ -41,6 +41,7 @@ const char * const TASK_INDEX = "CppTools.Task.Index";
const char * const C_SOURCE_MIMETYPE = "text/x-csrc";
const char * const C_HEADER_MIMETYPE = "text/x-chdr";
const char * const CPP_SOURCE_MIMETYPE = "text/x-c++src";
const char * const OBJECTIVE_CPP_SOURCE_MIMETYPE = "text/x-objcsrc";
const char * const CPP_HEADER_MIMETYPE = "text/x-c++hdr";
// QSettings keys for use by the "New Class" wizards.
......
......@@ -185,6 +185,7 @@ enum FileType {
HeaderFile,
C_SourceFile,
CPP_SourceFile,
ObjectiveCPP_SourceFile,
UnknownType
};
......@@ -198,6 +199,8 @@ static inline FileType fileType(const Core::MimeDatabase *mimeDatase, const QFi
return C_SourceFile;
if (typeName == QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE))
return CPP_SourceFile;
if (typeName == QLatin1String(CppTools::Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE))
return ObjectiveCPP_SourceFile;
if (typeName == QLatin1String(CppTools::Constants::C_HEADER_MIMETYPE)
|| typeName == QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE))
return HeaderFile;
......@@ -212,11 +215,13 @@ static QStringList matchingCandidateSuffixes(const Core::MimeDatabase *mimeDatas
case UnknownType:
break;
case HeaderFile: // Note that C/C++ headers are undistinguishable
return mimeDatase->findByType(QLatin1String(CppTools::Constants::C_SOURCE_MIMETYPE)).suffixes() +
mimeDatase->findByType(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE)).suffixes();
return mimeDatase->findByType(QLatin1String(CppTools::Constants::C_SOURCE_MIMETYPE)).suffixes()
+ mimeDatase->findByType(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE)).suffixes()
+ mimeDatase->findByType(QLatin1String(CppTools::Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE)).suffixes();
case C_SourceFile:
return mimeDatase->findByType(QLatin1String(CppTools::Constants::C_HEADER_MIMETYPE)).suffixes();
case CPP_SourceFile:
case ObjectiveCPP_SourceFile:
return mimeDatase->findByType(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE)).suffixes();
}
return QStringList();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment