mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
Fixed loading issues for reports containing variables in the connection settings
This commit is contained in:
parent
011b17b537
commit
a3988182bf
@ -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()<<e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QList<QString> DataSourceManager::childDatasources(const QString &parentDatasourceName)
|
||||
{
|
||||
QList<QString> 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()<<e.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (collectionName.compare("queries",Qt::CaseInsensitive)==0){
|
||||
|
@ -136,6 +136,7 @@ public:
|
||||
bool isConnection(const QString& connectionName);
|
||||
bool isConnectionConnected(const QString& connectionName);
|
||||
bool connectConnection(const QString &connectionName);
|
||||
void connectAutoConnections();
|
||||
void disconnectConnection(const QString &connectionName);
|
||||
QueryDesc* queryByName(const QString& dataSourceName);
|
||||
SubQueryDesc* subQueryByName(const QString& dataSourceName);
|
||||
@ -195,6 +196,7 @@ protected:
|
||||
void putSubQueryDesc(SubQueryDesc *subQueryDesc);
|
||||
void putProxyDesc(ProxyDesc *proxyDesc);
|
||||
bool connectConnection(ConnectionDesc* connectionDesc);
|
||||
|
||||
QList<QString> childDatasources(const QString& datasourceName);
|
||||
void invalidateChildren(const QString& parentDatasourceName);
|
||||
//ICollectionContainer
|
||||
|
@ -411,6 +411,7 @@ bool ReportEnginePrivate::loadFromFile(const QString &fileName)
|
||||
m_fileName=fileName;
|
||||
QFileInfo fi(fileName);
|
||||
m_reportName = fi.fileName();
|
||||
dataManager()->connectAutoConnections();
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user