diff options
Diffstat (limited to 'src/network/access/qnetworkaccessfilebackend.cpp')
-rw-r--r-- | src/network/access/qnetworkaccessfilebackend.cpp | 62 |
1 files changed, 15 insertions, 47 deletions
diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp index c5f1826203..2100c188a5 100644 --- a/src/network/access/qnetworkaccessfilebackend.cpp +++ b/src/network/access/qnetworkaccessfilebackend.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qnetworkaccessfilebackend_p.h" #include "qfileinfo.h" @@ -47,6 +11,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + QStringList QNetworkAccessFileBackendFactory::supportedSchemes() const { QStringList schemes; @@ -74,13 +40,13 @@ QNetworkAccessFileBackendFactory::create(QNetworkAccessManager::Operation op, } QUrl url = request.url(); - if (url.scheme().compare(QLatin1String("qrc"), Qt::CaseInsensitive) == 0 + if (url.scheme().compare("qrc"_L1, Qt::CaseInsensitive) == 0 #if defined(Q_OS_ANDROID) - || url.scheme().compare(QLatin1String("assets"), Qt::CaseInsensitive) == 0 + || url.scheme().compare("assets"_L1, Qt::CaseInsensitive) == 0 #endif || url.isLocalFile()) { return new QNetworkAccessFileBackend; - } else if (!url.scheme().isEmpty() && url.authority().isEmpty() && (url.scheme().length() > 1)) { + } else if (!url.scheme().isEmpty() && url.authority().isEmpty() && (url.scheme().size() > 1)) { // check if QFile could, in theory, open this URL via the file engines // it has to be in the format: // prefix:path/to/file @@ -112,7 +78,7 @@ void QNetworkAccessFileBackend::open() { QUrl url = this->url(); - if (url.host() == QLatin1String("localhost")) + if (url.host() == "localhost"_L1) url.setHost(QString()); #if !defined(Q_OS_WIN) // do not allow UNC paths on Unix @@ -125,17 +91,17 @@ void QNetworkAccessFileBackend::open() } #endif // !defined(Q_OS_WIN) if (url.path().isEmpty()) - url.setPath(QLatin1String("/")); + url.setPath("/"_L1); setUrl(url); QString fileName = url.toLocalFile(); if (fileName.isEmpty()) { - if (url.scheme() == QLatin1String("qrc")) { - fileName = QLatin1Char(':') + url.path(); + if (url.scheme() == "qrc"_L1) { + fileName = u':' + url.path(); } else { #if defined(Q_OS_ANDROID) - if (url.scheme() == QLatin1String("assets")) - fileName = QLatin1String("assets:") + url.path(); + if (url.scheme() == "assets"_L1) + fileName = "assets:"_L1 + url.path(); else #endif fileName = url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery); @@ -286,3 +252,5 @@ qint64 QNetworkAccessFileBackend::read(char *data, qint64 maxlen) } QT_END_NAMESPACE + +#include "moc_qnetworkaccessfilebackend_p.cpp" |