From fe6a1d34dc2e5d24d55fac67657ffe760e2e3e51 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 16 Jul 2020 14:21:53 +0200 Subject: [PATCH] QFileInfo: purge deprecated API Since 5.10: created() Since 5.13: readLink() Change-Id: I9722f81750dd92315a67a1c38df41a95ae63e0db Reviewed-by: Lars Knoll --- src/corelib/io/qfileinfo.cpp | 40 ------------------- src/corelib/io/qfileinfo.h | 8 ---- .../corelib/io/qfileinfo/tst_qfileinfo.cpp | 8 +--- 3 files changed, 1 insertion(+), 55 deletions(-) diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 062efcf40a..11db5dc146 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -1194,7 +1194,6 @@ bool QFileInfo::isRoot() const } /*! - \fn QString QFileInfo::symLinkTarget() const \since 4.2 Returns the absolute path to the file or directory a symbolic link @@ -1207,19 +1206,6 @@ bool QFileInfo::isRoot() const \sa exists(), isSymLink(), isDir(), isFile() */ - -#if QT_DEPRECATED_SINCE(5, 13) -/*! - \obsolete - - Use symLinkTarget() instead. -*/ -QString QFileInfo::readLink() const -{ - return symLinkTarget(); -} -#endif - QString QFileInfo::symLinkTarget() const { Q_D(const QFileInfo); @@ -1390,32 +1376,6 @@ qint64 QFileInfo::size() const }); } -#if QT_DEPRECATED_SINCE(5, 10) -/*! - \deprecated - - Returns the date and time when the file was created, the time its metadata - was last changed or the time of last modification, whichever one of the - three is available (in that order). - - This function is deprecated. Instead, use the birthTime() function to get - the time the file was created, metadataChangeTime() to get the time its - metadata was last changed, or lastModified() to get the time it was last modified. - - If the file is a symlink, the time of the target file is returned - (not the symlink). - - \sa birthTime(), metadataChangeTime(), lastModified(), lastRead() -*/ -QDateTime QFileInfo::created() const -{ - QDateTime d = fileTime(QFile::FileBirthTime); - if (d.isValid()) - return d; - return fileTime(QFile::FileMetadataChangeTime); -} -#endif - /*! \since 5.10 Returns the date and time when the file was created / born. diff --git a/src/corelib/io/qfileinfo.h b/src/corelib/io/qfileinfo.h index d7cc51c7df..aea0927310 100644 --- a/src/corelib/io/qfileinfo.h +++ b/src/corelib/io/qfileinfo.h @@ -151,10 +151,6 @@ public: bool isRoot() const; bool isBundle() const; -#if QT_DEPRECATED_SINCE(5, 13) - QT_DEPRECATED_X("Use QFileInfo::symLinkTarget() instead") - QString readLink() const; -#endif QString symLinkTarget() const; #if QT_CONFIG(cxx17_filesystem) std::filesystem::path filesystemSymLinkTarget() const @@ -172,10 +168,6 @@ public: qint64 size() const; // ### Qt6: inline these functions -#if QT_DEPRECATED_SINCE(5, 10) - QT_DEPRECATED_X("Use either birthTime() or metadataChangeTime()") - QDateTime created() const; -#endif QDateTime birthTime() const; QDateTime metadataChangeTime() const; QDateTime lastModified() const; diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index ce41e49985..ec1dc531dc 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -1035,9 +1035,6 @@ void tst_QFileInfo::systemFiles() QCOMPARE(fi.metadataChangeTime(), fi.lastModified()); // On Windows, they're the same QVERIFY(fi.birthTime().isValid()); QVERIFY(fi.birthTime() <= fi.lastModified()); -#if QT_DEPRECATED_SINCE(5, 10) - QCOMPARE(fi.created(), fi.birthTime()); // On Windows, they're the same -#endif } void tst_QFileInfo::compare_data() @@ -2209,9 +2206,6 @@ static void stateCheck(const QFileInfo &info, const QString &dirname, const QStr QCOMPARE(info.permissions(), QFile::Permissions()); -#if QT_DEPRECATED_SINCE(5, 10) - QVERIFY(!info.created().isValid()); -#endif QVERIFY(!info.birthTime().isValid()); QVERIFY(!info.metadataChangeTime().isValid()); QVERIFY(!info.lastRead().isValid());