aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <[email protected]>2021-11-08 14:33:39 +0100
committerEike Ziller <[email protected]>2021-12-08 14:00:07 +0000
commit42729a8fd92afe6a68f666a281405d5e6c9224ef (patch)
tree014c50d5d4f4320e17749b3c2c3eb384934d843b
parent8a61a945f5b37e5d3796474f2c686ce9fa3d0721 (diff)
Remove IEditorFactory::defaultEditorFactories() from public API
Only used internally now, other usages were changed to defaultEditorTypes(). Change-Id: I39f272dd0610c14070a16b7f9df1c7ef0adb17fd Reviewed-by: David Schulz <[email protected]>
-rw-r--r--src/plugins/coreplugin/editormanager/ieditorfactory.cpp20
-rw-r--r--src/plugins/coreplugin/editormanager/ieditorfactory.h1
2 files changed, 8 insertions, 13 deletions
diff --git a/src/plugins/coreplugin/editormanager/ieditorfactory.cpp b/src/plugins/coreplugin/editormanager/ieditorfactory.cpp
index 726bbbab1d8..a4e323b8d2f 100644
--- a/src/plugins/coreplugin/editormanager/ieditorfactory.cpp
+++ b/src/plugins/coreplugin/editormanager/ieditorfactory.cpp
@@ -241,18 +241,6 @@ const EditorFactoryList IEditorFactory::allEditorFactories()
}
/*!
- Returns all available editor factories for the \a mimeType in the default
- order (editor types ordered by MIME type hierarchy).
-*/
-const EditorFactoryList IEditorFactory::defaultEditorFactories(const Utils::MimeType &mimeType)
-{
- EditorFactoryList rc;
- const EditorFactoryList allFactories = IEditorFactory::allEditorFactories();
- Internal::mimeTypeFactoryLookup(mimeType, allFactories, &rc);
- return rc;
-}
-
-/*!
Returns the available editor factories for \a filePath in order of
preference. That is the default order for the document's MIME type but with
a user overridden default editor first, and the binary editor as the very
@@ -260,6 +248,14 @@ const EditorFactoryList IEditorFactory::defaultEditorFactories(const Utils::Mime
*/
const EditorFactoryList IEditorFactory::preferredEditorFactories(const FilePath &filePath)
{
+ const auto defaultEditorFactories = [](const MimeType &mimeType) {
+ const EditorTypeList types = defaultEditorTypes(mimeType);
+ const EditorTypeList ieditorTypes = Utils::filtered(types, [](EditorType *type) {
+ return type->asEditorFactory() != nullptr;
+ });
+ return Utils::qobject_container_cast<IEditorFactory *>(ieditorTypes);
+ };
+
// default factories by mime type
const Utils::MimeType mimeType = Utils::mimeTypeForFile(filePath);
EditorFactoryList factories = defaultEditorFactories(mimeType);
diff --git a/src/plugins/coreplugin/editormanager/ieditorfactory.h b/src/plugins/coreplugin/editormanager/ieditorfactory.h
index d1335a16ceb..20787c29155 100644
--- a/src/plugins/coreplugin/editormanager/ieditorfactory.h
+++ b/src/plugins/coreplugin/editormanager/ieditorfactory.h
@@ -87,7 +87,6 @@ public:
~IEditorFactory() override;
static const EditorFactoryList allEditorFactories();
- static const EditorFactoryList defaultEditorFactories(const Utils::MimeType &mimeType);
static const EditorFactoryList preferredEditorFactories(const Utils::FilePath &filePath);
IEditor *createEditor() const;