From 5fc354c496aeeafadbf098feb8183a847a1d813d Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Thu, 16 May 2019 00:11:38 +0200 Subject: [PATCH] Simplify code in setDateModified --- plugins/share/shareplugin.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/plugins/share/shareplugin.cpp b/plugins/share/shareplugin.cpp index 6bd767b28..76f4d4d4b 100644 --- a/plugins/share/shareplugin.cpp +++ b/plugins/share/shareplugin.cpp @@ -85,13 +85,9 @@ static QString cleanFilename(const QString &filename) void SharePlugin::setDateModified(const QUrl& destination, const qint64 timestamp) { QFile receivedFile(destination.toLocalFile()); - if (!receivedFile.exists()) { - if (!receivedFile.open(QIODevice::ReadWrite | QIODevice::Text)) { - QString error_msg = receivedFile.errorString(); - return; - } + if (!receivedFile.exists() || !receivedFile.open(QIODevice::ReadWrite | QIODevice::Text)) { + return; } - receivedFile.open(QIODevice::ReadWrite | QIODevice::Text); receivedFile.setFileTime(QDateTime::fromMSecsSinceEpoch(timestamp), QFileDevice::FileTime(QFileDevice::FileModificationTime)); }