Merge branch '1.4' into 1.4_QJSEngine

This commit is contained in:
Arin Alexander 2017-02-22 04:00:10 +03:00
commit 1d3646bd1a
6 changed files with 60 additions and 12 deletions

View File

@ -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);

View File

@ -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())

View File

@ -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();

View File

@ -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">

View File

@ -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);

View File

@ -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()){