don't show daemon popup when connected

This commit is contained in:
Jaquee 2017-02-05 13:49:25 +01:00
parent 979acf774a
commit 8a0163f14a
No known key found for this signature in database
GPG key ID: 384E52B09F45DC39
2 changed files with 18 additions and 16 deletions

View file

@ -265,10 +265,20 @@ ApplicationWindow {
} }
function onWalletConnectionStatusChanged(status){ function onWalletConnectionStatusChanged(status){
console.log("Wallet connection status changed") console.log("Wallet connection status changed " + status)
middlePanel.updateStatus(); middlePanel.updateStatus();
leftPanel.networkStatus.connected = status leftPanel.networkStatus.connected = status
leftPanel.progressBar.visible = (status === Wallet.ConnectionStatus_Connected) && !daemonSynced leftPanel.progressBar.visible = (status === Wallet.ConnectionStatus_Connected) && !daemonSynced
// If wallet isnt connected and no daemon is running - Ask
if(!walletInitialized && status === Wallet.ConnectionStatus_Disconnected && !daemonManager.running()){
daemonManagerDialog.open();
}
// initialize transaction history once wallet is initialized first time;
if (!walletInitialized) {
currentWallet.history.refresh()
walletInitialized = true
}
} }
function onWalletOpened(wallet) { function onWalletOpened(wallet) {
@ -345,12 +355,6 @@ ApplicationWindow {
// Update transfer page status // Update transfer page status
middlePanel.updateStatus(); middlePanel.updateStatus();
// If wallet isnt connected and no daemon is running - Ask
if(currentWallet.connected === Wallet.ConnectionStatus_Disconnected && !daemonManager.running() && !walletInitialized){
daemonManagerDialog.open();
}
// Refresh is succesfull if blockchain height > 1 // Refresh is succesfull if blockchain height > 1
if (currentWallet.blockChainHeight() > 1){ if (currentWallet.blockChainHeight() > 1){
@ -368,11 +372,6 @@ ApplicationWindow {
} }
} }
// initialize transaction history once wallet is initializef first time;
if (!walletInitialized) {
currentWallet.history.refresh()
walletInitialized = true
}
onWalletUpdate(); onWalletUpdate();
} }

View file

@ -115,7 +115,8 @@ void Wallet::updateConnectionStatusAsync()
QFuture<Monero::Wallet::ConnectionStatus> future = connectionWatcher->future(); QFuture<Monero::Wallet::ConnectionStatus> future = connectionWatcher->future();
connectionWatcher->deleteLater(); connectionWatcher->deleteLater();
ConnectionStatus newStatus = static_cast<ConnectionStatus>(future.result()); ConnectionStatus newStatus = static_cast<ConnectionStatus>(future.result());
if (newStatus != m_connectionStatus) { if (newStatus != m_connectionStatus || !m_initialized) {
m_initialized = true;
m_connectionStatus = newStatus; m_connectionStatus = newStatus;
emit connectionStatusChanged(newStatus); emit connectionStatusChanged(newStatus);
} }
@ -131,7 +132,6 @@ Wallet::ConnectionStatus Wallet::connected(bool forceCheck)
if (forceCheck || !m_initialized || (m_connectionStatusTime.elapsed() / 1000 > m_connectionStatusTtl && !m_connectionStatusRunning) || m_connectionStatusTime.elapsed() > 30000) { if (forceCheck || !m_initialized || (m_connectionStatusTime.elapsed() / 1000 > m_connectionStatusTtl && !m_connectionStatusRunning) || m_connectionStatusTime.elapsed() > 30000) {
qDebug() << "Checking connection status"; qDebug() << "Checking connection status";
m_connectionStatusRunning = true; m_connectionStatusRunning = true;
m_initialized = true;
m_connectionStatusTime.restart(); m_connectionStatusTime.restart();
updateConnectionStatusAsync(); updateConnectionStatusAsync();
} }
@ -184,8 +184,11 @@ bool Wallet::init(const QString &daemonAddress, quint64 upperTransactionLimit, b
void Wallet::initAsync(const QString &daemonAddress, quint64 upperTransactionLimit, bool isRecovering, quint64 restoreHeight) void Wallet::initAsync(const QString &daemonAddress, quint64 upperTransactionLimit, bool isRecovering, quint64 restoreHeight)
{ {
qDebug() << "initAsync: " + daemonAddress; qDebug() << "initAsync: " + daemonAddress;
m_connectionStatus = Wallet::ConnectionStatus_Disconnected; // Change status to disconnected if connected
emit connectionStatusChanged(m_connectionStatus); if(m_connectionStatus != Wallet::ConnectionStatus_Disconnected) {
m_connectionStatus = Wallet::ConnectionStatus_Disconnected;
emit connectionStatusChanged(m_connectionStatus);
}
QFuture<bool> future = QtConcurrent::run(this, &Wallet::init, QFuture<bool> future = QtConcurrent::run(this, &Wallet::init,
daemonAddress, upperTransactionLimit, isRecovering, restoreHeight); daemonAddress, upperTransactionLimit, isRecovering, restoreHeight);