forked from Silverfish/proton-bridge
GODT-1344: notifications for ApiCertError and NoActiveKeyForRecipient.
Phase 1: added the two event in bridge-gui-tester. Phase 2: implemented QML notifications.
This commit is contained in:
@ -43,6 +43,9 @@ SettingsTab::SettingsTab(QWidget *parent)
|
|||||||
connect(ui_.buttonInternetOn, &QPushButton::clicked, []() { app().grpc().sendEvent(newInternetStatusEvent(true)); });
|
connect(ui_.buttonInternetOn, &QPushButton::clicked, []() { app().grpc().sendEvent(newInternetStatusEvent(true)); });
|
||||||
connect(ui_.buttonInternetOff, &QPushButton::clicked, []() { app().grpc().sendEvent(newInternetStatusEvent(false)); });
|
connect(ui_.buttonInternetOff, &QPushButton::clicked, []() { app().grpc().sendEvent(newInternetStatusEvent(false)); });
|
||||||
connect(ui_.buttonShowMainWindow, &QPushButton::clicked, []() { app().grpc().sendEvent(newShowMainWindowEvent()); });
|
connect(ui_.buttonShowMainWindow, &QPushButton::clicked, []() { app().grpc().sendEvent(newShowMainWindowEvent()); });
|
||||||
|
connect(ui_.buttonAPICertIssue, &QPushButton::clicked, []() {app().grpc().sendEvent(newApiCertIssueEvent()); });
|
||||||
|
connect(ui_.buttonNoActiveKeyForRecipient, &QPushButton::clicked, [&]() {app().grpc().sendEvent(
|
||||||
|
newNoActiveKeyForRecipientEvent(ui_.editNoActiveKeyForRecipient->text())); });
|
||||||
connect(ui_.checkNextCacheChangeWillSucceed, &QCheckBox::toggled, this, &SettingsTab::updateGUIState);
|
connect(ui_.checkNextCacheChangeWillSucceed, &QCheckBox::toggled, this, &SettingsTab::updateGUIState);
|
||||||
this->resetUI();
|
this->resetUI();
|
||||||
this->updateGUIState();
|
this->updateGUIState();
|
||||||
|
|||||||
@ -703,19 +703,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>10</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="buttonInternetOn">
|
<widget class="QPushButton" name="buttonInternetOn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -723,19 +710,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_4">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>10</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="buttonShowMainWindow">
|
<widget class="QPushButton" name="buttonShowMainWindow">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -743,6 +717,31 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="buttonAPICertIssue">
|
||||||
|
<property name="text">
|
||||||
|
<string>API cert. Issue</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="buttonNoActiveKeyForRecipient">
|
||||||
|
<property name="text">
|
||||||
|
<string>No Active Key For Recipient</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="editNoActiveKeyForRecipient">
|
||||||
|
<property name="text">
|
||||||
|
<string>dummy.user@proton.me</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
@ -68,6 +68,7 @@ Dialog {
|
|||||||
|
|
||||||
Label {
|
Label {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
Layout.bottomMargin: 8
|
Layout.bottomMargin: 8
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
text: root.notification.title
|
text: root.notification.title
|
||||||
|
|||||||
@ -128,4 +128,14 @@ Item {
|
|||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
notification: root.notifications.rebuildKeychain
|
notification: root.notifications.rebuildKeychain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NotificationDialog {
|
||||||
|
colorScheme: root.colorScheme
|
||||||
|
notification: root.notifications.apiCertIssue
|
||||||
|
}
|
||||||
|
|
||||||
|
NotificationDialog {
|
||||||
|
colorScheme: root.colorScheme
|
||||||
|
notification: root.notifications.noActiveKeyForRecipient
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,7 +77,9 @@ QtObject {
|
|||||||
root.deleteAccount,
|
root.deleteAccount,
|
||||||
root.noKeychain,
|
root.noKeychain,
|
||||||
root.rebuildKeychain,
|
root.rebuildKeychain,
|
||||||
root.addressChanged
|
root.addressChanged,
|
||||||
|
root.apiCertIssue,
|
||||||
|
root.noActiveKeyForRecipient
|
||||||
]
|
]
|
||||||
|
|
||||||
// Connection
|
// Connection
|
||||||
@ -1051,4 +1053,63 @@ QtObject {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property Notification apiCertIssue: Notification {
|
||||||
|
title: qsTr("Unable to establish a \nsecure connection to \nProton servers")
|
||||||
|
description: qsTr("Bridge cannot verify the authenticity of Proton servers on your current network due to a TLS certificate error. " +
|
||||||
|
"Start Bridge again after ensuring your connection is secure and/or connecting to a VPN. Learn more about TLS pinning " +
|
||||||
|
"<a href=\"https://proton.me/blog/tls-ssl-certificate#Extra-security-precautions-taken-by-ProtonMail\">here</a>.")
|
||||||
|
|
||||||
|
brief: title
|
||||||
|
icon: "./icons/ic-exclamation-circle-filled.svg"
|
||||||
|
type: Notification.NotificationType.Danger
|
||||||
|
group: Notifications.Group.Dialogs | Notifications.Group.Connection
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: Backend
|
||||||
|
|
||||||
|
function onApiCertIssue() {
|
||||||
|
root.apiCertIssue.active = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
action: [
|
||||||
|
Action {
|
||||||
|
text: qsTr("Quit Bridge")
|
||||||
|
|
||||||
|
onTriggered: {
|
||||||
|
root.apiCertIssue.active = false;
|
||||||
|
Backend.quit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
property Notification noActiveKeyForRecipient: Notification {
|
||||||
|
title: qsTr("Unable to send \nencrypted message")
|
||||||
|
description: "#PlaceholderText#"
|
||||||
|
icon: "./icons/ic-exclamation-circle-filled.svg"
|
||||||
|
type: Notification.NotificationType.Danger
|
||||||
|
group: Notifications.Group.Dialogs | Notifications.Group.Connection
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: Backend
|
||||||
|
|
||||||
|
function onNoActiveKeyForRecipient(email) {
|
||||||
|
root.noActiveKeyForRecipient.description = qsTr("There are no active keys to encrypt your message to %1. "+
|
||||||
|
"Please update the setting for this contact.").arg(email)
|
||||||
|
root.noActiveKeyForRecipient.active = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
action: [
|
||||||
|
Action {
|
||||||
|
text: qsTr("OK")
|
||||||
|
|
||||||
|
onTriggered: {
|
||||||
|
root.noActiveKeyForRecipient.active = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1382,9 +1382,12 @@ void GRPCClient::processMailEvent(MailEvent const &event)
|
|||||||
switch (event.event_case())
|
switch (event.event_case())
|
||||||
{
|
{
|
||||||
case MailEvent::kNoActiveKeyForRecipientEvent:
|
case MailEvent::kNoActiveKeyForRecipientEvent:
|
||||||
this->logTrace("Mail event received: kNoActiveKeyForRecipientEvent.");
|
{
|
||||||
emit noActiveKeyForRecipient(QString::fromStdString(event.noactivekeyforrecipientevent().email()));
|
QString const email = QString::fromStdString(event.noactivekeyforrecipientevent().email());
|
||||||
|
this->logTrace(QString("Mail event received: NoActiveKeyForRecipient (email = %1).").arg(email));
|
||||||
|
emit noActiveKeyForRecipient(email);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case MailEvent::kAddressChanged:
|
case MailEvent::kAddressChanged:
|
||||||
this->logTrace("Mail event received: AddressChanged.");
|
this->logTrace("Mail event received: AddressChanged.");
|
||||||
emit addressChanged(QString::fromStdString(event.addresschanged().address()));
|
emit addressChanged(QString::fromStdString(event.addresschanged().address()));
|
||||||
|
|||||||
Reference in New Issue
Block a user