aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/refactoringchanges.cpp
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2021-05-18 07:57:14 +0200
committerDavid Schulz <david.schulz@qt.io>2021-05-18 12:35:49 +0000
commit8b7a90ac5152823b8561cb471eeb1e023b434fb9 (patch)
treea409f506783bc809ef918e0195458f210f63a95d /src/plugins/texteditor/refactoringchanges.cpp
parentf8ca730121b1266a452019a0272684dec63d1ab8 (diff)
Utils: filepathify TextFileFormat
Change-Id: I6a4e2d38b0bbdec661a4a492901d9182a9f2e502 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/texteditor/refactoringchanges.cpp')
-rw-r--r--src/plugins/texteditor/refactoringchanges.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp
index 9732972b01..b936066b1a 100644
--- a/src/plugins/texteditor/refactoringchanges.cpp
+++ b/src/plugins/texteditor/refactoringchanges.cpp
@@ -98,7 +98,7 @@ bool RefactoringChanges::createFile(const QString &fileName, const QString &cont
TextFileFormat format;
format.codec = EditorManager::defaultTextCodec();
QString error;
- bool saveOk = format.writeFile(fileName, document->toPlainText(), &error);
+ bool saveOk = format.writeFile(Utils::FilePath::fromString(fileName), document->toPlainText(), &error);
delete document;
if (!saveOk)
return false;
@@ -198,10 +198,12 @@ QTextDocument *RefactoringFile::mutableDocument() const
if (!m_fileName.isEmpty()) {
QString error;
QTextCodec *defaultCodec = EditorManager::defaultTextCodec();
- TextFileFormat::ReadResult result = TextFileFormat::readFile(
- m_fileName, defaultCodec,
- &fileContents, &m_textFileFormat,
- &error);
+ TextFileFormat::ReadResult result = TextFileFormat::readFile(FilePath::fromString(
+ m_fileName),
+ defaultCodec,
+ &fileContents,
+ &m_textFileFormat,
+ &error);
if (result != TextFileFormat::ReadSuccess) {
qWarning() << "Could not read " << m_fileName << ". Error: " << error;
m_textFileFormat.codec = nullptr;
@@ -372,7 +374,9 @@ bool RefactoringFile::apply()
QString error;
// suppress "file has changed" warnings if the file is open in a read-only editor
Core::FileChangeBlocker block(m_fileName);
- if (!m_textFileFormat.writeFile(m_fileName, doc->toPlainText(), &error)) {
+ if (!m_textFileFormat.writeFile(FilePath::fromString(m_fileName),
+ doc->toPlainText(),
+ &error)) {
qWarning() << "Could not apply changes to" << m_fileName << ". Error: " << error;
result = false;
}