Commit 10352247 authored by David Schulz's avatar David Schulz Committed by David Schulz
Browse files

Editor: Fix: "Open File With..." with empty File



and no extension is now handled as a plain text file.

Task-number: QTCREATORBUG-7591
Change-Id: I21471315cb6144f27c374e0919fd16e62f7d8f2a
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 61fb4f55
......@@ -222,8 +222,10 @@ public:
bool open(QString *errorString, const QString &fileName, quint64 offset = 0) {
QFile file(fileName);
if (offset >= static_cast<quint64>(file.size()))
if (offset >= static_cast<quint64>(file.size())) {
*errorString = tr("The Binary Editor can not open empty files.");
return false;
}
if (file.open(QIODevice::ReadOnly)) {
file.close();
m_fileName = fileName;
......
......@@ -1173,9 +1173,10 @@ Core::Id EditorManager::getOpenWithEditorId(const QString &fileName,
bool *isExternalEditor) const
{
// Collect editors that can open the file
const MimeType mt = ICore::mimeDatabase()->findByFile(fileName);
MimeType mt = ICore::mimeDatabase()->findByFile(fileName);
//Unable to determine mime type of fileName. Falling back to text/plain",
if (!mt)
return Id();
mt = ICore::mimeDatabase()->findByType(QLatin1String("text/plain"));
QStringList allEditorIds;
QStringList allEditorDisplayNames;
QList<Id> externalEditorIds;
......
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