Fix build with -no-feature-lineedit

Introduce a new feature for password dialog in cups that needs several widgets

Change-Id: I93799b814ac06e661c19cffcd7d3c9bfa56ff814
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 45df0ed2462beefce1aa51abf3cda7bc18e52118)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tasuku Suzuki 2023-03-03 15:34:15 +09:00 committed by Qt Cherry-pick Bot
parent b5fa546f5f
commit 959d339729
2 changed files with 11 additions and 6 deletions

View File

@ -11,14 +11,14 @@
#include <QtPrintSupport/QPrinterInfo>
#if QT_CONFIG(dialogbuttonbox) && QT_CONFIG(formlayout)
#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
@ -27,7 +27,7 @@
QT_BEGIN_NAMESPACE
#if QT_CONFIG(dialogbuttonbox) && QT_CONFIG(formlayout)
#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
@ -89,16 +89,16 @@ static const char *getPasswordCB(const char */*prompt*/, http_t *http, const cha
return password.constData();
}
#endif // QT_CONFIG(dialogbuttonbox) && QT_CONFIG(formlayout)
#endif // QT_CONFIG(cupspassworddialog)
QCupsPrinterSupport::QCupsPrinterSupport()
: QPlatformPrinterSupport()
{
#if QT_CONFIG(dialogbuttonbox) && QT_CONFIG(formlayout)
#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) && QT_CONFIG(formlayout)
#endif // QT_CONFIG(cupspassworddialog)
}
QCupsPrinterSupport::~QCupsPrinterSupport()

View File

@ -31,6 +31,11 @@ qt_feature("cupsjobwidget" PUBLIC PRIVATE
CONDITION ( QT_FEATURE_buttongroup ) AND ( QT_FEATURE_calendarwidget ) AND ( QT_FEATURE_checkbox ) AND ( QT_FEATURE_combobox ) AND ( QT_FEATURE_cups ) AND ( QT_FEATURE_datetimeedit ) AND ( QT_FEATURE_groupbox ) AND ( QT_FEATURE_tablewidget )
)
qt_feature_definition("cupsjobwidget" "QT_NO_CUPSJOBWIDGET" NEGATE VALUE "1")
qt_feature("cupspassworddialog" PRIVATE
SECTION "Widgets"
LABEL "CUPS password dialog"
CONDITION ( QT_FEATURE_dialogbuttonbox ) AND ( QT_FEATURE_formlayout ) AND ( QT_FEATURE_lineedit )
)
qt_feature("printer" PUBLIC
SECTION "Painting"
LABEL "QPrinter"