diff options
-rw-r--r-- | src/maingui/printergui.cpp | 23 |
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; + } } } } |