diff --git a/common.pri b/common.pri index b69a89e..9b07f01 100644 --- a/common.pri +++ b/common.pri @@ -128,7 +128,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 5 -LIMEREPORT_VERSION_RELEASE = 31 +LIMEREPORT_VERSION_RELEASE = 32 LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index 6887ca3..597d04a 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -468,7 +468,7 @@ public: QVariant getBookMark(const QString& key); void copyBookmarks(BookmarkContainerDesignIntf* source); private: - QMap m_bookmarks; + QHash m_bookmarks; }; } //namespace LimeReport diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index 6fa78a5..eb4b564 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -719,24 +719,35 @@ QVariant CallbackDatasource::dataByKeyField(const QString& columnName, const QSt { int backupCurrentRow = m_currentRow; QVariant result = QVariant(); - first(); - if (!checkIfEmpty()){ - int currentRow = 0; - do { - QVariant key = callbackData(keyColumnName, currentRow); + + m_currentRow = m_lastKeyRow; + if (next()){ + for (int i = 0; i < 10; ++i){ + QVariant key = callbackData(keyColumnName, m_currentRow); if (key == keyData){ - result = callbackData(columnName, currentRow); - break; + result = callbackData(columnName, m_currentRow); + m_lastKeyRow = m_currentRow; + m_currentRow = backupCurrentRow; + return result; } - currentRow++; - } while (next()); + if (!next()) break; + } } first(); - if (backupCurrentRow != -1){ - for (int i = 0; i < backupCurrentRow; ++i) - next(); + if (!checkIfEmpty()){ + do { + QVariant key = callbackData(keyColumnName, m_currentRow); + if (key == keyData){ + result = callbackData(columnName, m_currentRow); + m_lastKeyRow = m_currentRow; + m_currentRow = backupCurrentRow; + return result; + } + } while (next()); } + + m_currentRow = backupCurrentRow; return result; } diff --git a/limereport/lrdatadesignintf.h b/limereport/lrdatadesignintf.h index c682fc4..867cbbb 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -410,8 +410,8 @@ private: class CallbackDatasource :public ICallbackDatasource, public IDataSource { Q_OBJECT public: - CallbackDatasource(): m_currentRow(-1), m_eof(false), m_columnCount(-1), - m_rowCount(-1), m_getDataFromCache(false){} + CallbackDatasource(): m_currentRow(-1), m_eof(false), m_columnCount(-1), + m_rowCount(-1), m_getDataFromCache(false), m_lastKeyRow(0){} bool next(); bool hasNext(){ if (!m_eof) return checkNextRecord(m_currentRow); else return false;} bool prior(); @@ -431,6 +431,7 @@ public: private: bool checkNextRecord(int recordNum); bool checkIfEmpty(); + QVariant callbackData(const QString& columnName, int row); private: QVector m_headers; int m_currentRow; @@ -439,7 +440,7 @@ private: int m_rowCount; QHash m_valuesCache; bool m_getDataFromCache; - QVariant callbackData(const QString& columnName, int row); + int m_lastKeyRow; }; class CallbackDatasourceHolder :public QObject, public IDataSourceHolder{ diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index a1e8a3b..acd6298 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -722,6 +722,7 @@ void ReportDesignWidget::initThemeIfExist(const QString &themeName, const QStrin void ReportDesignWidget::previewReport() { + if (report()->isBusy()) return; prepareReport(); #ifdef HAVE_QTDESIGNER_INTEGRATION updateDialogs(); @@ -734,6 +735,7 @@ void ReportDesignWidget::previewReport() void ReportDesignWidget::printReport() { + if (report()->isBusy()) return; prepareReport(); #ifdef HAVE_QTDESIGNER_INTEGRATION updateDialogs(); diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index 5181c7b..d863ee9 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -1264,7 +1264,9 @@ void ReportDesignWindow::slotPrintReport() void ReportDesignWindow::slotPreviewReport() { + m_previewReportAction->setDisabled(true); m_reportDesignWidget->previewReport(); + m_previewReportAction->setDisabled(false); } void ReportDesignWindow::slotItemActionCliked() diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 2453b90..efb2881 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -113,6 +113,7 @@ public: virtual void cancelRender() = 0; virtual void setShowProgressDialog(bool value) = 0; virtual bool isShowProgressDialog() const = 0; + virtual bool isBusy() = 0; }; class PrintProcessor{ diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 49af8cc..0752a2e 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -261,11 +261,11 @@ void ReportRender::renderPage(PageItemDesignIntf* patternPage, bool isTOC, bool renderReportHeader(m_patternPageItem, AfterPageHeader); BandDesignIntf* lastRenderedBand = 0; - for (int i=0;idataBandCount() && !m_renderCanceled;i++){ + for (int i=0;idataBandCount() && !m_renderCanceled; i++){ lastRenderedBand = m_patternPageItem->dataBandAt(i); initDatasource(lastRenderedBand->datasourceName()); renderDataBand(lastRenderedBand); - if (idataBandCount()-1) closeFooterGroup(lastRenderedBand); + if (i < m_patternPageItem->dataBandCount()-1) closeFooterGroup(lastRenderedBand); } if (reportFooter) @@ -475,7 +475,7 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign if (bandData){ bandClone = bandData; } else { - bandClone=renderData(patternBand); + bandClone = renderData(patternBand); } if (isLast) bandClone->setBootomSpace(1); @@ -543,8 +543,10 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign savePage(); startNewPage(); if (!bandIsSliced){ + BandDesignIntf* t = renderData(patternBand); + t->copyBookmarks(bandClone); delete bandClone; - bandClone = renderData(patternBand); + bandClone = t; } } if (!registerBand(bandClone)) {