TextEditors: Remove useless duplicated (set)textCodec methods

They are duplicated from TextDocument::(set)codec. The default
implementation of the duplicated methods was just delegating to the text
document. The override of setTextCodec in QmlJsEditor was useless, since
it was only called from EditorConfiguration::configureEditor with the
ITextEditor::TextCodecFromProjectSetting flag anyhow, which made the
overridden method in QmlJsEditor be the same as the fallback.
Aside from that, the duplicated methods wouldn't have belonged to the
*editor* anyhow, but to the document.

Change-Id: Ib43c28210b6bf88726159d751a4905a1d062f80e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Eike Ziller
2013-07-16 17:10:16 +02:00
parent fade19a9bf
commit 7808266fca
8 changed files with 5 additions and 39 deletions

View File

@@ -1164,7 +1164,7 @@ DiffChunk VcsBaseEditorWidget::diffChunk(QTextCursor cursor) const
unicode += QLatin1Char('\n');
}
}
const QTextCodec *cd = textCodec();
const QTextCodec *cd = baseTextDocument()->codec();
rc.chunk = cd ? cd->fromUnicode(unicode) : unicode.toLocal8Bit();
return rc;
}
@@ -1232,8 +1232,8 @@ static QTextCodec *findFileCodec(const QString &source)
if (!editors.empty()) {
const EditorList::const_iterator ecend = editors.constEnd();
for (EditorList::const_iterator it = editors.constBegin(); it != ecend; ++it)
if (const TextEditor::BaseTextEditor *be = qobject_cast<const TextEditor::BaseTextEditor *>(*it)) {
QTextCodec *codec = be->editorWidget()->textCodec();
if (TextEditor::BaseTextEditor *be = qobject_cast<TextEditor::BaseTextEditor *>(*it)) {
QTextCodec *codec = const_cast<QTextCodec *>(be->textDocument()->codec());
return codec;
}
}