diff options
Diffstat (limited to 'src/plugins/printsupport/cups/qcupsprintersupport.cpp')
-rw-r--r-- | src/plugins/printsupport/cups/qcupsprintersupport.cpp | 60 |
1 files changed, 12 insertions, 48 deletions
diff --git a/src/plugins/printsupport/cups/qcupsprintersupport.cpp b/src/plugins/printsupport/cups/qcupsprintersupport.cpp index 8f7d0f1e1e..6578d8a558 100644 --- a/src/plugins/printsupport/cups/qcupsprintersupport.cpp +++ b/src/plugins/printsupport/cups/qcupsprintersupport.cpp @@ -1,42 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2014 John Layt <jlayt@kde.org> -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins 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. +// Copyright (C) 2014 John Layt <jlayt@kde.org> +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qcupsprintersupport_p.h" @@ -47,14 +11,14 @@ #include <QtPrintSupport/QPrinterInfo> -#if QT_CONFIG(dialogbuttonbox) +#if QT_CONFIG(cupspassworddialog) #include <QGuiApplication> #include <QDialog> #include <QDialogButtonBox> #include <QFormLayout> #include <QLabel> #include <QLineEdit> -#endif // QT_CONFIG(dialogbuttonbox) +#endif // QT_CONFIG(cupspassworddialog) #include <cups/ppd.h> #ifndef QT_LINUXBASE // LSB merges everything into cups.h @@ -63,7 +27,7 @@ QT_BEGIN_NAMESPACE -#if QT_CONFIG(dialogbuttonbox) +#if QT_CONFIG(cupspassworddialog) static const char *getPasswordCB(const char */*prompt*/, http_t *http, const char */*method*/, const char *resource, void */*user_data*/) { // cups doesn't free the const char * we return so keep around @@ -93,7 +57,7 @@ static const char *getPasswordCB(const char */*prompt*/, http_t *http, const cha QString resourceString = QString::fromLocal8Bit(resource); if (resourceString.startsWith(QStringLiteral("/printers/"))) - resourceString = resourceString.mid(QStringLiteral("/printers/").length()); + resourceString = resourceString.mid(QStringLiteral("/printers/").size()); QLabel *label = new QLabel(); if (hostname == QStringLiteral("localhost")) { @@ -125,16 +89,16 @@ static const char *getPasswordCB(const char */*prompt*/, http_t *http, const cha return password.constData(); } -#endif // QT_CONFIG(dialogbuttonbox) +#endif // QT_CONFIG(cupspassworddialog) QCupsPrinterSupport::QCupsPrinterSupport() : QPlatformPrinterSupport() { -#if QT_CONFIG(dialogbuttonbox) +#if QT_CONFIG(cupspassworddialog) // Only show password dialog if GUI application if (qobject_cast<QGuiApplication*>(QCoreApplication::instance())) cupsSetPasswordCB2(getPasswordCB, nullptr /* user_data */ ); -#endif // QT_CONFIG(dialogbuttonbox) +#endif // QT_CONFIG(cupspassworddialog) } QCupsPrinterSupport::~QCupsPrinterSupport() @@ -166,7 +130,7 @@ QStringList QCupsPrinterSupport::availablePrintDeviceIds() const for (int i = 0; i < count; ++i) { QString printerId = QString::fromLocal8Bit(dests[i].name); if (dests[i].instance) - printerId += QLatin1Char('/') + QString::fromLocal8Bit(dests[i].instance); + printerId += u'/' + QString::fromLocal8Bit(dests[i].instance); list.append(printerId); } cupsFreeDests(count, dests); @@ -187,7 +151,7 @@ QString QCupsPrinterSupport::staticDefaultPrintDeviceId() if (dests[i].is_default) { printerId = QString::fromLocal8Bit(dests[i].name); if (dests[i].instance) { - printerId += QLatin1Char('/') + QString::fromLocal8Bit(dests[i].instance); + printerId += u'/' + QString::fromLocal8Bit(dests[i].instance); break; } } |