From 51562b55e4dbbc2f95e06e26728b0ecee877d1c3 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 10 Oct 2018 10:37:40 +0200 Subject: [PATCH] Ssh: Add mtime to QSshFileInfo We will need it for checking if a file needs to be deployed. Change-Id: I4dc4e3a43ea161b27319ee2771806c1d52679856 Reviewed-by: Christian Kandeler --- src/libs/ssh/sftpchannel.cpp | 4 ++++ src/libs/ssh/sftpdefs.h | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/libs/ssh/sftpchannel.cpp b/src/libs/ssh/sftpchannel.cpp index 2e397ea404e..59c6ea66ec4 100644 --- a/src/libs/ssh/sftpchannel.cpp +++ b/src/libs/ssh/sftpchannel.cpp @@ -921,6 +921,10 @@ void SftpChannelPrivate::attributesToFileInfo(const SftpFileAttributes &attribut if (attributes.permissions & 00400) // S_IRUSR fileInfo.permissions |= QFile::ReadUser | QFile::ReadOwner; } + if (attributes.timesPresent) { + fileInfo.mtime = attributes.mtime; + fileInfo.mtimeValid = true; + } } void SftpChannelPrivate::removeTransferRequest(const JobMap::Iterator &it) diff --git a/src/libs/ssh/sftpdefs.h b/src/libs/ssh/sftpdefs.h index 71d2d6dd308..b996c38ca4f 100644 --- a/src/libs/ssh/sftpdefs.h +++ b/src/libs/ssh/sftpdefs.h @@ -44,16 +44,16 @@ enum SftpFileType { FileTypeRegular, FileTypeDirectory, FileTypeOther, FileTypeU class QSSH_EXPORT SftpFileInfo { public: - SftpFileInfo() : type(FileTypeUnknown), sizeValid(false), permissionsValid(false) { } - QString name; - SftpFileType type; - quint64 size; + SftpFileType type = FileTypeUnknown; + quint64 size = 0; QFile::Permissions permissions; + quint32 mtime = 0; // The RFC allows an SFTP server not to support any file attributes beyond the name. - bool sizeValid; - bool permissionsValid; + bool sizeValid = false; + bool permissionsValid = false; + bool mtimeValid = false; }; } // namespace QSsh