mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-25 04:54:40 +03:00
Datasources changes tracking has been added
This commit is contained in:
parent
8ad4d0f9c5
commit
df9253929f
@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
|
|||||||
|
|
||||||
LIMEREPORT_VERSION_MAJOR = 1
|
LIMEREPORT_VERSION_MAJOR = 1
|
||||||
LIMEREPORT_VERSION_MINOR = 4
|
LIMEREPORT_VERSION_MINOR = 4
|
||||||
LIMEREPORT_VERSION_RELEASE = 121
|
LIMEREPORT_VERSION_RELEASE = 122
|
||||||
|
|
||||||
LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"'
|
LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"'
|
||||||
DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\"
|
DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\"
|
||||||
|
@ -217,7 +217,8 @@ void DataSourceModel::updateModel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
DataSourceManager::DataSourceManager(QObject *parent) :
|
DataSourceManager::DataSourceManager(QObject *parent) :
|
||||||
QObject(parent), m_lastError(""), m_designTime(true), m_needUpdate(false), m_dbCredentialsProvider(0)
|
QObject(parent), m_lastError(""), m_designTime(true), m_needUpdate(false),
|
||||||
|
m_dbCredentialsProvider(0), m_hasChanges(false)
|
||||||
{
|
{
|
||||||
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("COUNT"),new ConstructorGroupFunctionCreator<CountGroupFunction>);
|
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("COUNT"),new ConstructorGroupFunctionCreator<CountGroupFunction>);
|
||||||
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("SUM"),new ConstructorGroupFunctionCreator<SumGroupFunction>);
|
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("SUM"),new ConstructorGroupFunctionCreator<SumGroupFunction>);
|
||||||
@ -230,11 +231,11 @@ DataSourceManager::DataSourceManager(QObject *parent) :
|
|||||||
setSystemVariable(QLatin1String("#IS_FIRST_PAGEFOOTER"),false,FirstPass);
|
setSystemVariable(QLatin1String("#IS_FIRST_PAGEFOOTER"),false,FirstPass);
|
||||||
|
|
||||||
connect(&m_reportVariables, SIGNAL(variableHasBeenAdded(QString)),
|
connect(&m_reportVariables, SIGNAL(variableHasBeenAdded(QString)),
|
||||||
this, SLOT(slotVariableHasBeenAdded(QString)) );
|
this, SLOT(slotVariableHasBeenAdded(QString)));
|
||||||
connect(&m_reportVariables, SIGNAL(variableHasBeenChanged(QString)),
|
connect(&m_reportVariables, SIGNAL(variableHasBeenChanged(QString)),
|
||||||
this, SLOT(slotVariableHasBeenChanged(QString)));
|
this, SLOT(slotVariableHasBeenChanged(QString)));
|
||||||
connect(&m_userVariables, SIGNAL(variableHasBeenAdded(QString)),
|
connect(&m_userVariables, SIGNAL(variableHasBeenAdded(QString)),
|
||||||
this, SLOT(slotVariableHasBeenAdded(QString)) );
|
this, SLOT(slotVariableHasBeenAdded(QString)));
|
||||||
connect(&m_userVariables, SIGNAL(variableHasBeenChanged(QString)),
|
connect(&m_userVariables, SIGNAL(variableHasBeenChanged(QString)),
|
||||||
this, SLOT(slotVariableHasBeenChanged(QString)));
|
this, SLOT(slotVariableHasBeenChanged(QString)));
|
||||||
|
|
||||||
@ -499,6 +500,7 @@ void DataSourceManager::addQuery(const QString &name, const QString &sqlText, co
|
|||||||
QueryDesc *queryDecs = new QueryDesc(name,sqlText,connectionName);
|
QueryDesc *queryDecs = new QueryDesc(name,sqlText,connectionName);
|
||||||
putQueryDesc(queryDecs);
|
putQueryDesc(queryDecs);
|
||||||
putHolder(name,new QueryHolder(sqlText, connectionName, this));
|
putHolder(name,new QueryHolder(sqlText, connectionName, this));
|
||||||
|
m_hasChanges = true;
|
||||||
emit datasourcesChanged();
|
emit datasourcesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,6 +509,7 @@ void DataSourceManager::addSubQuery(const QString &name, const QString &sqlText,
|
|||||||
SubQueryDesc *subQueryDesc = new SubQueryDesc(name.toLower(),sqlText,connectionName,masterDatasource);
|
SubQueryDesc *subQueryDesc = new SubQueryDesc(name.toLower(),sqlText,connectionName,masterDatasource);
|
||||||
putSubQueryDesc(subQueryDesc);
|
putSubQueryDesc(subQueryDesc);
|
||||||
putHolder(name,new SubQueryHolder(sqlText, connectionName, masterDatasource, this));
|
putHolder(name,new SubQueryHolder(sqlText, connectionName, masterDatasource, this));
|
||||||
|
m_hasChanges = true;
|
||||||
emit datasourcesChanged();
|
emit datasourcesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,6 +524,7 @@ void DataSourceManager::addProxy(const QString &name, QString master, QString de
|
|||||||
}
|
}
|
||||||
putProxyDesc(proxyDesc);
|
putProxyDesc(proxyDesc);
|
||||||
putHolder(name,new ProxyHolder(proxyDesc, this));
|
putHolder(name,new ProxyHolder(proxyDesc, this));
|
||||||
|
m_hasChanges = true;
|
||||||
emit datasourcesChanged();
|
emit datasourcesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,6 +647,7 @@ void DataSourceManager::removeDatasource(const QString &name)
|
|||||||
delete m_proxies.at(proxyIndex);
|
delete m_proxies.at(proxyIndex);
|
||||||
m_proxies.removeAt(proxyIndex);
|
m_proxies.removeAt(proxyIndex);
|
||||||
}
|
}
|
||||||
|
m_hasChanges = true;
|
||||||
emit datasourcesChanged();
|
emit datasourcesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -663,6 +668,7 @@ void DataSourceManager::removeConnection(const QString &connectionName)
|
|||||||
cit++;
|
cit++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_hasChanges = true;
|
||||||
emit datasourcesChanged();
|
emit datasourcesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -671,6 +677,7 @@ void DataSourceManager::addConnectionDesc(ConnectionDesc * connection)
|
|||||||
if (!isConnection(connection->name())) {
|
if (!isConnection(connection->name())) {
|
||||||
connect(connection,SIGNAL(nameChanged(QString,QString)),this,SLOT(slotConnectionRenamed(QString,QString)));
|
connect(connection,SIGNAL(nameChanged(QString,QString)),this,SLOT(slotConnectionRenamed(QString,QString)));
|
||||||
m_connections.append(connection);
|
m_connections.append(connection);
|
||||||
|
m_hasChanges = true;
|
||||||
if (connection->autoconnect()){
|
if (connection->autoconnect()){
|
||||||
try{
|
try{
|
||||||
connectConnection(connection);
|
connectConnection(connection);
|
||||||
@ -1025,6 +1032,7 @@ QStringList DataSourceManager::fieldNames(const QString &datasourceName)
|
|||||||
void DataSourceManager::addConnection(const QString &connectionName)
|
void DataSourceManager::addConnection(const QString &connectionName)
|
||||||
{
|
{
|
||||||
addConnectionDesc(new ConnectionDesc(QSqlDatabase::database(connectionName)));
|
addConnectionDesc(new ConnectionDesc(QSqlDatabase::database(connectionName)));
|
||||||
|
m_hasChanges = true;
|
||||||
emit datasourcesChanged();
|
emit datasourcesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1189,8 +1197,10 @@ void DataSourceManager::deleteVariable(const QString& name)
|
|||||||
m_userVariables.deleteVariable(name);
|
m_userVariables.deleteVariable(name);
|
||||||
if (m_reportVariables.containsVariable(name)&&m_reportVariables.variableType(name)==VarDesc::Report){
|
if (m_reportVariables.containsVariable(name)&&m_reportVariables.variableType(name)==VarDesc::Report){
|
||||||
m_reportVariables.deleteVariable(name);
|
m_reportVariables.deleteVariable(name);
|
||||||
if (designTime())
|
if (designTime()){
|
||||||
emit datasourcesChanged();
|
m_hasChanges = true;
|
||||||
|
emit datasourcesChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1266,14 +1276,16 @@ void DataSourceManager::invalidateQueriesContainsVariable(const QString& variabl
|
|||||||
|
|
||||||
void DataSourceManager::slotVariableHasBeenAdded(const QString& variableName)
|
void DataSourceManager::slotVariableHasBeenAdded(const QString& variableName)
|
||||||
{
|
{
|
||||||
//qDebug()<< "variable has been added"<< variableName;
|
|
||||||
invalidateQueriesContainsVariable(variableName);
|
invalidateQueriesContainsVariable(variableName);
|
||||||
|
if (variableType(variableName) == VarDesc::Report)
|
||||||
|
m_hasChanges = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataSourceManager::slotVariableHasBeenChanged(const QString& variableName)
|
void DataSourceManager::slotVariableHasBeenChanged(const QString& variableName)
|
||||||
{
|
{
|
||||||
//qDebug()<< "variable has been changed"<< variableName;
|
|
||||||
invalidateQueriesContainsVariable(variableName);
|
invalidateQueriesContainsVariable(variableName);
|
||||||
|
if (variableType(variableName) == VarDesc::Report)
|
||||||
|
m_hasChanges = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataSourceManager::clear(ClearMethod method)
|
void DataSourceManager::clear(ClearMethod method)
|
||||||
|
@ -201,6 +201,8 @@ public:
|
|||||||
ReportSettings *reportSettings() const;
|
ReportSettings *reportSettings() const;
|
||||||
void setReportSettings(ReportSettings *reportSettings);
|
void setReportSettings(ReportSettings *reportSettings);
|
||||||
|
|
||||||
|
bool isHasChanges(){ return m_hasChanges; }
|
||||||
|
void dropChanges(){ m_hasChanges = false; }
|
||||||
signals:
|
signals:
|
||||||
void loadCollectionFinished(const QString& collectionName);
|
void loadCollectionFinished(const QString& collectionName);
|
||||||
void cleared();
|
void cleared();
|
||||||
@ -256,6 +258,7 @@ private:
|
|||||||
QHash<QString,int> m_groupFunctionsExpressionsMap;
|
QHash<QString,int> m_groupFunctionsExpressionsMap;
|
||||||
QVector<QString> m_groupFunctionsExpressions;
|
QVector<QString> m_groupFunctionsExpressions;
|
||||||
IDbCredentialsProvider* m_dbCredentialsProvider;
|
IDbCredentialsProvider* m_dbCredentialsProvider;
|
||||||
|
bool m_hasChanges;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ PageDesignIntf::PageDesignIntf(QObject *parent):
|
|||||||
m_changePosMode(false),
|
m_changePosMode(false),
|
||||||
m_changePosOrSizeMode(false),
|
m_changePosOrSizeMode(false),
|
||||||
m_executingCommand(false),
|
m_executingCommand(false),
|
||||||
m_hasHanges(false),
|
m_hasChanges(false),
|
||||||
m_isLoading(false),
|
m_isLoading(false),
|
||||||
m_executingGroupCommand(false),
|
m_executingGroupCommand(false),
|
||||||
m_settings(0),
|
m_settings(0),
|
||||||
@ -608,7 +608,7 @@ bool PageDesignIntf::saveCommand(CommandIf::Ptr command, bool runCommand)
|
|||||||
|
|
||||||
m_commandsList.push_back(command);
|
m_commandsList.push_back(command);
|
||||||
m_currentCommand = m_commandsList.count() - 1;
|
m_currentCommand = m_commandsList.count() - 1;
|
||||||
m_hasHanges = true;
|
m_hasChanges = true;
|
||||||
emit commandHistoryChanged();
|
emit commandHistoryChanged();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -625,7 +625,7 @@ bool PageDesignIntf::isCanUndo()
|
|||||||
|
|
||||||
bool PageDesignIntf::isHasChanges()
|
bool PageDesignIntf::isHasChanges()
|
||||||
{
|
{
|
||||||
return (m_commandsList.count() > 0) && m_hasHanges;
|
return (m_commandsList.count() > 0) && m_hasChanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PageDesignIntf::isItemInsertMode()
|
bool PageDesignIntf::isItemInsertMode()
|
||||||
@ -1201,7 +1201,7 @@ void PageDesignIntf::undo()
|
|||||||
m_executingCommand = true;
|
m_executingCommand = true;
|
||||||
m_commandsList.at(m_currentCommand)->undoIt();
|
m_commandsList.at(m_currentCommand)->undoIt();
|
||||||
m_currentCommand--;
|
m_currentCommand--;
|
||||||
m_hasHanges = true;
|
m_hasChanges = true;
|
||||||
m_executingCommand = false;
|
m_executingCommand = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1212,7 +1212,7 @@ void PageDesignIntf::redo()
|
|||||||
m_executingCommand = true;
|
m_executingCommand = true;
|
||||||
m_currentCommand++;
|
m_currentCommand++;
|
||||||
m_commandsList.at(m_currentCommand)->doIt();
|
m_commandsList.at(m_currentCommand)->doIt();
|
||||||
m_hasHanges = true;
|
m_hasChanges = true;
|
||||||
m_executingCommand = false;
|
m_executingCommand = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1322,7 +1322,7 @@ void PageDesignIntf::cut()
|
|||||||
|
|
||||||
void PageDesignIntf::setToSaved()
|
void PageDesignIntf::setToSaved()
|
||||||
{
|
{
|
||||||
m_hasHanges = false;
|
m_hasChanges = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PageDesignIntf::bringToFront()
|
void PageDesignIntf::bringToFront()
|
||||||
|
@ -151,7 +151,7 @@ namespace LimeReport {
|
|||||||
void emitItemRemoved(BaseDesignIntf* item);
|
void emitItemRemoved(BaseDesignIntf* item);
|
||||||
|
|
||||||
DataSourceManager* datasourceManager();
|
DataSourceManager* datasourceManager();
|
||||||
bool isSaved(){ return !m_hasHanges;}
|
bool isSaved(){ return !m_hasChanges;}
|
||||||
void changeSelectedGrpoupTextAlignPropperty(const bool& horizontalAlign, Qt::AlignmentFlag flag);
|
void changeSelectedGrpoupTextAlignPropperty(const bool& horizontalAlign, Qt::AlignmentFlag flag);
|
||||||
|
|
||||||
int verticalGridStep() const;
|
int verticalGridStep() const;
|
||||||
@ -277,7 +277,7 @@ namespace LimeReport {
|
|||||||
bool m_changePosMode;
|
bool m_changePosMode;
|
||||||
bool m_changePosOrSizeMode;
|
bool m_changePosOrSizeMode;
|
||||||
bool m_executingCommand;
|
bool m_executingCommand;
|
||||||
bool m_hasHanges;
|
bool m_hasChanges;
|
||||||
bool m_isLoading;
|
bool m_isLoading;
|
||||||
bool m_executingGroupCommand;
|
bool m_executingGroupCommand;
|
||||||
QSettings* m_settings;
|
QSettings* m_settings;
|
||||||
|
@ -547,6 +547,7 @@ void ReportDesignWindow::startNewReport()
|
|||||||
m_newPageFooter->setEnabled(true);
|
m_newPageFooter->setEnabled(true);
|
||||||
m_newReportHeader->setEnabled(true);
|
m_newReportHeader->setEnabled(true);
|
||||||
m_newReportFooter->setEnabled(true);
|
m_newReportFooter->setEnabled(true);
|
||||||
|
m_reportDesignWidget->report()->dataManager()->dropChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReportDesignWindow::writePosition()
|
void ReportDesignWindow::writePosition()
|
||||||
|
@ -513,7 +513,7 @@ bool ReportEnginePrivate::slotLoadFromFile(const QString &fileName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dataManager()->connectAutoConnections();
|
dataManager()->connectAutoConnections();
|
||||||
|
dataManager()->dropChanges();
|
||||||
if ( hasActivePreview() )
|
if ( hasActivePreview() )
|
||||||
{
|
{
|
||||||
currentPreview->reloadPreview();
|
currentPreview->reloadPreview();
|
||||||
@ -666,6 +666,7 @@ bool ReportEnginePrivate::saveToFile(const QString &fileName)
|
|||||||
page->setToSaved();
|
page->setToSaved();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_datasources->dropChanges();
|
||||||
return saved;
|
return saved;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -680,6 +681,7 @@ QByteArray ReportEnginePrivate::saveToByteArray()
|
|||||||
page->setToSaved();
|
page->setToSaved();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_datasources->dropChanges();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,6 +695,7 @@ QString ReportEnginePrivate::saveToString(){
|
|||||||
page->setToSaved();
|
page->setToSaved();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_datasources->dropChanges();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -701,6 +704,9 @@ bool ReportEnginePrivate::isNeedToSave()
|
|||||||
foreach(PageDesignIntf* page, m_pages){
|
foreach(PageDesignIntf* page, m_pages){
|
||||||
if (page->isHasChanges()) return true;
|
if (page->isHasChanges()) return true;
|
||||||
}
|
}
|
||||||
|
if (dataManager()->isHasChanges()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user