feat(GODT-2771): macOS cert install support in bridge-gui-test + placeholder QML.

This commit is contained in:
Xavier Michelon
2023-08-17 17:35:50 +02:00
parent f57a40677e
commit 69190daf3f
15 changed files with 338 additions and 45 deletions

View File

@ -290,16 +290,6 @@ bool QMLBackend::isTLSCertificateInstalled() {
}
//****************************************************************************************************************************************************
//
//****************************************************************************************************************************************************
void QMLBackend::installTLSCertificate() {
HANDLE_EXCEPTION(
app().grpc().installTLSCertificate();
)
}
//****************************************************************************************************************************************************
/// \return The value for the 'showOnStartup' property.
//****************************************************************************************************************************************************
@ -963,6 +953,15 @@ void QMLBackend::reportBug(QString const &category, QString const &description,
}
//****************************************************************************************************************************************************
//
//****************************************************************************************************************************************************
void QMLBackend::installTLSCertificate() {
HANDLE_EXCEPTION(
app().grpc().installTLSCertificate();
)
}
//****************************************************************************************************************************************************
//
//****************************************************************************************************************************************************

View File

@ -65,7 +65,6 @@ public: // member functions.
Q_INVOKABLE QString collectAnswers(quint8 categoryId) const; ///< Collect answer for a given set of questions.
Q_INVOKABLE void clearAnswers(); ///< Clear all collected answers.
Q_INVOKABLE bool isTLSCertificateInstalled(); ///< Check if the bridge certificate is installed in the OS keychain.
Q_INVOKABLE void installTLSCertificate(); ///< Installs the Bridge TLS certificate in the Keychain.
public: // Qt/QML properties. Note that the NOTIFY-er signal is required even for read-only properties (QML warning otherwise)
Q_PROPERTY(bool showOnStartup READ showOnStartup NOTIFY showOnStartupChanged)
@ -197,6 +196,7 @@ public slots: // slot for signals received from QML -> To be forwarded to Bridge
void installUpdate() const; ///< Slot for the update install.
void triggerReset() const; ///< Slot for the triggering of reset.
void reportBug(QString const &category, QString const &description, QString const &address, QString const &emailClient, bool includeLogs) const; ///< Slot for the bug report.
void installTLSCertificate(); ///< Installs the Bridge TLS certificate in the Keychain.
void exportTLSCertificates() const; ///< Slot for the export of the TLS certificates.
void onResetFinished(); ///< Slot for the reset finish signal.
void onVersionChanged(); ///< Slot for the version change signal.

View File

@ -108,6 +108,7 @@
<file>qml/SettingsView.qml</file>
<file>qml/SetupWizard/ClientListItem.qml</file>
<file>qml/SetupWizard/LeftPane.qml</file>
<file>qml/SetupWizard/ClientConfigAppleMail.qml</file>
<file>qml/SetupWizard/ClientConfigOutlookSelector.qml</file>
<file>qml/SetupWizard/ClientConfigParameters.qml</file>
<file>qml/SetupWizard/ClientConfigSelector.qml</file>

View File

@ -0,0 +1,143 @@
// Copyright (c) 2023 Proton AG
// This file is part of Proton Mail Bridge.
// Proton Mail Bridge is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Proton Mail Bridge is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
import QtQml
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.impl
import Proton
Item {
id: root
enum Screen {
CertificateInstall = 0,
ProfileInstall = 1
}
property var wizard
function showAutoConfig() {
certInstallButton.loading = false;
if (Backend.isTLSCertificateInstalled()) {
stack.currentIndex = ClientConfigAppleMail.Screen.ProfileInstall;
} else {
stack.currentIndex = ClientConfigAppleMail.Screen.CertificateInstall;
}
}
StackLayout {
id: stack
anchors.fill: parent
// stack index 0
ColumnLayout {
id: certificateInstall
Layout.fillHeight: true
Layout.fillWidth: true
Connections {
function onCertificateInstallCanceled() {
// Note: this will lead to an error message in the final version.
certInstallButton.loading = false;
console.error("Certificate installation was canceled");
}
function onCertificateInstallFailed() {
// Note: this will lead to an error page later.
certInstallButton.loading = false;
console.error("Certificate installation failed");
}
function onCertificateInstallSuccess() {
certInstallButton.loading = false;
console.error("Certification installed successfully");
stack.currentIndex = ClientConfigAppleMail.Screen.ProfileInstall;
}
target: Backend
}
Label {
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
colorScheme: wizard.colorScheme
horizontalAlignment: Text.AlignHCenter
text: "Certificate install placeholder"
type: Label.LabelType.Heading
wrapMode: Text.WordWrap
}
Button {
id: certInstallButton
Layout.fillWidth: true
Layout.topMargin: 48
colorScheme: wizard.colorScheme
enabled: !loading
loading: false
text: "Install Certificate Placeholder"
onClicked: {
certInstallButton.loading = true;
Backend.installTLSCertificate();
}
}
Button {
Layout.fillWidth: true
Layout.topMargin: 32
colorScheme: wizard.colorScheme
enabled: !certInstallButton.loading
secondary: true
text: qsTr("Cancel")
onClicked: {
wizard.closeWizard();
}
}
}
// stack index 1
ColumnLayout {
id: profileInstall
Layout.fillHeight: true
Layout.fillWidth: true
Label {
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
colorScheme: wizard.colorScheme
horizontalAlignment: Text.AlignHCenter
text: "Profile install placeholder"
type: Label.LabelType.Heading
wrapMode: Text.WordWrap
}
Button {
Layout.fillWidth: true
Layout.topMargin: 48
colorScheme: wizard.colorScheme
text: "Install Profile Placeholder"
onClicked: {
wizard.user.configureAppleMail(wizard.address);
wizard.closeWizard();
}
}
Button {
Layout.fillWidth: true
Layout.topMargin: 32
colorScheme: wizard.colorScheme
secondary: true
text: qsTr("Cancel")
onClicked: {
wizard.closeWizard();
}
}
}
}
}

View File

@ -49,6 +49,7 @@ Item {
onClicked: {
wizard.client = SetupWizard.Client.AppleMail;
wizard.showAppleMailAutoConfig();
}
}
ClientListItem {

View File

@ -31,7 +31,8 @@ Item {
Login,
ClientConfigSelector,
ClientConfigOutlookSelector,
ClientConfigWarning
ClientConfigWarning,
ClientConfigAppleMail
}
enum RootStack {
TwoPanesView,
@ -80,6 +81,12 @@ Item {
function closeWizard() {
wizardEnded();
}
function showAppleMailAutoConfig() {
rootStackLayout.currentIndex = SetupWizard.RootStack.TwoPanesView;
leftContent.showClientSelector();
rightContent.currentIndex = SetupWizard.ContentStack.ClientConfigAppleMail;
clientConfigAppleMail.showAutoConfig();
}
function showClientConfig(user, address) {
root.user = user;
root.address = address;
@ -222,6 +229,13 @@ Item {
Layout.fillWidth: true
wizard: root
}
// rightContent stack index 5
ClientConfigAppleMail {
id: clientConfigAppleMail
Layout.fillHeight: true
Layout.fillWidth: true
wizard: root
}
}
LinkLabel {
id: reportProblemLink