aboutsummaryrefslogtreecommitdiff
path: root/src/ToastManager.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/ToastManager.qml')
-rw-r--r--src/ToastManager.qml23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/ToastManager.qml b/src/ToastManager.qml
index b448905..2f1600f 100644
--- a/src/ToastManager.qml
+++ b/src/ToastManager.qml
@@ -1,8 +1,8 @@
/*
* This file is part of Remote Support Desktop
* https://gitlab.das-netzwerkteam.de/RemoteWebApp/remote-support-desktop
- * Copyright 2020-2021 Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de>
- * Copyright 2020-2021 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+ * Copyright 2020, 2021 Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de>
+ * Copyright 2020, 2021 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* SPDX-License-Identifier: GPL-2.0-or-later
*
* This program is free software; you can redistribute it and/or modify
@@ -42,9 +42,12 @@ ListView {
*
* @param {string} text Text to show
* @param {real} duration Duration to show in milliseconds, defaults to 3000
+ * @param {enum} type Type of toast. Available is:
+ * ToastType.Standard, ToastType.Info, ToastType.Warning
+ * ToastType.Success, ToastType.Error
*/
- function show(text, duration) {
- model.insert(0, {text: text, duration: duration});
+ function show(text, duration, type) {
+ model.insert(0, {text: text, duration: duration, type: type});
}
/**
@@ -71,11 +74,13 @@ ListView {
delegate: Toast {
Component.onCompleted: {
- if (typeof duration === "undefined") {
- show(text);
- }
- else {
- show(text, duration);
+ if (typeof duration === "undefined" && typeof type === "undefined") {
+ show(text, ToastType.ToastStandard);
+ } else if (typeof duration === "undefined" &&
+ typeof type !== "undefined") {
+ show(text, type);
+ } else {
+ show(text, duration, type);
}
}
}