Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit 9fc00974 authored by Michael Weghorn's avatar Michael Weghorn Committed by Luigi Toscano

Show more information on CUPS auth dialog

This extends 'KCupsPasswordDialog' so that a prompt text can be
It is explicitly stated that authentication is required
by CUPS, which was not totally clear beforehand and
prompt information as passed via the CUPS
callback function is displayed in addition.

This e.g. makes clear what host the authentication
information is sent to.

BUGS: 397125

Test Plan:
Set up a remote CUPS server that requires authentication
and modify '~/.cups/client.conf' so that it points to this server,
e.g. as described in .

Start print-manager and make sure the authentication dialog is clear
what the authentication is needed for and where the information is sent.

Reviewers: dantti, ngraham

Reviewed By: dantti, ngraham

Subscribers: ltoscano, ngraham, kde-utils-devel

Differential Revision:
parent 39886c6a
......@@ -858,7 +858,6 @@ bool KCupsConnection::retry(const char *resource, int operation) const
const char * password_cb(const char *prompt, http_t *http, const char *method, const char *resource, void *user_data)
......@@ -872,6 +871,9 @@ const char * password_cb(const char *prompt, http_t *http, const char *method, c
auto passwordDialog = static_cast<KCupsPasswordDialog *>(user_data);
bool wrongPassword = password_retries > 1;
// use prompt text from CUPS callback for dialog
passwordDialog->setPromptText(i18n("A CUPS connection requires authentication: \"") + QString::fromUtf8(prompt) + QStringLiteral("\""));
// This will block this thread until exec is not finished
qCDebug(LIBKCUPS) << password_retries;
......@@ -31,7 +31,9 @@
KCupsPasswordDialog::KCupsPasswordDialog(QObject *parent) :
// default text, can be overriden using setPromptText()
m_promptText(i18n("Enter an username and a password to complete the task"))
......@@ -40,10 +42,15 @@ void KCupsPasswordDialog::setMainWindow(WId mainwindow)
m_mainwindow = mainwindow;
void KCupsPasswordDialog::setPromptText(const QString &text)
m_promptText = text;
void KCupsPasswordDialog::exec(const QString &username, bool wrongPassword)
QPointer<KPasswordDialog> dialog = new KPasswordDialog(nullptr, KPasswordDialog::ShowUsernameLine);
dialog->setPrompt(i18n("Enter an username and a password to complete the task"));
if (wrongPassword) {
......@@ -30,6 +30,7 @@ class KCupsPasswordDialog : public QObject
explicit KCupsPasswordDialog(QObject *parent = nullptr);
void setMainWindow(WId mainwindow);
void setPromptText(const QString &promptText);
public slots:
void exec(const QString &username, bool wrongPassword);
......@@ -43,6 +44,7 @@ private:
WId m_mainwindow;
QString m_username;
QString m_password;
QString m_promptText;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment