mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-24 04:33:03 +03:00
Merge branch '1.4' into 1.4_QJSEngine
This commit is contained in:
commit
1d3646bd1a
@ -426,18 +426,58 @@ void DataBrowser::initConnections()
|
||||
{
|
||||
ui->dataTree->clear();
|
||||
QList<QTreeWidgetItem *>items;
|
||||
foreach(QString connectionName,m_report->dataManager()->connectionNames()){
|
||||
|
||||
QStringList connections = QSqlDatabase::connectionNames();
|
||||
foreach(QString connectionName, m_report->dataManager()->connectionNames()){
|
||||
if (!connections.contains(connectionName,Qt::CaseInsensitive)){
|
||||
connections.append(connectionName);
|
||||
}
|
||||
}
|
||||
qSort(connections);
|
||||
foreach (QString connectionName, connections) {
|
||||
QTreeWidgetItem *item=new QTreeWidgetItem(
|
||||
ui->dataTree,
|
||||
QStringList(ConnectionDesc::connectionNameForUser(connectionName)),
|
||||
DataBrowserTree::Connection
|
||||
);
|
||||
if (m_report->dataManager()->isConnectionConnected(connectionName))
|
||||
if (!m_report->dataManager()->connectionNames().contains(ConnectionDesc::connectionNameForReport(connectionName), Qt::CaseInsensitive))
|
||||
{
|
||||
item->setIcon(0,QIcon(":/databrowser/images/database_connected"));
|
||||
else
|
||||
item->setIcon(0,QIcon(":/databrowser/images/database_disconnected"));
|
||||
} else {
|
||||
if (m_report->dataManager()->isConnectionConnected(connectionName))
|
||||
item->setIcon(0,QIcon(":/databrowser/images/database_connected"));
|
||||
else
|
||||
item->setIcon(0,QIcon(":/databrowser/images/database_disconnected"));
|
||||
}
|
||||
items.append(item);
|
||||
}
|
||||
|
||||
|
||||
// foreach (QString connectionName, connections) {
|
||||
// QTreeWidgetItem *item=new QTreeWidgetItem(
|
||||
// ui->dataTree,
|
||||
// QStringList(ConnectionDesc::connectionNameForUser(connectionName)),
|
||||
// DataBrowserTree::Connection
|
||||
// );
|
||||
// item->setIcon(0,QIcon(":/databrowser/images/database_connected"));
|
||||
// }
|
||||
|
||||
// connections = m_report->dataManager()->connectionNames();
|
||||
// qSort(connections);
|
||||
// foreach(QString connectionName,connectionName){
|
||||
// if (!QSqlDatabase::contains(connectionName)){
|
||||
// QTreeWidgetItem *item=new QTreeWidgetItem(
|
||||
// ui->dataTree,
|
||||
// QStringList(ConnectionDesc::connectionNameForUser(connectionName)),
|
||||
// DataBrowserTree::Connection
|
||||
// );
|
||||
// if (m_report->dataManager()->isConnectionConnected(connectionName))
|
||||
// item->setIcon(0,QIcon(":/databrowser/images/database_connected"));
|
||||
// else
|
||||
// item->setIcon(0,QIcon(":/databrowser/images/database_disconnected"));
|
||||
// items.append(item);
|
||||
// }
|
||||
// }
|
||||
ui->dataTree->insertTopLevelItems(0,items);
|
||||
}
|
||||
|
||||
@ -642,7 +682,8 @@ bool DataBrowser::checkConnectionDesc(ConnectionDesc *connection)
|
||||
|
||||
bool DataBrowser::containsDefaultConnection()
|
||||
{
|
||||
bool result = m_report->dataManager()->connectionByName(QSqlDatabase::defaultConnection);
|
||||
bool result = m_report->dataManager()->connectionByName(QSqlDatabase::defaultConnection) ||
|
||||
QSqlDatabase::contains(QSqlDatabase::defaultConnection);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -660,7 +701,7 @@ void DataBrowser::on_dataTree_currentItemChanged(QTreeWidgetItem *current, QTree
|
||||
{
|
||||
Q_UNUSED(previous)
|
||||
if (current&&(current->type() == DataBrowserTree::Connection)) {
|
||||
ui->pbConnect->setEnabled(true);
|
||||
bool internalConnection = m_report->dataManager()->connectionByName(ConnectionDesc::connectionNameForReport(current->text(0)));
|
||||
if (m_report->dataManager()->isConnectionConnected(current->text(0))){
|
||||
ui->pbConnect->setIcon(QIcon(":/databrowser/images/plug-connect.png"));
|
||||
} else {
|
||||
@ -668,9 +709,10 @@ void DataBrowser::on_dataTree_currentItemChanged(QTreeWidgetItem *current, QTree
|
||||
}
|
||||
ui->editDataSource->setEnabled(false);
|
||||
ui->deleteDataSource->setEnabled(false);
|
||||
ui->viewDataSource->setEnabled(false);
|
||||
ui->changeConnection->setEnabled(true);
|
||||
ui->deleteConection->setEnabled(true);
|
||||
ui->viewDataSource->setEnabled(false);
|
||||
ui->pbConnect->setEnabled(internalConnection);
|
||||
ui->changeConnection->setEnabled(internalConnection);
|
||||
ui->deleteConection->setEnabled(internalConnection);
|
||||
ui->errorMessage->setDisabled(true);
|
||||
} else {
|
||||
ui->changeConnection->setEnabled(false);
|
||||
|
@ -667,8 +667,10 @@ void DataSourceManager::addConnectionDesc(ConnectionDesc * connection)
|
||||
bool DataSourceManager::checkConnectionDesc(ConnectionDesc *connection)
|
||||
{
|
||||
if (connectConnection(connection)){
|
||||
if (connection->isInternal())
|
||||
if (connection->isInternal()){
|
||||
QSqlDatabase::removeDatabase(connection->name());
|
||||
if (designTime()) emit datasourcesChanged();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (connection->isInternal())
|
||||
|
@ -98,7 +98,6 @@ private slots:
|
||||
void slotScalePercentChanged(int percent);
|
||||
void on_actionShowMessages_toggled(bool value);
|
||||
void on_actionShow_Toolbar_triggered();
|
||||
|
||||
private:
|
||||
ItemsReaderIntf* reader();
|
||||
void initPercentCombobox();
|
||||
|
@ -35,7 +35,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>20</height>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuView">
|
||||
@ -158,6 +158,9 @@
|
||||
<property name="toolTip">
|
||||
<string>Close Preview</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Esc</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEdit_Mode">
|
||||
<property name="checkable">
|
||||
|
@ -539,6 +539,7 @@ void ReportDesignWindow::startNewReport()
|
||||
m_reportDesignWidget->createStartPage();
|
||||
m_lblReportName->setText("");
|
||||
updateRedoUndo();
|
||||
m_reportDesignWidget->slotPagesLoadFinished();
|
||||
m_newPageHeader->setEnabled(true);
|
||||
m_newPageFooter->setEnabled(true);
|
||||
m_newReportHeader->setEnabled(true);
|
||||
|
@ -64,6 +64,7 @@ void ScriptBrowser::setReportEditor(ReportDesignWidget* report)
|
||||
|
||||
void ScriptBrowser::updateFunctionTree()
|
||||
{
|
||||
ui->twFunctions->clear();
|
||||
ScriptEngineManager* sm = reportEditor()->scriptManager();
|
||||
QMap<QString,QTreeWidgetItem*> categ;
|
||||
foreach(ScriptFunctionDesc fd, sm->functionsDescribers()){
|
||||
|
Loading…
Reference in New Issue
Block a user