aboutsummaryrefslogtreecommitdiffstats
path: root/imports_system/system/models/notification/NotificationModel.qml
diff options
context:
space:
mode:
authorBramastyo Harimukti <bramastyo.harimukti.santoso@pelagicore.com>2018-10-15 19:26:00 +0200
committerDaniel d'Andrada <daniel.dandrada@luxoft.com>2018-10-17 11:03:56 +0000
commit060b4302f3ae662b4137f222caf7b4ea23faa0d4 (patch)
treec1e04deae9af0638a362c5e4cec081920f1d4253 /imports_system/system/models/notification/NotificationModel.qml
parent63eb0e2620935fcff6479c0ac34945aced3272e1 (diff)
[sysui] update the imports to use imports_system and imports_shared
- in the current implementation, applications are able to import components related to the system. this patch is to prevent that situation and have a better separation between applications and system Change-Id: Ic9ca41aa8b789a74d7b3a8df4686faa61bf702af Reviewed-by: Daniel d'Andrada <daniel.dandrada@luxoft.com>
Diffstat (limited to 'imports_system/system/models/notification/NotificationModel.qml')
-rw-r--r--imports_system/system/models/notification/NotificationModel.qml84
1 files changed, 84 insertions, 0 deletions
diff --git a/imports_system/system/models/notification/NotificationModel.qml b/imports_system/system/models/notification/NotificationModel.qml
new file mode 100644
index 00000000..1aa38510
--- /dev/null
+++ b/imports_system/system/models/notification/NotificationModel.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Neptune 3 IVI UI.
+**
+** $QT_BEGIN_LICENSE:GPL-QTAS$
+** Commercial License Usage
+** Licensees holding valid commercial Qt Automotive Suite licenses may use
+** this file in accordance with the commercial license agreement provided
+** with the Software or, alternatively, in accordance with the terms
+** contained in a written agreement between you and The Qt Company. For
+** licensing terms and conditions see https://www.qt.io/terms-conditions.
+** For further information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: GPL-3.0
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtApplicationManager 1.0
+
+QtObject {
+ id: root
+
+ property var model: NotificationManager
+ readonly property int count: root.model.count
+
+ property bool notificationCenterVisible: false
+ property bool notificationToastVisible: false
+
+ readonly property Connections notificationManagerConnection: Connections {
+ target: root.model
+ onNotificationAdded: {
+ closeNotification();
+ showNotification();
+ }
+
+ onNotificationChanged: {
+ if (!root.notificationToastVisible) {
+ showNotification();
+ }
+ }
+
+ onNotificationAboutToBeRemoved: {
+ closeNotification();
+ }
+ }
+
+ function showNotification() {
+ root.notificationToastVisible = true;
+ }
+
+ function closeNotification() {
+ root.notificationToastVisible = false;
+ }
+
+ function buttonClicked(id) {
+ NotificationManager.triggerNotificationAction(id, "");
+ root.closeNotification();
+ }
+
+ function removeNotification(id) {
+ NotificationManager.dismissNotification(id);
+ }
+
+ function clearNotifications() {
+ while (root.count > 0) {
+ removeNotification(NotificationManager.get(0).id);
+ }
+ }
+}