diff --git a/include/lrreportengine.h b/include/lrreportengine.h index aa8bd6a..178dcc2 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -80,7 +80,7 @@ public: explicit ReportEngine(QObject *parent = 0); ~ReportEngine(); bool printReport(QPrinter *printer=0); - bool printReport(QMap printers); + bool printReport(QMap printers, bool printToAllPrinters = false); bool printPages(ReportPages pages, QPrinter *printer); void printToFile(const QString& fileName); PageDesignIntf *createPreviewScene(QObject *parent = 0); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index c7a1233..7c3e104 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -307,7 +307,7 @@ void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer) } } -void ReportEnginePrivate::printReport(ReportPages pages, QMap printers) +void ReportEnginePrivate::printReport(ReportPages pages, QMap printers, bool printToAllPrinters) { if (printers.values().isEmpty()) return; int currenPage = 1; @@ -317,13 +317,20 @@ void ReportEnginePrivate::printReport(ReportPages pages, QMapprinterName())) - printProcessors[page->printerName()]->printPage(page); - else defaultProcessor->printPage(page); + if (!printToAllPrinters){ + if (printProcessors.contains(page->printerName())) + printProcessors[page->printerName()]->printPage(page); + else defaultProcessor->printPage(page); + } else { + printProcessors.values().at(currentPrinter)->printPage(page); + if (currentPrinter < printers.values().count()-1) + currentPrinter++; + else currentPrinter = 0; + } currenPage++; } @@ -384,7 +391,7 @@ bool ReportEnginePrivate::printReport(QPrinter* printer) } else return false; } -bool ReportEnginePrivate::printReport(QMap printers) +bool ReportEnginePrivate::printReport(QMap printers, bool printToAllPrinters) { try{ bool designTime = dataManager()->designTime(); @@ -392,7 +399,7 @@ bool ReportEnginePrivate::printReport(QMap printers) ReportPages pages = renderToPages(); dataManager()->setDesignTime(designTime); if (pages.count()>0){ - printReport(pages,printers); + printReport(pages, printers, printToAllPrinters); } } catch(ReportError &exception){ saveError(exception.what()); @@ -1263,10 +1270,10 @@ bool ReportEngine::printReport(QPrinter *printer) return d->printReport(printer); } -bool ReportEngine::printReport(QMap printers) +bool ReportEngine::printReport(QMap printers, bool printToAllPrinters) { Q_D(ReportEngine); - return d->printReport(printers); + return d->printReport(printers, printToAllPrinters); } bool ReportEngine::printPages(ReportPages pages, QPrinter *printer){ diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index aa8bd6a..178dcc2 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -80,7 +80,7 @@ public: explicit ReportEngine(QObject *parent = 0); ~ReportEngine(); bool printReport(QPrinter *printer=0); - bool printReport(QMap printers); + bool printReport(QMap printers, bool printToAllPrinters = false); bool printPages(ReportPages pages, QPrinter *printer); void printToFile(const QString& fileName); PageDesignIntf *createPreviewScene(QObject *parent = 0); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 93acb9b..27aa8ff 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -124,7 +124,7 @@ class ReportEnginePrivate : public QObject, public: static void printReport(ItemsReaderIntf::Ptr reader, QPrinter &printer); static void printReport(ReportPages pages, QPrinter &printer); - static void printReport(ReportPages pages, QMapprinters); + static void printReport(ReportPages pages, QMapprinters, bool printToAllPrinters = false); Q_INVOKABLE QStringList aviableReportTranslations(); Q_INVOKABLE void setReportTranslation(const QString& languageName); public: @@ -148,7 +148,7 @@ public: void clearReport(); bool printReport(QPrinter *printer=0); - bool printReport(QMapprinters); + bool printReport(QMapprinters, bool printToAllPrinters); bool printPages(ReportPages pages, QPrinter *printer); void printToFile(const QString& fileName); bool printToPDF(const QString& fileName);