From a3988182bf70c51c5275b74ad5800fa2f77f099d Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Thu, 25 Feb 2016 02:04:06 +0300 Subject: [PATCH] Fixed loading issues for reports containing variables in the connection settings --- src/lrdatasourcemanager.cpp | 29 ++++++++++++++++++----------- src/lrdatasourcemanager.h | 2 ++ src/lrreportengine.cpp | 1 + 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/lrdatasourcemanager.cpp b/src/lrdatasourcemanager.cpp index 3335497..262d748 100644 --- a/src/lrdatasourcemanager.cpp +++ b/src/lrdatasourcemanager.cpp @@ -352,6 +352,8 @@ QString DataSourceManager::replaceVariables(QString value){ var.remove("}"); if (variableNames().contains(var)){ value.replace(pos,rx.cap(0).length(),variable(var).toString()); + } else { + value.replace(pos,rx.cap(0).length(),QString(tr("Variable \"%1\" not found!").arg(var))); } } } @@ -696,6 +698,21 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) return true; } +void DataSourceManager::connectAutoConnections() +{ + foreach(ConnectionDesc* conn,m_connections){ + if (conn->autoconnect()) { + try { + connectConnection(conn); + } catch(ReportError e){ + setLastError(e.what()); + putError(e.what()); + qDebug()< DataSourceManager::childDatasources(const QString &parentDatasourceName) { QList result; @@ -923,17 +940,7 @@ void DataSourceManager::collectionLoadFinished(const QString &collectionName) { if (collectionName.compare("connections",Qt::CaseInsensitive)==0){ - foreach(ConnectionDesc* conn,m_connections){ - if (conn->autoconnect()) { - try { - connectConnection(conn); - } catch(ReportError e){ - setLastError(e.what()); - putError(e.what()); - qDebug()< childDatasources(const QString& datasourceName); void invalidateChildren(const QString& parentDatasourceName); //ICollectionContainer diff --git a/src/lrreportengine.cpp b/src/lrreportengine.cpp index acfa4aa..64a9392 100644 --- a/src/lrreportengine.cpp +++ b/src/lrreportengine.cpp @@ -411,6 +411,7 @@ bool ReportEnginePrivate::loadFromFile(const QString &fileName) m_fileName=fileName; QFileInfo fi(fileName); m_reportName = fi.fileName(); + dataManager()->connectAutoConnections(); return true; }; }