mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-18 16:17:03 +00:00
fix(GODT-2442): GUI changes for new bad event dialog.
This commit is contained in:
@ -53,6 +53,7 @@ void GRPCQtProxy::connectSignals() {
|
|||||||
connect(this, &GRPCQtProxy::logoutUserReceived, &usersTab, &UsersTab::logoutUser);
|
connect(this, &GRPCQtProxy::logoutUserReceived, &usersTab, &UsersTab::logoutUser);
|
||||||
connect(this, &GRPCQtProxy::setUserSplitModeReceived, &usersTab, &UsersTab::setUserSplitMode);
|
connect(this, &GRPCQtProxy::setUserSplitModeReceived, &usersTab, &UsersTab::setUserSplitMode);
|
||||||
connect(this, &GRPCQtProxy::configureUserAppleMailReceived, &usersTab, &UsersTab::configureUserAppleMail);
|
connect(this, &GRPCQtProxy::configureUserAppleMailReceived, &usersTab, &UsersTab::configureUserAppleMail);
|
||||||
|
connect(this, &GRPCQtProxy::sendBadEventUserFeedbackReceived, &usersTab, &UsersTab::processBadEventUserFeedback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -178,6 +179,15 @@ void GRPCQtProxy::setUserSplitMode(QString const &userID, bool makeItActive) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//****************************************************************************************************************************************************
|
||||||
|
/// \param[in] userID The userID.
|
||||||
|
/// \param[in] doResync Did the user request a resync?
|
||||||
|
//****************************************************************************************************************************************************
|
||||||
|
void GRPCQtProxy::sendBadEventUserFeedback(QString const &userID, bool doResync) {
|
||||||
|
emit sendBadEventUserFeedbackReceived(userID, doResync);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
/// \param[in] userID The userID.
|
/// \param[in] userID The userID.
|
||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
|
|||||||
@ -52,6 +52,7 @@ public: // member functions.
|
|||||||
void setDiskCachePath(QString const &path); ///< Forwards a setDiskCachePath call via a Qt signal.
|
void setDiskCachePath(QString const &path); ///< Forwards a setDiskCachePath call via a Qt signal.
|
||||||
void setIsAutomaticUpdateOn(bool on); ///< Forwards a SetIsAutomaticUpdateOn call via a Qt signal.
|
void setIsAutomaticUpdateOn(bool on); ///< Forwards a SetIsAutomaticUpdateOn call via a Qt signal.
|
||||||
void setUserSplitMode(QString const &userID, bool makeItActive); ///< Forwards a setUserSplitMode call via a Qt signal.
|
void setUserSplitMode(QString const &userID, bool makeItActive); ///< Forwards a setUserSplitMode call via a Qt signal.
|
||||||
|
void sendBadEventUserFeedback(QString const &userID, bool doResync); ///< Forwards a sendBadEventUserFeedback call via a Qt signal.
|
||||||
void logoutUser(QString const &userID); ///< Forwards a logoutUser call via a Qt signal.
|
void logoutUser(QString const &userID); ///< Forwards a logoutUser call via a Qt signal.
|
||||||
void removeUser(QString const &userID); ///< Forwards a removeUser call via a Qt signal.
|
void removeUser(QString const &userID); ///< Forwards a removeUser call via a Qt signal.
|
||||||
void configureUserAppleMail(QString const &userID, QString const &address); ///< Forwards a configureUserAppleMail call via a Qt signal.
|
void configureUserAppleMail(QString const &userID, QString const &address); ///< Forwards a configureUserAppleMail call via a Qt signal.
|
||||||
@ -72,6 +73,7 @@ signals:
|
|||||||
void setDiskCachePathReceived(QString const &path); ///< Signal for the setDiskCachePath gRPC call.
|
void setDiskCachePathReceived(QString const &path); ///< Signal for the setDiskCachePath gRPC call.
|
||||||
void setIsAutomaticUpdateOnReceived(bool on); ///< Signal for the SetIsAutomaticUpdateOn gRPC call.
|
void setIsAutomaticUpdateOnReceived(bool on); ///< Signal for the SetIsAutomaticUpdateOn gRPC call.
|
||||||
void setUserSplitModeReceived(QString const &userID, bool makeItActive); ///< Signal for the SetUserSplitModeReceived gRPC call.
|
void setUserSplitModeReceived(QString const &userID, bool makeItActive); ///< Signal for the SetUserSplitModeReceived gRPC call.
|
||||||
|
void sendBadEventUserFeedbackReceived(QString const &userID, bool doResync); ///< Signal for the SendBadEventUserFeedback gRPC call.
|
||||||
void logoutUserReceived(QString const &userID); ///< Signal for the LogoutUserReceived gRPC call.
|
void logoutUserReceived(QString const &userID); ///< Signal for the LogoutUserReceived gRPC call.
|
||||||
void removeUserReceived(QString const &userID); ///< Signal for the RemoveUserReceived gRPC call.
|
void removeUserReceived(QString const &userID); ///< Signal for the RemoveUserReceived gRPC call.
|
||||||
void configureUserAppleMailReceived(QString const &userID, QString const &address); ///< Signal for the ConfigureAppleMail gRPC call.
|
void configureUserAppleMailReceived(QString const &userID, QString const &address); ///< Signal for the ConfigureAppleMail gRPC call.
|
||||||
|
|||||||
@ -694,6 +694,17 @@ Status GRPCService::SetUserSplitMode(ServerContext *, UserSplitModeRequest const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//****************************************************************************************************************************************************
|
||||||
|
/// \param[in] request The request.
|
||||||
|
/// \return The status for the call.
|
||||||
|
//****************************************************************************************************************************************************
|
||||||
|
Status GRPCService::SendBadEventUserFeedback(ServerContext *, UserBadEventFeedbackRequest const *request, Empty *) {
|
||||||
|
app().log().debug(__FUNCTION__);
|
||||||
|
qtProxy_.sendBadEventUserFeedback(QString::fromStdString(request->userid()), request->doresync());
|
||||||
|
return Status::OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
/// \param[in] request The request.
|
/// \param[in] request The request.
|
||||||
/// \return The status for the call.
|
/// \return The status for the call.
|
||||||
|
|||||||
@ -88,12 +88,12 @@ public: // member functions.
|
|||||||
grpc::Status GetUserList(::grpc::ServerContext *, ::google::protobuf::Empty const *, ::grpc::UserListResponse *response) override;
|
grpc::Status GetUserList(::grpc::ServerContext *, ::google::protobuf::Empty const *, ::grpc::UserListResponse *response) override;
|
||||||
grpc::Status GetUser(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::grpc::User *response) override;
|
grpc::Status GetUser(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::grpc::User *response) override;
|
||||||
grpc::Status SetUserSplitMode(::grpc::ServerContext *, ::grpc::UserSplitModeRequest const *request, ::google::protobuf::Empty *) override;
|
grpc::Status SetUserSplitMode(::grpc::ServerContext *, ::grpc::UserSplitModeRequest const *request, ::google::protobuf::Empty *) override;
|
||||||
|
grpc::Status SendBadEventUserFeedback(::grpc::ServerContext *context, ::grpc::UserBadEventFeedbackRequest const *request, ::google::protobuf::Empty *response) override;
|
||||||
grpc::Status LogoutUser(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) override;
|
grpc::Status LogoutUser(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) override;
|
||||||
grpc::Status RemoveUser(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) override;
|
grpc::Status RemoveUser(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) override;
|
||||||
grpc::Status ConfigureUserAppleMail(::grpc::ServerContext *, ::grpc::ConfigureAppleMailRequest const *request, ::google::protobuf::Empty *) override;
|
grpc::Status ConfigureUserAppleMail(::grpc::ServerContext *, ::grpc::ConfigureAppleMailRequest const *request, ::google::protobuf::Empty *) override;
|
||||||
grpc::Status RunEventStream(::grpc::ServerContext *ctx, ::grpc::EventStreamRequest const *request, ::grpc::ServerWriter<::grpc::StreamEvent> *writer) override;
|
grpc::Status RunEventStream(::grpc::ServerContext *ctx, ::grpc::EventStreamRequest const *request, ::grpc::ServerWriter<::grpc::StreamEvent> *writer) override;
|
||||||
grpc::Status StopEventStream(::grpc::ServerContext *, ::google::protobuf::Empty const *, ::google::protobuf::Empty *) override;
|
grpc::Status StopEventStream(::grpc::ServerContext *, ::google::protobuf::Empty const *, ::google::protobuf::Empty *) override;
|
||||||
|
|
||||||
bool sendEvent(bridgepp::SPStreamEvent const &event); ///< Queue an event for sending through the event stream.
|
bool sendEvent(bridgepp::SPStreamEvent const &event); ///< Queue an event for sending through the event stream.
|
||||||
|
|
||||||
private: // member functions
|
private: // member functions
|
||||||
|
|||||||
@ -144,9 +144,6 @@ void UsersTab::onSendUserBadEvent() {
|
|||||||
app().log().error(QString("%1 failed. User is already signed out").arg(__FUNCTION__));
|
app().log().error(QString("%1 failed. User is already signed out").arg(__FUNCTION__));
|
||||||
}
|
}
|
||||||
|
|
||||||
user->setState(UserState::SignedOut);
|
|
||||||
users_.touch(index);
|
|
||||||
|
|
||||||
GRPCService &grpc = app().grpc();
|
GRPCService &grpc = app().grpc();
|
||||||
if (grpc.isStreaming()) {
|
if (grpc.isStreaming()) {
|
||||||
QString const userID = user->id();
|
QString const userID = user->id();
|
||||||
@ -344,5 +341,13 @@ void UsersTab::removeUser(QString const &userID) {
|
|||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
void UsersTab::configureUserAppleMail(QString const &userID, QString const &address) {
|
void UsersTab::configureUserAppleMail(QString const &userID, QString const &address) {
|
||||||
app().log().info(QString("Apple mail configuration was requested for user %1, address %2").arg(userID, address));
|
app().log().info(QString("Apple mail configuration was requested for user %1, address %2").arg(userID, address));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//****************************************************************************************************************************************************
|
||||||
|
/// \param[in] userID The userID.
|
||||||
|
/// \param[in] doResync Did the user request a resync?
|
||||||
|
//****************************************************************************************************************************************************
|
||||||
|
void UsersTab::processBadEventUserFeedback(QString const &userID, bool doResync) {
|
||||||
|
app().log().info(QString("Feedback received for bad event: doResync = %1, userID = %2").arg(doResync ? "true" : "false", userID));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,6 +54,7 @@ public slots:
|
|||||||
void logoutUser(QString const &userID); ///< slot for the logging out of a user.
|
void logoutUser(QString const &userID); ///< slot for the logging out of a user.
|
||||||
void removeUser(QString const &userID); ///< Slot for the removal of a user.
|
void removeUser(QString const &userID); ///< Slot for the removal of a user.
|
||||||
void configureUserAppleMail(QString const &userID, QString const &address); ///< Slot for the configuration of Apple mail.
|
void configureUserAppleMail(QString const &userID, QString const &address); ///< Slot for the configuration of Apple mail.
|
||||||
|
void processBadEventUserFeedback(QString const& userID, bool doResync); ///< Slot for the reception of a bad event user feedback.
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onAddUserButton(); ///< Add a user to the user list.
|
void onAddUserButton(); ///< Add a user to the user list.
|
||||||
|
|||||||
@ -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] imapPort The IMAP port.
|
||||||
/// \param[in] smtpPort The SMTP port.
|
/// \param[in] smtpPort The SMTP port.
|
||||||
@ -874,12 +885,11 @@ void QMLBackend::onUserBadEvent(QString const &userID, QString const &errorMessa
|
|||||||
HANDLE_EXCEPTION(
|
HANDLE_EXCEPTION(
|
||||||
SPUser const user = users_->getUserWithID(userID);
|
SPUser const user = users_->getUserWithID(userID);
|
||||||
if (!user)
|
if (!user)
|
||||||
app().log().error(QString("Received bad event for unknown user %1").arg(user->id()));
|
app().log().error(QString("Received bad event for unknown user %1: %2").arg(user->id(), errorMessage));
|
||||||
user->setState(UserState::SignedOut);
|
// user->setState(UserState::SignedOut);
|
||||||
emit userBadEvent(
|
emit userBadEvent(userID,
|
||||||
tr("Internal error: %1 was automatically logged out. Please log in again or report this problem if the issue persists.").arg(user->primaryEmailOrUsername()),
|
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"
|
||||||
errorMessage
|
" to do it later. Synchronization time depends on the size of your mailbox.").arg(user->primaryEmailOrUsername()));
|
||||||
);
|
|
||||||
emit selectUser(userID);
|
emit selectUser(userID);
|
||||||
emit showMainWindow();
|
emit showMainWindow();
|
||||||
)
|
)
|
||||||
|
|||||||
@ -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 onResetFinished(); ///< Slot for the reset finish signal.
|
||||||
void onVersionChanged(); ///< Slot for the version change 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 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
|
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.
|
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 addressChangedLogout(QString const &address); ///< Signal for the 'addressChangedLogout' gRPC stream event.
|
||||||
void apiCertIssue(); ///< Signal for the 'apiCertIssue' 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 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 internetOff(); ///< Signal for the 'internetOff' gRPC stream event.
|
||||||
void internetOn(); ///< Signal for the 'internetOn' gRPC stream event.
|
void internetOn(); ///< Signal for the 'internetOn' gRPC stream event.
|
||||||
void resetFinished(); ///< Signal for the 'resetFinished' gRPC stream event.
|
void resetFinished(); ///< Signal for the 'resetFinished' gRPC stream event.
|
||||||
|
|||||||
@ -1103,43 +1103,39 @@ QtObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
property Notification userBadEvent: Notification {
|
property Notification userBadEvent: Notification {
|
||||||
title: qsTr("Your account was logged out")
|
title: qsTr("Internal error")
|
||||||
brief: title
|
brief: title
|
||||||
description: "#PlaceHolderText"
|
description: "#PlaceHolderText"
|
||||||
icon: "./icons/ic-exclamation-circle-filled.svg"
|
icon: "./icons/ic-exclamation-circle-filled.svg"
|
||||||
type: Notification.NotificationType.Danger
|
type: Notification.NotificationType.Danger
|
||||||
group: Notifications.Group.Connection | Notifications.Group.Dialogs
|
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 userID: ""
|
||||||
property var errorMessage: ""
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: Backend
|
target: Backend
|
||||||
function onUserBadEvent(description, errorMessage) {
|
function onUserBadEvent(userID, errorMessage) {
|
||||||
root.userBadEvent.description = description
|
root.userBadEvent.userID = userID
|
||||||
root.userBadEvent.errorMessage = errorMessage
|
root.userBadEvent.description = errorMessage
|
||||||
root.userBadEvent.active = true
|
root.userBadEvent.active = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
action: [
|
action: [
|
||||||
Action {
|
Action {
|
||||||
text: qsTr("OK")
|
text: qsTr("Synchronize")
|
||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
Backend.sendBadEventUserFeedback(root.userBadEvent.userID, true)
|
||||||
root.userBadEvent.active = false
|
root.userBadEvent.active = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
Action {
|
Action {
|
||||||
text: qsTr("Report")
|
text: qsTr("Logout")
|
||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
root.frontendMain.showBugReportAndPrefill(
|
Backend.sendBadEventUserFeedback(root.userBadEvent.userID, false)
|
||||||
root.userBadEvent.bugReportMsg.
|
|
||||||
arg( root.userBadEvent.description).
|
|
||||||
arg(root.userBadEvent.errorMessage)
|
|
||||||
)
|
|
||||||
root.userBadEvent.active = false
|
root.userBadEvent.active = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -675,6 +675,18 @@ grpc::Status GRPCClient::setUserSplitMode(QString const &userID, bool active) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//****************************************************************************************************************************************************
|
||||||
|
/// \param[in] userID The userID.
|
||||||
|
/// \param[in] doResync Did the user request a resync.
|
||||||
|
//****************************************************************************************************************************************************
|
||||||
|
grpc::Status GRPCClient::sendBadEventUserFeedback(QString const &userID, bool doResync) {
|
||||||
|
UserBadEventFeedbackRequest request;
|
||||||
|
request.set_userid(userID.toStdString());
|
||||||
|
request.set_doresync(doResync);
|
||||||
|
return this->logGRPCCallStatus(stub_->SendBadEventUserFeedback(this->clientContext().get(), request, &empty), __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
/// \param[out] outUsers The user list.
|
/// \param[out] outUsers The user list.
|
||||||
/// \return The status code for the gRPC call.
|
/// \return The status code for the gRPC call.
|
||||||
|
|||||||
@ -173,6 +173,7 @@ public: // user related calls
|
|||||||
grpc::Status removeUser(QString const &userID); ///< Performs the 'removeUser' call.
|
grpc::Status removeUser(QString const &userID); ///< Performs the 'removeUser' call.
|
||||||
grpc::Status configureAppleMail(QString const &userID, QString const &address); ///< Performs the 'configureAppleMail' call.
|
grpc::Status configureAppleMail(QString const &userID, QString const &address); ///< Performs the 'configureAppleMail' call.
|
||||||
grpc::Status setUserSplitMode(QString const &userID, bool active); ///< Performs the 'SetUserSplitMode' call.
|
grpc::Status setUserSplitMode(QString const &userID, bool active); ///< Performs the 'SetUserSplitMode' call.
|
||||||
|
grpc::Status sendBadEventUserFeedback(QString const& userID, bool doResync); ///< Performs the 'SendBadEventUserFeedback' call.
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void toggleSplitModeFinished(QString const &userID);
|
void toggleSplitModeFinished(QString const &userID);
|
||||||
|
|||||||
Reference in New Issue
Block a user