GODT-1847: add option to export TLS Certificates in GUI.

This commit is contained in:
Xavier Michelon
2022-12-01 12:41:51 +01:00
parent 4375d77a98
commit 5b9c28e6f0
19 changed files with 2611 additions and 1389 deletions

View File

@ -166,6 +166,9 @@ void QMLBackend::connectGrpcEvents()
connect(client, &GRPCClient::addressChangedLogout, this, &QMLBackend::addressChangedLogout);
connect(client, &GRPCClient::apiCertIssue, this, &QMLBackend::apiCertIssue);
// generic error events
connect(client, &GRPCClient::genericError, this, &QMLBackend::onGenericError);
// user events
connect(client, &GRPCClient::userDisconnected, this, &QMLBackend::userDisconnected);
users_->connectGRPCEvents();
@ -439,6 +442,15 @@ void QMLBackend::onMailServerSettingsChanged(int imapPort, int smtpPort, bool us
}
//****************************************************************************************************************************************************
//
//****************************************************************************************************************************************************
void QMLBackend::onGenericError(ErrorInfo const &info)
{
emit genericError(info.title, info.description);
}
//****************************************************************************************************************************************************
/// \param[in] active Should DoH be active.
//****************************************************************************************************************************************************
@ -514,3 +526,15 @@ void QMLBackend::onVersionChanged()
emit releaseNotesLinkChanged(releaseNotesLink());
emit landingPageLinkChanged(landingPageLink());
}
//****************************************************************************************************************************************************
//
//****************************************************************************************************************************************************
void QMLBackend::exportTLSCertificates()
{
QString const folderPath = QFileDialog::getExistingDirectory(nullptr, QObject::tr("Select directory"),
QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
if (!folderPath.isEmpty())
app().grpc().exportTLSCertificates(folderPath);
}

View File

@ -171,12 +171,14 @@ public slots: // slot for signals received from QML -> To be forwarded to Bridge
void triggerReset();
void reportBug(QString const &description, QString const& address, QString const &emailClient, bool includeLogs) {
app().grpc().reportBug(description, address, emailClient, includeLogs); }
void exportTLSCertificates();
void onResetFinished();
void onVersionChanged();
void setMailServerSettings(int imapPort, int smtpPort, bool useSSLForIMAP, bool useSSLForSMTP); ///< Forwards a connection mode change request from QML to gRPC
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 onGenericError(bridgepp::ErrorInfo const& info); ///< Slot for generic errors received from the gRPC service.
signals: // Signals received from the Go backend, to be forwarded to QML
void toggleAutostartFinished();
@ -227,6 +229,7 @@ signals: // Signals received from the Go backend, to be forwarded to QML
void bugReportSendError();
void showMainWindow();
void hideMainWindow();
void genericError(QString const& title, QString const& description);
private: // member functions
void retrieveUserList(); ///< Retrieve the list of users via gRPC.

View File

@ -208,6 +208,21 @@ SettingsView {
Layout.fillWidth: true
}
SettingsItem {
id: exportTLSCertificates
visible: root._isAdvancedShown
colorScheme: root.colorScheme
text: qsTr("Export TLS certificates")
actionText: qsTr("Export")
description: qsTr("Export the TLS private key and certificate used by the IMAP and SMTP servers.")
type: SettingsItem.Button
onClicked: {
Backend.exportTLSCertificates()
}
Layout.fillWidth: true
}
SettingsItem {
id: reset
visible: root._isAdvancedShown

View File

@ -128,4 +128,9 @@ Item {
colorScheme: root.colorScheme
notification: root.notifications.noActiveKeyForRecipient
}
NotificationDialog {
colorScheme: root.colorScheme
notification: root.notifications.genericError
}
}

View File

@ -79,7 +79,8 @@ QtObject {
root.rebuildKeychain,
root.addressChanged,
root.apiCertIssue,
root.noActiveKeyForRecipient
root.noActiveKeyForRecipient,
root.genericError
]
// Connection
@ -368,7 +369,7 @@ QtObject {
}
property Notification updateForceError: Notification {
title: qsTr("Bridge coudnt update")
title: qsTr("Bridge couldn't update")
description: qsTr("You must update manually. Go to: https://proton.me/mail/bridge#download")
brief: title
icon: "./icons/ic-exclamation-circle-filled.svg"
@ -428,7 +429,7 @@ QtObject {
}
property Notification updateSilentError: Notification {
description: qsTr("Bridge couldnt update")
description: qsTr("Bridge couldn't update")
brief: description
icon: "./icons/ic-exclamation-circle-filled.svg"
type: Notification.NotificationType.Warning
@ -1099,4 +1100,30 @@ QtObject {
}
]
}
property Notification genericError: Notification {
title: "#PlaceholderText#"
description: "#PlaceholderText#"
icon: "./icons/ic-exclamation-circle-filled.svg"
type: Notification.NotificationType.Danger
group: Notification.Groups.Connection
Connections {
target: Backend
function onGenericError(title, description) {
root.genericError.title = title
root.genericError.description = description
root.genericError.active = true;
}
}
action: [
Action {
text: qsTr("OK")
onTriggered: {
root.genericError.active = false
}
}
]
}
}