summaryrefslogtreecommitdiffstats
path: root/src/printsupport/kernel/qcups.cpp
diff options
context:
space:
mode:
authorMartin Klapetek <mklapetek@kde.org>2013-10-18 17:31:46 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-18 18:01:54 +0200
commitfcedf4073aaa8bebf7cd5e12fab737166f1b399f (patch)
tree9e9c62a3e71f8ae9521a652500afa3632feef658 /src/printsupport/kernel/qcups.cpp
parent229d92dc1e20cd49ef8235c063df8fa948b3fcda (diff)
Set currently selected printer to QCUPSSupport in PageSetupWidget
Also adds new method to allows setting a printer in QCUPSSupport by printer name. Change-Id: Iff7a88d95eab9de2c96872c45b12e708207bda16 Reviewed-by: John Layt <jlayt@kde.org>
Diffstat (limited to 'src/printsupport/kernel/qcups.cpp')
-rw-r--r--src/printsupport/kernel/qcups.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/printsupport/kernel/qcups.cpp b/src/printsupport/kernel/qcups.cpp
index f14d4b8dd3..e237d44dcd 100644
--- a/src/printsupport/kernel/qcups.cpp
+++ b/src/printsupport/kernel/qcups.cpp
@@ -215,6 +215,17 @@ const ppd_file_t* QCUPSSupport::setCurrentPrinter(int index)
return currPPD;
}
+const ppd_file_t* QCUPSSupport::setCurrentPrinter(const QString &printerName)
+{
+ Q_FOREACH (const QCUPSSupport::Printer &printer, QCUPSSupport::availableUnixPrinters()) {
+ if (printer.name == printerName) {
+ return setCurrentPrinter(printer.cupsPrinterIndex);
+ }
+ }
+
+ return 0;
+}
+
int QCUPSSupport::currentPrinterIndex() const
{
return currPrinterIndex;