Editor: Disable adding UTF-8 BOM for qmake project files

Removes the "Add/Remove UTF-8 BOM" entry in the context menu
of the project file editor. Also ignores the setting
"Add If Encoding Is UTF-8" under
Options -> Text Editor -> Behavior -> File Encodings.

Task-number: QTCREATORBUG-8501

Change-Id: I368966b5235ee60011f2051ebdb82f9fe09bc4cc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
David Schulz
2013-01-24 08:47:31 +01:00
parent 8d4618e43d
commit 2f9574582d
4 changed files with 9 additions and 3 deletions

View File

@@ -237,8 +237,9 @@ bool BaseTextDocument::save(QString *errorString, const QString &fileName, bool
if (!fileName.isEmpty())
fName = fileName;
// check if UTF8-BOM has to be added or removed
Utils::TextFileFormat saveFormat = format();
if (saveFormat.codec->name() == "UTF-8") {
if (saveFormat.codec->name() == "UTF-8" && supportsUtf8Bom()) {
switch (d->m_extraEncodingSettings.m_utf8BomSetting) {
case TextEditor::ExtraEncodingSettings::AlwaysAdd:
saveFormat.hasUtf8Bom = true;
@@ -249,7 +250,7 @@ bool BaseTextDocument::save(QString *errorString, const QString &fileName, bool
saveFormat.hasUtf8Bom = false;
break;
}
} // "UTF-8"
}
const bool ok = write(fName, saveFormat, d->m_document->toPlainText(), errorString);