From f4f28deb0c9b885c46fc2e962aa8b3407f31deff Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 9 Oct 2015 17:17:31 +0200 Subject: [printergui] Don't allow selecting paper size until we figured things out --- src/maingui/printergui.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/maingui/printergui.cpp b/src/maingui/printergui.cpp index 0dd9e13..2467dcc 100644 --- a/src/maingui/printergui.cpp +++ b/src/maingui/printergui.cpp @@ -128,7 +128,7 @@ void PrinterGui::initializeUI() this->activateWindow(); } -static void enableOptionSelection(ppd_file_t *ppd, QStringList &nameList, QComboBox *combo, QLabel *label) +static void enableOptionSelection(ppd_file_t *ppd, QStringList &nameList, QComboBox *combo, QLabel *label, bool forceDisabled) { // Check for each option if it matches an QString matchedProperty; @@ -160,8 +160,8 @@ static void enableOptionSelection(ppd_file_t *ppd, QStringList &nameList, QCombo } } combo->setProperty("key", matchedProperty); - combo->setEnabled(!matchedProperty.isEmpty()); - label->setEnabled(!matchedProperty.isEmpty()); + combo->setEnabled(!matchedProperty.isEmpty() && !forceDisabled); + label->setEnabled(!matchedProperty.isEmpty() && !forceDisabled); } // ____________________________________________________________________________ @@ -185,9 +185,10 @@ void PrinterGui::on_printerList_currentItemChanged(QTreeWidgetItem *current, QTr if (ppd != NULL) { // Check color capabilities //if (res & CUPS_PRINTER_COLOR) // No needed? Should just get disabled either way - enableOptionSelection(ppd, knownColorOptions, ui->comboBoxColor, ui->label_color); - enableOptionSelection(ppd, knownDuplexOptions, ui->comboBoxSides, ui->label_duplex); - enableOptionSelection(ppd, knownPageSizeOptions, ui->cboPaperSize, ui->lblPaperSize); + enableOptionSelection(ppd, knownColorOptions, ui->comboBoxColor, ui->label_color, false); + enableOptionSelection(ppd, knownDuplexOptions, ui->comboBoxSides, ui->label_duplex, false); + // TODO: Make it so this selection overrides what the document specifies + enableOptionSelection(ppd, knownPageSizeOptions, ui->cboPaperSize, ui->lblPaperSize, true); ppdClose(ppd); } else { qDebug() << "ppd is null"<< dest->name << cupsLastErrorString(); -- cgit v1.2.3-55-g7522