Okular

fileprinter.cpp
1 /*
2  SPDX-FileCopyrightText: 2007, 2010 John Layt <[email protected]>
3 
4  FilePrinterPreview based on KPrintPreview (originally LGPL)
5  SPDX-FileCopyrightText: 2007 Alex Merry <[email protected]>
6 
7  SPDX-License-Identifier: GPL-2.0-or-later
8 */
9 
10 #include "fileprinter.h"
11 
12 #include <QFile>
13 #include <QFileInfo>
14 #include <QLabel>
15 #include <QPrintEngine>
16 #include <QShowEvent>
17 #include <QSize>
18 #include <QStringList>
19 #include <QTcpSocket>
20 
21 #include <KProcess>
22 #include <KShell>
23 #include <QDebug>
24 #include <QStandardPaths>
25 
26 #include "debug_p.h"
27 
28 using namespace Okular;
29 
31 FilePrinter::printFile(QPrinter &printer, const QString &file, QPrinter::Orientation documentOrientation, FileDeletePolicy fileDeletePolicy, PageSelectPolicy pageSelectPolicy, const QString &pageRange, ScaleMode scaleMode)
32 {
33  FilePrinter fp;
34  return fp.doPrintFiles(printer, QStringList(file), fileDeletePolicy, pageSelectPolicy, pageRange, documentOrientation, scaleMode);
35 }
36 
37 static Document::PrintError doKProcessExecute(const QString &exe, const QStringList &argList)
38 {
39  const int ret = KProcess::execute(exe, argList);
40  if (ret == -1) {
41  return Document::PrintingProcessCrashPrintError;
42  }
43  if (ret == -2) {
44  return Document::PrintingProcessStartPrintError;
45  }
46  if (ret < 0) {
47  return Document::UnknownPrintError;
48  }
49 
51 }
52 
54 FilePrinter::doPrintFiles(QPrinter &printer, const QStringList &fileList, FileDeletePolicy fileDeletePolicy, PageSelectPolicy pageSelectPolicy, const QString &pageRange, QPrinter::Orientation documentOrientation, ScaleMode scaleMode)
55 {
56  if (fileList.size() < 1) {
57  return Document::NoFileToPrintError;
58  }
59 
60  for (QStringList::ConstIterator it = fileList.constBegin(); it != fileList.constEnd(); ++it) {
61  if (!QFile::exists(*it)) {
62  return Document::UnableToFindFilePrintError;
63  }
64  }
65 
66  if (printer.printerState() == QPrinter::Aborted || printer.printerState() == QPrinter::Error) {
67  return Document::InvalidPrinterStatePrintError;
68  }
69 
70  QString exe;
71  QStringList argList;
73 
74  // Print to File if a filename set, assumes there must be only 1 file
75  if (!printer.outputFileName().isEmpty()) {
76  if (QFile::exists(printer.outputFileName())) {
77  QFile::remove(printer.outputFileName());
78  }
79 
80  QFileInfo inputFileInfo = QFileInfo(fileList[0]);
81  QFileInfo outputFileInfo = QFileInfo(printer.outputFileName());
82 
83  bool doDeleteFile = (fileDeletePolicy == FilePrinter::SystemDeletesFiles);
84  if (inputFileInfo.suffix() == outputFileInfo.suffix()) {
85  if (doDeleteFile) {
86  bool res = QFile::rename(fileList[0], printer.outputFileName());
87  if (res) {
88  doDeleteFile = false;
90  } else {
91  ret = Document::PrintToFilePrintError;
92  }
93  } else {
94  bool res = QFile::copy(fileList[0], printer.outputFileName());
95  if (res) {
97  } else {
98  ret = Document::PrintToFilePrintError;
99  }
100  }
101  } else if (inputFileInfo.suffix() == QLatin1String("ps") && printer.outputFormat() == QPrinter::PdfFormat && ps2pdfAvailable()) {
102  exe = QStringLiteral("ps2pdf");
103  argList << fileList[0] << printer.outputFileName();
104  qCDebug(OkularCoreDebug) << "Executing" << exe << "with arguments" << argList;
105  ret = doKProcessExecute(exe, argList);
106  } else if (inputFileInfo.suffix() == QLatin1String("pdf") && printer.outputFormat() == QPrinter::NativeFormat && pdf2psAvailable()) {
107  exe = QStringLiteral("pdf2ps");
108  argList << fileList[0] << printer.outputFileName();
109  qCDebug(OkularCoreDebug) << "Executing" << exe << "with arguments" << argList;
110  ret = doKProcessExecute(exe, argList);
111  } else {
112  ret = Document::PrintToFilePrintError;
113  }
114 
115  if (doDeleteFile) {
116  QFile::remove(fileList[0]);
117  }
118 
119  } else { // Print to a printer via lpr command
120 
121  // Decide what executable to use to print with, need the CUPS version of lpr if available
122  // Some distros name the CUPS version of lpr as lpr-cups or lpr.cups so try those first
123  // before default to lpr, or failing that to lp
124 
125  if (!QStandardPaths::findExecutable(QStringLiteral("lpr-cups")).isEmpty()) {
126  exe = QStringLiteral("lpr-cups");
127  } else if (!QStandardPaths::findExecutable(QStringLiteral("lpr.cups")).isEmpty()) {
128  exe = QStringLiteral("lpr.cups");
129  } else if (!QStandardPaths::findExecutable(QStringLiteral("lpr")).isEmpty()) {
130  exe = QStringLiteral("lpr");
131  } else if (!QStandardPaths::findExecutable(QStringLiteral("lp")).isEmpty()) {
132  exe = QStringLiteral("lp");
133  } else {
134  return Document::NoBinaryToPrintError;
135  }
136 
137  bool useCupsOptions = cupsAvailable();
138  argList = printArguments(printer, fileDeletePolicy, pageSelectPolicy, useCupsOptions, pageRange, exe, documentOrientation, scaleMode) << fileList;
139  qCDebug(OkularCoreDebug) << "Executing" << exe << "with arguments" << argList;
140 
141  ret = doKProcessExecute(exe, argList);
142  }
143 
144  return ret;
145 }
146 
147 QList<int> FilePrinter::pageList(QPrinter &printer, int lastPage, const QList<int> &selectedPageList)
148 {
149  return pageList(printer, lastPage, 0, selectedPageList);
150 }
151 
152 QList<int> FilePrinter::pageList(QPrinter &printer, int lastPage, int currentPage, const QList<int> &selectedPageList)
153 {
154  if (printer.printRange() == QPrinter::Selection) {
155  return selectedPageList;
156  }
157 
158  int startPage, endPage;
160 
161  if (printer.printRange() == QPrinter::PageRange) {
162  startPage = printer.fromPage();
163  endPage = printer.toPage();
164  } else if (printer.printRange() == QPrinter::CurrentPage) {
165  startPage = currentPage;
166  endPage = currentPage;
167  } else { // AllPages
168  startPage = 1;
169  endPage = lastPage;
170  }
171 
172  for (int i = startPage; i <= endPage; i++) {
173  list << i;
174  }
175 
176  return list;
177 }
178 
179 QString FilePrinter::pageRange(QPrinter &printer, int lastPage, const QList<int> &selectedPageList)
180 {
181  if (printer.printRange() == QPrinter::Selection) {
182  return pageListToPageRange(selectedPageList);
183  }
184 
185  if (printer.printRange() == QPrinter::PageRange) {
186  return QStringLiteral("%1-%2").arg(printer.fromPage()).arg(printer.toPage());
187  }
188 
189  return QStringLiteral("1-%2").arg(lastPage);
190 }
191 
192 QString FilePrinter::pageListToPageRange(const QList<int> &pageList)
193 {
194  QString pageRange;
195  int count = pageList.count();
196  int i = 0;
197  int seqStart = i;
198  int seqEnd;
199 
200  while (i != count) {
201  if (i + 1 == count || pageList[i] + 1 != pageList[i + 1]) {
202  seqEnd = i;
203 
204  if (!pageRange.isEmpty()) {
205  pageRange.append(QLatin1Char(','));
206  }
207 
208  if (seqStart == seqEnd) {
209  pageRange.append(pageList[i]);
210  } else {
211  pageRange.append(QStringLiteral("%1-%2").arg(seqStart).arg(seqEnd));
212  }
213 
214  seqStart = i + 1;
215  }
216 
217  i++;
218  }
219 
220  return pageRange;
221 }
222 
223 bool FilePrinter::ps2pdfAvailable()
224 {
225  return (!QStandardPaths::findExecutable(QStringLiteral("ps2pdf")).isEmpty());
226 }
227 
228 bool FilePrinter::pdf2psAvailable()
229 {
230  return (!QStandardPaths::findExecutable(QStringLiteral("pdf2ps")).isEmpty());
231 }
232 
233 bool FilePrinter::cupsAvailable()
234 {
235 #if defined(Q_OS_UNIX) && !defined(Q_OS_OSX)
236  // Ideally we would have access to the private Qt method
237  // QCUPSSupport::cupsAvailable() to do this as it is very complex routine.
238  // However, if CUPS is available then QPrinter::numCopies() will always return 1
239  // whereas if CUPS is not available it will return the real number of copies.
240  // This behaviour is guaranteed never to change, so we can use it as a reliable substitute.
241  QPrinter testPrinter;
242  testPrinter.setNumCopies(2);
243  return (testPrinter.numCopies() == 1);
244 #else
245  return false;
246 #endif
247 }
248 
249 bool FilePrinter::detectCupsService()
250 {
251  QTcpSocket qsock;
252  qsock.connectToHost(QStringLiteral("localhost"), 631);
253  bool rtn = qsock.waitForConnected() && qsock.isValid();
254  qsock.abort();
255  return rtn;
256 }
257 
258 bool FilePrinter::detectCupsConfig()
259 {
260  if (QFile::exists(QStringLiteral("/etc/cups/cupsd.conf"))) {
261  return true;
262  }
263  if (QFile::exists(QStringLiteral("/usr/etc/cups/cupsd.conf"))) {
264  return true;
265  }
266  if (QFile::exists(QStringLiteral("/usr/local/etc/cups/cupsd.conf"))) {
267  return true;
268  }
269  if (QFile::exists(QStringLiteral("/opt/etc/cups/cupsd.conf"))) {
270  return true;
271  }
272  if (QFile::exists(QStringLiteral("/opt/local/etc/cups/cupsd.conf"))) {
273  return true;
274  }
275  return false;
276 }
277 
278 QSize FilePrinter::psPaperSize(QPrinter &printer)
279 {
280  QSize size = printer.pageLayout().pageSize().sizePoints();
281 
282  if (printer.pageSize() == QPrinter::Custom) {
283  return QSize((int)printer.widthMM() * (25.4 / 72), (int)printer.heightMM() * (25.4 / 72));
284  }
285 
286  if (printer.orientation() == QPrinter::Landscape) {
287  size.transpose();
288  }
289 
290  return size;
291 }
292 
293 QStringList FilePrinter::printArguments(QPrinter &printer,
294  FileDeletePolicy fileDeletePolicy,
295  PageSelectPolicy pageSelectPolicy,
296  bool useCupsOptions,
297  const QString &pageRange,
298  const QString &version,
299  QPrinter::Orientation documentOrientation,
300  ScaleMode scaleMode)
301 {
302  QStringList argList;
303 
304  if (!destination(printer, version).isEmpty()) {
305  argList << destination(printer, version);
306  }
307 
308  if (!copies(printer, version).isEmpty()) {
309  argList << copies(printer, version);
310  }
311 
312  if (!jobname(printer, version).isEmpty()) {
313  argList << jobname(printer, version);
314  }
315 
316  if (!pages(printer, pageSelectPolicy, pageRange, useCupsOptions, version).isEmpty()) {
317  argList << pages(printer, pageSelectPolicy, pageRange, useCupsOptions, version);
318  }
319 
320  if (useCupsOptions && !cupsOptions(printer, documentOrientation, scaleMode).isEmpty()) {
321  argList << cupsOptions(printer, documentOrientation, scaleMode);
322  }
323 
324  if (!deleteFile(printer, fileDeletePolicy, version).isEmpty()) {
325  argList << deleteFile(printer, fileDeletePolicy, version);
326  }
327 
328  if (version == QLatin1String("lp")) {
329  argList << QStringLiteral("--");
330  }
331 
332  return argList;
333 }
334 
335 QStringList FilePrinter::destination(QPrinter &printer, const QString &version)
336 {
337  if (version == QLatin1String("lp")) {
338  return QStringList(QStringLiteral("-d")) << printer.printerName();
339  }
340 
341  if (version.startsWith(QLatin1String("lpr"))) {
342  return QStringList(QStringLiteral("-P")) << printer.printerName();
343  }
344 
345  return QStringList();
346 }
347 
348 QStringList FilePrinter::copies(QPrinter &printer, const QString &version)
349 {
350  int cp = printer.actualNumCopies();
351 
352  if (version == QLatin1String("lp")) {
353  return QStringList(QStringLiteral("-n")) << QStringLiteral("%1").arg(cp);
354  }
355 
356  if (version.startsWith(QLatin1String("lpr"))) {
357  return QStringList() << QStringLiteral("-#%1").arg(cp);
358  }
359 
360  return QStringList();
361 }
362 
363 QStringList FilePrinter::jobname(QPrinter &printer, const QString &version)
364 {
365  if (!printer.docName().isEmpty()) {
366  if (version == QLatin1String("lp")) {
367  return QStringList(QStringLiteral("-t")) << printer.docName();
368  }
369 
370  if (version.startsWith(QLatin1String("lpr"))) {
371  const QString shortenedDocName = QString::fromUtf8(printer.docName().toUtf8().left(255));
372  return QStringList(QStringLiteral("-J")) << shortenedDocName;
373  }
374  }
375 
376  return QStringList();
377 }
378 
379 QStringList FilePrinter::deleteFile(QPrinter &, FileDeletePolicy fileDeletePolicy, const QString &version)
380 {
381  if (fileDeletePolicy == FilePrinter::SystemDeletesFiles && version.startsWith(QLatin1String("lpr"))) {
382  return QStringList(QStringLiteral("-r"));
383  }
384 
385  return QStringList();
386 }
387 
388 QStringList FilePrinter::pages(QPrinter &printer, PageSelectPolicy pageSelectPolicy, const QString &pageRange, bool useCupsOptions, const QString &version)
389 {
390  if (pageSelectPolicy == FilePrinter::SystemSelectsPages) {
391  if (printer.printRange() == QPrinter::Selection && !pageRange.isEmpty()) {
392  if (version == QLatin1String("lp")) {
393  return QStringList(QStringLiteral("-P")) << pageRange;
394  }
395 
396  if (version.startsWith(QLatin1String("lpr")) && useCupsOptions) {
397  return QStringList(QStringLiteral("-o")) << QStringLiteral("page-ranges=%1").arg(pageRange);
398  }
399  }
400 
401  if (printer.printRange() == QPrinter::PageRange) {
402  if (version == QLatin1String("lp")) {
403  return QStringList(QStringLiteral("-P")) << QStringLiteral("%1-%2").arg(printer.fromPage()).arg(printer.toPage());
404  }
405 
406  if (version.startsWith(QLatin1String("lpr")) && useCupsOptions) {
407  return QStringList(QStringLiteral("-o")) << QStringLiteral("page-ranges=%1-%2").arg(printer.fromPage()).arg(printer.toPage());
408  }
409  }
410  }
411 
412  return QStringList(); // AllPages
413 }
414 
415 QStringList FilePrinter::cupsOptions(QPrinter &printer, QPrinter::Orientation documentOrientation, ScaleMode scaleMode)
416 {
417  QStringList optionList;
418 
419  if (!optionMedia(printer).isEmpty()) {
420  optionList << optionMedia(printer);
421  }
422 
423  if (!optionOrientation(printer, documentOrientation).isEmpty()) {
424  optionList << optionOrientation(printer, documentOrientation);
425  }
426 
427  if (!optionDoubleSidedPrinting(printer).isEmpty()) {
428  optionList << optionDoubleSidedPrinting(printer);
429  }
430 
431  if (!optionPageOrder(printer).isEmpty()) {
432  optionList << optionPageOrder(printer);
433  }
434 
435  if (!optionCollateCopies(printer).isEmpty()) {
436  optionList << optionCollateCopies(printer);
437  }
438 
439  if (!optionPageMargins(printer, scaleMode).isEmpty()) {
440  optionList << optionPageMargins(printer, scaleMode);
441  }
442 
443  optionList << optionCupsProperties(printer);
444 
445  return optionList;
446 }
447 
448 QStringList FilePrinter::optionMedia(QPrinter &printer)
449 {
450  if (!mediaPageSize(printer).isEmpty() && !mediaPaperSource(printer).isEmpty()) {
451  return QStringList(QStringLiteral("-o")) << QStringLiteral("media=%1,%2").arg(mediaPageSize(printer), mediaPaperSource(printer));
452  }
453 
454  if (!mediaPageSize(printer).isEmpty()) {
455  return QStringList(QStringLiteral("-o")) << QStringLiteral("media=%1").arg(mediaPageSize(printer));
456  }
457 
458  if (!mediaPaperSource(printer).isEmpty()) {
459  return QStringList(QStringLiteral("-o")) << QStringLiteral("media=%1").arg(mediaPaperSource(printer));
460  }
461 
462  return QStringList();
463 }
464 
465 QString FilePrinter::mediaPageSize(QPrinter &printer)
466 {
467  switch (printer.pageSize()) {
468  case QPrinter::A0:
469  return QStringLiteral("A0");
470  case QPrinter::A1:
471  return QStringLiteral("A1");
472  case QPrinter::A2:
473  return QStringLiteral("A2");
474  case QPrinter::A3:
475  return QStringLiteral("A3");
476  case QPrinter::A4:
477  return QStringLiteral("A4");
478  case QPrinter::A5:
479  return QStringLiteral("A5");
480  case QPrinter::A6:
481  return QStringLiteral("A6");
482  case QPrinter::A7:
483  return QStringLiteral("A7");
484  case QPrinter::A8:
485  return QStringLiteral("A8");
486  case QPrinter::A9:
487  return QStringLiteral("A9");
488  case QPrinter::B0:
489  return QStringLiteral("B0");
490  case QPrinter::B1:
491  return QStringLiteral("B1");
492  case QPrinter::B10:
493  return QStringLiteral("B10");
494  case QPrinter::B2:
495  return QStringLiteral("B2");
496  case QPrinter::B3:
497  return QStringLiteral("B3");
498  case QPrinter::B4:
499  return QStringLiteral("B4");
500  case QPrinter::B5:
501  return QStringLiteral("B5");
502  case QPrinter::B6:
503  return QStringLiteral("B6");
504  case QPrinter::B7:
505  return QStringLiteral("B7");
506  case QPrinter::B8:
507  return QStringLiteral("B8");
508  case QPrinter::B9:
509  return QStringLiteral("B9");
510  case QPrinter::C5E:
511  return QStringLiteral("C5"); // Correct Translation?
512  case QPrinter::Comm10E:
513  return QStringLiteral("Comm10"); // Correct Translation?
514  case QPrinter::DLE:
515  return QStringLiteral("DL"); // Correct Translation?
516  case QPrinter::Executive:
517  return QStringLiteral("Executive");
518  case QPrinter::Folio:
519  return QStringLiteral("Folio");
520  case QPrinter::Ledger:
521  return QStringLiteral("Ledger");
522  case QPrinter::Legal:
523  return QStringLiteral("Legal");
524  case QPrinter::Letter:
525  return QStringLiteral("Letter");
526  case QPrinter::Tabloid:
527  return QStringLiteral("Tabloid");
528  case QPrinter::Custom:
529  return QStringLiteral("Custom.%1x%2mm").arg(printer.widthMM()).arg(printer.heightMM());
530  default:
531  return QString();
532  }
533 }
534 
535 // What about Upper and MultiPurpose? And others in PPD???
536 QString FilePrinter::mediaPaperSource(QPrinter &printer)
537 {
538  switch (printer.paperSource()) {
539  case QPrinter::Auto:
540  return QString();
541  case QPrinter::Cassette:
542  return QStringLiteral("Cassette");
543  case QPrinter::Envelope:
544  return QStringLiteral("Envelope");
546  return QStringLiteral("EnvelopeManual");
548  return QStringLiteral("FormSource");
550  return QStringLiteral("LargeCapacity");
552  return QStringLiteral("LargeFormat");
553  case QPrinter::Lower:
554  return QStringLiteral("Lower");
556  return QStringLiteral("MaxPageSource");
557  case QPrinter::Middle:
558  return QStringLiteral("Middle");
559  case QPrinter::Manual:
560  return QStringLiteral("Manual");
561  case QPrinter::OnlyOne:
562  return QStringLiteral("OnlyOne");
563  case QPrinter::Tractor:
564  return QStringLiteral("Tractor");
566  return QStringLiteral("SmallFormat");
567  default:
568  return QString();
569  }
570 }
571 
572 QStringList FilePrinter::optionOrientation(QPrinter &printer, QPrinter::Orientation documentOrientation)
573 {
574  // portrait and landscape options rotate the document according to the document orientation
575  // If we want to print a landscape document as one would expect it, we have to pass the
576  // portrait option so that the document is not rotated additionally
577  if (printer.orientation() == documentOrientation) {
578  // the user wants the document printed as is
579  return QStringList(QStringLiteral("-o")) << QStringLiteral("portrait");
580  } else {
581  // the user expects the document being rotated by 90 degrees
582  return QStringList(QStringLiteral("-o")) << QStringLiteral("landscape");
583  }
584 }
585 
586 QStringList FilePrinter::optionDoubleSidedPrinting(QPrinter &printer)
587 {
588  switch (printer.duplex()) {
590  return QStringList(QStringLiteral("-o")) << QStringLiteral("sides=one-sided");
592  if (printer.orientation() == QPrinter::Landscape) {
593  return QStringList(QStringLiteral("-o")) << QStringLiteral("sides=two-sided-short-edge");
594  } else {
595  return QStringList(QStringLiteral("-o")) << QStringLiteral("sides=two-sided-long-edge");
596  }
598  return QStringList(QStringLiteral("-o")) << QStringLiteral("sides=two-sided-long-edge");
600  return QStringList(QStringLiteral("-o")) << QStringLiteral("sides=two-sided-short-edge");
601  default:
602  return QStringList(); // Use printer default
603  }
604 }
605 
606 QStringList FilePrinter::optionPageOrder(QPrinter &printer)
607 {
608  if (printer.pageOrder() == QPrinter::LastPageFirst) {
609  return QStringList(QStringLiteral("-o")) << QStringLiteral("outputorder=reverse");
610  }
611  return QStringList(QStringLiteral("-o")) << QStringLiteral("outputorder=normal");
612 }
613 
614 QStringList FilePrinter::optionCollateCopies(QPrinter &printer)
615 {
616  if (printer.collateCopies()) {
617  return QStringList(QStringLiteral("-o")) << QStringLiteral("Collate=True");
618  }
619  return QStringList(QStringLiteral("-o")) << QStringLiteral("Collate=False");
620 }
621 
622 QStringList FilePrinter::optionPageMargins(QPrinter &printer, ScaleMode scaleMode)
623 {
625  return QStringList();
626  } else {
627  qreal l(0), t(0), r(0), b(0);
628  if (!printer.fullPage()) {
629  printer.getPageMargins(&l, &t, &r, &b, QPrinter::Point);
630  }
631  QStringList marginOptions;
632  marginOptions << (QStringLiteral("-o")) << QStringLiteral("page-left=%1").arg(l) << QStringLiteral("-o") << QStringLiteral("page-top=%1").arg(t) << QStringLiteral("-o") << QStringLiteral("page-right=%1").arg(r)
633  << QStringLiteral("-o") << QStringLiteral("page-bottom=%1").arg(b);
634  if (scaleMode == ScaleMode::FitToPrintArea) {
635  marginOptions << QStringLiteral("-o") << QStringLiteral("fit-to-page");
636  }
637 
638  return marginOptions;
639  }
640 }
641 
642 QStringList FilePrinter::optionCupsProperties(QPrinter &printer)
643 {
645  QStringList cupsOptions;
646 
647  for (int i = 0; i < dialogOptions.count(); i = i + 2) {
648  if (dialogOptions[i + 1].isEmpty()) {
649  cupsOptions << QStringLiteral("-o") << dialogOptions[i];
650  } else {
651  cupsOptions << QStringLiteral("-o") << dialogOptions[i] + QLatin1Char('=') + dialogOptions[i + 1];
652  }
653  }
654 
655  return cupsOptions;
656 }
657 
658 /* kate: replace-tabs on; indent-width 4; */
virtual void connectToHost(const QString &hostName, quint16 port, QIODevice::OpenMode openMode, QAbstractSocket::NetworkLayerProtocol protocol)
bool isNull() const const
int fromPage() const const
int numCopies() const const
int heightMM() const const
QString fromUtf8(const char *str, int size)
The documentation to the global Okular namespace.
Definition: action.h:16
bool remove()
bool copy(const QString &newName)
int count(const T &value) const const
bool rename(const QString &newName)
QString printerName() const const
QPrinter::PrintRange printRange() const const
QList::const_iterator constBegin() const const
QSize sizePoints() const const
KIOFILEWIDGETS_EXPORT QStringList list(const QString &fileClass)
QString suffix() const const
bool collateCopies() const const
bool exists() const const
QString findExecutable(const QString &executableName, const QStringList &paths)
void setNumCopies(int numCopies)
int size() const const
QPrinter::PageOrder pageOrder() const const
int toPage() const const
int widthMM() const const
QPrintEngine * printEngine() const const
bool isEmpty() const const
QByteArray toUtf8() const const
QPrinter::PaperSource paperSource() const const
bool fullPage() const const
bool isValid() const const
QPrinter::Orientation orientation() const const
QPrinter::OutputFormat outputFormat() const const
QString outputFileName() const const
QAction * deleteFile(const QObject *recvr, const char *slot, QObject *parent)
typedef ConstIterator
QPrinter::DuplexMode duplex() const const
void transpose()
int actualNumCopies() const const
QByteArray left(int len) const const
QList::const_iterator constEnd() const const
KDB_EXPORT KDbVersionInfo version()
@ NoPrintError
Printing succeeded.
Definition: document.h:757
virtual QVariant property(QPrintEngine::PrintEnginePropertyKey key) const const=0
QPageLayout pageLayout() const const
virtual bool waitForConnected(int msecs)
void getPageMargins(qreal *left, qreal *top, qreal *right, qreal *bottom, QPrinter::Unit unit) const const
QPagedPaintDevice::PageSize pageSize() const const
QPageSize pageSize() const const
QStringList toStringList() const const
QAction * lastPage(const QObject *recvr, const char *slot, QObject *parent)
int execute(int msecs=-1)
QPrinter::PrinterState printerState() const const
QString docName() const const
QString & append(QChar ch)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Mar 23 2023 04:04:24 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.