diff --git a/limereport/databrowser/lrconnectiondialog.cpp b/limereport/databrowser/lrconnectiondialog.cpp index 9795628..96204c4 100644 --- a/limereport/databrowser/lrconnectiondialog.cpp +++ b/limereport/databrowser/lrconnectiondialog.cpp @@ -117,6 +117,8 @@ ConnectionDesc *ConnectionDialog::uiToConnection(LimeReport::ConnectionDesc* con result = new LimeReport::ConnectionDesc(); result ->setName(ConnectionDesc::connectionNameForReport(ui->leConnectionName->text())); result ->setHost(ui->leServerName->text()); + if (!ui->lePort->text().isEmpty()) + result->setPort(ui->lePort->text().toInt()); result ->setDriver(ui->cbbDrivers->currentText()); result ->setUserName(ui->leUserName->text()); result ->setPassword(ui->lePassword->text()); @@ -139,6 +141,7 @@ void ConnectionDialog::connectionToUI() ui->cbbDrivers->setCurrentIndex(ui->cbbDrivers->findText(m_connection->driver())); ui->cbAutoConnect->setChecked(m_connection->autoconnect()); ui->cbbKeepCredentials->setChecked(!m_connection->keepDBCredentials()); + ui->lePort->setText(m_connection->port()!=-1?QString::number(m_connection->port()):""); } void ConnectionDialog::on_toolButton_clicked() diff --git a/limereport/databrowser/lrconnectiondialog.ui b/limereport/databrowser/lrconnectiondialog.ui index 60bf527..d76b765 100644 --- a/limereport/databrowser/lrconnectiondialog.ui +++ b/limereport/databrowser/lrconnectiondialog.ui @@ -7,7 +7,7 @@ 0 0 420 - 294 + 323 @@ -17,7 +17,7 @@ :/databrowser/images/database_disconnected:/databrowser/images/database_disconnected - + @@ -44,88 +44,106 @@ - - - - - Driver - - - - - - - - - - Server - - - - - - - - - - - - - - User - - - - - - - - - - - - - - Password - - - - - - - - - - QLineEdit::Password - - - - - - - Database - - - - - - - 2 - + + + - + + + Driver + + + + + + + Server + + + + + + + Port + + + + + + + User + + + + + + + Password + + + + + + + Database + + + + + + + + + + + + - + + + + - ... + + + + + + + + QLineEdit::Password + + + + + + + 2 + + + + + + + + + + + + ... + + + + + diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index 78f8ab2..6cb5678 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -342,13 +342,13 @@ void ModelToDataSource::slotModelDestroed() ConnectionDesc::ConnectionDesc(QSqlDatabase db, QObject *parent) : QObject(parent), m_connectionName(db.connectionName()), m_connectionHost(db.hostName()), m_connectionDriver(db.driverName()), - m_databaseName(db.databaseName()), m_user(db.userName()), m_password(db.password()), m_autoconnect(false), + m_databaseName(db.databaseName()), m_user(db.userName()), m_password(db.password()), m_port(-1), m_autoconnect(false), m_internal(false), m_keepDBCredentials(true) {} ConnectionDesc::ConnectionDesc(QObject *parent) - :QObject(parent),m_connectionName(""),m_connectionHost(""),m_connectionDriver(""), - m_databaseName(""), m_user(""), m_password(""), m_autoconnect(false), + :QObject(parent),m_connectionName(""),m_connectionHost(""), m_connectionDriver(""), + m_databaseName(""), m_user(""), m_password(""), m_port(-1), m_autoconnect(false), m_internal(false), m_keepDBCredentials(true) {} @@ -383,6 +383,16 @@ QString ConnectionDesc::connectionNameForReport(const QString &connectionName) return connectionName.compare(tr("defaultConnection")) == 0 ? QSqlDatabase::defaultConnection : connectionName; } +int ConnectionDesc::port() const +{ + return m_port; +} + +void ConnectionDesc::setPort(int port) +{ + m_port = port; +} + bool ConnectionDesc::keepDBCredentials() const { return m_keepDBCredentials; diff --git a/limereport/lrdatadesignintf.h b/limereport/lrdatadesignintf.h index cafe60d..0e77ae8 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -111,6 +111,7 @@ class ConnectionDesc : public QObject{ Q_PROPERTY(QString host READ host WRITE setHost) Q_PROPERTY(bool autoconnect READ autoconnect WRITE setAutoconnect) Q_PROPERTY(bool keepDBCredentials READ keepDBCredentials WRITE setKeepDBCredentials) + Q_PROPERTY(int port READ port WRITE setPort) public: typedef QSharedPointer Ptr; ConnectionDesc(QSqlDatabase db, QObject* parent=0); @@ -135,6 +136,8 @@ public: void setInternal(bool value) {m_internal = value;} bool keepDBCredentials() const; void setKeepDBCredentials(bool keepDBCredentials); + int port() const; + void setPort(int port); public: static QString connectionNameForUser(const QString& connectionName); static QString connectionNameForReport(const QString& connectionName); @@ -147,6 +150,7 @@ private: QString m_databaseName; QString m_user; QString m_password; + int m_port; bool m_autoconnect; bool m_internal; bool m_keepDBCredentials; diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 436f35a..c7950f2 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -740,6 +740,8 @@ bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connecti db.setHostName(replaceVariables(connectionDesc.host())); db.setUserName(replaceVariables(connectionDesc.userName())); db.setPassword(replaceVariables(connectionDesc.password())); + if (connectionDesc.port()!=-1) + db.setPort(connectionDesc.port()); if (!connectionDesc.keepDBCredentials() && m_dbCredentialsProvider){ if (!m_dbCredentialsProvider->getUserName(connectionDesc.name()).isEmpty()) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 1cdc23a..6bc1d2a 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -724,13 +724,19 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da } if (gb && !gb->isStarted()){ - if (band->reprintOnEachPage()) + if (band->reprintOnEachPage()){ m_reprintableBands.append(band); + } gb->startGroup(m_datasources); openDataGroup(band); if (!firstTime && gb->startNewPage()){ if (gb->resetPageNumber()) resetPageNumber(BandReset); - renderBand(band, 0, ForcedStartPage); + if (band->reprintOnEachPage()){ + savePage(); + startNewPage(); + } else { + renderBand(band, 0, ForcedStartPage); + } } else { renderBand(band, 0, StartNewPageAsNeeded); } @@ -845,6 +851,14 @@ void ReportRender::closeDataGroup(BandDesignIntf *band) if (groupBand){ groupBand->closeGroup(); if (band->reprintOnEachPage()) m_reprintableBands.removeOne(band); + + QList::Iterator it = m_reprintableBands.begin(); + while (it != m_reprintableBands.end()){ + if ((*it)->bandIndex()>band->bandIndex()) + it = m_reprintableBands.erase(it); + else + it++; + } } closeGroup(band); } @@ -1094,7 +1108,6 @@ void ReportRender::startNewPage() m_dataAreaSize = m_maxHeightByColumn[m_currentColumn]; m_renderedDataBandCount = 0; - foreach (BandDesignIntf* band, m_reprintableBands) { renderBand(band, 0); }