[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kraft] src: Fix search for report files.
From: Klaas Freitag <freitag () kde ! org>
Date: 2014-03-31 20:02:06
Message-ID: E1WUiPG-0006y2-7N () scm ! kde ! org
[Download RAW message or body]
Git commit a79d9a751b7e95c89d7431a0c7f7926e91a17b98 by Klaas Freitag.
Committed on 31/03/2014 at 20:01.
Pushed by freitag into branch 'master'.
Fix search for report files.
M +17 -14 src/doctype.cpp
http://commits.kde.org/kraft/a79d9a751b7e95c89d7431a0c7f7926e91a17b98
diff --git a/src/doctype.cpp b/src/doctype.cpp
index 2098cb1..8c0dc9b 100644
--- a/src/doctype.cpp
+++ b/src/doctype.cpp
@@ -239,16 +239,16 @@ QString DocType::templateFile( const QString& lang )
// Try to find it from the installation
QStringList searchList;
if( !lang.isEmpty() ) {
- searchList << QString("/reports/%1/%2.trml").arg(lang).arg(name().toLower());
+ searchList << QString("kraft/reports/%1/%2.trml").arg(lang).arg(name().toLower());
}
- searchList << QString("/reports/%1.trml").arg(name().toLower());
+ searchList << QString("kraft/reports/%1.trml").arg(name().toLower());
if( !lang.isEmpty() ) {
- searchList << QString("/reports/%1/invoice.trml").arg(lang);
+ searchList << QString("kraft/reports/%1/invoice.trml").arg(lang);
}
- searchList << QLatin1String("/reports/invoice.trml");
+ searchList << QLatin1String("kraft/reports/invoice.trml");
foreach( QString searchPath, searchList ) {
- const QString tFile = stdDirs.findResource( "data", searchPath );
+ const QString tFile = KStandardDirs::locate( "data", searchPath );
if( !tFile.isEmpty() && tFile != searchPath && QFile::exists( tFile )) {
tmplFile = tFile;
@@ -257,15 +257,17 @@ QString DocType::templateFile( const QString& lang )
}
}
- const QString prjPath = QString::fromUtf8(qgetenv( "KRAFT_HOME" ));
-
- if( tmplFile.isEmpty() && !prjPath.isEmpty() ) {
- foreach( QString searchPath, searchList ) {
- const QString tFile = prjPath + searchPath;
- if( !tFile.isEmpty() && QFile::exists(tFile) ) {
- kDebug() << "Found template file " << tFile;
- tmplFile = tFile;
- break;
+ if( tmplFile.isEmpty() ) {
+ const QString prjPath = QString::fromUtf8(qgetenv( "KRAFT_HOME" ));
+
+ if( tmplFile.isEmpty() && !prjPath.isEmpty() ) {
+ foreach( QString searchPath, searchList ) {
+ const QString tFile = prjPath + searchPath;
+ if( !tFile.isEmpty() && QFile::exists(tFile) ) {
+ kDebug() << "Found template file " << tFile;
+ tmplFile = tFile;
+ break;
+ }
}
}
}
@@ -273,6 +275,7 @@ QString DocType::templateFile( const QString& lang )
if( tmplFile.isEmpty() ) {
kDebug() << "unable to find a template file for " << name();
}
+
return tmplFile;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic