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 b966a2b..f3add56 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -352,13 +352,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) {} @@ -393,6 +393,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 ed4f609..3486549 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -112,6 +112,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); @@ -136,6 +137,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); @@ -148,6 +151,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 6890b3e..1c14081 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -742,6 +742,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 03bc3d5..c3a4b2b 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -764,14 +764,20 @@ 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); BandDesignIntf* renderedHeader = 0; if (!firstTime && gb->startNewPage()){ if (gb->resetPageNumber()) resetPageNumber(BandReset); - renderedHeader = renderBand(band, 0, ForcedStartPage); + if (band->reprintOnEachPage()){ + savePage(); + startNewPage(); + } else { + renderedHeader = renderBand(band, 0, ForcedStartPage); + } } else { renderedHeader = renderBand(band, 0, StartNewPageAsNeeded); } @@ -890,6 +896,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++; + } } recalcIfNeeded(band); closeGroup(band); @@ -1178,7 +1192,6 @@ void ReportRender::startNewPage(bool isFirst) m_dataAreaSize = m_maxHeightByColumn[m_currentColumn]; m_renderedDataBandCount = 0; - foreach (BandDesignIntf* band, m_reprintableBands) { renderBand(band, 0); }