forked from Public/monero-gui
confirm daemon running on exit
This commit is contained in:
33
main.qml
33
main.qml
@@ -686,6 +686,7 @@ ApplicationWindow {
|
||||
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
||||
informationPopup.text = "internal error";
|
||||
informationPopup.icon = StandardIcon.Critical
|
||||
informationPopup.onCloseCallback = null
|
||||
informationPopup.open()
|
||||
return
|
||||
}
|
||||
@@ -792,6 +793,9 @@ ApplicationWindow {
|
||||
daemonManager.daemonStartFailure.connect(onDaemonStartFailure);
|
||||
daemonManager.daemonStopped.connect(onDaemonStopped);
|
||||
|
||||
// Connect app exit to qml window exit handling
|
||||
mainApp.closing.connect(appWindow.close);
|
||||
|
||||
if(!walletsFound()) {
|
||||
rootItem.state = "wizard"
|
||||
} else {
|
||||
@@ -1249,10 +1253,39 @@ ApplicationWindow {
|
||||
id: notifier
|
||||
}
|
||||
}
|
||||
|
||||
onClosing: {
|
||||
|
||||
// If daemon is running - prompt user before exiting
|
||||
if(typeof daemonManager != undefined && daemonManager.running(persistentSettings.testnet)) {
|
||||
close.accepted = false;
|
||||
|
||||
// Show confirmation dialog
|
||||
confirmationDialog.title = qsTr("Daemon is running") + translationManager.emptyString;
|
||||
confirmationDialog.text = qsTr("Daemon will still be running in background when GUI is closed.");
|
||||
confirmationDialog.icon = StandardIcon.Question
|
||||
confirmationDialog.cancelText = qsTr("Stop daemon")
|
||||
confirmationDialog.onAcceptedCallback = function() {
|
||||
closeAccepted();
|
||||
}
|
||||
|
||||
confirmationDialog.onRejectedCallback = function() {
|
||||
daemonManager.stop(persistentSettings.testnet);
|
||||
closeAccepted();
|
||||
};
|
||||
|
||||
confirmationDialog.open()
|
||||
|
||||
} else {
|
||||
closeAccepted();
|
||||
}
|
||||
}
|
||||
|
||||
function closeAccepted(){
|
||||
// Close wallet non async on exit
|
||||
daemonManager.exit();
|
||||
walletManager.closeWallet();
|
||||
Qt.quit();
|
||||
}
|
||||
|
||||
function checkUpdates() {
|
||||
|
||||
Reference in New Issue
Block a user