Fix compilation warnings about QFile::open

This commit is contained in:
Tobias Fella
2025-08-28 14:46:56 +02:00
parent 8098fce461
commit 5c5dcd555b
6 changed files with 23 additions and 7 deletions

View File

@@ -533,7 +533,11 @@ KeyImport::Error NeoChatConnection::exportMegolmSessions(const QString &passphra
}
QUrl url(path);
QFile file(url.toLocalFile());
file.open(QFile::WriteOnly);
auto ok = file.open(QFile::WriteOnly);
if (!ok) {
qWarning() << "Failed to open" << file.fileName() << file.errorString();
return KeyImport::OtherError;
}
file.write(result.value());
file.close();
return KeyImport::Success;

View File

@@ -261,7 +261,10 @@ QCoro::Task<void> NeoChatRoom::doUploadFile(QUrl url, QString body, std::optiona
QTemporaryFile file;
file.setFileTemplate(QStringLiteral("XXXXXX.jpg"));
file.open();
auto ok = file.open();
if (!ok) {
qWarning() << "Failed to open" << file.fileName() << file.errorString();
}
const auto thumbnailImage = sink.videoFrame().toImage();
Q_UNUSED(thumbnailImage.save(file.fileName()))