From 6f7e827492b1cadcfe6e4538b1fd48861f13f793 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Mon, 4 Sep 2017 15:34:09 +0200 Subject: [PATCH] Ref T148, in CDbLoadOverviewComponent do not trigger info object read if DB cannot be connected (only results in error messages) --- src/blackgui/components/dbloadoverviewcomponent.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/blackgui/components/dbloadoverviewcomponent.cpp b/src/blackgui/components/dbloadoverviewcomponent.cpp index e383d44cb..c49f8f2ea 100644 --- a/src/blackgui/components/dbloadoverviewcomponent.cpp +++ b/src/blackgui/components/dbloadoverviewcomponent.cpp @@ -29,9 +29,11 @@ namespace BlackGui ui(new Ui::CDbLoadOverviewComponent) { Q_ASSERT_X(sGui, Q_FUNC_INFO, "missing sGui"); - ui->setupUi(this); - this->admitCaches(); // in background + + //! \fixme KB 201709 It is hard to judgte if it is a good idea to trigger cache admit in a UI component + // althought admit happens in background, this component might trigger cache reads not needed (though it is not very likely) + this->admitCaches(); ui->lbl_DatabaseUrl->setTextFormat(Qt::RichText); ui->lbl_DatabaseUrl->setTextInteractionFlags(Qt::TextBrowserInteraction); @@ -187,7 +189,7 @@ namespace BlackGui static const QString imgFailed(":/diagona/icons/diagona/icons/cross-script.png"); const QString dbUrlHtml("  %3"); const QString url = sGui->getGlobalSetup().getDbHomePageUrl().getFullUrl(); - bool canConnect = CNetworkUtils::canConnect(sGui->getGlobalSetup().getDbHomePageUrl()); + bool canConnect = sGui->getWebDataServices() && sGui->getWebDataServices()->canConnectSwiftDb(); ui->lbl_DatabaseUrl->setText(dbUrlHtml.arg(canConnect ? imgOk : imgFailed, url, url)); ui->lbl_DatabaseUrl->setToolTip(url); @@ -333,14 +335,16 @@ namespace BlackGui { if (m_loadInProgress) { return; } if (!sGui || !sGui->hasWebDataServices()) { return; } + if (sGui->isShuttingDown()) { return; } bool direct = false; if (sGui->getWebDataServices()->getDbInfoDataReader() && sGui->getWebDataServices()->getDbInfoDataReader()->getInfoObjectCount() > 0) { direct = true; } - else + else if (sGui->getWebDataServices()->canConnectSwiftDb()) { + // do not trigger if cannot be connected sGui->getWebDataServices()->triggerReadOfDbInfoObjects(); }