File indexing completed on 2024-06-23 05:48:53
0001 /* 0002 This file is part of the Okteta Kasten module, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2008 Friedrich W. H. Kossebau <kossebau@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #include "printjob.hpp" 0010 0011 // controller 0012 #include "framestopaperprinter.hpp" 0013 // #include "printthread.hpp" 0014 // Qt 0015 #include <QCoreApplication> 0016 // #include <QFontDatabase> 0017 0018 namespace Kasten { 0019 0020 #if 0 0021 PrintJob::PrintJob(FramesToPaperPrinter* framesPrinter, int firstPage, int lastPage, QPrinter* printer) 0022 : mPrintThread(new PrintThread(this, framesPrinter, firstPage, lastPage, printer)) 0023 { 0024 connect(mPrintThread, SIGNAL(finished()), SLOT(onFinished())); 0025 } 0026 0027 void PrintJob::start() 0028 { 0029 if (QFontDatabase::supportsThreadedFontRendering()) { 0030 mPrintThread->start(); 0031 } 0032 } 0033 #endif 0034 0035 bool PrintJob::exec() 0036 { 0037 connect(mFramesPrinter, &FramesToPaperPrinter::printedPage, this, &PrintJob::onPagePrinted); 0038 0039 const bool result = mFramesPrinter->print(mPrinter, mFirstPage, mLastPage); 0040 0041 deleteLater(); 0042 0043 return result; 0044 } 0045 0046 void PrintJob::onPagePrinted() 0047 { 0048 QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); 0049 } 0050 0051 #if 0 0052 void PrintJob::onFinished() 0053 { 0054 emitResult(); 0055 } 0056 #endif 0057 0058 } 0059 0060 #include "moc_printjob.cpp"