From ed91fe6cddd689382f23167c1136e3a8386df0b5 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 27 Oct 2017 11:19:44 +0200 Subject: Handle host not found --- components/kube/contents/ui/Kube.qml | 5 ++++ components/kube/contents/ui/LogView.qml | 51 +++++++++++++++++++++++++++++++-- framework/qml/Messages.qml | 1 + framework/qml/Notifications.qml | 1 + framework/src/sinkfabric.cpp | 1 + 5 files changed, 57 insertions(+), 2 deletions(-) diff --git a/components/kube/contents/ui/Kube.qml b/components/kube/contents/ui/Kube.qml index a7451b13..008d4899 100644 --- a/components/kube/contents/ui/Kube.qml +++ b/components/kube/contents/ui/Kube.qml @@ -111,6 +111,11 @@ Controls2.ApplicationWindow { onMessageReceived: kubeViews.setLoginView() } + Kube.Listener { + filter: Kube.Messages.requestAccountsConfiguration + onMessageReceived: kubeViews.setAccountsView() + } + //BEGIN Shortcuts Shortcut { sequence: StandardKey.Quit diff --git a/components/kube/contents/ui/LogView.qml b/components/kube/contents/ui/LogView.qml index 24d42373..75e768d9 100644 --- a/components/kube/contents/ui/LogView.qml +++ b/components/kube/contents/ui/LogView.qml @@ -84,7 +84,9 @@ Controls.SplitView { } details.message = error.message + "\n" + error.details details.timestamp = error.timestamp - details.subtype = currentItem.currentData.subtype + if (!!currentItem.currentData.subtype) { + details.subtype = currentItem.currentData.subtype + } } delegate: Kube.ListDelegate { @@ -163,7 +165,17 @@ Controls.SplitView { property string accountId: retriever.currentData ? retriever.currentData.accountId : "" property string accountName: retriever.currentData ? retriever.currentData.name : "" - sourceComponent: details.subtype == Kube.Notifications.loginError ? loginErrorComponent : detailsComponent + function getComponent(subtype) { + if (subtype == Kube.Notifications.loginError) { + return loginErrorComponent + } + if (subtype == Kube.Notifications.hostNotFoundError) { + return hostNotFoundErrorComponent + } + return detailsComponent + } + + sourceComponent: getComponent(details.subtype) } } @@ -274,4 +286,39 @@ Controls.SplitView { } } } + + Component { + id: hostNotFoundErrorComponent + Item { + Column { + anchors { + top: parent.top + left: parent.left + right: parent.right + } + spacing: Kube.Units.largeSpacing + Column { + Kube.Heading { + id: heading + text: qsTr("Host not found") + color: Kube.Colors.warningColor + } + + Kube.Label { + id: subHeadline + text: accountName + ": " + qsTr("Please check your network connection and settings.") + color: Kube.Colors.disabledTextColor + wrapMode: Text.Wrap + } + } + Kube.Button { + text: qsTr("Account settings") + onClicked: { + Kube.Fabric.postMessage(Kube.Messages.componentDone, {}) + Kube.Fabric.postMessage(Kube.Messages.requestAccountsConfiguration, {}) + } + } + } + } + } } diff --git a/framework/qml/Messages.qml b/framework/qml/Messages.qml index 7e415c34..597afc0c 100644 --- a/framework/qml/Messages.qml +++ b/framework/qml/Messages.qml @@ -36,6 +36,7 @@ Item { property string moveToDrafts: "moveToDrafts" property string unlockKeyring: "unlockKeyring" property string requestLogin: "requestLogin" + property string requestAccountsConfiguration: "requestAccountsConfiguration" property string notification: "notification" property string progressNotification: "progressNotification" diff --git a/framework/qml/Notifications.qml b/framework/qml/Notifications.qml index 7dd57dfa..622aca86 100644 --- a/framework/qml/Notifications.qml +++ b/framework/qml/Notifications.qml @@ -26,5 +26,6 @@ Item { property string progress: "progress" property string loginError: "loginError" + property string hostNotFoundError: "hostNotFoundError" } diff --git a/framework/src/sinkfabric.cpp b/framework/src/sinkfabric.cpp index cb72c120..6435bd08 100644 --- a/framework/src/sinkfabric.cpp +++ b/framework/src/sinkfabric.cpp @@ -169,6 +169,7 @@ public: break; case Sink::ApplicationDomain::NoServerError: message["message"] = QObject::tr("Host not found."); + message["subtype"] = "hostNotFoundError"; break; case Sink::ApplicationDomain::LoginError: message["message"] = QObject::tr("Failed to login."); -- cgit v1.2.3