From ffefff6c6ed10c9992c9de7fa4f99a30f1f99901 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 25 Jan 2018 13:53:53 +0100 Subject: Only display one error when failing to send a mail. --- framework/qml/Notifications.qml | 1 + framework/src/sinkfabric.cpp | 5 ++++- views/log/qml/View.qml | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/framework/qml/Notifications.qml b/framework/qml/Notifications.qml index 18f2a68a..1593f416 100644 --- a/framework/qml/Notifications.qml +++ b/framework/qml/Notifications.qml @@ -28,5 +28,6 @@ Item { property string loginError: "loginError" property string hostNotFoundError: "hostNotFoundError" property string connectionError: "connectionError" + property string transmissionError: "transmissionError" } diff --git a/framework/src/sinkfabric.cpp b/framework/src/sinkfabric.cpp index 897534b9..58ddae83 100644 --- a/framework/src/sinkfabric.cpp +++ b/framework/src/sinkfabric.cpp @@ -152,8 +152,10 @@ public: QVariantMap message; if (notification.type == Sink::Notification::Warning) { message["type"] = "warning"; + message["resource"] = QString{notification.resource}; if (notification.code == Sink::ApplicationDomain::TransmissionError) { message["message"] = QObject::tr("Failed to send message."); + message["subtype"] = "transmissionError"; } else { return; } @@ -186,7 +188,8 @@ public: message["message"] = QObject::tr("No credentials available."); break; default: - message["message"] = QObject::tr("An unknown error occurred."); + //Ignore unknown errors, they are not going to help. + return; } Fabric::Fabric{}.postMessage("errorNotification", message); } else if (notification.type == Sink::Notification::Info) { diff --git a/views/log/qml/View.qml b/views/log/qml/View.qml index 4ae1a67c..14e2d543 100644 --- a/views/log/qml/View.qml +++ b/views/log/qml/View.qml @@ -177,6 +177,9 @@ Controls.SplitView { if (subtype == Kube.Notifications.connectionError) { return hostNotFoundErrorComponent } + if (subtype == Kube.Notifications.transmissionError) { + return transmissionErrorComponent + } return detailsComponent } @@ -326,4 +329,38 @@ Controls.SplitView { } } } + + Component { + id: transmissionErrorComponent + Item { + Column { + anchors { + top: parent.top + left: parent.left + right: parent.right + } + spacing: Kube.Units.largeSpacing + Column { + Kube.Heading { + id: heading + text: qsTr("Failed to send the message.") + color: Kube.Colors.warningColor + } + Kube.Label { + id: subHeadline + text: accountName + color: Kube.Colors.disabledTextColor + wrapMode: Text.Wrap + } + } + Kube.Button { + text: qsTr("Try again") + onClicked: { + Kube.Fabric.postMessage(Kube.Messages.sendOutbox, {}) + } + } + } + } + } + } -- cgit v1.2.3