Designer: block non Utf8 codecs for FormWindowFile

Fixes: QTCREATORBUG-26028
Change-Id: Ia10804fef127f6caa9f9bd50ab3ff9946499e3c6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
David Schulz
2021-10-11 11:48:40 +02:00
parent cb5325f6d5
commit 67037b1ca8
2 changed files with 6 additions and 0 deletions

View File

@@ -247,6 +247,11 @@ QString FormWindowFile::fallbackSaveAsFileName() const
return m_suggestedName; return m_suggestedName;
} }
bool FormWindowFile::supportsCodec(const QTextCodec *codec) const
{
return codec == QTextCodec::codecForName("UTF-8");
}
bool FormWindowFile::writeFile(const Utils::FilePath &filePath, QString *errorString) const bool FormWindowFile::writeFile(const Utils::FilePath &filePath, QString *errorString) const
{ {
if (Designer::Constants::Internal::debug) if (Designer::Constants::Internal::debug)

View File

@@ -58,6 +58,7 @@ public:
bool isSaveAsAllowed() const override; bool isSaveAsAllowed() const override;
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override; bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
QString fallbackSaveAsFileName() const override; QString fallbackSaveAsFileName() const override;
bool supportsCodec(const QTextCodec *codec) const override;
// Internal // Internal
void setFallbackSaveAsFileName(const QString &fileName); void setFallbackSaveAsFileName(const QString &fileName);