diff --git a/src/blackcore/application.cpp b/src/blackcore/application.cpp index 4bdea8a3d..1c50dcab7 100644 --- a/src/blackcore/application.cpp +++ b/src/blackcore/application.cpp @@ -1064,15 +1064,15 @@ namespace BlackCore } } - void CApplication::onChangedSwiftDbAccessibility(bool accessible) + void CApplication::onChangedSwiftDbAccessibility(bool accessible, const CUrl &url) { if (accessible) { - CLogMessage(this).info("swift DB reported accessible"); + CLogMessage(this).info("swift DB reported accessible: '%1'") << url.toQString(); } else { - CLogMessage(this).warning("swift DB not accessible"); + CLogMessage(this).warning("swift DB not accessible: '%1'") << url.toQString(); if (m_networkWatchDog) { CLogMessage(this).warning(m_networkWatchDog->getCheckInfo()); diff --git a/src/blackcore/application.h b/src/blackcore/application.h index 83710e2df..54273b2a0 100644 --- a/src/blackcore/application.h +++ b/src/blackcore/application.h @@ -492,7 +492,7 @@ namespace BlackCore void changedInternetAccessibility(bool accessible); //! DB accessibility changed - void changedSwiftDbAccessibility(bool accessible); + void changedSwiftDbAccessibility(bool accessible, const BlackMisc::Network::CUrl &testedUrl); protected: //! Setup read/synchronized @@ -575,7 +575,7 @@ namespace BlackCore void onChangedInternetAccessibility(bool accessible); //! Changed swift DB accessibility - void onChangedSwiftDbAccessibility(bool accessible); + void onChangedSwiftDbAccessibility(bool accessible, const BlackMisc::Network::CUrl &url); //! init logging system void initLogging(); diff --git a/src/blackcore/db/networkwatchdog.cpp b/src/blackcore/db/networkwatchdog.cpp index 588da4f4a..be7cba698 100644 --- a/src/blackcore/db/networkwatchdog.cpp +++ b/src/blackcore/db/networkwatchdog.cpp @@ -70,7 +70,7 @@ namespace BlackCore QString CNetworkWatchdog::getCheckInfo() const { - static const QString info("Internet accessible: %1 (good: %2/ bad: %3), swift DB accessible: %4 (good: %5/bad: %6)"); + static const QString info("Internet accessible: %1 (good: %2 / bad: %3), swift DB accessible: %4 (good: %5 / bad: %6)"); return info. arg(boolToYesNo(this->isInternetAccessible())).arg(m_goodCountInternet).arg(m_badCountInternet). arg(boolToYesNo(this->isSwiftDbAccessible())).arg(m_goodCountDb).arg(m_badCountDb); @@ -247,11 +247,12 @@ namespace BlackCore // trigger really queued if (oldDbAccessible != m_dbAccessible) { - QTimer::singleShot(0, this, [this] { emit this->changedSwiftDbAccessibility(m_dbAccessible);}); + const CUrl testUrl(this->dbTestUrl()); + QTimer::singleShot(0, this, [=] { emit this->changedSwiftDbAccessibility(m_dbAccessible, testUrl); }); } if (oldInternetAccessible != m_internetAccessible) { - QTimer::singleShot(0, this, [this] { emit this->changedInternetAccessibility(m_internetAccessible);}); + QTimer::singleShot(0, this, [this] { emit this->changedInternetAccessibility(m_internetAccessible); }); } } @@ -261,7 +262,7 @@ namespace BlackCore this->setWorkingSharedUrl(workingUrl); } - BlackMisc::Network::CUrl CNetworkWatchdog::dbTestUrl() + CUrl CNetworkWatchdog::dbTestUrl() { // requires global setup to be read const CUrl testUrl(sApp->getGlobalSetup().getDbHomePageUrl()); diff --git a/src/blackcore/db/networkwatchdog.h b/src/blackcore/db/networkwatchdog.h index d972b3971..08a89db27 100644 --- a/src/blackcore/db/networkwatchdog.h +++ b/src/blackcore/db/networkwatchdog.h @@ -113,7 +113,7 @@ namespace BlackCore signals: //! DB was available, but not longer is and vice versa - void changedSwiftDbAccessibility(bool available); + void changedSwiftDbAccessibility(bool available, const BlackMisc::Network::CUrl &url); //! Internet was available, but not longer is and vice versa void changedInternetAccessibility(bool available); diff --git a/src/blackgui/components/infobarwebreadersstatuscomponent.cpp b/src/blackgui/components/infobarwebreadersstatuscomponent.cpp index 8bb07c370..17467a674 100644 --- a/src/blackgui/components/infobarwebreadersstatuscomponent.cpp +++ b/src/blackgui/components/infobarwebreadersstatuscomponent.cpp @@ -38,9 +38,9 @@ namespace BlackGui m_timer.setObjectName("CInfoBarWebReadersStatusBase::CheckSwiftDbTimer"); bool c = connect(&m_timer, &QTimer::timeout, this, &CInfoBarWebReadersStatusBase::checkServerAndData); Q_ASSERT_X(c, Q_FUNC_INFO, "Failed connect"); - c = connect(sGui, &CGuiApplication::changedInternetAccessibility, this, &CInfoBarWebReadersStatusBase::accessibilityChanged); + c = connect(sGui, &CGuiApplication::changedInternetAccessibility, this, &CInfoBarWebReadersStatusBase::networkAccessibilityChanged); Q_ASSERT_X(c, Q_FUNC_INFO, "Failed connect"); - c = connect(sGui, &CGuiApplication::changedSwiftDbAccessibility, this, &CInfoBarWebReadersStatusBase::accessibilityChanged); + c = connect(sGui, &CGuiApplication::changedSwiftDbAccessibility, this, &CInfoBarWebReadersStatusBase::dbAccessibilityChanged); Q_ASSERT_X(c, Q_FUNC_INFO, "Failed connect"); if (sGui->hasWebDataServices()) @@ -85,12 +85,19 @@ namespace BlackGui if (!leds.isEmpty()) { this->setLedReadStates(leds, readState); } } - void CInfoBarWebReadersStatusBase::accessibilityChanged(bool accessible) + void CInfoBarWebReadersStatusBase::networkAccessibilityChanged(bool accessible) { Q_UNUSED(accessible); this->checkServerAndData(); } + void CInfoBarWebReadersStatusBase::dbAccessibilityChanged(bool accessible, const CUrl &testedUrl) + { + Q_UNUSED(accessible); + Q_UNUSED(testedUrl); + this->checkServerAndData(); + } + void CInfoBarWebReadersStatusBase::checkServerAndData() { const bool swift = sGui && sGui->isSwiftDbAccessible(); diff --git a/src/blackgui/components/infobarwebreadersstatuscomponent.h b/src/blackgui/components/infobarwebreadersstatuscomponent.h index 1ee48ab14..014e68bd7 100644 --- a/src/blackgui/components/infobarwebreadersstatuscomponent.h +++ b/src/blackgui/components/infobarwebreadersstatuscomponent.h @@ -14,6 +14,7 @@ #include "blackgui/blackguiexport.h" #include "blackgui/led.h" +#include "blackmisc/network/url.h" #include "blackmisc/network/entityflags.h" #include @@ -72,8 +73,11 @@ namespace BlackGui //! Data have been read void dataRead(BlackMisc::Network::CEntityFlags::Entity entities, BlackMisc::Network::CEntityFlags::ReadState readState, int count); - //! DB or network accessibility changed - void accessibilityChanged(bool accessible); + //! Network accessibility changed + void networkAccessibilityChanged(bool accessible); + + //! DB accessibility changed + void dbAccessibilityChanged(bool accessible, const BlackMisc::Network::CUrl &testedUrl); //! Check server status void checkServerAndData();