diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-10-27 11:19:44 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-10-27 11:19:44 +0200 |
commit | ed91fe6cddd689382f23167c1136e3a8386df0b5 (patch) | |
tree | 1455d4b403bb1f327265150447c1503bda8483d5 | |
parent | e666c8a42b931f547cdb2176475b2124203fe64b (diff) | |
download | kube-ed91fe6cddd689382f23167c1136e3a8386df0b5.tar.gz kube-ed91fe6cddd689382f23167c1136e3a8386df0b5.zip |
Handle host not found
-rw-r--r-- | components/kube/contents/ui/Kube.qml | 5 | ||||
-rw-r--r-- | components/kube/contents/ui/LogView.qml | 51 | ||||
-rw-r--r-- | framework/qml/Messages.qml | 1 | ||||
-rw-r--r-- | framework/qml/Notifications.qml | 1 | ||||
-rw-r--r-- | 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 { | |||
111 | onMessageReceived: kubeViews.setLoginView() | 111 | onMessageReceived: kubeViews.setLoginView() |
112 | } | 112 | } |
113 | 113 | ||
114 | Kube.Listener { | ||
115 | filter: Kube.Messages.requestAccountsConfiguration | ||
116 | onMessageReceived: kubeViews.setAccountsView() | ||
117 | } | ||
118 | |||
114 | //BEGIN Shortcuts | 119 | //BEGIN Shortcuts |
115 | Shortcut { | 120 | Shortcut { |
116 | sequence: StandardKey.Quit | 121 | 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 { | |||
84 | } | 84 | } |
85 | details.message = error.message + "\n" + error.details | 85 | details.message = error.message + "\n" + error.details |
86 | details.timestamp = error.timestamp | 86 | details.timestamp = error.timestamp |
87 | details.subtype = currentItem.currentData.subtype | 87 | if (!!currentItem.currentData.subtype) { |
88 | details.subtype = currentItem.currentData.subtype | ||
89 | } | ||
88 | } | 90 | } |
89 | 91 | ||
90 | delegate: Kube.ListDelegate { | 92 | delegate: Kube.ListDelegate { |
@@ -163,7 +165,17 @@ Controls.SplitView { | |||
163 | property string accountId: retriever.currentData ? retriever.currentData.accountId : "" | 165 | property string accountId: retriever.currentData ? retriever.currentData.accountId : "" |
164 | property string accountName: retriever.currentData ? retriever.currentData.name : "" | 166 | property string accountName: retriever.currentData ? retriever.currentData.name : "" |
165 | 167 | ||
166 | sourceComponent: details.subtype == Kube.Notifications.loginError ? loginErrorComponent : detailsComponent | 168 | function getComponent(subtype) { |
169 | if (subtype == Kube.Notifications.loginError) { | ||
170 | return loginErrorComponent | ||
171 | } | ||
172 | if (subtype == Kube.Notifications.hostNotFoundError) { | ||
173 | return hostNotFoundErrorComponent | ||
174 | } | ||
175 | return detailsComponent | ||
176 | } | ||
177 | |||
178 | sourceComponent: getComponent(details.subtype) | ||
167 | } | 179 | } |
168 | } | 180 | } |
169 | 181 | ||
@@ -274,4 +286,39 @@ Controls.SplitView { | |||
274 | } | 286 | } |
275 | } | 287 | } |
276 | } | 288 | } |
289 | |||
290 | Component { | ||
291 | id: hostNotFoundErrorComponent | ||
292 | Item { | ||
293 | Column { | ||
294 | anchors { | ||
295 | top: parent.top | ||
296 | left: parent.left | ||
297 | right: parent.right | ||
298 | } | ||
299 | spacing: Kube.Units.largeSpacing | ||
300 | Column { | ||
301 | Kube.Heading { | ||
302 | id: heading | ||
303 | text: qsTr("Host not found") | ||
304 | color: Kube.Colors.warningColor | ||
305 | } | ||
306 | |||
307 | Kube.Label { | ||
308 | id: subHeadline | ||
309 | text: accountName + ": " + qsTr("Please check your network connection and settings.") | ||
310 | color: Kube.Colors.disabledTextColor | ||
311 | wrapMode: Text.Wrap | ||
312 | } | ||
313 | } | ||
314 | Kube.Button { | ||
315 | text: qsTr("Account settings") | ||
316 | onClicked: { | ||
317 | Kube.Fabric.postMessage(Kube.Messages.componentDone, {}) | ||
318 | Kube.Fabric.postMessage(Kube.Messages.requestAccountsConfiguration, {}) | ||
319 | } | ||
320 | } | ||
321 | } | ||
322 | } | ||
323 | } | ||
277 | } | 324 | } |
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 { | |||
36 | property string moveToDrafts: "moveToDrafts" | 36 | property string moveToDrafts: "moveToDrafts" |
37 | property string unlockKeyring: "unlockKeyring" | 37 | property string unlockKeyring: "unlockKeyring" |
38 | property string requestLogin: "requestLogin" | 38 | property string requestLogin: "requestLogin" |
39 | property string requestAccountsConfiguration: "requestAccountsConfiguration" | ||
39 | 40 | ||
40 | property string notification: "notification" | 41 | property string notification: "notification" |
41 | property string progressNotification: "progressNotification" | 42 | 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 { | |||
26 | property string progress: "progress" | 26 | property string progress: "progress" |
27 | 27 | ||
28 | property string loginError: "loginError" | 28 | property string loginError: "loginError" |
29 | property string hostNotFoundError: "hostNotFoundError" | ||
29 | } | 30 | } |
30 | 31 | ||
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: | |||
169 | break; | 169 | break; |
170 | case Sink::ApplicationDomain::NoServerError: | 170 | case Sink::ApplicationDomain::NoServerError: |
171 | message["message"] = QObject::tr("Host not found."); | 171 | message["message"] = QObject::tr("Host not found."); |
172 | message["subtype"] = "hostNotFoundError"; | ||
172 | break; | 173 | break; |
173 | case Sink::ApplicationDomain::LoginError: | 174 | case Sink::ApplicationDomain::LoginError: |
174 | message["message"] = QObject::tr("Failed to login."); | 175 | message["message"] = QObject::tr("Failed to login."); |