Move mimetype definitions to plugin specs

- Avoids the hassle of QRC files and manually registering mime types
- Avoids performance regressions because of mime types that are
  registered after mime database has been used
- Makes it technically possible to detect that a disabled plugin could
  handle a mime type if it was enabled

Change-Id: I373008b1b56e9c6b4853055f20b3eeb112a6eff9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2017-02-08 14:31:55 +01:00
parent ca1d1dfbe2
commit d64e17ad55
120 changed files with 596 additions and 650 deletions

View File

@@ -14,5 +14,17 @@
],
\"Description\" : \"Use .tasks-files to populate the Issues view.\",
\"Url\" : \"http://www.qt.io\",
$$dependencyList
$$dependencyList,
\"Mimetypes\" : \"
<?xml version=\'1.0\' encoding=\'UTF-8\'?>
<mime-info xmlns=\'http://www.freedesktop.org/standards/shared-mime-info\'>
<mime-type type=\'text/x-tasklist\'>
<sub-class-of type=\'text/plain\'/>
<comment>Qt Creator task list file</comment>
<glob pattern=\'*.tasks\'/>
<glob pattern=\'*.tasks.txt\'/>
</mime-type>
</mime-info>
\"
}

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/x-tasklist">
<sub-class-of type="text/plain"/>
<comment>Qt Creator task list file</comment>
<glob pattern="*.tasks"/>
<glob pattern="*.tasks.txt"/>
</mime-type>
</mime-info>

View File

@@ -8,5 +8,3 @@ HEADERS += tasklistplugin.h \
SOURCES += tasklistplugin.cpp \
stopmonitoringhandler.cpp \
taskfile.cpp \
RESOURCES += tasklist.qrc

View File

@@ -14,7 +14,6 @@ QtcPlugin {
"stopmonitoringhandler.h",
"taskfile.cpp",
"taskfile.h",
"tasklist.qrc",
"tasklistconstants.h",
"tasklistplugin.cpp",
"tasklistplugin.h",

View File

@@ -1,5 +0,0 @@
<RCC>
<qresource prefix="/tasklist">
<file>TaskList.mimetypes.xml</file>
</qresource>
</RCC>

View File

@@ -35,7 +35,6 @@
#include <projectexplorer/session.h>
#include <projectexplorer/task.h>
#include <projectexplorer/taskhub.h>
#include <utils/mimetypes/mimedatabase.h>
#include <QDir>
#include <QMessageBox>
@@ -194,8 +193,6 @@ bool TaskListPlugin::initialize(const QStringList &arguments, QString *errorMess
//: Category under which tasklist tasks are listed in Issues view
TaskHub::addCategory(Constants::TASKLISTTASK_ID, tr("My Tasks"));
MimeDatabase::addMimeTypes(QLatin1String(":tasklist/TaskList.mimetypes.xml"));
m_fileFactory = new IDocumentFactory;
m_fileFactory->addMimeType(QLatin1String("text/x-tasklist"));
m_fileFactory->setOpener([this](const QString &fileName) {