Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
a12acc62
Commit
a12acc62
authored
Mar 16, 2010
by
Robert Loehning
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Opening large text files in binary editor to avoid crashes.
Reviewed-By: dt Task-number: QTCREATORBUG-876
parent
f1a719d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
src/plugins/coreplugin/editormanager/editormanager.cpp
src/plugins/coreplugin/editormanager/editormanager.cpp
+5
-1
No files found.
src/plugins/coreplugin/editormanager/editormanager.cpp
View file @
a12acc62
...
...
@@ -1031,13 +1031,17 @@ IEditor *EditorManager::createEditor(const QString &editorId,
EditorFactoryList
factories
;
if
(
editorId
.
isEmpty
())
{
const
QFileInfo
fileInfo
(
fileName
);
// Find by mime type
MimeType
mimeType
=
m_d
->
m_core
->
mimeDatabase
()
->
findByFile
(
QF
ileInfo
(
fileName
)
);
MimeType
mimeType
=
m_d
->
m_core
->
mimeDatabase
()
->
findByFile
(
f
ileInfo
);
if
(
!
mimeType
)
{
qWarning
(
"%s unable to determine mime type of %s/%s. Falling back to text/plain"
,
Q_FUNC_INFO
,
fileName
.
toUtf8
().
constData
(),
editorId
.
toUtf8
().
constData
());
mimeType
=
m_d
->
m_core
->
mimeDatabase
()
->
findByType
(
QLatin1String
(
"text/plain"
));
}
// open text files > 48 MB in binary editor
if
(
fileInfo
.
size
()
>
qint64
(
3
)
<<
24
&&
mimeType
.
type
().
startsWith
(
QLatin1String
(
"text"
)))
mimeType
=
m_d
->
m_core
->
mimeDatabase
()
->
findByType
(
QLatin1String
(
"application/octet-stream"
));
factories
=
editorFactories
(
mimeType
,
true
);
}
else
{
// Find by editor id
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment