0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 16:44:39 +03:00

#289 Data source renaming has been fixed

This commit is contained in:
Arin Alexandex 2020-08-16 17:54:44 +03:00
parent bf6a7ce462
commit 2777cbb744
3 changed files with 6 additions and 7 deletions

View File

@ -133,7 +133,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 5 LIMEREPORT_VERSION_MINOR = 5
LIMEREPORT_VERSION_RELEASE = 66 LIMEREPORT_VERSION_RELEASE = 67
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}\\\"

View File

@ -677,7 +677,7 @@ SQLEditResult::ResultMode DataBrowser::currentDatasourceType(const QString& data
void DataBrowser::applyChanges(SQLEditResult result) void DataBrowser::applyChanges(SQLEditResult result)
{ {
if (result.resultMode == currentDatasourceType(result.datasourceName)){ if (result.resultMode == currentDatasourceType(result.oldDatasourceName)){
switch(result.resultMode){ switch(result.resultMode){
case SQLEditResult::Query: case SQLEditResult::Query:
changeQuery(result); changeQuery(result);
@ -694,7 +694,7 @@ void DataBrowser::applyChanges(SQLEditResult result)
default: break; default: break;
} }
} else { } else {
removeDatasource(result.datasourceName); removeDatasource(result.oldDatasourceName);
addDatasource(result); addDatasource(result);
} }
activateItem(result.datasourceName, DataBrowserTree::Table); activateItem(result.datasourceName, DataBrowserTree::Table);

View File

@ -675,8 +675,6 @@ CSVDesc *DataSourceManager::csvByName(const QString &datasourceName)
void DataSourceManager::removeDatasource(const QString &name) void DataSourceManager::removeDatasource(const QString &name)
{ {
invalidateLinkedDatasources(name);
if (m_datasources.contains(name)){ if (m_datasources.contains(name)){
IDataSourceHolder *holder; IDataSourceHolder *holder;
holder=m_datasources.value(name); holder=m_datasources.value(name);
@ -703,6 +701,7 @@ void DataSourceManager::removeDatasource(const QString &name)
delete m_csvs.at(csvIndex); delete m_csvs.at(csvIndex);
m_csvs.removeAt(csvIndex); m_csvs.removeAt(csvIndex);
} }
invalidateLinkedDatasources(name);
m_hasChanges = true; m_hasChanges = true;
emit datasourcesChanged(); emit datasourcesChanged();
} }
@ -1348,12 +1347,12 @@ void DataSourceManager::invalidateLinkedDatasources(QString datasourceName)
{ {
foreach(QString name, dataSourceNames()){ foreach(QString name, dataSourceNames()){
if (isSubQuery(name)){ if (isSubQuery(name)){
if (subQueryByName(name)->master() == datasourceName) if (subQueryByName(name)->master().compare(datasourceName) == 0)
dataSourceHolder(name)->invalidate(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE); dataSourceHolder(name)->invalidate(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE);
} }
if (isProxy(name)){ if (isProxy(name)){
ProxyDesc* proxy = proxyByName(name); ProxyDesc* proxy = proxyByName(name);
if ((proxy->master() == datasourceName) || (proxy->child() == datasourceName)) if ((proxy->master().compare(datasourceName) == 0) || (proxy->child().compare(datasourceName) == 0))
dataSourceHolder(name)->invalidate(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE); dataSourceHolder(name)->invalidate(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE);
} }