GODT-1320: Add loading property to each action within a notification

This commit is contained in:
Alexander Bilyak
2021-10-04 16:12:12 +02:00
committed by Jakub
parent ecc1c34b16
commit 1141ea27e2
4 changed files with 56 additions and 11 deletions

View File

@ -110,7 +110,7 @@ Dialog {
secondary: index > 0
loading: notification.loading
loading: modelData.loading
}
}
}

View File

@ -39,7 +39,6 @@ QtObject {
property bool dismissed: false
property bool active: false
property bool loading: false
readonly property var occurred: active ? new Date() : undefined
property var data

View File

@ -353,6 +353,7 @@ QtObject {
action: [
Action {
id: disableBeta_remindLater
text: qsTr("Remind me later")
onTriggered: {
@ -360,10 +361,12 @@ QtObject {
}
},
Action {
id: disableBeta_disable
text: qsTr("Disable and restart")
onTriggered: {
root.backend.toggleBeta(false)
root.disableBeta.loading = true
disableBeta_disable.loading = true
disableBeta_remindLater.enabled = false
}
}
]
@ -647,21 +650,26 @@ QtObject {
target: (root && root.enableSplitMode && root.enableSplitMode.user ) ? root.enableSplitMode.user : null
onToggleSplitModeFinished: {
root.enableSplitMode.active = false
root.enableSplitMode.loading = false
enableSplitMode_enable.loading = false
enableSplitMode_cancel.enabled = true
}
}
action: [
Action {
id: enableSplitMode_cancel
text: qsTr("Cancel")
onTriggered: {
root.enableSplitMode.active = false
}
},
Action {
id: enableSplitMode_enable
text: qsTr("Enable split mode")
onTriggered: {
root.enableSplitMode.loading = true
enableSplitMode_enable.loading = true
enableSplitMode_cancel.enabled = false
root.enableSplitMode.user.toggleSplitMode(true)
}
}
@ -686,21 +694,26 @@ QtObject {
target: root.backend
onChangeLocalCacheFinished: {
root.disableLocalCache.active = false
root.disableLocalCache.loading = false
disableLocalCache_disable.loading = false
disableLocalCache_cancel.enabled = true
}
}
action: [
Action {
id: disableLocalCache_cancel
text: qsTr("Cancel")
onTriggered: {
root.disableLocalCache.active = false
}
},
Action {
id: disableLocalCache_disable
text: qsTr("Disable and restart")
onTriggered: {
root.disableLocalCache.loading = true
disableLocalCache_disable.loading = true
disableLocalCache_cancel.enabled = false
root.backend.changeLocalCache(false, root.backend.diskCachePath)
}
}
@ -728,19 +741,24 @@ QtObject {
target: root.backend
onChangeLocalCacheFinished: {
root.enableLocalCache.active = false
root.enableLocalCache.loading = false
enableLocalCache_enable.loading = false
enableLocalCache_cancel.enabled = true
}
}
action: [
Action {
id: enableLocalCache_enable
text: qsTr("Enable and restart")
onTriggered: {
root.enableLocalCache.loading = true
enableLocalCache_enable.loading = true
enableLocalCache_cancel.enabled = false
root.backend.changeLocalCache(true, root.enableLocalCache.path)
}
},
Action {
id: enableLocalCache_cancel
text: qsTr("Cancel")
onTriggered: {
root.enableLocalCache.active = false
@ -769,21 +787,26 @@ QtObject {
target: root.backend
onResetFinished: {
root.resetBridge.active = false
root.resetBridge.loading = false
resetBridge_reset.loading = false
resetBridge_cancel.enabled = true
}
}
action: [
Action {
id: resetBridge_cancel
text: qsTr("Cancel")
onTriggered: {
root.resetBridge.active = false
}
},
Action {
id: resetBridge_reset
text: qsTr("Reset and restart")
onTriggered: {
root.resetBridge.loading = true
resetBridge_reset.loading = true
resetBridge_cancel.enabled = false
root.backend.triggerReset()
}
}

View File

@ -0,0 +1,23 @@
// Copyright (c) 2021 Proton Technologies AG
//
// This file is part of ProtonMail Bridge.
//
// ProtonMail Bridge is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ProtonMail Bridge is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
import QtQuick 2.12
import QtQuick.Templates 2.12 as T
T.Action {
property bool loading
}