diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/maingui/printergui.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
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"); |