summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2017-03-10 10:32:57 +0100
committerSimon Rettberg2017-03-10 10:32:57 +0100
commitd559b1678a11f703ca4dc2e88671805bffd4a68c (patch)
tree09bf963770985de3de7cbb7b3f7bf5b7e42a4c9a /src
parent[printergui] Removed NULL checks that can never yield true (diff)
downloadprintergui-d559b1678a11f703ca4dc2e88671805bffd4a68c.tar.gz
printergui-d559b1678a11f703ca4dc2e88671805bffd4a68c.tar.xz
printergui-d559b1678a11f703ca4dc2e88671805bffd4a68c.zip
[printergui] Handle NULL ppd in handleTrustedPrint()
Diffstat (limited to 'src')
-rw-r--r--src/maingui/printergui.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/maingui/printergui.cpp b/src/maingui/printergui.cpp
index 8d094e3..4cd1192 100644
--- a/src/maingui/printergui.cpp
+++ b/src/maingui/printergui.cpp
@@ -112,6 +112,8 @@ void PrinterGui::initializeUI()
h.append("Standort");
ui->printerList->setHeaderLabels(h);
+ // Hide trusted print by default
+ handleTrustedPrint(NULL);
// Fill treewidget with data from cups dests;
cups_dest_t *dest = dests;
for (int i = num_dests; i > 0; ++dest, --i) {
@@ -182,18 +184,19 @@ void PrinterGui::handleTrustedPrint(ppd_file_t *ppd)
static QRegExpValidator sevenNum(QRegExp("^[0-9]{1,7}$"));
QRegExpValidator *pwValidator = NULL;
-
- for (ppd_option_t *o = ppdFirstOption(ppd); o != NULL; o = ppdNextOption(ppd)) {
- if (strcmp(o->keyword, "UseSecure") == 0) {
- supported = true;
- enabled = (strcmp(o->defchoice, "On") == 0);
- } else if (strcmp(o->keyword, "SecuredPassword") == 0) {
- pwProperty = o->keyword;
- pwValidator = &sevenNum;
- } else if (strcmp(o->keyword, "UserPassword") == 0) {
- if (pwProperty.isEmpty()) {
+ if (ppd != NULL) {
+ for (ppd_option_t *o = ppdFirstOption(ppd); o != NULL; o = ppdNextOption(ppd)) {
+ if (strcmp(o->keyword, "UseSecure") == 0) {
+ supported = true;
+ enabled = (strcmp(o->defchoice, "On") == 0);
+ } else if (strcmp(o->keyword, "SecuredPassword") == 0) {
pwProperty = o->keyword;
pwValidator = &sevenNum;
+ } else if (strcmp(o->keyword, "UserPassword") == 0) {
+ if (pwProperty.isEmpty()) {
+ pwProperty = o->keyword;
+ pwValidator = &sevenNum;
+ }
}
}
}