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 <christian.kandeler@qt.io>
This commit is contained in:
Ulf Hermann
2018-10-10 10:37:40 +02:00
parent e5d1bc9cce
commit 51562b55e4
2 changed files with 10 additions and 6 deletions

View File

@@ -921,6 +921,10 @@ void SftpChannelPrivate::attributesToFileInfo(const SftpFileAttributes &attribut
if (attributes.permissions & 00400) // S_IRUSR if (attributes.permissions & 00400) // S_IRUSR
fileInfo.permissions |= QFile::ReadUser | QFile::ReadOwner; fileInfo.permissions |= QFile::ReadUser | QFile::ReadOwner;
} }
if (attributes.timesPresent) {
fileInfo.mtime = attributes.mtime;
fileInfo.mtimeValid = true;
}
} }
void SftpChannelPrivate::removeTransferRequest(const JobMap::Iterator &it) void SftpChannelPrivate::removeTransferRequest(const JobMap::Iterator &it)

View File

@@ -44,16 +44,16 @@ enum SftpFileType { FileTypeRegular, FileTypeDirectory, FileTypeOther, FileTypeU
class QSSH_EXPORT SftpFileInfo class QSSH_EXPORT SftpFileInfo
{ {
public: public:
SftpFileInfo() : type(FileTypeUnknown), sizeValid(false), permissionsValid(false) { }
QString name; QString name;
SftpFileType type; SftpFileType type = FileTypeUnknown;
quint64 size; quint64 size = 0;
QFile::Permissions permissions; QFile::Permissions permissions;
quint32 mtime = 0;
// The RFC allows an SFTP server not to support any file attributes beyond the name. // The RFC allows an SFTP server not to support any file attributes beyond the name.
bool sizeValid; bool sizeValid = false;
bool permissionsValid; bool permissionsValid = false;
bool mtimeValid = false;
}; };
} // namespace QSsh } // namespace QSsh