From 0bfbdf5e7c11e047bde6951594aed36eb60def3d Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 11 Oct 2021 11:50:41 +0200 Subject: [PATCH] ScxmlEditor: block non Utf8 codecs Change-Id: I7d44dc0ddb17ab543e9e578d4480a090cc6835f1 Reviewed-by: Alessandro Portale --- src/plugins/scxmleditor/scxmleditordocument.cpp | 5 +++++ src/plugins/scxmleditor/scxmleditordocument.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/plugins/scxmleditor/scxmleditordocument.cpp b/src/plugins/scxmleditor/scxmleditordocument.cpp index 22cf8285896..2ce6669e686 100644 --- a/src/plugins/scxmleditor/scxmleditordocument.cpp +++ b/src/plugins/scxmleditor/scxmleditordocument.cpp @@ -147,6 +147,11 @@ bool ScxmlEditorDocument::reload(QString *errorString, ReloadFlag flag, ChangeTy return success; } +bool ScxmlEditorDocument::supportsCodec(const QTextCodec *codec) const +{ + return codec == QTextCodec::codecForName("UTF-8"); +} + QString ScxmlEditorDocument::designWidgetContents() const { return m_designWidget->contents(); diff --git a/src/plugins/scxmleditor/scxmleditordocument.h b/src/plugins/scxmleditor/scxmleditordocument.h index 587343a70b0..f46d03f0a21 100644 --- a/src/plugins/scxmleditor/scxmleditordocument.h +++ b/src/plugins/scxmleditor/scxmleditordocument.h @@ -57,6 +57,7 @@ public: bool isSaveAsAllowed() const override; bool isModified() const override; bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override; + bool supportsCodec(const QTextCodec *codec) const override; // Internal Common::MainWidget *designWidget() const;