From 816a51e3b0ccbeb4a2d98869560d6d8f98099e67 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 23 Dec 2016 10:29:17 +0100 Subject: [maingui] Also set UseSecured and OptSecured if secure print is enabled --- src/maingui/printergui.cpp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/maingui/printergui.cpp b/src/maingui/printergui.cpp index 8758a6b..bb6122f 100644 --- a/src/maingui/printergui.cpp +++ b/src/maingui/printergui.cpp @@ -369,20 +369,32 @@ void PrinterGui::on_buttonPrint_clicked() dest->num_options = cupsRemoveOption("InputSlot", dest->num_options, &(dest->options)); // If we use secured print, allow overriding username - if (ui->txtUserId->isHidden() || ui->txtUserId->text().isEmpty()) { + const char *securedMode = "Off"; + if (ui->chkSecurePrint->isHidden() || !ui->chkSecurePrint->isChecked()) { cupsSetUser(this->user); } else { - cupsSetUser(ui->txtUserId->text().toUtf8().constData()); - } - // Secured print -> set pin - if (!ui->txtUserPin->isHidden()) { - QString pinKey = ui->txtUserPin->property("key").toString(); + securedMode = "On"; + if (ui->txtUserId->text().isEmpty()) { + cupsSetUser(this->user); + } else { + cupsSetUser(ui->txtUserId->text().toUtf8().constData()); + } + const QString pinKey = ui->txtUserPin->property("key").toString(); dest->num_options = cupsAddOption(pinKey.toUtf8().constData(), - ui->txtUserPin->text().toUtf8().constData(), - dest->num_options, - &(dest->options)); + ui->txtUserPin->text().toUtf8().constData(), + dest->num_options, + &(dest->options)); } + dest->num_options = cupsAddOption("UseSecured", + securedMode, + dest->num_options, + &(dest->options)); + dest->num_options = cupsAddOption("OptSecured", + securedMode, + dest->num_options, + &(dest->options)); + char jobtitle[250]; const char *docName; docName = getenv("J"); -- cgit v1.2.3-55-g7522