summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2015-10-09 17:17:31 +0200
committerSimon Rettberg2015-10-09 17:17:31 +0200
commitf4f28deb0c9b885c46fc2e962aa8b3407f31deff (patch)
treea038399f00459b582af360bced9449ea2dc77e2d
parent[pwgui] Also use the grayed out fake background (diff)
downloadprintergui-f4f28deb0c9b885c46fc2e962aa8b3407f31deff.tar.gz
printergui-f4f28deb0c9b885c46fc2e962aa8b3407f31deff.tar.xz
printergui-f4f28deb0c9b885c46fc2e962aa8b3407f31deff.zip
[printergui] Don't allow selecting paper size until we figured things out
-rw-r--r--src/maingui/printergui.cpp13
1 files 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();