summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/maingui/printergui.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/maingui/printergui.cpp b/src/maingui/printergui.cpp
index 7972a0d..8bc9133 100644
--- a/src/maingui/printergui.cpp
+++ b/src/maingui/printergui.cpp
@@ -8,7 +8,8 @@
#include <QFileInfo>
#include <pwd.h>
-static QStringList knownColorOptions = QStringList() << "ColorModel" << "XRXColor" << "HPColorAsGray";
+static QStringList knownColorOptions = QStringList() << "ColorModel" << "XRXColor";
+static QStringList knownGrayscaleOptions = QStringList() << "HPColorAsGray";
static QStringList knownDuplexOptions = QStringList() << "Duplex";
static QStringList knownPageSizeOptions = QStringList() << "PageSize";
@@ -225,7 +226,7 @@ void PrinterGui::on_chkSecurePrint_stateChanged(int state)
}
}
-static void enableOptionSelection(ppd_file_t *ppd, QStringList &nameList, QComboBox *combo, QLabel *label, bool forceDisabled)
+static bool enableOptionSelection(ppd_file_t *ppd, QStringList &nameList, QComboBox *combo, QLabel *label, bool forceDisabled)
{
// Check for each option if it matches an
QString matchedProperty;
@@ -254,8 +255,10 @@ static void enableOptionSelection(ppd_file_t *ppd, QStringList &nameList, QCombo
}
}
combo->setProperty("key", matchedProperty);
- combo->setEnabled(!matchedProperty.isEmpty() && !forceDisabled);
- label->setEnabled(!matchedProperty.isEmpty() && !forceDisabled);
+ const bool selectable = !matchedProperty.isEmpty() && !forceDisabled;
+ combo->setEnabled(selectable);
+ label->setEnabled(selectable);
+ return selectable;
}
// ____________________________________________________________________________
@@ -295,7 +298,11 @@ 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, false);
+ if (enableOptionSelection(ppd, knownGrayscaleOptions, ui->comboBoxColor, ui->label_color, false)) {
+ ui->label_color->setText(trUtf8("Graustufen"));
+ } else if (enableOptionSelection(ppd, knownColorOptions, ui->comboBoxColor, ui->label_color, false)) {
+ ui->label_color->setText(trUtf8("Farbe"));
+ }
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);