summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-01-25 13:53:53 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-01-25 14:03:13 +0100
commitffefff6c6ed10c9992c9de7fa4f99a30f1f99901 (patch)
treef684deccb992a2e9c57682e29cc8ece452af24a7
parent27ab6710b6626517d1386cd90ca9065d3d36f370 (diff)
downloadkube-ffefff6c6ed10c9992c9de7fa4f99a30f1f99901.tar.gz
kube-ffefff6c6ed10c9992c9de7fa4f99a30f1f99901.zip
Only display one error when failing to send a mail.
-rw-r--r--framework/qml/Notifications.qml1
-rw-r--r--framework/src/sinkfabric.cpp5
-rw-r--r--views/log/qml/View.qml37
3 files changed, 42 insertions, 1 deletions
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 {
28 property string loginError: "loginError" 28 property string loginError: "loginError"
29 property string hostNotFoundError: "hostNotFoundError" 29 property string hostNotFoundError: "hostNotFoundError"
30 property string connectionError: "connectionError" 30 property string connectionError: "connectionError"
31 property string transmissionError: "transmissionError"
31} 32}
32 33
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:
152 QVariantMap message; 152 QVariantMap message;
153 if (notification.type == Sink::Notification::Warning) { 153 if (notification.type == Sink::Notification::Warning) {
154 message["type"] = "warning"; 154 message["type"] = "warning";
155 message["resource"] = QString{notification.resource};
155 if (notification.code == Sink::ApplicationDomain::TransmissionError) { 156 if (notification.code == Sink::ApplicationDomain::TransmissionError) {
156 message["message"] = QObject::tr("Failed to send message."); 157 message["message"] = QObject::tr("Failed to send message.");
158 message["subtype"] = "transmissionError";
157 } else { 159 } else {
158 return; 160 return;
159 } 161 }
@@ -186,7 +188,8 @@ public:
186 message["message"] = QObject::tr("No credentials available."); 188 message["message"] = QObject::tr("No credentials available.");
187 break; 189 break;
188 default: 190 default:
189 message["message"] = QObject::tr("An unknown error occurred."); 191 //Ignore unknown errors, they are not going to help.
192 return;
190 } 193 }
191 Fabric::Fabric{}.postMessage("errorNotification", message); 194 Fabric::Fabric{}.postMessage("errorNotification", message);
192 } else if (notification.type == Sink::Notification::Info) { 195 } 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 {
177 if (subtype == Kube.Notifications.connectionError) { 177 if (subtype == Kube.Notifications.connectionError) {
178 return hostNotFoundErrorComponent 178 return hostNotFoundErrorComponent
179 } 179 }
180 if (subtype == Kube.Notifications.transmissionError) {
181 return transmissionErrorComponent
182 }
180 return detailsComponent 183 return detailsComponent
181 } 184 }
182 185
@@ -326,4 +329,38 @@ Controls.SplitView {
326 } 329 }
327 } 330 }
328 } 331 }
332
333 Component {
334 id: transmissionErrorComponent
335 Item {
336 Column {
337 anchors {
338 top: parent.top
339 left: parent.left
340 right: parent.right
341 }
342 spacing: Kube.Units.largeSpacing
343 Column {
344 Kube.Heading {
345 id: heading
346 text: qsTr("Failed to send the message.")
347 color: Kube.Colors.warningColor
348 }
349 Kube.Label {
350 id: subHeadline
351 text: accountName
352 color: Kube.Colors.disabledTextColor
353 wrapMode: Text.Wrap
354 }
355 }
356 Kube.Button {
357 text: qsTr("Try again")
358 onClicked: {
359 Kube.Fabric.postMessage(Kube.Messages.sendOutbox, {})
360 }
361 }
362 }
363 }
364 }
365
329} 366}