From ccf81340122b332a581bb661d199756a49f721c6 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 8 May 2020 14:19:02 +0300 Subject: [PATCH] Using variables in the connection describer has been extended --- common.pri | 2 +- limereport/databrowser/images/closed_eye.png | Bin 0 -> 232 bytes limereport/databrowser/images/eye.png | Bin 0 -> 429 bytes limereport/databrowser/lrconnectiondialog.cpp | 10 ++- limereport/databrowser/lrconnectiondialog.h | 2 + limereport/databrowser/lrconnectiondialog.ui | 62 +++++++++++++++--- limereport/databrowser/lrdatabrowser.qrc | 2 + limereport/lrdatadesignintf.cpp | 8 +-- limereport/lrdatadesignintf.h | 8 +-- limereport/lrdatasourcemanager.cpp | 6 +- 10 files changed, 77 insertions(+), 23 deletions(-) create mode 100755 limereport/databrowser/images/closed_eye.png create mode 100755 limereport/databrowser/images/eye.png diff --git a/common.pri b/common.pri index 24a0708..558ecc7 100644 --- a/common.pri +++ b/common.pri @@ -133,7 +133,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 5 -LIMEREPORT_VERSION_RELEASE = 50 +LIMEREPORT_VERSION_RELEASE = 51 LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" diff --git a/limereport/databrowser/images/closed_eye.png b/limereport/databrowser/images/closed_eye.png new file mode 100755 index 0000000000000000000000000000000000000000..754840646a21a3974dcd5757efdadff1068181e5 GIT binary patch literal 232 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#Xvd&gc&Ptc_#rGvpiiK zLo9lq1|1Y+GUT|kmC0*E%akJ32q&)%BHkNVyf;jFogiCs^2Ob~d*&M*R$&pF#-N(m zFH^R#UWf7IwoiE+ClxGtWBeMQ-25i!Fx_PRLVberQ=v`+K@^;KP|~D=LlLNHDiNd>SAD9VQ2yW&%sDFS zsKfRH5LH!(IuxM_35U2~5Jy4?0rALe-ZrmI9fDPxeLM5s% zPFg3%G;-Yr5qxu1+Z#(vo|wke6>4vCD@{HQ4tKWIhzTB0&rntS zCV??NbN_hvh3@Gdnyv6$UW%;hI0?b@#EdINBp7IJpHuV6S#t%B(hM9h#QGQ~F>l5* zp0~O08R^1+@vTrw9%A%=!Ns#=_D(Z_oPdO@xC3U}XA+TkIhsqNrK*N^uy*%setName(ConnectionDesc::connectionNameForReport(ui->leConnectionName->text())); result ->setHost(ui->leServerName->text()); if (!ui->lePort->text().isEmpty()) - result->setPort(ui->lePort->text().toInt()); + result->setPort(ui->lePort->text()); result ->setDriver(ui->cbbDrivers->currentText()); result ->setUserName(ui->leUserName->text()); result ->setPassword(ui->lePassword->text()); @@ -141,7 +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()):""); + ui->lePort->setText(m_connection->port()); } void ConnectionDialog::on_toolButton_clicked() @@ -160,6 +160,10 @@ void ConnectionDialog::on_cbbUseDefaultConnection_toggled(bool checked) ui->leConnectionName->setEnabled(true); } } +void ConnectionDialog::on_toolButton_2_toggled(bool checked) +{ + ui->lePassword->setEchoMode(checked ? QLineEdit::Normal : QLineEdit::Password); +} } // namespace LimeReport @@ -167,3 +171,5 @@ void ConnectionDialog::on_cbbUseDefaultConnection_toggled(bool checked) + + diff --git a/limereport/databrowser/lrconnectiondialog.h b/limereport/databrowser/lrconnectiondialog.h index 531666a..12140b1 100644 --- a/limereport/databrowser/lrconnectiondialog.h +++ b/limereport/databrowser/lrconnectiondialog.h @@ -60,6 +60,8 @@ private slots: void on_toolButton_clicked(); void on_cbbUseDefaultConnection_toggled(bool checked); + void on_toolButton_2_toggled(bool checked); + private: Ui::ConnectionDialog *ui; ConnectionDesc* m_connection; diff --git a/limereport/databrowser/lrconnectiondialog.ui b/limereport/databrowser/lrconnectiondialog.ui index d76b765..4b0e996 100644 --- a/limereport/databrowser/lrconnectiondialog.ui +++ b/limereport/databrowser/lrconnectiondialog.ui @@ -7,7 +7,7 @@ 0 0 420 - 323 + 363 @@ -44,7 +44,7 @@ - + @@ -114,14 +114,39 @@ - - - + + + 2 - - QLineEdit::Password - - + + + + + + + QLineEdit::Password + + + + + + + Qt::ClickFocus + + + + + + + :/databrowser/images/closed_eye.png + :/databrowser/images/eye.png:/databrowser/images/closed_eye.png + + + true + + + + @@ -137,6 +162,9 @@ + + Qt::ClickFocus + ... @@ -221,8 +249,24 @@ + + leConnectionName + cbbUseDefaultConnection + cbbDrivers + leServerName + lePort + leUserName + lePassword + leDataBase + cbAutoConnect + cbbKeepCredentials + pbCheckConnection + pbCancel + pbOk + + diff --git a/limereport/databrowser/lrdatabrowser.qrc b/limereport/databrowser/lrdatabrowser.qrc index aa4f852..de2ce88 100644 --- a/limereport/databrowser/lrdatabrowser.qrc +++ b/limereport/databrowser/lrdatabrowser.qrc @@ -44,5 +44,7 @@ images/value_edit2.png images/value1.png images/varToReport.png + images/eye.png + images/closed_eye.png diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index aca04e3..b16d77d 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -336,13 +336,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_port(-1), m_autoconnect(false), + m_databaseName(db.databaseName()), m_user(db.userName()), m_password(db.password()), m_port(""), 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_port(-1), m_autoconnect(false), + m_databaseName(""), m_user(""), m_password(""), m_port(""), m_autoconnect(false), m_internal(false), m_keepDBCredentials(true) {} @@ -377,12 +377,12 @@ QString ConnectionDesc::connectionNameForReport(const QString &connectionName) return connectionName.compare(tr("defaultConnection")) == 0 ? QSqlDatabase::defaultConnection : connectionName; } -int ConnectionDesc::port() const +QString ConnectionDesc::port() const { return m_port; } -void ConnectionDesc::setPort(int port) +void ConnectionDesc::setPort(QString port) { m_port = port; } diff --git a/limereport/lrdatadesignintf.h b/limereport/lrdatadesignintf.h index 867cbbb..71543cb 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -78,7 +78,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) + Q_PROPERTY(QString port READ port WRITE setPort) public: typedef QSharedPointer Ptr; ConnectionDesc(QSqlDatabase db, QObject* parent=0); @@ -103,8 +103,8 @@ public: void setInternal(bool value) {m_internal = value;} bool keepDBCredentials() const; void setKeepDBCredentials(bool keepDBCredentials); - int port() const; - void setPort(int port); + QString port() const; + void setPort(QString port); public: static QString connectionNameForUser(const QString& connectionName); static QString connectionNameForReport(const QString& connectionName); @@ -117,7 +117,7 @@ private: QString m_databaseName; QString m_user; QString m_password; - int m_port; + QString m_port; bool m_autoconnect; bool m_internal; bool m_keepDBCredentials; diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 9b9b876..668aa71 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -808,12 +808,12 @@ bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connecti bool connected = false; - db.setHostName(replaceVariables(connectionDesc.host())); db.setUserName(replaceVariables(connectionDesc.userName())); db.setPassword(replaceVariables(connectionDesc.password())); - if (connectionDesc.port()!=-1) - db.setPort(connectionDesc.port()); + db.setDatabaseName(replaceVariables(connectionDesc.databaseName())); + if (connectionDesc.port()!="") + db.setPort(replaceVariables(connectionDesc.port()).toInt()); if (!connectionDesc.keepDBCredentials() && m_dbCredentialsProvider){ if (!m_dbCredentialsProvider->getUserName(connectionDesc.name()).isEmpty())