diff options
Diffstat (limited to 'views')
-rw-r--r-- | views/log/main.qml | 18 | ||||
-rw-r--r-- | views/log/main.qml.bak | 139 | ||||
-rw-r--r-- | views/log/qml/View.qml | 72 |
3 files changed, 205 insertions, 24 deletions
diff --git a/views/log/main.qml b/views/log/main.qml index e33d7945..f4f20582 100644 --- a/views/log/main.qml +++ b/views/log/main.qml | |||
@@ -111,6 +111,8 @@ ApplicationWindow { | |||
111 | entities: [] | 111 | entities: [] |
112 | } | 112 | } |
113 | ) | 113 | ) |
114 | var mail = TestStore.load("mail", {messageId: "msg1@test.com"}) | ||
115 | var mail_uid = TestStore.read(mail).uid | ||
114 | Kube.Fabric.postMessage( | 116 | Kube.Fabric.postMessage( |
115 | Kube.Messages.notification, | 117 | Kube.Messages.notification, |
116 | { | 118 | { |
@@ -118,7 +120,19 @@ ApplicationWindow { | |||
118 | "subtype": Kube.Notifications.transmissionError, | 120 | "subtype": Kube.Notifications.transmissionError, |
119 | message: "merge1", | 121 | message: "merge1", |
120 | resource: "resource1", | 122 | resource: "resource1", |
121 | entities: ["<msg1@test.com>"] | 123 | entities: [mail_uid] |
124 | } | ||
125 | ) | ||
126 | var mail2 = TestStore.load("mail", {messageId: "msg2@test.com"}) | ||
127 | var mail2_uid = TestStore.read(mail2).uid | ||
128 | Kube.Fabric.postMessage( | ||
129 | Kube.Messages.notification, | ||
130 | { | ||
131 | "type": Kube.Notifications.error, | ||
132 | "subtype": Kube.Notifications.transmissionError, | ||
133 | message: "merge1", | ||
134 | resource: "resource1", | ||
135 | entities: [mail2_uid] | ||
122 | } | 136 | } |
123 | ) | 137 | ) |
124 | Kube.Fabric.postMessage( | 138 | Kube.Fabric.postMessage( |
@@ -128,7 +142,7 @@ ApplicationWindow { | |||
128 | "subtype": "customSubType", | 142 | "subtype": "customSubType", |
129 | message: "merge1", | 143 | message: "merge1", |
130 | resource: "resource1", | 144 | resource: "resource1", |
131 | entities: ["entity1", "entity2"] | 145 | entities: [] |
132 | } | 146 | } |
133 | ) | 147 | ) |
134 | } | 148 | } |
diff --git a/views/log/main.qml.bak b/views/log/main.qml.bak new file mode 100644 index 00000000..fbe47238 --- /dev/null +++ b/views/log/main.qml.bak | |||
@@ -0,0 +1,139 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2018 Christian Mollekopf, <mollekopf@kolabsys.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | import QtQuick 2.7 | ||
20 | import QtQuick.Controls 2.0 | ||
21 | import QtQuick.Window 2.0 | ||
22 | |||
23 | import org.kube.framework 1.0 as Kube | ||
24 | import org.kube.test 1.0 | ||
25 | import "qml" | ||
26 | |||
27 | ApplicationWindow { | ||
28 | id: app | ||
29 | height: Screen.desktopAvailableHeight * 0.8 | ||
30 | width: Screen.desktopAvailableWidth * 0.8 | ||
31 | |||
32 | Component.onCompleted: { | ||
33 | var initialState = { | ||
34 | accounts: [{ | ||
35 | id: "account1", | ||
36 | name: "Test Account" | ||
37 | }], | ||
38 | identities: [{ | ||
39 | account: "account1", | ||
40 | name: "Test Identity", | ||
41 | address: "identity@example.org" | ||
42 | }], | ||
43 | resources: [{ | ||
44 | id: "resourceaccount1", | ||
45 | account: "account1", | ||
46 | type: "dummy" | ||
47 | }, | ||
48 | { | ||
49 | id: "resourceaccount2", | ||
50 | account: "account1", | ||
51 | type: "mailtransport" | ||
52 | }], | ||
53 | folders: [{ | ||
54 | id: "folder1", | ||
55 | resource: "resourcefolder1", | ||
56 | name: "Folder 1", | ||
57 | specialpurpose: ["drafts"], | ||
58 | mails: [{ | ||
59 | resource: "resourcemail1", | ||
60 | messageId: "<msg1@test.com>", | ||
61 | date: "2017-07-24T15:46:29", | ||
62 | subject: "subject1", | ||
63 | body: "body", | ||
64 | to: ["to@example.org"], | ||
65 | cc: ["cc@example.org"], | ||
66 | bcc: ["bcc@example.org"], | ||
67 | draft: true | ||
68 | }, | ||
69 | { | ||
70 | resource: "resourcemail2", | ||
71 | messageId: "<msg2@test.com>", | ||
72 | date: "2017-07-23T15:46:29", | ||
73 | subject: "LooooooooooooooooooooooooooooooooooooooooooooooooooooooooonggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggEnd", | ||
74 | body: "LooooooooooooooooooooooooooooooooooooooooooooooooooooooooonggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggEnd\nbody\nbody\n\n\nbody\n\n\nbody\n\n\nbody\n\n\nbody\nbody\n\n\nbody\n\n\nbody\n\n\nbody\n\n\nbody\n\n\n\n\n\n\n\n\nbody\nbody\n\n\nbody\n\n\nbody\n\n\nbody\n\n\nbody\n\n\nbody", | ||
75 | to: ["toLoooooooooooooooooooooooooooooooooooooooooooooooooong@example.org"], | ||
76 | cc: ["ccLoooooooooooooooooooooooooooooooooooooooooooooooooong@example.org"], | ||
77 | bcc: ["bccLoooooooooooooooooooooooooooooooooooooooooooooooooong@example.org"], | ||
78 | draft: true | ||
79 | } | ||
80 | ] | ||
81 | }], | ||
82 | } | ||
83 | TestStore.setup(initialState) | ||
84 | Kube.Fabric.postMessage( | ||
85 | Kube.Messages.notification, | ||
86 | { | ||
87 | "type": Kube.Notifications.error, | ||
88 | "subtype": Kube.Notifications.loginError, | ||
89 | message: "merge1", | ||
90 | resource: "resourceaccount1", | ||
91 | entities: [] | ||
92 | } | ||
93 | ); | ||
94 | Kube.Fabric.postMessage( | ||
95 | Kube.Messages.notification, | ||
96 | { | ||
97 | "type": Kube.Notifications.error, | ||
98 | "subtype": Kube.Notifications.hostNotFoundError, | ||
99 | message: "merge1", | ||
100 | resource: "resourceaccount1", | ||
101 | entities: [] | ||
102 | } | ||
103 | ) | ||
104 | Kube.Fabric.postMessage( | ||
105 | Kube.Messages.notification, | ||
106 | { | ||
107 | "type": Kube.Notifications.error, | ||
108 | "subtype": Kube.Notifications.connectionError, | ||
109 | message: "merge1", | ||
110 | resource: "resource1account", | ||
111 | entities: [] | ||
112 | } | ||
113 | ) | ||
114 | Kube.Fabric.postMessage( | ||
115 | Kube.Messages.notification, | ||
116 | { | ||
117 | "type": Kube.Notifications.error, | ||
118 | "subtype": Kube.Notifications.transmissionError, | ||
119 | message: "merge1", | ||
120 | resource: "resourceaccount1", | ||
121 | entities: ["resourcemail1"] | ||
122 | } | ||
123 | ) | ||
124 | Kube.Fabric.postMessage( | ||
125 | Kube.Messages.notification, | ||
126 | { | ||
127 | "type": Kube.Notifications.error, | ||
128 | "subtype": "customSubType", | ||
129 | message: "merge1", | ||
130 | resource: "resource1", | ||
131 | entities: [] | ||
132 | } | ||
133 | ) | ||
134 | } | ||
135 | |||
136 | View { | ||
137 | anchors.fill: parent | ||
138 | } | ||
139 | } | ||
diff --git a/views/log/qml/View.qml b/views/log/qml/View.qml index 0dbf3b5e..7e95e20f 100644 --- a/views/log/qml/View.qml +++ b/views/log/qml/View.qml | |||
@@ -46,14 +46,16 @@ Controls.SplitView { | |||
46 | root.pendingError = true | 46 | root.pendingError = true |
47 | } | 47 | } |
48 | 48 | ||
49 | console.log("Message: " + message.message) | 49 | var error = { |
50 | console.log("Type: " + message.type) | 50 | timestamp: new Date(), |
51 | console.log("SubType: " + message.subtype) | 51 | message: message.message, |
52 | console.log("Entities: " + message.entities) | 52 | details: message.details, |
53 | 53 | resource: message.resource, | |
54 | var error = {timestamp: new Date(), message: message.message, details: message.details, resource: message.resource, entities: message.entities} | 54 | // TODO: if we passed entities as a list, it would get |
55 | 55 | // converted to a ListModel, in all likelihood because of | |
56 | console.log("Error: " + JSON.stringify(error)) | 56 | // ListDelegate, which we should rewrite in C++ |
57 | entities: {elements: message.entities} | ||
58 | } | ||
57 | 59 | ||
58 | if (logModel.count > 0) { | 60 | if (logModel.count > 0) { |
59 | var lastEntry = logModel.get(0) | 61 | var lastEntry = logModel.get(0) |
@@ -88,7 +90,6 @@ Controls.SplitView { | |||
88 | 90 | ||
89 | onCurrentItemChanged: { | 91 | onCurrentItemChanged: { |
90 | var error = currentItem.currentData.errors.get(0) | 92 | var error = currentItem.currentData.errors.get(0) |
91 | console.log("Current error: " + JSON.stringify(error)); | ||
92 | if (!!error.resource) { | 93 | if (!!error.resource) { |
93 | details.resourceId = error.resource | 94 | details.resourceId = error.resource |
94 | } | 95 | } |
@@ -100,9 +101,6 @@ Controls.SplitView { | |||
100 | details.subtype = "" | 101 | details.subtype = "" |
101 | } | 102 | } |
102 | 103 | ||
103 | console.log("Setting resource to: " + error.resource) | ||
104 | console.log("Setting entities to: " + error.entities) | ||
105 | |||
106 | details.entities = error.entities | 104 | details.entities = error.entities |
107 | } | 105 | } |
108 | 106 | ||
@@ -357,19 +355,49 @@ Controls.SplitView { | |||
357 | right: parent.right | 355 | right: parent.right |
358 | } | 356 | } |
359 | spacing: Kube.Units.largeSpacing | 357 | spacing: Kube.Units.largeSpacing |
358 | |||
359 | Kube.Heading { | ||
360 | id: heading | ||
361 | text: qsTr("Failed to send the message.") | ||
362 | color: Kube.Colors.warningColor | ||
363 | } | ||
364 | |||
360 | Column { | 365 | Column { |
361 | Kube.Heading { | 366 | spacing: Kube.Units.largeSpacing |
362 | id: heading | 367 | |
363 | text: qsTr("Failed to send the message.") | 368 | Repeater { |
364 | color: Kube.Colors.warningColor | 369 | model: Kube.MailListModel { |
365 | } | 370 | entityId: entities.elements[0] |
366 | Kube.Label { | 371 | } |
367 | id: subHeadline | 372 | delegate: Column { |
368 | text: "Account: " + accountName + "\nMessage-Id: " + entities; | 373 | id: subHeadline |
369 | color: Kube.Colors.disabledTextColor | 374 | |
370 | wrapMode: Text.Wrap | 375 | Kube.Label { |
376 | text: qsTr("Account") + ": " + accountName | ||
377 | color: Kube.Colors.disabledTextColor | ||
378 | wrapMode: Text.Wrap | ||
379 | } | ||
380 | Kube.Label { | ||
381 | text: qsTr("Subject") + ": " + model.subject | ||
382 | color: Kube.Colors.disabledTextColor | ||
383 | wrapMode: Text.Wrap | ||
384 | } | ||
385 | Kube.Label { | ||
386 | text: qsTr("To") + ": " + model.to | ||
387 | color: Kube.Colors.disabledTextColor | ||
388 | wrapMode: Text.Wrap | ||
389 | } | ||
390 | Kube.Label { | ||
391 | visible: !!model.cc | ||
392 | text: qsTr("Cc") + ": " + model.cc; | ||
393 | color: Kube.Colors.disabledTextColor | ||
394 | wrapMode: Text.Wrap | ||
395 | } | ||
396 | |||
397 | } | ||
371 | } | 398 | } |
372 | } | 399 | } |
400 | |||
373 | Kube.Button { | 401 | Kube.Button { |
374 | text: qsTr("Try again") | 402 | text: qsTr("Try again") |
375 | onClicked: { | 403 | onClicked: { |