diff options
author | Simon Rettberg | 2016-12-23 10:29:17 +0100 |
---|---|---|
committer | Simon Rettberg | 2016-12-23 10:29:17 +0100 |
commit | 816a51e3b0ccbeb4a2d98869560d6d8f98099e67 (patch) | |
tree | 5f3b1845879a1c8d6f0c364d8c47271c6d3aeb92 | |
parent | [pwgui] Focus password field by default, react to return key in text boxes (diff) | |
download | printergui-816a51e3b0ccbeb4a2d98869560d6d8f98099e67.tar.gz printergui-816a51e3b0ccbeb4a2d98869560d6d8f98099e67.tar.xz printergui-816a51e3b0ccbeb4a2d98869560d6d8f98099e67.zip |
[maingui] Also set UseSecured and OptSecured if secure print is enabled
-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"); |