mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
Using variables in the connection describer has been extended
This commit is contained in:
parent
36b60319ce
commit
ccf8134012
@ -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}\\\"
|
||||
|
BIN
limereport/databrowser/images/closed_eye.png
Executable file
BIN
limereport/databrowser/images/closed_eye.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 232 B |
BIN
limereport/databrowser/images/eye.png
Executable file
BIN
limereport/databrowser/images/eye.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 429 B |
@ -118,7 +118,7 @@ ConnectionDesc *ConnectionDialog::uiToConnection(LimeReport::ConnectionDesc* con
|
||||
result ->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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>420</width>
|
||||
<height>323</height>
|
||||
<height>363</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -44,7 +44,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
@ -114,14 +114,39 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lePassword">
|
||||
<property name="text">
|
||||
<string/>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lePassword">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_2">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="lrdatabrowser.qrc">
|
||||
<normaloff>:/databrowser/images/closed_eye.png</normaloff>
|
||||
<normalon>:/databrowser/images/eye.png</normalon>:/databrowser/images/closed_eye.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
@ -137,6 +162,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
@ -221,8 +249,24 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>leConnectionName</tabstop>
|
||||
<tabstop>cbbUseDefaultConnection</tabstop>
|
||||
<tabstop>cbbDrivers</tabstop>
|
||||
<tabstop>leServerName</tabstop>
|
||||
<tabstop>lePort</tabstop>
|
||||
<tabstop>leUserName</tabstop>
|
||||
<tabstop>lePassword</tabstop>
|
||||
<tabstop>leDataBase</tabstop>
|
||||
<tabstop>cbAutoConnect</tabstop>
|
||||
<tabstop>cbbKeepCredentials</tabstop>
|
||||
<tabstop>pbCheckConnection</tabstop>
|
||||
<tabstop>pbCancel</tabstop>
|
||||
<tabstop>pbOk</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="lrdatabrowser.qrc"/>
|
||||
<include location="lrdatabrowser.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
|
@ -44,5 +44,7 @@
|
||||
<file alias="/images/value_edit">images/value_edit2.png</file>
|
||||
<file alias="/images/value">images/value1.png</file>
|
||||
<file alias="/images/varToReport">images/varToReport.png</file>
|
||||
<file>images/eye.png</file>
|
||||
<file>images/closed_eye.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<ConnectionDesc> 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;
|
||||
|
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user