mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-24 16:44:39 +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("}");
|
var.remove("}");
|
||||||
if (variableNames().contains(var)){
|
if (variableNames().contains(var)){
|
||||||
value.replace(pos,rx.cap(0).length(),variable(var).toString());
|
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;
|
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> DataSourceManager::childDatasources(const QString &parentDatasourceName)
|
||||||
{
|
{
|
||||||
QList<QString> result;
|
QList<QString> result;
|
||||||
@ -923,17 +940,7 @@ void DataSourceManager::collectionLoadFinished(const QString &collectionName)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (collectionName.compare("connections",Qt::CaseInsensitive)==0){
|
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){
|
if (collectionName.compare("queries",Qt::CaseInsensitive)==0){
|
||||||
|
@ -136,6 +136,7 @@ public:
|
|||||||
bool isConnection(const QString& connectionName);
|
bool isConnection(const QString& connectionName);
|
||||||
bool isConnectionConnected(const QString& connectionName);
|
bool isConnectionConnected(const QString& connectionName);
|
||||||
bool connectConnection(const QString &connectionName);
|
bool connectConnection(const QString &connectionName);
|
||||||
|
void connectAutoConnections();
|
||||||
void disconnectConnection(const QString &connectionName);
|
void disconnectConnection(const QString &connectionName);
|
||||||
QueryDesc* queryByName(const QString& dataSourceName);
|
QueryDesc* queryByName(const QString& dataSourceName);
|
||||||
SubQueryDesc* subQueryByName(const QString& dataSourceName);
|
SubQueryDesc* subQueryByName(const QString& dataSourceName);
|
||||||
@ -195,6 +196,7 @@ protected:
|
|||||||
void putSubQueryDesc(SubQueryDesc *subQueryDesc);
|
void putSubQueryDesc(SubQueryDesc *subQueryDesc);
|
||||||
void putProxyDesc(ProxyDesc *proxyDesc);
|
void putProxyDesc(ProxyDesc *proxyDesc);
|
||||||
bool connectConnection(ConnectionDesc* connectionDesc);
|
bool connectConnection(ConnectionDesc* connectionDesc);
|
||||||
|
|
||||||
QList<QString> childDatasources(const QString& datasourceName);
|
QList<QString> childDatasources(const QString& datasourceName);
|
||||||
void invalidateChildren(const QString& parentDatasourceName);
|
void invalidateChildren(const QString& parentDatasourceName);
|
||||||
//ICollectionContainer
|
//ICollectionContainer
|
||||||
|
@ -411,6 +411,7 @@ bool ReportEnginePrivate::loadFromFile(const QString &fileName)
|
|||||||
m_fileName=fileName;
|
m_fileName=fileName;
|
||||||
QFileInfo fi(fileName);
|
QFileInfo fi(fileName);
|
||||||
m_reportName = fi.fileName();
|
m_reportName = fi.fileName();
|
||||||
|
dataManager()->connectAutoConnections();
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user