0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-10-09 14:04:43 +03:00

Merge branch 'develop' into feature/Variables_with_params

This commit is contained in:
Arin Alexander
2019-01-31 21:15:13 +03:00
7 changed files with 39 additions and 15 deletions

View File

@@ -224,7 +224,8 @@ void DataSourceModel::updateModel()
}
DataSourceManager::DataSourceManager(QObject *parent) :
QObject(parent), m_lastError(""), m_designTime(false), m_needUpdate(false), m_dbCredentialsProvider(0)
QObject(parent), m_lastError(""), m_designTime(false), m_needUpdate(false),
m_dbCredentialsProvider(0), m_hasChanges(false)
{
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("COUNT"),new ConstructorGroupFunctionCreator<CountGroupFunction>);
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("SUM"),new ConstructorGroupFunctionCreator<SumGroupFunction>);
@@ -238,11 +239,11 @@ DataSourceManager::DataSourceManager(QObject *parent) :
m_datasourcesModel.setDataSourceManager(this);
connect(&m_reportVariables, SIGNAL(variableHasBeenAdded(QString)),
this, SLOT(slotVariableHasBeenAdded(QString)) );
this, SLOT(slotVariableHasBeenAdded(QString)));
connect(&m_reportVariables, SIGNAL(variableHasBeenChanged(QString)),
this, SLOT(slotVariableHasBeenChanged(QString)));
connect(&m_userVariables, SIGNAL(variableHasBeenAdded(QString)),
this, SLOT(slotVariableHasBeenAdded(QString)) );
this, SLOT(slotVariableHasBeenAdded(QString)));
connect(&m_userVariables, SIGNAL(variableHasBeenChanged(QString)),
this, SLOT(slotVariableHasBeenChanged(QString)));
@@ -523,6 +524,7 @@ void DataSourceManager::addQuery(const QString &name, const QString &sqlText, co
QueryDesc *queryDecs = new QueryDesc(name,sqlText,connectionName);
putQueryDesc(queryDecs);
putHolder(name,new QueryHolder(sqlText, connectionName, this));
m_hasChanges = true;
emit datasourcesChanged();
}
@@ -531,6 +533,7 @@ void DataSourceManager::addSubQuery(const QString &name, const QString &sqlText,
SubQueryDesc *subQueryDesc = new SubQueryDesc(name.toLower(),sqlText,connectionName,masterDatasource);
putSubQueryDesc(subQueryDesc);
putHolder(name,new SubQueryHolder(sqlText, connectionName, masterDatasource, this));
m_hasChanges = true;
emit datasourcesChanged();
}
@@ -545,6 +548,7 @@ void DataSourceManager::addProxy(const QString &name, QString master, QString de
}
putProxyDesc(proxyDesc);
putHolder(name,new ProxyHolder(proxyDesc, this));
m_hasChanges = true;
emit datasourcesChanged();
}
@@ -667,6 +671,7 @@ void DataSourceManager::removeDatasource(const QString &name)
delete m_proxies.at(proxyIndex);
m_proxies.removeAt(proxyIndex);
}
m_hasChanges = true;
emit datasourcesChanged();
}
@@ -687,6 +692,7 @@ void DataSourceManager::removeConnection(const QString &connectionName)
cit++;
}
}
m_hasChanges = true;
emit datasourcesChanged();
}
@@ -695,6 +701,7 @@ void DataSourceManager::addConnectionDesc(ConnectionDesc * connection)
if (!isConnection(connection->name())) {
connect(connection,SIGNAL(nameChanged(QString,QString)),this,SLOT(slotConnectionRenamed(QString,QString)));
m_connections.append(connection);
m_hasChanges = true;
if (connection->autoconnect()){
try{
connectConnection(connection);
@@ -1049,6 +1056,7 @@ QStringList DataSourceManager::fieldNames(const QString &datasourceName)
void DataSourceManager::addConnection(const QString &connectionName)
{
addConnectionDesc(new ConnectionDesc(QSqlDatabase::database(connectionName)));
m_hasChanges = true;
emit datasourcesChanged();
}
@@ -1228,8 +1236,10 @@ void DataSourceManager::deleteVariable(const QString& name)
m_userVariables.deleteVariable(name);
if (m_reportVariables.containsVariable(name)&&m_reportVariables.variableType(name)==VarDesc::Report){
m_reportVariables.deleteVariable(name);
if (designTime())
emit datasourcesChanged();
if (designTime()){
m_hasChanges = true;
emit datasourcesChanged();
}
}
}
@@ -1307,11 +1317,15 @@ void DataSourceManager::invalidateQueriesContainsVariable(const QString& variabl
void DataSourceManager::slotVariableHasBeenAdded(const QString& variableName)
{
invalidateQueriesContainsVariable(variableName);
if (variableType(variableName) == VarDesc::Report)
m_hasChanges = true;
}
void DataSourceManager::slotVariableHasBeenChanged(const QString& variableName)
{
invalidateQueriesContainsVariable(variableName);
if (variableType(variableName) == VarDesc::Report)
m_hasChanges = true;
}
void DataSourceManager::clear(ClearMethod method)