fix(GODT-2442): GUI changes for new bad event dialog.

This commit is contained in:
Xavier Michelon
2023-03-07 17:09:55 +01:00
parent 7fc907a874
commit c496d6c71c
11 changed files with 74 additions and 25 deletions

View File

@ -815,6 +815,17 @@ void QMLBackend::setMailServerSettings(int imapPort, int smtpPort, bool useSSLFo
}
//****************************************************************************************************************************************************
/// \param[in] userID The userID.
/// \param[in] doResync Did the user request a resync.
//****************************************************************************************************************************************************
void QMLBackend::sendBadEventUserFeedback(QString const &userID, bool doResync) {
HANDLE_EXCEPTION(
app().grpc().sendBadEventUserFeedback(userID, doResync);
)
}
//****************************************************************************************************************************************************
/// \param[in] imapPort The IMAP port.
/// \param[in] smtpPort The SMTP port.
@ -874,12 +885,11 @@ void QMLBackend::onUserBadEvent(QString const &userID, QString const &errorMessa
HANDLE_EXCEPTION(
SPUser const user = users_->getUserWithID(userID);
if (!user)
app().log().error(QString("Received bad event for unknown user %1").arg(user->id()));
user->setState(UserState::SignedOut);
emit userBadEvent(
tr("Internal error: %1 was automatically logged out. Please log in again or report this problem if the issue persists.").arg(user->primaryEmailOrUsername()),
errorMessage
);
app().log().error(QString("Received bad event for unknown user %1: %2").arg(user->id(), errorMessage));
// user->setState(UserState::SignedOut);
emit userBadEvent(userID,
tr("Bridge ran into an internal error and it is not able to proceed with the account %1. Synchronize your local database now or logout"
" to do it later. Synchronization time depends on the size of your mailbox.").arg(user->primaryEmailOrUsername()));
emit selectUser(userID);
emit showMainWindow();
)

View File

@ -173,6 +173,7 @@ public slots: // slot for signals received from QML -> To be forwarded to Bridge
void onResetFinished(); ///< Slot for the reset finish signal.
void onVersionChanged(); ///< Slot for the version change signal.
void setMailServerSettings(int imapPort, int smtpPort, bool useSSLForIMAP, bool useSSLForSMTP) const; ///< Forwards a connection mode change request from QML to gRPC
void sendBadEventUserFeedback(QString const &userID, bool doResync); ///< Slot the providing user feedback for a bad event.
public slots: // slot for signals received from gRPC that need transformation instead of simple forwarding
void onMailServerSettingsChanged(int imapPort, int smtpPort, bool useSSLForIMAP, bool useSSLForSMTP); ///< Slot for the ConnectionModeChanged gRPC event.
@ -222,7 +223,7 @@ signals: // Signals received from the Go backend, to be forwarded to QML
void addressChangedLogout(QString const &address); ///< Signal for the 'addressChangedLogout' gRPC stream event.
void apiCertIssue(); ///< Signal for the 'apiCertIssue' gRPC stream event.
void userDisconnected(QString const &username); ///< Signal for the 'userDisconnected' gRPC stream event.
void userBadEvent(QString const &description, QString const &errorMessage); ///< Signal for the 'userBadEvent' gRPC stream event.
void userBadEvent(QString const &userID, QString const &description); ///< Signal for the 'userBadEvent' gRPC stream event.
void internetOff(); ///< Signal for the 'internetOff' gRPC stream event.
void internetOn(); ///< Signal for the 'internetOn' gRPC stream event.
void resetFinished(); ///< Signal for the 'resetFinished' gRPC stream event.

View File

@ -1103,43 +1103,39 @@ QtObject {
}
property Notification userBadEvent: Notification {
title: qsTr("Your account was logged out")
title: qsTr("Internal error")
brief: title
description: "#PlaceHolderText"
icon: "./icons/ic-exclamation-circle-filled.svg"
type: Notification.NotificationType.Danger
group: Notifications.Group.Connection | Notifications.Group.Dialogs
property var bugReportMsg: "Reporting an issue:\n\n\"%1\"\n\nError: %2\n\nThe issue persists even after loggin back in."
property var errorMessage: ""
property var userID: ""
Connections {
target: Backend
function onUserBadEvent(description, errorMessage) {
root.userBadEvent.description = description
root.userBadEvent.errorMessage = errorMessage
function onUserBadEvent(userID, errorMessage) {
root.userBadEvent.userID = userID
root.userBadEvent.description = errorMessage
root.userBadEvent.active = true
}
}
action: [
Action {
text: qsTr("OK")
text: qsTr("Synchronize")
onTriggered: {
Backend.sendBadEventUserFeedback(root.userBadEvent.userID, true)
root.userBadEvent.active = false
}
},
Action {
text: qsTr("Report")
text: qsTr("Logout")
onTriggered: {
root.frontendMain.showBugReportAndPrefill(
root.userBadEvent.bugReportMsg.
arg( root.userBadEvent.description).
arg(root.userBadEvent.errorMessage)
)
Backend.sendBadEventUserFeedback(root.userBadEvent.userID, false)
root.userBadEvent.active = false
}
}