summaryrefslogtreecommitdiffstats
path: root/framework
diff options
context:
space:
mode:
Diffstat (limited to 'framework')
-rw-r--r--framework/qml/Notifications.qml28
-rw-r--r--framework/qmldir1
-rw-r--r--framework/src/sinkfabric.cpp7
3 files changed, 33 insertions, 3 deletions
diff --git a/framework/qml/Notifications.qml b/framework/qml/Notifications.qml
new file mode 100644
index 00000000..df1190d3
--- /dev/null
+++ b/framework/qml/Notifications.qml
@@ -0,0 +1,28 @@
1/*
2 Copyright (C) 2017 Michael Bohlender, <bohlender@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
19pragma Singleton
20
21import QtQuick 2.7
22
23Item {
24 property string error: "error"
25 property string info: "info"
26 property string progress: "progress"
27}
28
diff --git a/framework/qmldir b/framework/qmldir
index 90d1c762..12eeb43d 100644
--- a/framework/qmldir
+++ b/framework/qmldir
@@ -47,6 +47,7 @@ GridView 1.0 GridView.qml
47ScrollHelper 1.0 ScrollHelper.qml 47ScrollHelper 1.0 ScrollHelper.qml
48ModelIndexRetriever 1.0 ModelIndexRetriever.qml 48ModelIndexRetriever 1.0 ModelIndexRetriever.qml
49singleton Messages 1.0 Messages.qml 49singleton Messages 1.0 Messages.qml
50singleton Notifications 1.0 Notifications.qml
50singleton Colors 1.0 Colors.qml 51singleton Colors 1.0 Colors.qml
51singleton Icons 1.0 Icons.qml 52singleton Icons 1.0 Icons.qml
52singleton Units 1.0 Units.qml 53singleton Units 1.0 Units.qml
diff --git a/framework/src/sinkfabric.cpp b/framework/src/sinkfabric.cpp
index 9768fa96..cdaa9a90 100644
--- a/framework/src/sinkfabric.cpp
+++ b/framework/src/sinkfabric.cpp
@@ -151,7 +151,7 @@ public:
151 SinkLog() << "Received notification: " << notification; 151 SinkLog() << "Received notification: " << notification;
152 QVariantMap message; 152 QVariantMap message;
153 if (notification.type == Sink::Notification::Warning) { 153 if (notification.type == Sink::Notification::Warning) {
154 message["type"] = Notification::Warning; 154 message["type"] = "warning";
155 if (notification.code == Sink::ApplicationDomain::TransmissionError) { 155 if (notification.code == Sink::ApplicationDomain::TransmissionError) {
156 message["message"] = QObject::tr("Failed to send message."); 156 message["message"] = QObject::tr("Failed to send message.");
157 } else { 157 } else {
@@ -160,7 +160,7 @@ public:
160 } else if (notification.type == Sink::Notification::Status) { 160 } else if (notification.type == Sink::Notification::Status) {
161 return; 161 return;
162 } else if (notification.type == Sink::Notification::Error) { 162 } else if (notification.type == Sink::Notification::Error) {
163 message["type"] = Notification::Warning; 163 message["type"] = "error";
164 message["resource"] = QString{notification.resource}; 164 message["resource"] = QString{notification.resource};
165 message["details"] = notification.message; 165 message["details"] = notification.message;
166 switch(notification.code) { 166 switch(notification.code) {
@@ -188,12 +188,13 @@ public:
188 Fabric::Fabric{}.postMessage("errorNotification", message); 188 Fabric::Fabric{}.postMessage("errorNotification", message);
189 } else if (notification.type == Sink::Notification::Info) { 189 } else if (notification.type == Sink::Notification::Info) {
190 if (notification.code == Sink::ApplicationDomain::TransmissionSuccess) { 190 if (notification.code == Sink::ApplicationDomain::TransmissionSuccess) {
191 message["type"] = Notification::Info; 191 message["type"] = "info";
192 message["message"] = QObject::tr("A message has been sent."); 192 message["message"] = QObject::tr("A message has been sent.");
193 } else { 193 } else {
194 return; 194 return;
195 } 195 }
196 } else if (notification.type == Sink::Notification::Progress) { 196 } else if (notification.type == Sink::Notification::Progress) {
197 message["type"] = "progress";
197 message["progress"] = notification.progress; 198 message["progress"] = notification.progress;
198 message["total"] = notification.total; 199 message["total"] = notification.total;
199 if (!notification.entities.isEmpty()) { 200 if (!notification.entities.isEmpty()) {