lock: fix connection status

This commit is contained in:
tobtoht 2023-12-30 12:43:10 +01:00
parent 96bbdd126a
commit 6a3b3fc830
No known key found for this signature in database
GPG key ID: E45B10DD027D2472
3 changed files with 8 additions and 3 deletions

View file

@ -667,7 +667,6 @@ void MainWindow::onProxySettingsChanged() {
} }
void MainWindow::onOfflineMode(bool offline) { void MainWindow::onOfflineMode(bool offline) {
this->onConnectionStatusChanged(Wallet::ConnectionStatus_Disconnected);
m_wallet->setOffline(offline); m_wallet->setOffline(offline);
if (m_wallet->viewOnly()) { if (m_wallet->viewOnly()) {
@ -717,6 +716,9 @@ void MainWindow::onRefreshSync(int height, int target) {
void MainWindow::onConnectionStatusChanged(int status) void MainWindow::onConnectionStatusChanged(int status)
{ {
// Note: Wallet does not emit this signal unless status is changed, so calling this function from MainWindow may
// result in the wrong connection status being displayed.
qDebug() << "Wallet connection status changed " << Utils::QtEnumToString(static_cast<Wallet::ConnectionStatus>(status)); qDebug() << "Wallet connection status changed " << Utils::QtEnumToString(static_cast<Wallet::ConnectionStatus>(status));
// Update connection info in status bar. // Update connection info in status bar.

View file

@ -274,8 +274,11 @@ void Wallet::setSeedLanguage(const QString &lang)
// #################### Node connection #################### // #################### Node connection ####################
void Wallet::setOffline(bool offline) const { void Wallet::setOffline(bool offline) {
m_wallet2->set_offline(offline); m_wallet2->set_offline(offline);
if (offline) {
setConnectionStatus(Wallet::ConnectionStatus_Disconnected);
}
} }
void Wallet::setTrustedDaemon(bool arg) { void Wallet::setTrustedDaemon(bool arg) {

View file

@ -193,7 +193,7 @@ public:
// ##### Node connection ##### // ##### Node connection #####
void setOffline(bool offline) const; void setOffline(bool offline);
//! indicates if daemon is trusted //! indicates if daemon is trusted
void setTrustedDaemon(bool arg); void setTrustedDaemon(bool arg);