diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-06-23 12:40:55 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-07-02 15:35:18 +0200 |
commit | 057329c24c00047c8c3e1502a9a8dfa9a4169481 (patch) | |
tree | 307ed9e68e004dad434aa7c5a140f56ae0391bcc /src/network/access/qftp.cpp | |
parent | c30e0c656f34815f7ba5fac33ce58baa421c4289 (diff) |
Make feature datetimeparser depend on feature datestring
No client of QDateTimeParser actually uses it unless datestring was
enabled, nor is it any use without datestring. Various methods
conditioned on datestring are broken unless datetimeparser is enabled.
We can't condition public API on datetimeparser, as it's a private
feature, but client code can condition use of it on the private
feature. All string-to-date/time conversions that use a string format
(this includes all locale-specific formats) depend on feature
datetimeparser.
Change #if-ery (or add it) in all client (including test) code to test
the right feature.
Tidied up some code in the process. Killed some already-redundant
textdate #if-ery. Renamed a test whose name claimed it involved
locale, which it doesn't, in the course of #if-ing it.
This simplifies the condition for feature datetimeedit (which overtly
depended on textdate, redundantly since it depends on datestring which
depends on textdate; its dependence on datetimeparser now makes its
dependency on datestring also redundant).
It also removes the need for assorted datestring checks in
QDateTimeParser itself.
Change-Id: I5dfe3a977042134b2cfb16cbcc795070634e7adf
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/network/access/qftp.cpp')
-rw-r--r-- | src/network/access/qftp.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index ffe0ae7b6b..878f55f604 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.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 QtNetwork module of the Qt Toolkit. @@ -517,7 +517,7 @@ static void _q_parseUnixDir(const QStringList &tokens, const QString &userName, // Resolve the modification date by parsing all possible formats QDateTime dateTime; int n = 0; -#if QT_CONFIG(datestring) +#if QT_CONFIG(datetimeparser) do { dateTime = QLocale::c().toDateTime(dateString, formats.at(n++)); } while (n < formats.size() && (!dateTime.isValid())); @@ -592,7 +592,7 @@ static void _q_parseDosDir(const QStringList &tokens, const QString &userName, Q info->setWritable(info->isFile()); QDateTime dateTime; -#if QT_CONFIG(datestring) +#if QT_CONFIG(datetimeparser) dateTime = QLocale::c().toDateTime(tokens.at(1), QLatin1String("MM-dd-yy hh:mmAP")); if (dateTime.date().year() < 1971) { dateTime.setDate(QDate(dateTime.date().year() + 100, |