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>
This commit is contained in:
parent
229d92dc1e
commit
fcedf4073a
@ -408,6 +408,7 @@ void QPageSetupWidget::selectPrinter()
|
||||
if (QCUPSSupport::isAvailable()) {
|
||||
m_cups = true;
|
||||
QCUPSSupport cups;
|
||||
cups.setCurrentPrinter(m_printer->printerName());
|
||||
const ppd_option_t* pageSizes = cups.pageSizes();
|
||||
const int numChoices = pageSizes ? pageSizes->num_choices : 0;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -149,6 +149,7 @@ public:
|
||||
const cups_dest_t* availablePrinters() const;
|
||||
int currentPrinterIndex() const;
|
||||
const ppd_file_t* setCurrentPrinter(int index);
|
||||
const ppd_file_t* setCurrentPrinter(const QString &printerName);
|
||||
|
||||
const ppd_file_t* currentPPD() const;
|
||||
const ppd_option_t* ppdOption(const char *key) const;
|
||||
|
Loading…
Reference in New Issue
Block a user