[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/office/kraft/src
From: Klaas Freitag <freitag () suse ! de>
Date: 2006-12-31 20:25:23
Message-ID: 1167596723.411541.7580.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 618267 by freitag:
Load invoice.trml in case no specific template is found
M +20 -14 reportgenerator.cpp
--- trunk/playground/office/kraft/src/reportgenerator.cpp #618266:618267
@@ -89,27 +89,33 @@
QString templFileName = QString( type ).lower()+ ".trml";
QString findFile = "kraft/reports/" + templFileName;
- QString tmplFile = stdDirs.findResource( "data", templFileName );
+ QString tmplFile = stdDirs.findResource( "data", findFile );
QString re;
if ( tmplFile.isEmpty() ) {
- KMessageBox::error( 0, i18n("A document template named %1 could not be loaded."
- "Please check the installation." ).arg( templFileName ) ,
- i18n( "Template not found" ) );
- return QString();
- } else {
-
- kdDebug() << "Loading create file from " << findFile << endl;
- QFile f( tmplFile );
- if ( !f.open( IO_ReadOnly ) ) {
- kdError() << "Could not open " << tmplFile << endl;
+ findFile = "kraft/reports/invoice.trml";
+ tmplFile = stdDirs.findResource( "data", findFile );
+ if ( tmplFile.isEmpty() ) {
+ KMessageBox::error( 0, i18n("A document template named %1 could not be loaded."
+ "Please check the installation." ).arg( templFileName ) ,
+ i18n( "Template not found" ) );
return QString();
+ } else {
+ kdDebug() << templFileName << " not found, reverting to invoice.trml" << endl;
}
+ }
- QTextStream ts( &f );
- re = ts.read();
- f.close();
+ kdDebug() << "Loading create file from " << findFile << endl;
+ QFile f( tmplFile );
+ if ( !f.open( IO_ReadOnly ) ) {
+ kdError() << "Could not open " << tmplFile << endl;
+ return QString();
}
+
+ QTextStream ts( &f );
+ re = ts.read();
+ f.close();
+
return re;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic