diff options
author | Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de> | 2021-08-01 02:22:57 +0200 |
---|---|---|
committer | Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de> | 2021-08-01 02:25:13 +0200 |
commit | 35343e5158ca441f8001c0a91685f4e93b53cb03 (patch) | |
tree | d3bf2c6b4396644b2e33a675217d9f1a002bf85c /src/ToastManager.qml | |
parent | 766a90125df68f065495354c20412faf9e1df77a (diff) | |
download | RWA.Support.DesktopApp-35343e5158ca441f8001c0a91685f4e93b53cb03.tar.gz RWA.Support.DesktopApp-35343e5158ca441f8001c0a91685f4e93b53cb03.tar.bz2 RWA.Support.DesktopApp-35343e5158ca441f8001c0a91685f4e93b53cb03.zip |
Toast: Add a variety of new toast colors; Session complete rewrite; A lot of bugfixing;
New available toast colors/types:
ToastType.Standard, ToastType.Info, ToastType.Warning ToastType.Success, ToastType.Error
Diffstat (limited to 'src/ToastManager.qml')
-rw-r--r-- | src/ToastManager.qml | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/ToastManager.qml b/src/ToastManager.qml index 1acf8d5..2f1600f 100644 --- a/src/ToastManager.qml +++ b/src/ToastManager.qml @@ -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); } } } |