Skip to content

Commit

Permalink
Really check config setting for the erml2pdf script.
Browse files Browse the repository at this point in the history
Was ignored before.
  • Loading branch information
dragotin committed Dec 7, 2019
1 parent fd6f770 commit 79ac8a3
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/reportgenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,15 +464,20 @@ QString ReportGenerator::rmlString( const QString& str, const QString& paraStyle

QStringList ReportGenerator::findTrml2Pdf( )
{
const QString rmlbinDefault = QStringLiteral( "trml2pdf" ); // FIXME: how to get the default value?
QString rmlbin = KraftSettings::self()->trml2PdfBinary();
// Get the item to check if it is set to default
KConfigSkeletonItem *item = KraftSettings::self()->findItem("Trml2PdfBinary");

// qDebug () << "### Start searching rml2pdf bin: " << rmlbin;

QStringList retList;
mHavePdfMerge = false;


if ( rmlbinDefault == rmlbin ) {
if ( item && !item->isDefault() ) {
const QString rmlbin = KraftSettings::self()->trml2PdfBinary();
retList = rmlbin.split(' ', QString::SkipEmptyParts);
} else {
// The value in the config is not, as it is still the same as the default
// read from either KRAFT_HOME or search in the system.
QString p = QString::fromUtf8(qgetenv("KRAFT_HOME"));
if( !p.isEmpty() ) {
p += QLatin1String("/tools/erml2pdf.py");
Expand Down Expand Up @@ -643,15 +648,18 @@ void ReportGenerator::trml2pdfFinished( int exitCode, QProcess::ExitStatus stat)
if( mFile.isOpen() ) {
mFile.close();
}
Q_UNUSED(stat);
Q_UNUSED(stat)

// qDebug () << "PDF Creation Process finished with status " << exitStatus;
// qDebug () << "Wrote bytes to the output file: " << mOutputSize;
if ( exitCode == 0 ) {
emit pdfAvailable( mFile.fileName() );
if( mProcess) {
const QString rmlFile = mProcess->arguments().last(); // the file name of the temp rmlfile
QFile::remove(rmlFile); // remove the rmlFile
QFileInfo fi(mFile.fileName());
if( fi.exists() ) {
emit pdfAvailable( mFile.fileName() );
if( mProcess) {
const QString rmlFile = mProcess->arguments().last(); // the file name of the temp rmlfile
QFile::remove(rmlFile); // remove the rmlFile
}
}
} else {
if( mErrors.contains(QLatin1String("No module named Reportlab"))) {
Expand Down

0 comments on commit 79ac8a3

Please sign in to comment.