mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-14 22:46:44 +00:00
GODT-1062: Fix lost notification bar when window is closed
This commit is contained in:
committed by
Jakub Cuth
parent
feeb7179f5
commit
fd73ec6861
@ -107,17 +107,21 @@ Item {
|
|||||||
gui.openMainWindow(false)
|
gui.openMainWindow(false)
|
||||||
if (go.isConnectionOK) {
|
if (go.isConnectionOK) {
|
||||||
if( winMain.updateState=="noInternet") {
|
if( winMain.updateState=="noInternet") {
|
||||||
go.setUpdateState("upToDate")
|
go.updateState = "upToDate"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
go.setUpdateState("noInternet")
|
go.updateState = "noInternet"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onSetUpdateState : {
|
onUpdateStateChanged : {
|
||||||
|
// if main window is closed - most probably it is destroyed (see closeMainWindow())
|
||||||
|
if (winMain == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
// once app is outdated prevent from state change
|
// once app is outdated prevent from state change
|
||||||
if (winMain.updateState != "forceUpdate") {
|
if (winMain.updateState != "forceUpdate") {
|
||||||
winMain.updateState = updateState
|
winMain.updateState = go.updateState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,15 +133,14 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onNotifyManualUpdate: {
|
onNotifyManualUpdate: {
|
||||||
go.setUpdateState("oldVersion")
|
go.updateState = "oldVersion"
|
||||||
}
|
}
|
||||||
|
|
||||||
onNotifyManualUpdateRestartNeeded: {
|
onNotifyManualUpdateRestartNeeded: {
|
||||||
if (!winMain.dialogUpdate.visible) {
|
if (!winMain.dialogUpdate.visible) {
|
||||||
gui.openMainWindow(true)
|
|
||||||
winMain.dialogUpdate.show()
|
winMain.dialogUpdate.show()
|
||||||
}
|
}
|
||||||
go.setUpdateState("updateRestart")
|
go.updateState = "updateRestart"
|
||||||
winMain.dialogUpdate.finished(false)
|
winMain.dialogUpdate.finished(false)
|
||||||
|
|
||||||
// after manual update - just retart immidiatly
|
// after manual update - just retart immidiatly
|
||||||
@ -147,28 +150,25 @@ Item {
|
|||||||
|
|
||||||
onNotifyManualUpdateError: {
|
onNotifyManualUpdateError: {
|
||||||
if (!winMain.dialogUpdate.visible) {
|
if (!winMain.dialogUpdate.visible) {
|
||||||
gui.openMainWindow(true)
|
|
||||||
winMain.dialogUpdate.show()
|
winMain.dialogUpdate.show()
|
||||||
}
|
}
|
||||||
go.setUpdateState("updateError")
|
go.updateState = "updateError"
|
||||||
winMain.dialogUpdate.finished(true)
|
winMain.dialogUpdate.finished(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
onNotifyForceUpdate : {
|
onNotifyForceUpdate : {
|
||||||
go.setUpdateState("forceUpdate")
|
go.updateState = "forceUpdate"
|
||||||
if (!winMain.dialogUpdate.visible) {
|
if (!winMain.dialogUpdate.visible) {
|
||||||
gui.openMainWindow(true)
|
|
||||||
winMain.dialogUpdate.show()
|
winMain.dialogUpdate.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onNotifySilentUpdateRestartNeeded: {
|
onNotifySilentUpdateRestartNeeded: {
|
||||||
go.setUpdateState("updateRestart")
|
go.updateState = "updateRestart"
|
||||||
}
|
}
|
||||||
|
|
||||||
onNotifySilentUpdateError: {
|
onNotifySilentUpdateError: {
|
||||||
go.setUpdateState("updateError")
|
go.updateState = "updateError"
|
||||||
gui.openMainWindow(true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onNotifyLogout : {
|
onNotifyLogout : {
|
||||||
@ -287,9 +287,17 @@ Item {
|
|||||||
if (showAndRise) {
|
if (showAndRise) {
|
||||||
gui.winMain.showAndRise()
|
gui.winMain.showAndRise()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// restore update notification bar: trigger updateStateChanged
|
||||||
|
var tmp = go.updateState
|
||||||
|
go.updateState = ""
|
||||||
|
go.updateState = tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeMainWindow () {
|
function closeMainWindow () {
|
||||||
|
// Historical reasons: once upon a time there was a report about high GPU
|
||||||
|
// usage on MacOS while bridge is closed. Legends say that destroying
|
||||||
|
// MainWindow solved this.
|
||||||
gui.winMain.hide()
|
gui.winMain.hide()
|
||||||
gui.winMain.destroy(5000)
|
gui.winMain.destroy(5000)
|
||||||
gui.winMain = null
|
gui.winMain = null
|
||||||
|
|||||||
@ -96,17 +96,17 @@ Item {
|
|||||||
go.isConnectionOK = isAvailable
|
go.isConnectionOK = isAvailable
|
||||||
if (go.isConnectionOK) {
|
if (go.isConnectionOK) {
|
||||||
if( winMain.updateState==gui.enums.statusNoInternet) {
|
if( winMain.updateState==gui.enums.statusNoInternet) {
|
||||||
go.setUpdateState(gui.enums.statusUpToDate)
|
go.updateState = gui.enums.statusUpToDate
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
go.setUpdateState(gui.enums.statusNoInternet)
|
go.updateState = gui.enums.statusNoInternet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onSetUpdateState : {
|
onUpdateStateChanged : {
|
||||||
// once app is outdated prevent from state change
|
// once app is outdated prevent from state change
|
||||||
if (winMain.updateState != "forceUpdate") {
|
if (winMain.updateState != "forceUpdate") {
|
||||||
winMain.updateState = updateState
|
winMain.updateState = go.updateState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,14 +207,14 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onNotifyManualUpdate: {
|
onNotifyManualUpdate: {
|
||||||
go.setUpdateState("oldVersion")
|
go.updateState = "oldVersion"
|
||||||
}
|
}
|
||||||
|
|
||||||
onNotifyManualUpdateRestartNeeded: {
|
onNotifyManualUpdateRestartNeeded: {
|
||||||
if (!winMain.dialogUpdate.visible) {
|
if (!winMain.dialogUpdate.visible) {
|
||||||
winMain.dialogUpdate.show()
|
winMain.dialogUpdate.show()
|
||||||
}
|
}
|
||||||
go.setUpdateState("updateRestart")
|
go.updateState = "updateRestart"
|
||||||
winMain.dialogUpdate.finished(false)
|
winMain.dialogUpdate.finished(false)
|
||||||
|
|
||||||
// after manual update - just retart immidiatly
|
// after manual update - just retart immidiatly
|
||||||
@ -226,23 +226,23 @@ Item {
|
|||||||
if (!winMain.dialogUpdate.visible) {
|
if (!winMain.dialogUpdate.visible) {
|
||||||
winMain.dialogUpdate.show()
|
winMain.dialogUpdate.show()
|
||||||
}
|
}
|
||||||
go.setUpdateState("updateError")
|
go.updateState = "updateError"
|
||||||
winMain.dialogUpdate.finished(true)
|
winMain.dialogUpdate.finished(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
onNotifyForceUpdate : {
|
onNotifyForceUpdate : {
|
||||||
go.setUpdateState("forceUpdate")
|
go.updateState = "forceUpdate"
|
||||||
if (!winMain.dialogUpdate.visible) {
|
if (!winMain.dialogUpdate.visible) {
|
||||||
winMain.dialogUpdate.show()
|
winMain.dialogUpdate.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onNotifySilentUpdateRestartNeeded: {
|
onNotifySilentUpdateRestartNeeded: {
|
||||||
go.setUpdateState("updateRestart")
|
go.updateState = "updateRestart"
|
||||||
}
|
}
|
||||||
|
|
||||||
onNotifySilentUpdateError: {
|
onNotifySilentUpdateError: {
|
||||||
go.setUpdateState("updateError")
|
go.updateState = "updateError"
|
||||||
}
|
}
|
||||||
|
|
||||||
onNotifyLogout : {
|
onNotifyLogout : {
|
||||||
|
|||||||
@ -299,6 +299,7 @@ Window {
|
|||||||
property string fullversion : "QA.1.0 (d9f8sdf9) 2020-02-19T10:57:23+01:00"
|
property string fullversion : "QA.1.0 (d9f8sdf9) 2020-02-19T10:57:23+01:00"
|
||||||
property string downloadLink: "https://protonmail.com/download/beta/protonmail-bridge-1.1.5-1.x86_64.rpm;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;"
|
property string downloadLink: "https://protonmail.com/download/beta/protonmail-bridge-1.1.5-1.x86_64.rpm;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;"
|
||||||
|
|
||||||
|
property string updateState
|
||||||
property string updateVersion : "QA.1.0"
|
property string updateVersion : "QA.1.0"
|
||||||
property bool updateCanInstall: true
|
property bool updateCanInstall: true
|
||||||
property string updateLandingPage : "https://protonmail.com/bridge/download/"
|
property string updateLandingPage : "https://protonmail.com/bridge/download/"
|
||||||
@ -340,7 +341,6 @@ Window {
|
|||||||
|
|
||||||
signal notifyPortIssue(bool busyPortIMAP, bool busyPortSMTP)
|
signal notifyPortIssue(bool busyPortIMAP, bool busyPortSMTP)
|
||||||
signal notifyVersionIsTheLatest()
|
signal notifyVersionIsTheLatest()
|
||||||
signal setUpdateState(string updateState)
|
|
||||||
signal notifyKeychainRebuild()
|
signal notifyKeychainRebuild()
|
||||||
signal notifyHasNoKeychain()
|
signal notifyHasNoKeychain()
|
||||||
|
|
||||||
|
|||||||
@ -856,6 +856,7 @@ Window {
|
|||||||
property string fullversion : "QA.1.0 (d9f8sdf9) 2020-02-19T10:57:23+01:00"
|
property string fullversion : "QA.1.0 (d9f8sdf9) 2020-02-19T10:57:23+01:00"
|
||||||
property string downloadLink: "https://protonmail.com/download/beta/protonmail-bridge-1.1.5-1.x86_64.rpm;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;"
|
property string downloadLink: "https://protonmail.com/download/beta/protonmail-bridge-1.1.5-1.x86_64.rpm;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;"
|
||||||
|
|
||||||
|
property string updateState
|
||||||
property string updateVersion : "q0.1.0"
|
property string updateVersion : "q0.1.0"
|
||||||
property bool updateCanInstall: true
|
property bool updateCanInstall: true
|
||||||
property string updateLandingPage : "https://protonmail.com/import-export/download/"
|
property string updateLandingPage : "https://protonmail.com/import-export/download/"
|
||||||
@ -900,7 +901,6 @@ Window {
|
|||||||
signal showQuit()
|
signal showQuit()
|
||||||
|
|
||||||
signal notifyVersionIsTheLatest()
|
signal notifyVersionIsTheLatest()
|
||||||
signal setUpdateState(string updateState)
|
|
||||||
|
|
||||||
signal showMainWin()
|
signal showMainWin()
|
||||||
signal hideMainWin()
|
signal hideMainWin()
|
||||||
|
|||||||
@ -53,6 +53,7 @@ type GoQMLInterface struct {
|
|||||||
_ string `property:"fullversion"`
|
_ string `property:"fullversion"`
|
||||||
_ string `property:"downloadLink"`
|
_ string `property:"downloadLink"`
|
||||||
|
|
||||||
|
_ string `property:"updateState"`
|
||||||
_ string `property:"updateVersion"`
|
_ string `property:"updateVersion"`
|
||||||
_ bool `property:"updateCanInstall"`
|
_ bool `property:"updateCanInstall"`
|
||||||
_ string `property:"updateLandingPage"`
|
_ string `property:"updateLandingPage"`
|
||||||
@ -77,7 +78,6 @@ type GoQMLInterface struct {
|
|||||||
_ string `property:"versionCheckFailed"`
|
_ string `property:"versionCheckFailed"`
|
||||||
//
|
//
|
||||||
_ func(isAvailable bool) `signal:"setConnectionStatus"`
|
_ func(isAvailable bool) `signal:"setConnectionStatus"`
|
||||||
_ func(updateState string) `signal:"setUpdateState"`
|
|
||||||
_ func() `slot:"checkInternet"`
|
_ func() `slot:"checkInternet"`
|
||||||
|
|
||||||
_ func() `slot:"setToRestart"`
|
_ func() `slot:"setToRestart"`
|
||||||
|
|||||||
@ -50,6 +50,7 @@ type GoQMLInterface struct {
|
|||||||
_ string `property:"fullversion"`
|
_ string `property:"fullversion"`
|
||||||
_ string `property:"downloadLink"`
|
_ string `property:"downloadLink"`
|
||||||
|
|
||||||
|
_ string `property:"updateState"`
|
||||||
_ string `property:"updateVersion"`
|
_ string `property:"updateVersion"`
|
||||||
_ bool `property:"updateCanInstall"`
|
_ bool `property:"updateCanInstall"`
|
||||||
_ string `property:"updateLandingPage"`
|
_ string `property:"updateLandingPage"`
|
||||||
@ -82,9 +83,8 @@ type GoQMLInterface struct {
|
|||||||
_ float32 `property:"progress"`
|
_ float32 `property:"progress"`
|
||||||
_ string `property:"progressDescription"`
|
_ string `property:"progressDescription"`
|
||||||
|
|
||||||
_ func(isAvailable bool) `signal:"setConnectionStatus"`
|
_ func(isAvailable bool) `signal:"setConnectionStatus"`
|
||||||
_ func(updateState string) `signal:"setUpdateState"`
|
_ func() `slot:"checkInternet"`
|
||||||
_ func() `slot:"checkInternet"`
|
|
||||||
|
|
||||||
_ func() `slot:"setToRestart"`
|
_ func() `slot:"setToRestart"`
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user