diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 1fc514e63008cb32df5dace31762f2134e1fc3a5..44fda4151270655cf38dbc173de18151ec95c062 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -87,6 +87,7 @@ #include <QtCore/QtPlugin> #include <QtCore/QUrl> #include <QtCore/QDir> +#include <QtCore/QFile> #include <QtGui/QApplication> #include <QtGui/QCloseEvent> @@ -339,6 +340,8 @@ void MainWindow::extensionsInitialized() readSettings(); updateContext(); + registerUserMimeTypes(); + emit m_coreImpl->coreAboutToOpen(); show(); emit m_coreImpl->coreOpened(); @@ -1383,3 +1386,15 @@ bool MainWindow::showWarningWithOptions(const QString &title, } return false; } + +void MainWindow::registerUserMimeTypes() const +{ + // This is to temporarily allow user specific MIME types (without recompilation). + // Be careful with the file contents. Otherwise unpredictable behavior might arise. + const QString &fileName = m_coreImpl->userResourcePath() + QLatin1String("/mimetypes.xml"); + if (QFile::exists(fileName)) { + QString error; + if (!m_coreImpl->mimeDatabase()->addMimeTypes(fileName, &error)) + qWarning() << error; + } +} diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index dc88545e9ad3c7e2ff3d551b258b6b0a61e05ed9..22506fd78c3f7580444461bc44a656a6c0a3bd2b 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -177,6 +177,8 @@ private: void readSettings(); void writeSettings(); + void registerUserMimeTypes() const; + CoreImpl *m_coreImpl; UniqueIDManager *m_uniqueIDManager; Context m_additionalContexts;