Commit 5a3a940a authored by Eike Ziller's avatar Eike Ziller
Browse files

Use new mime database



Change-Id: I4305872b6b11ef3e8a364280ffa5209a5a793600
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent 365c1ddb
<?xml version="1.0"?> <?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/x-designer"> <mime-type type="application/vnd.google.android.android_manifest">
<comment>Android manifest file</comment>
<sub-class-of type="application/xml"/> <sub-class-of type="application/xml"/>
<comment>Qt Designer file</comment> <glob pattern="AndroidManifest.xml"/>
<glob pattern="*.ui"/> </mime-type>
</mime-type>
</mime-info> </mime-info>
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/x-java">
<sub-class-of type="text/x-csrc"/>
<comment>Java Source file</comment>
<glob pattern="*.java"/>
</mime-type>
</mime-info>
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
<qresource prefix="/android"> <qresource prefix="/android">
<file>images/QtAndroid.png</file> <file>images/QtAndroid.png</file>
<file>images/download.png</file> <file>images/download.png</file>
<file>Java.mimetypes.xml</file> <file>Android.mimetypes.xml</file>
</qresource> </qresource>
</RCC> </RCC>
...@@ -50,10 +50,10 @@ ...@@ -50,10 +50,10 @@
# include "androidqbspropertyprovider.h" # include "androidqbspropertyprovider.h"
#endif #endif
#include <coreplugin/mimedatabase.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <projectexplorer/kitmanager.h> #include <projectexplorer/kitmanager.h>
#include <qtsupport/qtversionmanager.h> #include <qtsupport/qtversionmanager.h>
#include <utils/mimetypes/mimedatabase.h>
#include <QtPlugin> #include <QtPlugin>
...@@ -82,22 +82,9 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa ...@@ -82,22 +82,9 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa
addAutoReleasedObject(new Internal::JavaEditorFactory); addAutoReleasedObject(new Internal::JavaEditorFactory);
ProjectExplorer::KitManager::registerKitInformation(new Internal::AndroidGdbServerKitInformation); ProjectExplorer::KitManager::registerKitInformation(new Internal::AndroidGdbServerKitInformation);
// AndroidManifest.xml editor Utils::MimeDatabase::addMimeTypes(QLatin1String(":/android/Android.mimetypes.xml"));
Core::MimeGlobPattern androidManifestGlobPattern(QLatin1String("AndroidManifest.xml"), Core::MimeGlobPattern::MaxWeight);
Core::MimeType androidManifestMimeType;
androidManifestMimeType.setType(QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE));
androidManifestMimeType.setComment(tr("Android Manifest file"));
androidManifestMimeType.setGlobPatterns(QList<Core::MimeGlobPattern>() << androidManifestGlobPattern);
androidManifestMimeType.setSubClassesOf(QStringList() << QLatin1String("application/xml"));
if (!Core::MimeDatabase::addMimeType(androidManifestMimeType)) {
*errorMessage = tr("Could not add mime-type for AndroidManifest.xml editor.");
return false;
}
addAutoReleasedObject(new Internal::AndroidManifestEditorFactory);
if (!Core::MimeDatabase::addMimeTypes(QLatin1String(":android/Java.mimetypes.xml"), errorMessage)) addAutoReleasedObject(new Internal::AndroidManifestEditorFactory);
return false;
connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsLoaded()), connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsLoaded()),
this, SLOT(kitsRestored())); this, SLOT(kitsRestored()));
......
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/x-makefile">
<sub-class-of type="text/plain"/>
<comment>Automake based Makefile</comment>
<glob weight="10" pattern="Makefile.am"/>
</mime-type>
</mime-info>
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#include "configurestep.h" #include "configurestep.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/mimedatabase.h>
#include <projectexplorer/buildinfo.h> #include <projectexplorer/buildinfo.h>
#include <projectexplorer/buildsteplist.h> #include <projectexplorer/buildsteplist.h>
#include <projectexplorer/kitinformation.h> #include <projectexplorer/kitinformation.h>
...@@ -48,6 +47,7 @@ ...@@ -48,6 +47,7 @@
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <qtsupport/customexecutablerunconfiguration.h> #include <qtsupport/customexecutablerunconfiguration.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QFileInfo> #include <QFileInfo>
...@@ -104,8 +104,10 @@ QList<BuildInfo *> AutotoolsBuildConfigurationFactory::availableBuilds(const Tar ...@@ -104,8 +104,10 @@ QList<BuildInfo *> AutotoolsBuildConfigurationFactory::availableBuilds(const Tar
int AutotoolsBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const int AutotoolsBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
{ {
return (k && Core::MimeDatabase::findByFile(QFileInfo(projectPath)) Utils::MimeDatabase mdb;
.matchesType(QLatin1String(Constants::MAKEFILE_MIMETYPE))) ? 0 : -1; if (k && mdb.mimeTypeForFile(projectPath).matchesName(QLatin1String(Constants::MAKEFILE_MIMETYPE)))
return 0;
return -1;
} }
QList<BuildInfo *> AutotoolsBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const QList<BuildInfo *> AutotoolsBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
......
...@@ -29,4 +29,3 @@ SOURCES = autotoolsprojectplugin.cpp\ ...@@ -29,4 +29,3 @@ SOURCES = autotoolsprojectplugin.cpp\
configurestep.cpp\ configurestep.cpp\
makefileparserthread.cpp\ makefileparserthread.cpp\
makefileparser.cpp makefileparser.cpp
RESOURCES += autotoolsproject.qrc
...@@ -39,8 +39,6 @@ ...@@ -39,8 +39,6 @@
#include "configurestep.h" #include "configurestep.h"
#include "autotoolsprojectconstants.h" #include "autotoolsprojectconstants.h"
#include <coreplugin/mimedatabase.h>
#include <QStringList> #include <QStringList>
#include <QtPlugin> #include <QtPlugin>
...@@ -57,10 +55,8 @@ void AutotoolsProjectPlugin::extensionsInitialized() ...@@ -57,10 +55,8 @@ void AutotoolsProjectPlugin::extensionsInitialized()
bool AutotoolsProjectPlugin::initialize(const QStringList &arguments, bool AutotoolsProjectPlugin::initialize(const QStringList &arguments,
QString *errorString) QString *errorString)
{ {
Q_UNUSED(arguments); Q_UNUSED(arguments)
Q_UNUSED(errorString)
if (!Core::MimeDatabase::addMimeTypes(QLatin1String(":autotoolsproject/AutotoolsProjectManager.mimetypes.xml"), errorString))
return false;
addAutoReleasedObject(new AutotoolsBuildConfigurationFactory); addAutoReleasedObject(new AutotoolsBuildConfigurationFactory);
addAutoReleasedObject(new MakeStepFactory); addAutoReleasedObject(new MakeStepFactory);
......
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
#include <coreplugin/editormanager/ieditor.h> #include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/find/ifindsupport.h> #include <coreplugin/find/ifindsupport.h>
#include <coreplugin/idocument.h> #include <coreplugin/idocument.h>
#include <coreplugin/mimedatabase.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <utils/reloadpromptutils.h> #include <utils/reloadpromptutils.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/idocument.h> #include <coreplugin/idocument.h>
#include <coreplugin/mimedatabase.h>
#include <cplusplus/BackwardsScanner.h> #include <cplusplus/BackwardsScanner.h>
#include <cplusplus/ExpressionUnderCursor.h> #include <cplusplus/ExpressionUnderCursor.h>
...@@ -58,6 +57,7 @@ ...@@ -58,6 +57,7 @@
#include <texteditor/completionsettings.h> #include <texteditor/completionsettings.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/mimetypes/mimedatabase.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDirIterator> #include <QDirIterator>
...@@ -1095,7 +1095,8 @@ bool ClangCompletionAssistProcessor::completeInclude(const QTextCursor &cursor) ...@@ -1095,7 +1095,8 @@ bool ClangCompletionAssistProcessor::completeInclude(const QTextCursor &cursor)
if (!headerPaths.contains(currentFilePath)) if (!headerPaths.contains(currentFilePath))
headerPaths.append(currentFilePath); headerPaths.append(currentFilePath);
const Core::MimeType mimeType = Core::MimeDatabase::findByType(QLatin1String("text/x-c++hdr")); Utils::MimeDatabase mdb;
const Utils::MimeType mimeType = mdb.mimeTypeForName(QLatin1String("text/x-c++hdr"));
const QStringList suffixes = mimeType.suffixes(); const QStringList suffixes = mimeType.suffixes();
foreach (const ProjectPart::HeaderPath &headerPath, headerPaths) { foreach (const ProjectPart::HeaderPath &headerPath, headerPaths) {
......
...@@ -52,13 +52,13 @@ ...@@ -52,13 +52,13 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/infobar.h> #include <coreplugin/infobar.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
#include <coreplugin/mimedatabase.h>
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/locator/commandlocator.h> #include <coreplugin/locator/commandlocator.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/iprojectmanager.h> #include <projectexplorer/iprojectmanager.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/synchronousprocess.h> #include <utils/synchronousprocess.h>
#include <utils/parameteraction.h> #include <utils/parameteraction.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
...@@ -441,6 +441,7 @@ static const VcsBaseSubmitEditorParameters submitParameters = { ...@@ -441,6 +441,7 @@ static const VcsBaseSubmitEditorParameters submitParameters = {
bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *errorMessage) bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *errorMessage)
{ {
Q_UNUSED(errorMessage)
using namespace Constants; using namespace Constants;
using namespace Core::Constants; using namespace Core::Constants;
...@@ -453,8 +454,7 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er ...@@ -453,8 +454,7 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
connect(ProgressManager::instance(), SIGNAL(allTasksFinished(Core::Id)), connect(ProgressManager::instance(), SIGNAL(allTasksFinished(Core::Id)),
this, SLOT(tasksFinished(Core::Id))); this, SLOT(tasksFinished(Core::Id)));
if (!MimeDatabase::addMimeTypes(QLatin1String(":/clearcase/ClearCase.mimetypes.xml"), errorMessage)) Utils::MimeDatabase::addMimeTypes(QLatin1String(":/clearcase/ClearCase.mimetypes.xml"));
return false;
m_settings.fromSettings(ICore::settings()); m_settings.fromSettings(ICore::settings());
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <coreplugin/documentmanager.h> #include <coreplugin/documentmanager.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/mimedatabase.h>
#include <projectexplorer/buildsteplist.h> #include <projectexplorer/buildsteplist.h>
#include <projectexplorer/kit.h> #include <projectexplorer/kit.h>
...@@ -45,6 +44,7 @@ ...@@ -45,6 +44,7 @@
#include <projectexplorer/projectmacroexpander.h> #include <projectexplorer/projectmacroexpander.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QInputDialog> #include <QInputDialog>
...@@ -161,8 +161,10 @@ QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableBui ...@@ -161,8 +161,10 @@ QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableBui
int CMakeBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const int CMakeBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const
{ {
return (k && Core::MimeDatabase::findByFile(QFileInfo(projectPath)) Utils::MimeDatabase mdb;
.matchesType(QLatin1String(Constants::CMAKEPROJECTMIMETYPE))) ? 0 : -1; if (k && mdb.mimeTypeForFile(projectPath).matchesName(QLatin1String(Constants::CMAKEPROJECTMIMETYPE)))
return 0;
return -1;
} }
QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit *k, QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit *k,
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include "cmakesettingspage.h" #include "cmakesettingspage.h"
#include <coreplugin/featureprovider.h> #include <coreplugin/featureprovider.h>
#include <coreplugin/mimedatabase.h> #include <utils/mimetypes/mimedatabase.h>
#include <QtPlugin> #include <QtPlugin>
#include <QDebug> #include <QDebug>
...@@ -59,8 +59,8 @@ CMakeProjectPlugin::~CMakeProjectPlugin() ...@@ -59,8 +59,8 @@ CMakeProjectPlugin::~CMakeProjectPlugin()
bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
{ {
if (!Core::MimeDatabase::addMimeTypes(QLatin1String(":cmakeproject/CMakeProjectManager.mimetypes.xml"), errorMessage)) Q_UNUSED(errorMessage)
return false; Utils::MimeDatabase::addMimeTypes(QLatin1String(":cmakeproject/CMakeProjectManager.mimetypes.xml"));
CMakeSettingsPage *cmp = new CMakeSettingsPage(); CMakeSettingsPage *cmp = new CMakeSettingsPage();
addAutoReleasedObject(cmp); addAutoReleasedObject(cmp);
......
...@@ -34,14 +34,14 @@ ...@@ -34,14 +34,14 @@
#include "icontext.h" #include "icontext.h"
#include "icore.h" #include "icore.h"
#include "ifilewizardextension.h" #include "ifilewizardextension.h"
#include "mimedatabase.h"
#include "editormanager/editormanager.h" #include "editormanager/editormanager.h"
#include "dialogs/promptoverwritedialog.h" #include "dialogs/promptoverwritedialog.h"
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <utils/filewizardpage.h> #include <utils/filewizardpage.h>
#include <utils/wizard.h> #include <utils/mimetypes/mimedatabase.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/stringutils.h> #include <utils/stringutils.h>
#include <utils/wizard.h>
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
...@@ -476,7 +476,11 @@ QString BaseFileWizardFactory::buildFileName(const QString &path, ...@@ -476,7 +476,11 @@ QString BaseFileWizardFactory::buildFileName(const QString &path,
QString BaseFileWizardFactory::preferredSuffix(const QString &mimeType) QString BaseFileWizardFactory::preferredSuffix(const QString &mimeType)
{ {
const QString rc = MimeDatabase::preferredSuffixByType(mimeType); QString rc;
Utils::MimeDatabase mdb;
Utils::MimeType mt = mdb.mimeTypeForName(mimeType);
if (mt.isValid())
rc = mt.preferredSuffix();
if (rc.isEmpty()) if (rc.isEmpty())
qWarning("%s: WARNING: Unable to find a preferred suffix for %s.", qWarning("%s: WARNING: Unable to find a preferred suffix for %s.",
Q_FUNC_INFO, mimeType.toUtf8().constData()); Q_FUNC_INFO, mimeType.toUtf8().constData());
......
...@@ -63,7 +63,6 @@ ...@@ -63,7 +63,6 @@
<file>images/category_core.png</file> <file>images/category_core.png</file>
<file>images/category_texteditor.png</file> <file>images/category_texteditor.png</file>
<file>images/category_design.png</file> <file>images/category_design.png</file>
<file>editormanager/BinFiles.mimetypes.xml</file>
<file>images/progressbar.png</file> <file>images/progressbar.png</file>
<file>images/progressbar@2x.png</file> <file>images/progressbar@2x.png</file>
<file>images/help.png</file> <file>images/help.png</file>
......
...@@ -30,9 +30,8 @@ ...@@ -30,9 +30,8 @@
#include "corejsextensions.h" #include "corejsextensions.h"
#include "mimedatabase.h"
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QDir> #include <QDir>
...@@ -90,7 +89,11 @@ QString UtilsJsExtension::absoluteFilePath(const QString &in) const ...@@ -90,7 +89,11 @@ QString UtilsJsExtension::absoluteFilePath(const QString &in) const
QString UtilsJsExtension::preferredSuffix(const QString &mimetype) const QString UtilsJsExtension::preferredSuffix(const QString &mimetype) const
{ {
return MimeDatabase::preferredSuffixByType(mimetype); Utils::MimeDatabase mdb;
Utils::MimeType mt = mdb.mimeTypeForName(mimetype);
if (mt.isValid())
return mt.preferredSuffix();
return QString();
} }
QString UtilsJsExtension::fileName(const QString &path, const QString &extension) const QString UtilsJsExtension::fileName(const QString &path, const QString &extension) const
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include "editmode.h" #include "editmode.h"
#include "helpmanager.h" #include "helpmanager.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "mimedatabase.h"
#include "modemanager.h" #include "modemanager.h"
#include "infobar.h" #include "infobar.h"
#include "iwizardfactory.h" #include "iwizardfactory.h"
...@@ -212,7 +211,8 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage) ...@@ -212,7 +211,8 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage)
void CorePlugin::extensionsInitialized() void CorePlugin::extensionsInitialized()
{ {
MimeDatabase::syncUserModifiedMimeTypes(); // TODO
// MimeDatabase::syncUserModifiedMimeTypes();
if (m_designMode->designModeIsRequired()) if (m_designMode->designModeIsRequired())
addObject(m_designMode); addObject(m_designMode);
m_findPlugin->extensionsInitialized(); m_findPlugin->extensionsInitialized();
......
...@@ -72,7 +72,6 @@ SOURCES += corejsextensions.cpp \ ...@@ -72,7 +72,6 @@ SOURCES += corejsextensions.cpp \
rightpane.cpp \ rightpane.cpp \
sidebar.cpp \ sidebar.cpp \
fileiconprovider.cpp \ fileiconprovider.cpp \
mimedatabase.cpp \
icore.cpp \ icore.cpp \
infobar.cpp \ infobar.cpp \
editormanager/ieditor.cpp \ editormanager/ieditor.cpp \
...@@ -196,7 +195,6 @@ HEADERS += corejsextensions.h \ ...@@ -196,7 +195,6 @@ HEADERS += corejsextensions.h \
rightpane.h \ rightpane.h \
sidebar.h \ sidebar.h \
fileiconprovider.h \ fileiconprovider.h \
mimedatabase.h \
settingsdatabase.h \ settingsdatabase.h \
editormanager/systemeditor.h \ editormanager/systemeditor.h \
designmode.h \ designmode.h \
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "icore.h" #include "icore.h"
#include "idocument.h" #include "idocument.h"
#include "mimedatabase.h"
#include "coreconstants.h" #include "coreconstants.h"
#include <coreplugin/dialogs/readonlyfilesdialog.h> #include <coreplugin/dialogs/readonlyfilesdialog.h>
...@@ -46,6 +45,7 @@ ...@@ -46,6 +45,7 @@
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <utils/reloadpromptutils.h> #include <utils/reloadpromptutils.h>
...@@ -740,7 +740,9 @@ QString DocumentManager::getSaveAsFileName(const IDocument *document, const QStr ...@@ -740,7 +740,9 @@ QString DocumentManager::getSaveAsFileName(const IDocument *document, const QStr
QString filterString; QString filterString;
if (filter.isEmpty()) { if (filter.isEmpty()) {
if (const MimeType &mt = MimeDatabase::findByFile(fi)) Utils::MimeDatabase mdb;
const Utils::MimeType &mt = mdb.mimeTypeForFile(fi);
if (mt.isValid())
filterString = mt.filterString(); filterString = mt.filterString();
selectedFilter = &filterString; selectedFilter = &filterString;
} else { } else {
...@@ -1391,7 +1393,9 @@ void DocumentManager::populateOpenWithMenu(QMenu *menu, const QString &fileName) ...@@ -1391,7 +1393,9 @@ void DocumentManager::populateOpenWithMenu(QMenu *menu, const QString &fileName)
bool anyMatches = false; bool anyMatches = false;
if (const MimeType mt = MimeDatabase::findByFile(QFileInfo(fileName))) { Utils::MimeDatabase mdb;
const Utils::MimeType mt = mdb.mimeTypeForFile(fileName);
if (mt.isValid()) {
const EditorFactoryList factories = EditorManager::editorFactories(mt, false); const EditorFactoryList factories = EditorManager::editorFactories(mt, false);
const ExternalEditorList externalEditors = EditorManager::externalEditors(mt, false); const ExternalEditorList externalEditors = EditorManager::externalEditors(mt, false);
anyMatches = !factories.empty() || !externalEditors.empty(); anyMatches = !factories.empty() || !externalEditors.empty();
......
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/octet-stream">
<comment>unknown</comment>
<glob pattern="*.a"/>
<glob pattern="*.dll"/>
<glob pattern="*.exe"/>
<glob pattern="*.lib"/>
<glob pattern="*.o"/>
<glob pattern="*.obj"/>
<glob pattern="*.out"/>
<glob pattern="*.so"/>
<!-- Magic for ELF binaries -->
<magic priority="99">
<match type="byte" offset="0" value="\0x7f\0x45\0x4c\0x46"/>
</magic>
</mime-type>
</mime-info>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment