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