GODT-1325: Add "already logged in" notification

This commit is contained in:
Alexander Bilyak
2021-11-22 23:27:16 +00:00
committed by Jakub
parent 961742fa53
commit 4a2ac813d3
6 changed files with 58 additions and 2 deletions

View File

@ -26,6 +26,7 @@ ColumnLayout {
id: root
property var user
property var userIndex
property var backend
spacing : 5
@ -250,7 +251,25 @@ ColumnLayout {
id: loginFinishedIndex
colorScheme: root.colorScheme
label: "Index:"
text: "0"
text: root.userIndex
}
}
RowLayout {
Button {
colorScheme: root.colorScheme
text: "Already logged in"
onClicked: {
root.backend.loginAlreadyLoggedIn(0+loginAlreadyLoggedInIndex.text)
user.resetLoginRequests()
}
}
TextField {
id: loginAlreadyLoggedInIndex
colorScheme: root.colorScheme
label: "Index:"
text: root.userIndex
}
}

View File

@ -436,6 +436,7 @@ Window {
colorScheme: root.colorScheme
backend: root
user: ((root.usersTest.count > usersListView.currentIndex) && usersListView.currentIndex != -1) ? root.usersTest.get(usersListView.currentIndex) : undefined
userIndex: usersListView.currentIndex - 1 // -1 because 0 index is fake user
}
}
@ -671,6 +672,7 @@ Window {
signal login2PasswordError(string errorMsg)
signal login2PasswordErrorAbort(string errorMsg)
signal loginFinished(int index)
signal loginAlreadyLoggedIn(int index)
signal internetOff()
signal internetOn()
@ -849,6 +851,9 @@ Window {
onLoginFinished: {
console.debug("<- loginFinished", index)
}
onLoginAlreadyLoggedIn: {
console.debug("<- loginAlreadyLoggedIn", index)
}
onInternetOff: {
console.debug("<- internetOff")

View File

@ -377,6 +377,7 @@ Item {
target: root.backend
onLoginFinished: rightContent.showAccount(index)
onLoginAlreadyLoggedIn: rightContent.showAccount(index)
}
}
}

View File

@ -57,6 +57,7 @@ QtObject {
root.updateIsLatestVersion,
root.loginConnectionError,
root.onlyPaidUsers,
root.alreadyLoggedIn,
root.enableBeta,
root.bugReportSendSuccess,
root.bugReportSendError,
@ -414,6 +415,29 @@ QtObject {
]
}
property Notification alreadyLoggedIn: Notification {
text: qsTr("This account is already signed it.")
icon: "./icons/ic-exclamation-circle-filled.svg"
type: Notification.NotificationType.Info
group: Notifications.Group.Configuration
Connections {
target: root.backend
onLoginAlreadyLoggedIn: {
root.alreadyLoggedIn.active = true
}
}
action: [
Action {
text: qsTr("OK")
onTriggered: {
root.alreadyLoggedIn.active = false
}
}
]
}
// Bug reports
property Notification bugReportSendSuccess: Notification {
text: qsTr("Thank you for the report. We'll get back to you as soon as we can.")