diff options
author | Simon Rettberg | 2016-03-24 17:44:05 +0100 |
---|---|---|
committer | Simon Rettberg | 2016-03-24 17:44:05 +0100 |
commit | cf997e90fdf6d0e89273651072dd0eeccfef98cb (patch) | |
tree | 96f38097523cbb5ba64d9cb8486aa0293efcb3d8 | |
parent | [printergui] Sanitize job names (ASCII only to be extra safe) (diff) | |
download | printergui-cf997e90fdf6d0e89273651072dd0eeccfef98cb.tar.gz printergui-cf997e90fdf6d0e89273651072dd0eeccfef98cb.tar.xz printergui-cf997e90fdf6d0e89273651072dd0eeccfef98cb.zip |
[printergui] Interpret --error message as utf8
-rw-r--r-- | src/maingui/main.cpp | 2 | ||||
-rw-r--r-- | src/maingui/printergui.cpp | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/maingui/main.cpp b/src/maingui/main.cpp index 58ace07..1e7c2b2 100644 --- a/src/maingui/main.cpp +++ b/src/maingui/main.cpp @@ -18,7 +18,7 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); if (strcmp(argv[1], "--error") == 0) { - QMessageBox::critical(NULL, "Verarbeitungsfehler", argv[2]); + QMessageBox::critical(NULL, "Verarbeitungsfehler", QString::fromUtf8(argv[2])); return 0; } else { // Check if file exists diff --git a/src/maingui/printergui.cpp b/src/maingui/printergui.cpp index e235007..a7f993b 100644 --- a/src/maingui/printergui.cpp +++ b/src/maingui/printergui.cpp @@ -140,7 +140,8 @@ static void enableOptionSelection(ppd_file_t *ppd, QStringList &nameList, QCombo for (ppd_option_t *o = ppdFirstOption(ppd); o != NULL; o = ppdNextOption(ppd)) { QString option(o->keyword); for (QStringList::iterator it = nameList.begin(); it != nameList.end(); ++it) { - if(!option.contains(*it)) + bool exact = (option == *it); + if((!exact && !matchedProperty.isEmpty()) || !option.contains(*it)) continue; // Matches, update combo matchedProperty = option; @@ -160,7 +161,9 @@ static void enableOptionSelection(ppd_file_t *ppd, QStringList &nameList, QCombo } combo->setUpdatesEnabled(true); combo->adjustSize(); - break; + if (exact) { + break; + } } } combo->setProperty("key", matchedProperty); @@ -296,6 +299,8 @@ void PrinterGui::on_buttonPrint_clicked() &(dest->options)); } + dest->num_options = cupsRemoveOption("InputSlot", dest->num_options, &(dest->options)); + cupsSetUser(this->user); char jobtitle[250]; const char *docName; |