Other: wired 'use SSL for IMAP' toggle in bridge-gui-tester.

This commit is contained in:
Xavier Michelon
2022-10-28 11:15:23 +02:00
committed by James Houlahan
parent d9762010fa
commit f1160a11af
6 changed files with 52 additions and 2 deletions

View File

@ -45,6 +45,7 @@ void GRPCQtProxy::connectSignals()
connect(this, &GRPCQtProxy::setIsStreamingReceived, &settingsTab, &SettingsTab::setIsStreaming);
connect(this, &GRPCQtProxy::setClientPlatformReceived, &settingsTab, &SettingsTab::setClientPlatform);
connect(this, &GRPCQtProxy::changePortsReceived, &settingsTab, &SettingsTab::changePorts);
connect(this, &GRPCQtProxy::setUseSSLForIMAPReceived, &settingsTab, &SettingsTab::setUseSSLForIMAP);
connect(this, &GRPCQtProxy::setUseSSLForSMTPReceived, &settingsTab, &SettingsTab::setUseSSLForSMTP);
connect(this, &GRPCQtProxy::setIsDoHEnabledReceived, &settingsTab, &SettingsTab::setIsDoHEnabled);
connect(this, &GRPCQtProxy::setDiskCachePathReceived, &settingsTab, &SettingsTab::setDiskCachePath);
@ -145,6 +146,15 @@ void GRPCQtProxy::changePorts(qint32 imapPort, qint32 smtpPort)
}
//****************************************************************************************************************************************************
/// \param[in] use Should SMTP use SSL?
//****************************************************************************************************************************************************
void GRPCQtProxy::setUseSSLForIMAP(bool use)
{
emit setUseSSLForIMAPReceived(use);
}
//****************************************************************************************************************************************************
/// \param[in] use Should SMTP use SSL?
//****************************************************************************************************************************************************

View File

@ -48,6 +48,7 @@ public: // member functions.
void setIsStreaming(bool isStreaming); ///< Forward a isStreaming internal messages via a Qt signal.
void setClientPlatform(QString const &clientPlatform); ///< Forward s setClientPlatform call via a Qt signal.
void changePorts(qint32 imapPort, qint32 smtpPort); ///< Forwards a ChangePorts call via a Qt signal.
void setUseSSLForIMAP(bool use); ///< Forwards a SetUseSSLForIMAP call via a Qt signal.
void setUseSSLForSMTP(bool use); ///< Forwards a SetUseSSLForSMTP call via a Qt signal.
void setIsDoHEnabled(bool enabled); ///< Forwards a setIsDoHEnabled call via a Qt signal.
void setDiskCachePath(QString const &path); ///< Forwards a setDiskCachePath call via a Qt signal.
@ -68,6 +69,7 @@ signals:
void setIsStreamingReceived(bool isStreaming); ///< Signal for the IsStreaming internal message.
void setClientPlatformReceived(QString const &clientPlatform); ///< Signal for the SetClientPlatform gRPC call.
void changePortsReceived(qint32 imapPort, qint32 smtpPort); ///< Signal for the ChangePorts gRPC call.
void setUseSSLForIMAPReceived(bool use); ///< Signal for the SetUseSSLForIMAP gRPC call.
void setUseSSLForSMTPReceived(bool use); ///< Signal for the SetUseSSLForSMTP gRPC call.
void setIsDoHEnabledReceived(bool enabled); ///< Signal for the SetIsDoHEnabled gRPC call.
void setDiskCachePathReceived(QString const &path); ///< Signal for the setDiskCachePath gRPC call.

View File

@ -634,6 +634,31 @@ Status GRPCService::IsDoHEnabled(ServerContext *, Empty const *, BoolValue *resp
}
//****************************************************************************************************************************************************
/// \param[in] request The request.
/// \return The status for the call.
//****************************************************************************************************************************************************
Status GRPCService::SetUseSslForImap(ServerContext *, BoolValue const *request, Empty *)
{
app().log().debug(__FUNCTION__);
qtProxy_.setUseSSLForIMAP(request->value());
qtProxy_.sendDelayedEvent(newUseSslForImapFinishedEvent());
return Status::OK;
}
//****************************************************************************************************************************************************
/// \param[out] response The response.
/// \return The status for the call.
//****************************************************************************************************************************************************
Status GRPCService::UseSslForImap(ServerContext *, Empty const *, BoolValue *response)
{
app().log().debug(__FUNCTION__);
response->set_value(app().mainWindow().settingsTab().useSSLForIMAP());
return Status::OK;
}
//****************************************************************************************************************************************************
/// \param[in] request The request.
/// \return The status for the call.
@ -924,5 +949,3 @@ bool GRPCService::sendEvent(SPStreamEvent const &event)
}

View File

@ -82,6 +82,8 @@ public: // member functions.
grpc::Status IsDoHEnabled(::grpc::ServerContext *, ::google::protobuf::Empty const*, ::google::protobuf::BoolValue *response) override;
grpc::Status SetUseSslForSmtp(::grpc::ServerContext *, ::google::protobuf::BoolValue const *request, ::google::protobuf::Empty *) override;
grpc::Status UseSslForSmtp(::grpc::ServerContext *, ::google::protobuf::Empty const*, ::google::protobuf::BoolValue *response) override;
grpc::Status SetUseSslForImap(::grpc::ServerContext *, ::google::protobuf::BoolValue const *request, ::google::protobuf::Empty *) override;
grpc::Status UseSslForImap(::grpc::ServerContext *, ::google::protobuf::Empty const*, ::google::protobuf::BoolValue *response) override;
grpc::Status Hostname(::grpc::ServerContext *, ::google::protobuf::Empty const*, ::google::protobuf::StringValue *response) override;
grpc::Status ImapPort(::grpc::ServerContext *, ::google::protobuf::Empty const*, ::google::protobuf::Int32Value *response) override;
grpc::Status SmtpPort(::grpc::ServerContext *, ::google::protobuf::Empty const*, ::google::protobuf::Int32Value *response) override;

View File

@ -435,6 +435,18 @@ SPStreamEvent newMailSettingsErrorEvent(grpc::MailSettingsErrorType errorType)
}
//****************************************************************************************************************************************************
/// \return The event.
//****************************************************************************************************************************************************
SPStreamEvent newUseSslForImapFinishedEvent()
{
auto event = new grpc::UseSslForImapFinishedEvent;
auto mailSettingsEvent = new grpc::MailSettingsEvent;
mailSettingsEvent->set_allocated_usesslforimapfinished(event);
return wrapMailSettingsEvent(mailSettingsEvent);
}
//****************************************************************************************************************************************************
/// \return The event.
//****************************************************************************************************************************************************

View File

@ -60,6 +60,7 @@ SPStreamEvent newDiskCachePathChangeFinishedEvent(); ///< Create a new DiskCache
// Mail settings related events
SPStreamEvent newMailSettingsErrorEvent(grpc::MailSettingsErrorType errorType); ///< Create a new MailSettingsErrorEvent event.
SPStreamEvent newUseSslForImapFinishedEvent(); ///< Create a new UseSslForImapFinishedEvent event.
SPStreamEvent newUseSslForSmtpFinishedEvent(); ///< Create a new UseSslForSmtpFinishedEvent event.
SPStreamEvent newChangePortsFinishedEvent(); ///< Create a new ChangePortsFinishedEvent event.